vue-spear-tip 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +42 -32
- package/dist/{Button-Cjc_rGOC.cjs → Button-C-_LLCJ8.cjs} +1 -1
- package/dist/{Button-CeE0XgUQ.js → Button-D3wxk32n.js} +1 -1
- package/dist/{CodeHighlight-eHkjA2-z.cjs → CodeHighlight-BQkI0Qdb.cjs} +1 -1
- package/dist/{CodeHighlight-BF0IfK1T.js → CodeHighlight-hA59-wK0.js} +1 -1
- package/dist/DateField--anXRYwD.cjs +5 -0
- package/dist/{DateField-Di-9cThw.js → DateField-CbD-7nJo.js} +106 -137
- package/dist/{FieldComponent.vue_vue_type_script_lang-CcZ0n1tb.cjs → FieldComponent.vue_vue_type_script_lang-BBV9PhxZ.cjs} +1 -1
- package/dist/{FieldComponent.vue_vue_type_script_lang-BcKSz5pD.js → FieldComponent.vue_vue_type_script_lang-D8oglWYI.js} +1 -1
- package/dist/Interfaces/IBaseVueComponent.d.ts +1 -1
- package/dist/Interfaces/IVueClass.d.ts +1 -1
- package/dist/{SelectField-Cb93USnU.cjs → SelectField-0sIO2oZ8.cjs} +1 -1
- package/dist/{SelectField-CgRVO_Ik.js → SelectField-_DCw7asw.js} +2 -2
- package/dist/{StringField-CDOFXAC2.cjs → StringField-Dx9x3hG1.cjs} +1 -1
- package/dist/{StringField-BoYflBLa.js → StringField-Q6tdcgNE.js} +16 -15
- package/dist/{SwitchField-C8drUeqV.js → SwitchField-D2CUl-83.js} +72 -61
- package/dist/SwitchField-DF62AQwm.cjs +1 -0
- package/dist/{Tabs-BbImaERA.js → Tabs-Bdbmi4vp.js} +1 -1
- package/dist/{Tabs-Bqlv_0YY.cjs → Tabs-Bs59wIyv.cjs} +1 -1
- package/dist/TextField-BiySwnpX.js +24354 -0
- package/dist/TextField-D4LS0W8b.cjs +169 -0
- package/dist/_commonjsHelpers-DqS8WYlY.cjs +1 -0
- package/dist/_commonjsHelpers-VXLwngCN.js +9 -0
- package/dist/core/VueClass.d.ts +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/{index-CzfN5Ujw.cjs → index-C6zu8hmM.cjs} +1 -1
- package/dist/{index-B_RpB4zN.js → index-Cb9JNh32.js} +5 -5
- package/dist/replaceable/FieldComponent.vue +2 -2
- package/dist/vue-spear-tip.cjs.js +1 -1
- package/dist/vue-spear-tip.css +1 -1
- package/dist/vue-spear-tip.es.js +1 -1
- package/docs/index.html +2 -2
- package/docs/static/{Button-j8wmZUkJ.js → Button-DQufd156.js} +1 -1
- package/docs/static/{CodeHighlight-Bk1-dVpe.js → CodeHighlight-B3Ig4KDk.js} +1 -1
- package/docs/static/DateField-C6BbToAd.js +5 -0
- package/docs/static/{FieldComponent.vue_vue_type_script_lang-kcu707jX.js → FieldComponent.vue_vue_type_script_lang-DvjF0ufQ.js} +1 -1
- package/docs/static/{NoSymbolIcon-C07Mbunu.js → NoSymbolIcon-BcSCXTGD.js} +1 -1
- package/docs/static/{SelectField-CGMK45MH.js → SelectField-CIZ_xg-o.js} +1 -1
- package/docs/static/{StringField-FTm4hPIh.css → StringField-BJ5e1NcF.css} +1 -1
- package/docs/static/{StringField-CB1EqY_E.js → StringField-DoqZ8gGA.js} +1 -1
- package/docs/static/{SwitchField-Ct85pbvZ.css → SwitchField-D1HrNcLY.css} +1 -1
- package/docs/static/SwitchField-Db23H0Im.js +1 -0
- package/docs/static/{Tabs-CaCH9JtY.js → Tabs-D191loy_.js} +1 -1
- package/docs/static/TextField-o2QP_97x.js +169 -0
- package/docs/static/_commonjsHelpers-CV2jkJYL.js +1 -0
- package/docs/static/index-F0CNC5Sw.js +2 -0
- package/docs/static/main-Bqckh-QL.css +1 -0
- package/docs/static/main-DkOCkEos.js +95 -0
- package/package.json +1 -1
- package/dist/DateField-DOtmBCoj.cjs +0 -31
- package/dist/SwitchField-C6KEaENg.cjs +0 -1
- package/dist/TextField-CXYhTfmD.cjs +0 -145
- package/dist/TextField-DFx8x_xu.js +0 -19557
- package/docs/static/DateField-B7SrsvTk.js +0 -31
- package/docs/static/SwitchField-uZyWkOrm.js +0 -1
- package/docs/static/TextField-CF2HuxS4.js +0 -145
- package/docs/static/index-DMb1rZyo.js +0 -2
- package/docs/static/main-D1hiHOjl.js +0 -108
- package/docs/static/main-kVqkj31w.css +0 -1
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
var bh=Object.defineProperty;var c=(n,e)=>bh(n,"name",{value:e,configurable:!0});import{h as Cu,j as yo,r as kh,D as wh,E as Mu,F as xh,G as Sh,H as Tu,I as vh,J as Ch,e as Mh,T as Th,K as Eh,L as Oh,P as hl,W as Ah,V as Nh,k as er,c as Hs,o as tr,m as ja,l as Vs,p as Se,a as K,v as Be,n as Ye,x as js,s as Ih,z as Rh,M as Dh,y as Lh,b as Ph}from"./main-D1hiHOjl.js";import{F as Bh}from"./FieldComponent.vue_vue_type_script_lang-kcu707jX.js";import{r as zh}from"./NoSymbolIcon-C07Mbunu.js";function ne(n){this.content=n}c(ne,"OrderedMap");ne.prototype={constructor:ne,find:c(function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},"find"),get:c(function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},"get"),update:c(function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new ne(s)},"update"),remove:c(function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ne(t)},"remove"),addToStart:c(function(n,e){return new ne([n,e].concat(this.remove(n).content))},"addToStart"),addToEnd:c(function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ne(t)},"addToEnd"),addBefore:c(function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new ne(i)},"addBefore"),forEach:c(function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},"forEach"),prepend:c(function(n){return n=ne.from(n),n.size?new ne(n.content.concat(this.subtract(n).content)):this},"prepend"),append:c(function(n){return n=ne.from(n),n.size?new ne(this.subtract(n).content.concat(n.content)):this},"append"),subtract:c(function(n){var e=this;n=ne.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},"subtract"),toObject:c(function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},"toObject"),get size(){return this.content.length>>1}};ne.from=function(n){if(n instanceof ne)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ne(e)};function Eu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Eu(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}c(Eu,"findDiffStart");function Ou(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let u=0,d=Math.min(o.text.length,l.text.length);for(;u<d&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let u=Ou(o.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}c(Ou,"findDiffEnd");const te=class te{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,i+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new te(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new te(r,i)}cutByIndex(e,t){return e==t?te.empty:e==0&&t==this.content.length?this:new te(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new te(i,s)}addToStart(e){return new te([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new te(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Eu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Ou(this,e,t,r)}findIndex(e){if(e==0)return Wr(0,e);if(e==this.size)return Wr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Wr(t+1,s):Wr(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return te.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new te(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return te.empty;let t,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)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new te(t||e,r)}static from(e){if(!e)return te.empty;if(e instanceof te)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new te([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};c(te,"Fragment");let v=te;v.empty=new v([],0);const Us={index:0,offset:0};function Wr(n,e){return Us.index=n,Us.offset=e,Us}c(Wr,"retIndex");function ci(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ci(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ci(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}c(ci,"compareDeep");var Tt;let $=(Tt=class{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,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))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ci(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Tt.none;if(e instanceof Tt)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}},c(Tt,"Mark"),Tt);$.none=[];const ca=class ca extends Error{};c(ca,"ReplaceError");let Fn=ca;const yt=class yt{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Nu(this.content,e+this.openStart,t);return r&&new yt(r,this.openStart,this.openEnd)}removeBetween(e,t){return new yt(Au(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return yt.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new yt(v.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new yt(e,r,i)}};c(yt,"Slice");let T=yt;T.empty=new T(v.empty,0,0);function Au(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Au(s.content,e-i-1,t-i-1)))}c(Au,"removeRange");function Nu(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Nu(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}c(Nu,"insertInto");function $h(n,e,t){if(t.openStart>n.depth)throw new Fn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Fn("Inconsistent open depths");return Iu(n,e,t,0)}c($h,"replace");function Iu(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Iu(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Gt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Fh(t,n);return Gt(s,Du(n,o,l,e,r))}else return Gt(s,ui(n,e,r))}c(Iu,"replaceOuter");function Ru(n,e){if(!e.type.compatibleContent(n.type))throw new Fn("Cannot join "+e.type.name+" onto "+n.type.name)}c(Ru,"checkJoin");function bo(n,e,t){let r=n.node(t);return Ru(r,e.node(t)),r}c(bo,"joinable$1");function _t(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}c(_t,"addNode");function lr(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(_t(n.nodeAfter,r),s++));for(let l=s;l<o;l++)_t(i.child(l),r);e&&e.depth==t&&e.textOffset&&_t(e.nodeBefore,r)}c(lr,"addRange");function Gt(n,e){return n.type.checkContent(e),n.copy(e)}c(Gt,"close");function Du(n,e,t,r,i){let s=n.depth>i&&bo(n,e,i+1),o=r.depth>i&&bo(t,r,i+1),l=[];return lr(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Ru(s,o),_t(Gt(s,Du(n,e,t,r,i+1)),l)):(s&&_t(Gt(s,ui(n,e,i+1)),l),lr(e,t,i,l),o&&_t(Gt(o,ui(t,r,i+1)),l)),lr(r,null,i,l),new v(l)}c(Du,"replaceThreeWay");function ui(n,e,t){let r=[];if(lr(null,n,t,r),n.depth>t){let i=bo(n,e,t+1);_t(Gt(i,ui(n,e,t+1)),r)}return lr(e,null,t,r),new v(r)}c(ui,"replaceTwoWay");function Fh(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(v.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}c(Fh,"prepareSliceForReplace");const br=class br{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return $.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let 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 t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.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 t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Hn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),u=s-a;if(r.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new br(t,r,s)}static resolveCached(e,t){let r=Ua.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Ua.set(e,r=new ko);let i=r.elts[r.i]=br.resolve(e,t);return r.i=(r.i+1)%Hh,i}};c(br,"ResolvedPos");let di=br;const ua=class ua{constructor(){this.elts=[],this.i=0}};c(ua,"ResolveCache");let ko=ua;const Hh=12,Ua=new WeakMap,da=class da{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};c(da,"NodeRange");let Hn=da;const Vh=Object.create(null);var Et;let vt=(Et=class{constructor(e,t,r,i=$.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||v.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ci(this.attrs,t||e.defaultAttrs||Vh)&&$.sameSet(this.marks,r||$.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,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return T.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new T(u,i.depth-o,s.depth-o)}replace(e,t,r){return $h(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return di.resolveCached(this,e)}resolveNoCache(e){return di.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,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()+")"),Lu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=v.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);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,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);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=$.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=v.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}},c(Et,"Node"),Et);vt.prototype.text=void 0;const kr=class kr extends vt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Lu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new kr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new kr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};c(kr,"TextNode");let wo=kr;function Lu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}c(Lu,"wrapMarks");const ps=class ps{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new xo(e,t);if(r.next==null)return ps.empty;let i=Pu(r);r.next&&r.err("Unexpected trailing text");let s=_h(Jh(i));return Gh(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return v.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return c(s,"search"),s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let 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 t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return c(t,"scan"),t(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(`
|
|
2
|
-
`)}};c(ps,"ContentMatch");let ln=ps;ln.empty=new ln(!0);const fa=class fa{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};c(fa,"TokenStream");let xo=fa;function Pu(n){let e=[];do e.push(jh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}c(Pu,"parseExpr");function jh(n){let e=[];do e.push(Uh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}c(jh,"parseExprSeq");function Uh(n){let e=qh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Wh(n,e);else break;return e}c(Uh,"parseExprSubscript");function Wa(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}c(Wa,"parseNum");function Wh(n,e){let t=Wa(n),r=t;return n.eat(",")&&(n.next!="}"?r=Wa(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}c(Wh,"parseExprRange");function Kh(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}c(Kh,"resolveName");function qh(n){if(n.eat("(")){let e=Pu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Kh(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}c(qh,"parseExprAtom");function Jh(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}c(t,"node");function r(o,l,a){let u={term:a,to:l};return e[o].push(u),u}c(r,"edge");function i(o,l){o.forEach(a=>a.to=l)}c(i,"connect");function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=s(o.exprs[a],l);if(a==o.exprs.length-1)return u;i(u,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();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 u=0;u<o.min;u++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let d=t();r(a,d),i(s(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}c(s,"compile")}c(Jh,"nfa");function Bu(n,e){return e-n}c(Bu,"cmp");function Ka(n,e){let t=[];return r(e),t.sort(Bu);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}c(r,"scan")}c(Ka,"nullFrom");function _h(n){let e=Object.create(null);return t(Ka(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<i.length;d++)i[d][0]==l&&(u=i[d][1]);Ka(n,a).forEach(d=>{u||i.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new ln(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Bu);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}c(_h,"dfa");function Gh(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:u}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}c(Gh,"checkForDeadEnds");function zu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}c(zu,"defaultAttrs");function $u(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}c($u,"computeAttrs");function Fu(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}c(Fu,"checkAttrs");function Hu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new So(n,r,e[r]);return t}c(Hu,"initAttrs");var tn;let qa=(tn=class{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hu(e,r.attrs),this.defaultAttrs=zu(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==ln.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:$u(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vt(this,this.computeAttrs(e),v.from(t),$.setFrom(r))}createChecked(e=null,t,r){return t=v.from(t),this.checkContent(t),new vt(this,this.computeAttrs(e),t,$.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=v.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(v.empty,!0);return s?new vt(this,e,t.append(s),$.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Fu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:$.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new tn(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}},c(tn,"NodeType"),tn);function Yh(n,e,t){let r=t.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 ${n}, got ${s}`)}}c(Yh,"validateType");const ha=class ha{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Yh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}};c(ha,"Attribute");let So=ha;const ms=class ms{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Hu(e,i.attrs),this.excluded=null;let s=zu(this.attrs);this.instance=s?new $(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $(this,$u(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ms(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}};c(ms,"MarkType");let fi=ms;const pa=class pa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=ne.from(e.nodes),t.marks=ne.from(e.marks||{}),this.nodes=qa.compile(this.spec.nodes,this),this.marks=fi.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]=ln.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?Ja(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==""?[]:Ja(this,o.split(" "))}this.nodeFromJSON=i=>vt.fromJSON(this,i),this.markFromJSON=i=>$.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof qa){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new wo(r,r.defaultAttrs,e,$.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};c(pa,"Schema");let hi=pa;function Ja(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}c(Ja,"gatherMarks");function Xh(n){return n.tag!=null}c(Xh,"isTagRule");function Qh(n){return n.style!=null}c(Qh,"isStyleRule");const wr=class wr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Xh(i))this.tags.push(i);else if(Qh(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,t={}){let r=new pi(this,t,!1);return r.addAll(e,$.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new pi(this,t,!0);return r.addAll(e,$.none,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(tp(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,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)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}c(r,"insert");for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ga(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=Ga(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wr(e,wr.schemaRules(e)))}};c(wr,"DOMParser");let Yt=wr;const Vu={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},Zh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ju={ol:!0,ul:!0},Tr=1,vo=2,ar=4;function _a(n,e,t){return e!=null?(e?Tr:0)|(e==="full"?vo:0):n&&n.whitespace=="pre"?Tr|vo:t&~ar}c(_a,"wsOptionsFor");const ma=class ma{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=$.none,this.match=s||(o&ar?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(v.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Tr)){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 t=v.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(v.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}};c(ma,"NodeContext");let wn=ma;const ga=class ga{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=_a(null,t.preserveWhitespace,0)|(r?ar:0);i?s=new wn(i.type,i.attrs,$.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new wn(null,null,$.none,!0,null,o):s=new wn(e.schema.topNodeType,null,$.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&vo?"full":this.localPreserveWS||(i.options&Tr)>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,`
|
|
3
|
-
`);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(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\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),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,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;ju.hasOwnProperty(o)&&this.parser.normalizeLists&&ep(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Zh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);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 u,d=this.needsBlock;if(Vu.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(s),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let 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?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,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,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=a,!u.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++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Ya(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=_a(e,s,o.options);o.options&ar&&o.content.length==0&&(l|=ar);let a=$.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):Ya(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new wn(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Tr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=c((l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0},"match");return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};c(ga,"ParseContext");let pi=ga;function ep(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ju.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}c(ep,"normalizeList");function tp(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}c(tp,"matches");function Ga(n){let e={};for(let t in n)e[t]=n[t];return e}c(Ga,"copy");function Ya(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=c(l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||s.indexOf(d)<0&&o(d))return!0}},"scan");if(o(i.contentMatch))return!0}}c(Ya,"markMayApply");const gs=class gs{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ws(t).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 u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],d=this.serializeMark(u,o.isInline,t);d&&(s.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ri(Ws(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ri(Ws(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return ri(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new gs(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Xa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Xa(e.marks)}};c(gs,"DOMSerializer");let an=gs;function Xa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}c(Xa,"gatherToDOM");function Ws(n){return n.document||window.document}c(Ws,"doc$1");const Qa=new WeakMap;function np(n){let e=Qa.get(n);return e===void 0&&Qa.set(n,e=rp(n)),e}c(np,"suspiciousAttributes");function rp(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return c(t,"scan"),t(n),e}c(rp,"suspiciousAttributesInner");function ri(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=np(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&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:m}=ri(n,h,t,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}c(ri,"renderSpec");const Uu=65535,Wu=Math.pow(2,16);function ip(n,e){return n+e*Wu}c(ip,"makeRecover");function Za(n){return n&Uu}c(Za,"recoverIndex");function sp(n){return(n-(n&Uu))/Wu}c(sp,"recoverOffset");const Ku=1,qu=2,ii=4,Ju=8,ya=class ya{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ju)>0}get deletedBefore(){return(this.delInfo&(Ku|ii))>0}get deletedAfter(){return(this.delInfo&(qu|ii))>0}get deletedAcross(){return(this.delInfo&ii)>0}};c(ya,"MapResult");let Er=ya;const bt=class bt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&bt.empty)return bt.empty}recover(e){let t=0,r=Za(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+sp(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,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 u=this.ranges[l+s],d=this.ranges[l+o],f=a+u;if(e<=f){let h=u?e==a?-1:e==f?1:t:t,p=a+i+(h<0?0:d);if(r)return p;let m=e==(t<0?a:f)?null:ip(l/3,e-a),g=e==a?qu:e==f?Ku:ii;return(t<0?e!=a:e!=f)&&(g|=Ju),new Er(p,g,m)}i+=d-u}return r?e+i:new Er(e+i,0,null)}touches(e,t){let r=0,i=Za(t),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 u=this.ranges[l+s],d=a+u;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let t=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),u=this.ranges[i+t],d=this.ranges[i+r];e(l,l+u,a,a+d),s+=d-u}}invert(){return new bt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?bt.empty:new bt(e<0?[0,-e,0]:[0,0,e])}};c(bt,"StepMap");let at=bt;at.empty=new at([]);const xr=class xr{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new xr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new xr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);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 Er(e,i,null)}};c(xr,"Mapping");let mi=xr;const Ks=Object.create(null),ba=class ba{getMap(){return at.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ks[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ks)throw new RangeError("Duplicate use of step JSON ID "+e);return Ks[e]=t,t.prototype.jsonID=e,t}};c(ba,"Step");let ee=ba;const Bt=class Bt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Bt(e,null)}static fail(e){return new Bt(null,e)}static fromReplace(e,t,r,i){try{return Bt.ok(e.replace(t,r,i))}catch(s){if(s instanceof Fn)return Bt.fail(s.message);throw s}}};c(Bt,"StepResult");let se=Bt;function pl(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(pl(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return v.fromArray(r)}c(pl,"mapFragment");const zt=class zt extends ee{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new T(pl(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return se.fromReplace(e,this.from,this.to,s)}invert(){return new Ot(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new zt(t.pos,r.pos,this.mark)}merge(e){return e instanceof zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new zt(t.from,t.to,e.markFromJSON(t.mark))}};c(zt,"AddMarkStep");let Or=zt;ee.jsonID("addMark",Or);const $t=class $t extends ee{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new T(pl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return se.fromReplace(e,this.from,this.to,r)}invert(){return new Or(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $t(t.pos,r.pos,this.mark)}merge(e){return e instanceof $t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new $t(t.from,t.to,e.markFromJSON(t.mark))}};c($t,"RemoveMarkStep");let Ot=$t;ee.jsonID("removeMark",Ot);const Ft=class Ft extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return se.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return se.fromReplace(e,this.pos,this.pos+1,new T(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Ft(this.pos,t.marks[i]);return new Ft(this.pos,this.mark)}}return new Vn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ft(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ft(t.pos,e.markFromJSON(t.mark))}};c(Ft,"AddNodeMarkStep");let Ar=Ft;ee.jsonID("addNodeMark",Ar);const Sr=class Sr extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return se.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return se.fromReplace(e,this.pos,this.pos+1,new T(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ar(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sr(t.pos,e.markFromJSON(t.mark))}};c(Sr,"RemoveNodeMarkStep");let Vn=Sr;ee.jsonID("removeNodeMark",Vn);const nt=class nt extends ee{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Co(e,this.from,this.to)?se.fail("Structure replace would overwrite content"):se.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new at([this.from,this.to-this.from,this.slice.size])}invert(e){return new nt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new nt(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof nt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new nt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new nt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new nt(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}};c(nt,"ReplaceStep");let we=nt;ee.jsonID("replace",we);const xn=class xn extends ee{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Co(e,this.from,this.gapFrom)||Co(e,this.gapTo,this.to)))return se.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return se.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?se.fromReplace(e,this.from,this.to,r):se.fail("Content does not fit in gap")}getMap(){return new at([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new xn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new xn(t.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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new xn(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}};c(xn,"ReplaceAroundStep");let ce=xn;ee.jsonID("replaceAround",ce);function Co(n,e,t){let r=n.resolve(e),i=t-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}c(Co,"contentBetween");function op(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+a.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[g])?o.to=p:i.push(o=new Ot(h,p,f[g])));l&&l.to==h?l.to=p:s.push(l=new Or(h,p,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}c(op,"addMark");function lp(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof fi){let u=o.marks,d;for(;d=r.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=s):i.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(o=>n.step(new Ot(o.from,o.to,o.style)))}c(lp,"removeMark");function ml(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let u=s.child(a),d=l+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new we(l,d,T.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new Ot(l,d,u.marks[h]));if(i&&u.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new T(v.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new we(l+h.index,l+h.index+h[0].length,m))}}l=d}if(!r.validEnd){let a=r.fillBefore(v.empty,!0);n.replace(l,l,new T(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}c(ml,"clearIncompatible");function ap(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}c(ap,"canCut");function Qn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!ap(i,s,o))break}return null}c(Qn,"liftTarget");function cp(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,u=l,d=v.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,d=v.from(r.node(m).copy(d)),f++):a--;let h=v.empty,p=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=v.from(i.node(m).copy(h)),p++):u++;n.step(new ce(a,u,o,l,new T(d.append(h),f,p),d.size-f,!0))}c(cp,"lift$2");function gl(n,e,t=null,r=n){let i=up(n,e),s=i&&dp(r,e);return s?i.map(ec).concat({type:e,attrs:t}).concat(s.map(ec)):null}c(gl,"findWrapping");function ec(n){return{type:n,attrs:null}}c(ec,"withAttrs");function up(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}c(up,"findWrappingOutside");function dp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;a&&u<i;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:o}c(dp,"findWrappingInside");function fp(n,e,t){let r=v.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[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=v.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new ce(i,s,i,s,new T(r,0,0),t.length,!0))}c(fp,"wrap");function hp(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&pp(n.doc,n.mapping.slice(s).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Gu(n,o,l,s),ml(n,n.mapping.slice(s).map(l,1),r,void 0,u===null);let d=n.mapping.slice(s),f=d.map(l,1),h=d.map(l+o.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new T(v.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&_u(n,o,l,s),!1}})}c(hp,"setBlockType$1");function _u(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}c(_u,"replaceNewlines");function Gu(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
5
|
-
`))}})}c(Gu,"replaceLinebreaks");function pp(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}c(pp,"canChangeType");function mp(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ce(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new T(v.from(o),0,0),1,!0))}c(mp,"setNodeMarkup");function ot(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,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 u=i.depth-1,d=t-2;u>s;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))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)}c(ot,"canSplit");function gp(n,e,t=1,r){let i=n.doc.resolve(e),s=v.empty,o=v.empty;for(let l=i.depth,a=i.depth-t,u=t-1;l>a;l--,u--){s=v.from(i.node(l).copy(s));let d=r&&r[u];o=v.from(d?d.type.create(d.attrs,o):i.node(l).copy(o))}n.step(new we(e,e,new T(s.append(o),t,t),!0))}c(gp,"split");function Rt(n,e){let t=n.resolve(e),r=t.index();return Yu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}c(Rt,"canJoin");function yp(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}c(yp,"canAppendWithSubstitutedLinebreaks");function Yu(n,e){return!!(n&&e&&!n.isLeaf&&yp(n,e))}c(Yu,"joinable");function Ms(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>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&&Yu(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}c(Ms,"joinPoint");function bp(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);d&&!f?r=!1:!d&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);Gu(n,d.node(),d.before(),l)}o.inlineContent&&ml(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new we(u,a.map(e+t,-1),T.empty,!0)),r===!0){let d=n.doc.resolve(u);_u(n,d.node(),d.before(),n.steps.length)}return n}c(bp,"join");function kp(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))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,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}c(kp,"insertPoint");function Xu(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.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),u=r.node(o),d=!1;if(s==1)d=u.canReplace(a,a,i);else{let f=u.contentMatchAt(a).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}c(Xu,"dropPoint");function Ts(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Qu(i,s,r)?new we(e,t,r):new Mo(i,s,r).fit()}c(Ts,"replaceStep");function Qu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}c(Qu,"fitsTrivially");const ka=class ka{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=v.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=v.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new T(s,o,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new we(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=qs(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:u}=this.frontier[l],d,f=null;if(t==1&&(o?u.matchType(o.type)||(f=u.fillBefore(v.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=qs(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=qs(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new T(ir(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new T(ir(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(Zu(g.mark(h.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=sr(this.placed,t,v.from(d)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?T.empty:new T(ir(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new T(ir(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Js(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Js(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=Js(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=sr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.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,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=sr(this.placed,this.depth,v.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(v.empty,!0);t.childCount&&(this.placed=sr(this.placed,this.frontier.length,t))}};c(ka,"Fitter");let Mo=ka;function ir(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ir(n.firstChild.content,e-1,t)))}c(ir,"dropFromFragment");function sr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(sr(n.lastChild.content,e-1,t)))}c(sr,"addToFragment");function qs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}c(qs,"contentAt");function Zu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Zu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(v.empty,!0)))),n.copy(r)}c(Zu,"closeNodeStart");function Js(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!wp(t,s.content,o)?l:null}c(Js,"contentAfterFits");function wp(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}c(wp,"invalidMarks");function xp(n){return n.spec.defining||n.spec.definingForContent}c(xp,"definesContent");function Sp(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Qu(i,s,r))return n.step(new we(e,t,r));let o=td(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?l=h:i.before(h)==p&&o.splice(1,0,-h)}let a=o.indexOf(l),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=xp(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<o.length;g++){let y=o[(g+a)%o.length],b=!0;y<0&&(b=!1,y=-y);let k=i.node(y-1),x=i.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(i.before(y),b?s.after(y):t,new T(ed(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=o[h];p<0||(e=i.before(p),t=s.after(p))}}c(Sp,"replaceRange");function ed(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(ed(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(v.empty,!0))}return n}c(ed,"closeFragment");function vp(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=kp(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(v.from(r),0,0))}c(vp,"replaceRangeWith");function Cp(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=td(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 n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=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 n.delete(r.before(o),t);n.delete(e,t)}c(Cp,"deleteRange$1");function td(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}c(td,"coveredDepths");const Sn=class Sn extends ee{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return se.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return se.fromReplace(e,this.pos,this.pos+1,new T(v.from(i),0,t.isLeaf?0:1))}getMap(){return at.empty}invert(e){return new Sn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Sn(t.pos,t.attr,t.value)}};c(Sn,"AttrStep");let gi=Sn;ee.jsonID("attr",gi);const vr=class vr extends ee{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return se.ok(r)}getMap(){return at.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(t.attr,t.value)}};c(vr,"DocAttrStep");let yi=vr;ee.jsonID("docAttr",yi);var Tn;let jn=(Tn=class extends Error{},c(Tn,"TransformError"),Tn);jn=c(function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},"TransformError");jn.prototype=Object.create(Error.prototype);jn.prototype.constructor=jn;jn.prototype.name="TransformError";const wa=class wa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new jn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=T.empty){let i=Ts(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new T(v.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Sp(this,e,t,r),this}replaceRangeWith(e,t,r){return vp(this,e,t,r),this}deleteRange(e,t){return Cp(this,e,t),this}lift(e,t){return cp(this,e,t),this}join(e,t=1){return bp(this,e,t),this}wrap(e,t){return fp(this,e,t),this}setBlockType(e,t=e,r,i=null){return hp(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return mp(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new gi(e,t,r)),this}setDocAttribute(e,t){return this.step(new yi(e,t)),this}addNodeMark(e,t){return this.step(new Ar(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof $)t.isInSet(r.marks)&&this.step(new Vn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Vn(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return gp(this,e,t,r),this}addMark(e,t,r){return op(this,e,t,r),this}removeMark(e,t,r){return lp(this,e,t,r),this}clearIncompatible(e,t,r){return ml(this,e,t,r),this}};c(wa,"Transform");let bi=wa;const _s=Object.create(null),xa=class xa{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ki(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.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:u}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(u.pos),l?T.empty:t),l==0&&rc(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){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),u=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),rc(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):yn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?yn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):yn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Re(e.node(0))}static atStart(e){return yn(e,e,0,0,1)||new Re(e)}static atEnd(e){return yn(e,e,e.content.size,e.childCount,-1)||new Re(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=_s[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in _s)throw new RangeError("Duplicate use of selection JSON ID "+e);return _s[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}};c(xa,"Selection");let I=xa;I.prototype.visible=!0;const Sa=class Sa{constructor(e,t){this.$from=e,this.$to=t}};c(Sa,"SelectionRange");let ki=Sa,tc=!1;function nc(n){!tc&&!n.parent.inlineContent&&(tc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}c(nc,"checkTextSelection");const Ht=class Ht extends I{constructor(e,t=e){nc(e),nc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return I.near(r);let i=e.resolve(t.map(this.anchor));return new Ht(i.parent.inlineContent?i:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ht&&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,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ht(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=I.findFrom(t,r,!0)||I.findFrom(t,-r,!0);if(s)t=s.$head;else return I.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new Ht(e,t)}};c(Ht,"TextSelection");let L=Ht;I.jsonID("text",L);const ys=class ys{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ys(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}};c(ys,"TextBookmark");let wi=ys;const Vt=class Vt extends I{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?I.near(s):new Vt(s)}content(){return new T(v.from(this.node),0,0)}eq(e){return e instanceof Vt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new To(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Vt(e.resolve(t.anchor))}static create(e,t){return new Vt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};c(Vt,"NodeSelection");let N=Vt;N.prototype.visible=!1;I.jsonID("node",N);const bs=class bs{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new wi(r,r):new bs(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&N.isSelectable(r)?new N(t):I.near(t)}};c(bs,"NodeBookmark");let To=bs;const vn=class vn extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let r=I.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vn(e)}map(e){return new vn(e)}eq(e){return e instanceof vn}getBookmark(){return Mp}};c(vn,"AllSelection");let Re=vn;I.jsonID("all",Re);const Mp={map(){return this},resolve(n){return new Re(n)}};function yn(n,e,t,r,i,s=!1){if(e.inlineContent)return L.create(n,t);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&&N.isSelectable(l))return N.create(n,t-(i<0?l.nodeSize:0))}else{let a=yn(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}c(yn,"findSelectionIn");function rc(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof we||i instanceof ce))return;let s=n.mapping.maps[r],o;s.forEach((l,a,u,d)=>{o==null&&(o=d)}),n.setSelection(I.near(n.doc.resolve(o),t))}c(rc,"selectionToInsertionEnd$1");const ic=1,Kr=2,sc=4,va=class va extends bi{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|ic)&~Kr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ic)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Kr,this}ensureMarks(e){return $.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Kr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Kr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(I.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=sc,this}get scrolledIntoView(){return(this.updated&sc)>0}};c(va,"Transaction");let Eo=va;function oc(n,e){return!e||!n?n:n.bind(e)}c(oc,"bind");const Ca=class Ca{constructor(e,t,r){this.name=e,this.init=oc(t.init,r),this.apply=oc(t.apply,r)}};c(Ca,"FieldDesc");let Wt=Ca;const Tp=[new Wt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Wt("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new Wt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Wt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],Ma=class Ma{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Tp.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Wt(r.key,r.spec.state,r))})}};c(Ma,"Configuration");let cr=Ma;const jt=class jt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let 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,u=i?i[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new jt(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Eo(this)}static create(e){let t=new cr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jt(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new cr(this.schema,e.plugins),r=t.fields,i=new jt(t);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 t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new cr(e.schema,e.plugins),s=new jt(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=vt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=I.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=u.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};c(jt,"EditorState");let Oo=jt;function nd(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=nd(i,e,{})),t[r]=i}return t}c(nd,"bindProps");const Ta=class Ta{constructor(e){this.spec=e,this.props={},e.props&&nd(e.props,this,this.props),this.key=e.key?e.key.key:rd("plugin")}getState(e){return e[this.key]}};c(Ta,"Plugin");let H=Ta;const Gs=Object.create(null);function rd(n){return n in Gs?n+"$"+ ++Gs[n]:(Gs[n]=0,n+"$")}c(rd,"createKey");const Ea=class Ea{constructor(e="key"){this.key=rd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};c(Ea,"PluginKey");let U=Ea;const yl=c((n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0),"deleteSelection$1");function id(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}c(id,"atBlockStart");const sd=c((n,e,t)=>{let r=id(n,t);if(!r)return!1;let i=bl(r);if(!i){let o=r.blockRange(),l=o&&Qn(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(pd(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Un(s,"end")||N.isSelectable(s)))for(let o=r.depth;;o--){let l=Ts(n.doc,r.before(o),r.after(o),T.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Un(s,"end")?I.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):N.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(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},"joinBackward$1"),Ep=c((n,e,t)=>{let r=id(n,t);if(!r)return!1;let i=bl(r);return i?od(n,i,e):!1},"joinTextblockBackward$1"),Op=c((n,e,t)=>{let r=ad(n,t);if(!r)return!1;let i=kl(r);return i?od(n,i,e):!1},"joinTextblockForward$1");function od(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=Ts(n.doc,s,a,T.empty);if(!u||u.from!=s||u instanceof we&&u.slice.size>=a-s)return!1;if(t){let d=n.tr.step(u);d.setSelection(L.create(d.doc,s)),t(d.scrollIntoView())}return!0}c(od,"joinTextblocksAround");function Un(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}c(Un,"textblockAt");const ld=c((n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=bl(r)}let o=s&&s.nodeBefore;return!o||!N.isSelectable(o)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)},"selectNodeBackward$1");function bl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}c(bl,"findCutBefore");function ad(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}c(ad,"atBlockEnd");const cd=c((n,e,t)=>{let r=ad(n,t);if(!r)return!1;let i=kl(r);if(!i)return!1;let s=i.nodeAfter;if(pd(n,i,e,1))return!0;if(r.parent.content.size==0&&(Un(s,"start")||N.isSelectable(s))){let o=Ts(n.doc,r.before(),r.after(),T.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Un(s,"start")?I.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):N.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},"joinForward$1"),ud=c((n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=kl(r)}let o=s&&s.nodeAfter;return!o||!N.isSelectable(o)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,s.pos)).scrollIntoView()),!0)},"selectNodeForward$1");function kl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}c(kl,"findCutAfter");const Ap=c((n,e)=>{let t=n.selection,r=t instanceof N,i;if(r){if(t.node.isTextblock||!Rt(n.doc,t.from))return!1;i=t.from}else if(i=Ms(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(N.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},"joinUp$1"),Np=c((n,e)=>{let t=n.selection,r;if(t instanceof N){if(t.node.isTextblock||!Rt(n.doc,t.to))return!1;r=t.to}else if(r=Ms(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},"joinDown$1"),Ip=c((n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Qn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},"lift$1"),dd=c((n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
6
|
-
`).scrollIntoView()),!0)},"newlineInCode$1");function wl(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}c(wl,"defaultBlockAt$1");const Rp=c((n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=wl(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(I.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},"exitCode$1"),fd=c((n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Re||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=wl(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=n.tr.insert(o,s.createAndFill());l.setSelection(L.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},"createParagraphNear$1"),hd=c((n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(ot(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Qn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},"liftEmptyBlock$1");function Dp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof N&&e.selection.node.isBlock)return!r.parentOffset||!ot(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,u=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),u=r.start(p)==r.pos-(r.depth-p),l=wl(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(a&&l?{type:l}:null),o=p;break}else{if(p==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof L||e.selection instanceof Re)&&d.deleteSelection();let f=d.mapping.map(r.pos),h=ot(d.doc,f,s.length,s);if(h||(s[0]=l?{type:l}:null,h=ot(d.doc,f,s.length,s)),!h)return!1;if(d.split(f,s.length,s),!a&&u&&r.node(o).type!=l){let p=d.mapping.map(r.before(o)),m=d.doc.resolve(p);l&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(o)),l)}return t&&t(d.scrollIntoView()),!0}}c(Dp,"splitBlockAs");const Lp=Dp(),Pp=c((n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(N.create(n.doc,i))),!0)},"selectParentNode$1");function Bp(n,e,t){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)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Rt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}c(Bp,"joinMaybeClear");function pd(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Bp(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,m=v.empty;for(let b=o.length-1;b>=0;b--)m=v.from(o[b].create(null,m));m=v.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new T(m,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&Rt(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&a?null:I.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Qn(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&Un(s,"start",!0)&&Un(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let b=v.empty;for(let x=m.length-1;x>=0;x--)b=v.from(m[x].copy(b));let k=n.tr.step(new ce(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new T(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}c(pd,"deleteBarrier");function md(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(L.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}c(md,"selectTextblockSide");const zp=md(-1),$p=md(1);function Fp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&gl(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}c(Fp,"wrapIn$1");function lc(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,u)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let d=t.doc.resolve(u),f=d.index();i=d.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}c(lc,"setBlockType");function xl(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}c(xl,"chainCommands");xl(yl,sd,ld);xl(yl,cd,ud);xl(dd,fd,hd,Lp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Hp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let l=r?t.tr:null;return Vp(l,o,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}c(Hp,"wrapInList$1");function Vp(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new Hn(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Hn(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=gl(s,t,r,e);return l?(n&&jp(n,e,l,i,t),!0):!1}c(Vp,"wrapRangeInList");function jp(n,e,t,r,i){let s=v.empty;for(let d=t.length-1;d>=0;d--)s=v.from(t[d].type.create(t[d].attrs,s));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new T(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let l=t.length-o,a=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&ot(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}c(jp,"doWrapInList");function Up(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Wp(e,t,n,s):Kp(e,t,s):!0:!1}}c(Up,"liftListItem$1");function Wp(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new ce(s-1,o,s,o,new T(v.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Hn(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Qn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return Rt(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}c(Wp,"liftToOuterList");function Kp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,o.content.append(a?v.empty:v.from(i))))return!1;let f=s.pos,h=f+o.nodeSize;return r.step(new ce(f-(l?1:0),h+(a?1:0),f+1,h-1,new T((l?v.empty:v.from(i.copy(v.empty))).append(a?v.empty:v.from(i.copy(v.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}c(Kp,"liftOutOfList");function qp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==n);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!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=v.from(u?n.create():null),f=new T(v.from(n.create(null,v.from(l.type.create(null,d)))),u?3:1,0),h=s.start,p=s.end;t(e.tr.step(new ce(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}c(qp,"sinkListItem$1");const re=c(function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},"domIndex"),Wn=c(function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},"parentNode");let Ao=null;const tt=c(function(n,e,t){let r=Ao||(Ao=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},"textRange"),Jp=c(function(){Ao=null},"clearReusedRange"),cn=c(function(n,e,t,r){return t&&(ac(n,e,t,r,-1)||ac(n,e,t,r,1))},"isEquivalentPosition"),_p=/^(img|br|input|textarea|hr)$/i;function ac(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Te(n))){let o=n.parentNode;if(!o||o.nodeType!=1||$r(n)||_p.test(n.nodeName)||n.contentEditable=="false")return!1;e=re(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.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 n=o,e=i<0?Te(n):0}else return!1}}c(ac,"scanFor");function Te(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(Te,"nodeSize");function Gp(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Te(n)}else if(n.parentNode&&!$r(n))e=re(n),n=n.parentNode;else return null}}c(Gp,"textNodeBefore$1");function Yp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!$r(n))e=re(n)+1,n=n.parentNode;else return null}}c(Yp,"textNodeAfter$1");function Xp(n,e,t){for(let r=e==0,i=e==Te(n);r||i;){if(n==t)return!0;let s=re(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Te(n)}}c(Xp,"isOnEdge");function $r(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}c($r,"hasBlockDesc");const Es=c(function(n){return n.focusNode&&cn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)},"selectionCollapsed");function Pt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}c(Pt,"keyEvent");function Qp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}c(Qp,"deepActiveElement");function Zp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Te(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Te(r.startContainer),r.startOffset)}}}c(Zp,"caretFromPoint");const qe=typeof navigator<"u"?navigator:null,cc=typeof document<"u"?document:null,Dt=qe&&qe.userAgent||"",No=/Edge\/(\d+)/.exec(Dt),gd=/MSIE \d/.exec(Dt),Io=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),ye=!!(gd||Io||No),Ct=gd?document.documentMode:Io?+Io[1]:No?+No[1]:0,Ee=!ye&&/gecko\/(\d+)/i.test(Dt);Ee&&+(/Firefox\/(\d+)/.exec(Dt)||[0,0])[1];const Ro=!ye&&/Chrome\/(\d+)/.exec(Dt),ae=!!Ro,yd=Ro?+Ro[1]:0,fe=!ye&&!!qe&&/Apple Computer/.test(qe.vendor),Kn=fe&&(/Mobile\/\w+/.test(Dt)||!!qe&&qe.maxTouchPoints>2),Me=Kn||(qe?/Mac/.test(qe.platform):!1),em=qe?/Win/.test(qe.platform):!1,it=/Android \d/.test(Dt),Fr=!!cc&&"webkitFontSmoothing"in cc.documentElement.style,tm=Fr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function nm(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}c(nm,"windowRect");function Xe(n,e){return typeof n=="number"?n:n[e]}c(Xe,"getSide$1");function rm(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}c(rm,"clientRect");function uc(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Wn(o);continue}let l=o,a=l==s.body,u=a?nm(s):rm(l),d=0,f=0;if(e.top<u.top+Xe(r,"top")?f=-(u.top-e.top+Xe(i,"top")):e.bottom>u.bottom-Xe(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Xe(i,"top")-u.top:e.bottom-u.bottom+Xe(i,"bottom")),e.left<u.left+Xe(r,"left")?d=-(u.left-e.left+Xe(i,"left")):e.right>u.right-Xe(r,"right")&&(d=e.right-u.right+Xe(i,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Wn(o)}}c(uc,"scrollRectIntoView");function im(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:bd(n.dom)}}c(im,"storeScrollPos");function bd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Wn(r));return e}c(bd,"scrollStack");function sm({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;kd(t,r==0?0:r-e)}c(sm,"resetScrollPos");function kd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}c(kd,"restoreScrollStack");let mn=null;function om(n){if(n.setActive)return n.setActive();if(mn)return n.focus(mn);let e=bd(n);n.focus(mn==null?{get preventScroll(){return mn={preventScroll:!0},!0}}:void 0),mn||(mn=!1,kd(e,0))}c(om,"focusPreventScroll");function wd(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=tt(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=l){o=Math.max(m.bottom,o),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=d,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=u,r=0),t&&t.nodeType==3?lm(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:wd(t,i)}c(wd,"findOffsetInNode");function lm(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=pt(r,1);if(s.top!=s.bottom&&Sl(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}c(lm,"findOffsetInText");function Sl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}c(Sl,"inRect");function am(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}c(am,"targetKludge");function cm(n,e,t){let{node:r,offset:i}=wd(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}c(cm,"posFromElement");function um(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.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:n.docView.posFromDOM(e,t,-1)}c(um,"posFromCaret");function xd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(Sl(e,u))return xd(o,e,u)}}if((s=(s+1)%r)==i)break}return n}c(xd,"elementFromPoint");function dm(n,e){let t=n.dom.ownerDocument,r,i=0,s=Zp(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=n.dom.getBoundingClientRect();if(!Sl(e,u)||(o=xd(n.dom,e,u),!o))return null}if(fe)for(let u=o;r&&u;u=Wn(u))u.draggable&&(r=void 0);if(o=am(o,e),r){if(Ee&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;Fr&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=um(n,r,i,e))}l==null&&(l=cm(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}c(dm,"posAtCoords");function dc(n){return n.top<n.bottom||n.left<n.right}c(dc,"nonZero");function pt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(dc(r))return r}return Array.prototype.find.call(t,dc)||n.getBoundingClientRect()}c(pt,"singleRect");const fm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Sd(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Fr||Ee;if(r.nodeType==3)if(o&&(fm.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=pt(tt(r,i,i),t);if(Ee&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=pt(tt(r,i-1,i-1),-1);if(u.top==a.top){let d=pt(tt(r,i,i+1),-1);if(d.top!=a.top)return nr(d,d.left<u.left)}}return a}else{let a=i,u=i,d=t<0?1:-1;return t<0&&!i?(u++,d=-1):t>=0&&i==r.nodeValue.length?(a--,d=1):t<0?a--:u++,nr(pt(tt(r,a,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Te(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ys(a.getBoundingClientRect(),!1)}if(s==null&&i<Te(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ys(a.getBoundingClientRect(),!0)}return Ys(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Te(r))){let a=r.childNodes[i-1],u=a.nodeType==3?tt(a,Te(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return nr(pt(u,1),!1)}if(s==null&&i<Te(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?tt(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return nr(pt(u,-1),!0)}return nr(pt(r.nodeType==3?tt(r):r,-t),t>=0)}c(Sd,"coordsAtPos");function nr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}c(nr,"flattenV");function Ys(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}c(Ys,"flattenH");function vd(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}c(vd,"withFlushedState");function hm(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return vd(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Sd(n,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=tt(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}c(hm,"endOfTextblockVertical");const pm=/[\u0590-\u08ac]/;function mm(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!pm.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:vd(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}c(mm,"endOfTextblockHorizontal");let fc=null,hc=null,pc=!1;function gm(n,e,t){return fc==e&&hc==t?pc:(fc=e,hc=t,pc=t=="up"||t=="down"?hm(n,e,t):mm(n,e,t))}c(gm,"endOfTextblock");const Oe=0,mc=1,Kt=2,Je=3,Oa=class Oa{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Oe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-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[t];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=t>re(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==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,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||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 t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],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,t){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 vi){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof xi&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?re(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,t):{node:this.contentDOM,offset:s?re(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],u=o+a.size;if(i==-1&&e<=u){let d=o+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=re(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=re(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(s>m&&o<y)return g.setSelection(e-m-g.border,t-m-g.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((Ee||fe)&&e==t){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
|
|
7
|
-
`),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:re(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ee&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&fe)&&cn(l.node,l.offset,d.anchorNode,d.anchorOffset)&&cn(a.node,a.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Ee)){u.collapse(l.node,l.offset);try{e!=t&&u.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>t){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){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&&t>=r:e<o&&t>r){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?Kt:mc,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Je:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Kt:Je}r=o}this.dirty=Kt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Kt:mc;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};c(Oa,"ViewDesc");let un=Oa;const Aa=class Aa extends un{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.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=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Oe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}};c(Aa,"WidgetViewDesc");let xi=Aa;const Na=class Na extends un{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}};c(Na,"CompositionViewDesc");let Do=Na;const Cr=class Cr extends un{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=an.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Cr(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Je||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Je&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Oe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Oe}}slice(e,t,r){let i=Cr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=zo(s,t,o,r)),e>0&&(s=zo(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()}};c(Cr,"MarkViewDesc");let qn=Cr;const ks=class ks extends un{constructor(e,t,r,i,s,o,l,a,u){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,u=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=an.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Td(d,r,t),u?a=new Lo(e,t,r,i,d,f||null,h,u,s,o+1):t.isText?new Si(e,t,r,i,d,h,s):new ks(e,t,r,i,d,f||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>v.empty)}return e}matchesNode(e,t,r){return this.dirty==Oe&&e.eq(this.node)&&Ci(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Bo(this,o&&o.node,e);wm(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?$.none:this.node.child(d).marks,r,e),a.placeWidget(u,e,i)},(u,d,f,h)=>{a.syncToMarks(u.marks,r,e);let p;a.findNodeMatch(u,d,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(u,d,f,p,e)||a.updateNextNode(u,d,f,e,h,i)||a.addNode(u,d,f,e,i),i+=u.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Kt)&&(o&&this.protectLocalComposition(e,o),Cd(this.contentDOM,this.children,e),Kn&&xm(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof L)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=Sm(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Do(this,s,t,i);e.input.compositionNodes.push(o),this.children=zo(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Je||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Oe}updateOuterDeco(e){if(Ci(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Md(this.dom,this.nodeDOM,Po(this.outerDeco,this.node,t),Po(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};c(ks,"NodeViewDesc");let Mt=ks;function gc(n,e,t,r,i){Td(r,e,n);let s=new Mt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}c(gc,"docViewDesc");const ws=class ws extends Mt{constructor(e,t,r,i,s,o,l){super(e,t,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,t,r,i){return this.dirty==Je||this.dirty!=Oe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Oe||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=Oe,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new ws(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Je)}get domAtom(){return!1}isText(e){return this.node.text==e}};c(ws,"TextViewDesc");let Si=ws;const Ia=class Ia extends un{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Oe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}};c(Ia,"TrailingHackViewDesc");let vi=Ia;const Ra=class Ra extends Mt{constructor(e,t,r,i,s,o,l,a,u,d){super(e,t,r,i,s,o,l,u,d),this.spec=a}update(e,t,r,i){if(this.dirty==Je)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};c(Ra,"CustomNodeViewDesc");let Lo=Ra;function Cd(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=yc(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof qn){let a=r?r.previousSibling:n.lastChild;Cd(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=yc(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}c(Cd,"renderDescs");const ur=c(function(n){n&&(this.nodeName=n)},"OuterDecoLevel");ur.prototype=Object.create(null);const qt=[new ur];function Po(n,e,t){if(n.length==0)return qt;let r=t?qt[0]:new ur,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new ur(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new ur(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}c(Po,"computeOuterDeco");function Md(n,e,t,r){if(t==qt&&r==qt)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=qt[0]),i=a}ym(i,l||qt[0],o)}return i}c(Md,"patchOuterDeco");function ym(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}c(ym,"patchAttributes");function Td(n,e,t){return Md(n,n,qt,Po(e,t,n.nodeType!=1))}c(Td,"applyOuterDeco");function Ci(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}c(Ci,"sameOuterDeco");function yc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}c(yc,"rm");const Da=class Da{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=bm(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Oe,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let u=this.top.children[a];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=qn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,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,t,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 u=this.top.children[l];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==Je&&o.dom==o.contentDOM&&(o.dirty=Kt),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Mt){let u=this.preMatch.matched.get(a);if(u!=null&&u!=s)return!1;let d=a.dom,f,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Je&&Ci(t,a.outerDeco));if(!h&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,e,t,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Kt,f.updateChildren(i,o+1),f.dirty=Oe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ci(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Mt.create(this.top,t,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,t,r,i,s){let o=Mt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new xi(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof qn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Si)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((fe||ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new vi(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};c(Da,"ViewTreeUpdater");let Bo=Da;function bm(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let u=t.children[r-1];if(u instanceof qn)t=u,r=u.children.length;else{l=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}c(bm,"preMatch");function km(n,e){return n.type.side-e.type.side}c(km,"compareSide");function wm(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,i,e.forChild(s,d),u),s+=d.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let d,f;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(km);for(let y=0;y<f.length;y++)t(f[y],u,!!a)}else t(d,u,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(u<n.childCount)p=u,h=n.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let y=m;o<i.length&&i[o].from<y&&(y=i[o].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=h.cut(y-s),h=h.cut(0,y-s),m=y,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(s,h),p),s=m}}c(wm,"iterDeco");function xm(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}c(xm,"iosHacks");function Sm(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<n.childCount;){let u=n.child(i++);if(s+=u.nodeSize,!u.isText)break;a+=u.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?a.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=t)return l+u;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}c(Sm,"findTextInFragment");function zo(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],u=l,d=l+=a.size;u>=t||d<=e?s.push(a):(u<e&&s.push(a.slice(0,e-u,r)),i&&(s.push(i),i=void 0),d>t&&s.push(a.slice(t-u,a.size,r)))}return s}c(zo,"replaceNodes");function vl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(Es(t)){for(a=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&N.isSelectable(f)&&i.parent&&!(f.isInline&&Xp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;u=new N(o==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,o]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;u=Cl(n,d,l,f)}return u}c(vl,"selectionFromDOM");function Ed(n){return n.editable?n.hasFocus():Ad(n)&&document.activeElement&&document.activeElement.contains(n.dom)}c(Ed,"editorOwnsSelection");function lt(n,e=!1){let t=n.state.selection;if(Od(n,t),!!Ed(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&cn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Cm(n);else{let{anchor:r,head:i}=t,s,o;bc&&!(t instanceof L)&&(t.$from.parent.inlineContent||(s=kc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=kc(n,t.to))),n.docView.setSelection(r,i,n,e),bc&&(s&&wc(s),o&&wc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&vm(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}c(lt,"selectionToDOM");const bc=fe||ae&&yd<63;function kc(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(fe&&i&&i.contentEditable=="false")return Xs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Xs(i);if(s)return Xs(s)}}c(kc,"temporarilyEditableNear");function Xs(n){return n.contentEditable="true",fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}c(Xs,"setEditable");function wc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}c(wc,"resetEditable");function vm(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ed(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}c(vm,"removeClassOnSelectionChange");function Cm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,re(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&ye&&Ct<=11&&(t.disabled=!0,t.disabled=!1)}c(Cm,"selectCursorWrapper");function Od(n,e){if(e instanceof N){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(xc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else xc(n)}c(Od,"syncNodeSelection");function xc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}c(xc,"clearNodeSelection");function Cl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}c(Cl,"selectionBetween");function Sc(n){return n.editable&&!n.hasFocus()?!1:Ad(n)}c(Sc,"hasFocusAndSelection");function Ad(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}c(Ad,"hasSelection");function Mm(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return cn(e.node,e.offset,t.anchorNode,t.anchorOffset)}c(Mm,"anchorInRightPlace");function $o(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&I.findFrom(s,e)}c($o,"moveSelectionBlock");function mt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}c(mt,"apply");function vc(n,e,t){let r=n.state.selection;if(r instanceof L)if(t.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=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return mt(n,new L(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=$o(n.state,e);return i&&i instanceof N?mt(n,i):!1}else if(!(Me&&t.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=n.docView.descAt(l))&&!o.contentDOM?N.isSelectable(s)?mt(n,new N(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fr?mt(n,new L(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof N&&r.node.isInline)return mt(n,new L(e>0?r.$to:r.$from));{let i=$o(n.state,e);return i?mt(n,i):!1}}}c(vc,"selectHorizontally");function Mi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(Mi,"nodeLen");function dr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}c(dr,"isIgnorable");function gn(n,e){return e<0?Tm(n):Em(n)}c(gn,"skipIgnoredNodes");function Tm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Ee&&t.nodeType==1&&r<Mi(t)&&dr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(dr(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Nd(t))break;{let l=t.previousSibling;for(;l&&dr(l,-1);)i=t.parentNode,s=re(l),l=l.previousSibling;if(l)t=l,r=Mi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Fo(n,t,r):i&&Fo(n,i,s)}c(Tm,"skipIgnoredNodesBefore");function Em(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Mi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(dr(l,1))s=t,o=++r;else break}else{if(Nd(t))break;{let l=t.nextSibling;for(;l&&dr(l,1);)s=l.parentNode,o=re(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Mi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Fo(n,s,o)}c(Em,"skipIgnoredNodesAfter");function Nd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}c(Nd,"isBlockNode");function Om(n,e){for(;n&&e==n.childNodes.length&&!$r(n);)e=re(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}c(Om,"textNodeAfter");function Am(n,e){for(;n&&!e&&!$r(n);)e=re(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}c(Am,"textNodeBefore");function Fo(n,e,t){if(e.nodeType!=3){let s,o;(o=Om(e,t))?(e=o,t=0):(s=Am(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Es(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&<(n)},50)}c(Fo,"setSelFocus");function Cc(n,e){let t=n.state.doc.resolve(e);if(!(ae||em)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.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<t.end()){let s=n.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(n.dom).direction=="rtl"?"rtl":"ltr"}c(Cc,"findDirection");function Mc(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||Me&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=$o(n.state,e);if(o&&o instanceof N)return mt(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Re?I.near(o,e):I.findFrom(o,e);return l?mt(n,l):!1}return!1}c(Mc,"selectVertically");function Tc(n,e){if(!(n.state.selection instanceof L))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}c(Tc,"stopNativeHorizontalDelete");function Ec(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}c(Ec,"switchEditable");function Nm(n){if(!fe||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ec(n,r,"true"),setTimeout(()=>Ec(n,r,"false"),20)}return!1}c(Nm,"safariDownArrowBug");function Im(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}c(Im,"getMods");function Rm(n,e){let t=e.keyCode,r=Im(e);if(t==8||Me&&t==72&&r=="c")return Tc(n,-1)||gn(n,-1);if(t==46&&!e.shiftKey||Me&&t==68&&r=="c")return Tc(n,1)||gn(n,1);if(t==13||t==27)return!0;if(t==37||Me&&t==66&&r=="c"){let i=t==37?Cc(n,n.state.selection.from)=="ltr"?-1:1:-1;return vc(n,i,r)||gn(n,i)}else if(t==39||Me&&t==70&&r=="c"){let i=t==39?Cc(n,n.state.selection.from)=="ltr"?1:-1:1;return vc(n,i,r)||gn(n,i)}else{if(t==38||Me&&t==80&&r=="c")return Mc(n,-1,r)||gn(n,-1);if(t==40||Me&&t==78&&r=="c")return Nm(n)||Mc(n,1,r)||gn(n,1);if(r==(Me?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}c(Rm,"captureKeyDown");function Ml(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||an.fromSchema(n.state.schema),l=Bd(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=Pd[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
|
|
8
|
-
|
|
9
|
-
`);return{dom:a,text:h,slice:e}}c(Ml,"serializeForClipboard");function Id(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return l=new T(v.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
-
`))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(f)l=f;else{let h=i.marks(),{schema:p}=n.state,m=an.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=Bm(t),Fr&&zm(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Yt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Dm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=$m(Oc(l,+d[1],+d[2]),d[4]);else if(l=T.maxOpen(Lm(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=Oc(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}c(Id,"parseFromClipboard");const Dm=/^(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 Lm(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&s.length&&Dd(a,s,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Ld(o[o.length-1],s.length));let d=Rd(l,a);o.push(d),i=i.matchType(d.type),s=a}}),o)return v.from(o)}return n}c(Lm,"normalizeSiblings");function Rd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}c(Rd,"withWrappers");function Dd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=Dd(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(v.from(Rd(t,n,i+1))))}}c(Dd,"addToSibling");function Ld(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ld(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}c(Ld,"closeRight");function Ho(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=Ho(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(v.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}c(Ho,"closeRange");function Oc(n,e,t){return e<n.openStart&&(n=new T(Ho(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(Ho(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}c(Oc,"closeSlice");const Pd={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 Ac=null;function Bd(){return Ac||(Ac=document.implementation.createHTMLDocument("title"))}c(Bd,"detachedDoc");let Qs=null;function Pm(n){let e=window.trustedTypes;return e?(Qs||(Qs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:c(t=>t,"createHTML")})),Qs.createHTML(n)):n}c(Pm,"maybeWrapTrusted");function Bm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Pd[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Pm(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}c(Bm,"readHTML");function zm(n){let e=n.querySelectorAll(ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}c(zm,"restoreReplacedSpaces");function $m(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=v.from(a.create(r[l+1],i)),s++,o++}return new T(i,s,o)}c($m,"addContext");const he={},pe={},Fm={touchstart:!0,touchmove:!0},La=class La{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};c(La,"InputState");let Vo=La;function Hm(n){for(let e in he){let t=he[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{jm(n,r)&&!Tl(n,r)&&(n.editable||!(r.type in pe))&&t(n,r)},Fm[e]?{passive:!0}:void 0)}fe&&n.dom.addEventListener("input",()=>null),jo(n)}c(Hm,"initInput");function St(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}c(St,"setSelectionOrigin");function Vm(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}c(Vm,"destroyInput");function jo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Tl(n,r))})}c(jo,"ensureListeners");function Tl(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}c(Tl,"runCustomHandler");function jm(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}c(jm,"eventBelongsToView");function Um(n,e){!Tl(n,e)&&he[e.type]&&(n.editable||!(e.type in pe))&&he[e.type](n,e)}c(Um,"dispatchEvent");pe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!$d(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(it&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Kn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Pt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Rm(n,t)?t.preventDefault():St(n,"key")};pe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};pe.keypress=(n,e)=>{let t=e;if($d(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Me&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=c(()=>n.state.tr.insertText(i).scrollIntoView(),"deflt");!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function Os(n){return{left:n.clientX,top:n.clientY}}c(Os,"eventCoords");function Wm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}c(Wm,"isNear");function El(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}c(El,"runHandlerOnContext");function Cn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}c(Cn,"updateSelection");function Km(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&N.isSelectable(r)?(Cn(n,new N(t)),!0):!1}c(Km,"selectClickedLeaf");function qm(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof N&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(N.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Cn(n,N.create(n.state.doc,i)),!0):!1}c(qm,"selectClickedNode");function Jm(n,e,t,r,i){return El(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?qm(n,t):Km(n,t))}c(Jm,"handleSingleClick");function _m(n,e,t,r){return El(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}c(_m,"handleDoubleClick");function Gm(n,e,t,r){return El(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Ym(n,t,r)}c(Gm,"handleTripleClick");function Ym(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Cn(n,L.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)Cn(n,L.create(r,l+1,l+1+o.content.size));else if(N.isSelectable(o))Cn(n,N.create(r,l));else continue;return!0}}c(Ym,"defaultTripleClick");function Ol(n){return Ti(n)}c(Ol,"forceDOMFlush");const zd=Me?"metaKey":"ctrlKey";he.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ol(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Wm(t,n.input.lastClick)&&!t[zd]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(Os(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Uo(n,o,t,!!r)):(s=="doubleClick"?_m:Gm)(n,o.pos,o.inside,t)?t.preventDefault():St(n,"pointer"))};const Pa=class Pa{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[zd],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.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:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof N&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ee&&!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)),St(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(()=>lt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Os(e))),this.updateAllowDefault(e),this.allowDefault||!t?St(this.view,"pointer"):Jm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||fe&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Cn(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):St(this.view,"pointer")}move(e){this.updateAllowDefault(e),St(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)}};c(Pa,"MouseDown");let Uo=Pa;he.touchstart=n=>{n.input.lastTouch=Date.now(),Ol(n),St(n,"pointer")};he.touchmove=n=>{n.input.lastTouch=Date.now(),St(n,"pointer")};he.contextmenu=n=>Ol(n);function $d(n,e){return n.composing?!0:fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}c($d,"inOrNearComposition");const Xm=it?5e3:-1;pe.compositionstart=pe.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ti(n,!0),n.markCursor=null;else if(Ti(n,!e.selection.empty),Ee&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.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=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Fd(n,Xm)};pe.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Fd(n,20))};function Fd(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ti(n),e))}c(Fd,"scheduleComposeEnd");function Hd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Zm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}c(Hd,"clearComposition");function Qm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Gp(e.focusNode,e.focusOffset),r=Yp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}c(Qm,"findCompositionNode");function Zm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}c(Zm,"timestampFromCustomEvent");function Ti(n,e=!1){if(!(it&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Hd(n),e||n.docView&&n.docView.dirty){let t=vl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}c(Ti,"endComposition");function eg(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}c(eg,"captureCopy");const Nr=ye&&Ct<15||Kn&&tm<604;he.copy=pe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Nr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=Ml(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):eg(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}c(tg,"sliceSingleNode");function ng(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Ir(n,r.value,null,i,e):Ir(n,r.textContent,r.innerHTML,i,e)},50)}c(ng,"capturePaste");function Ir(n,e,t,r,i){let s=Id(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||T.empty)))return!0;if(!s)return!1;let o=tg(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}c(Ir,"doPaste");function Vd(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}c(Vd,"getText$1");pe.paste=(n,e)=>{let t=e;if(n.composing&&!it)return;let r=Nr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ir(n,Vd(r),r.getData("text/html"),i,t)?t.preventDefault():ng(n,t)};const Ba=class Ba{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};c(Ba,"Dragging");let Ei=Ba;const rg=Me?"altKey":"ctrlKey";function jd(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[rg]}c(jd,"dragMoves");he.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Os(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof N?i.to-1:i.to))){if(r&&r.mightDrag)o=N.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=N.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:u,slice:d}=Ml(n,l);(!t.dataTransfer.files.length||!ae||yd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Nr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Nr||t.dataTransfer.setData("text/plain",u),n.dragging=new Ei(d,jd(n,t),o)};he.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};pe.dragover=pe.dragenter=(n,e)=>e.preventDefault();pe.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Os(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",m=>{o=m(o,n,!1)}):o=Id(n,Vd(t.dataTransfer),Nr?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&jd(n,t));if(n.someProp("handleDrop",m=>m(n,t,o||T.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?Xu(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let u=n.state.tr;if(l){let{node:m}=r;m?m.replace(u):u.deleteSelection()}let d=u.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=u.doc;if(f?u.replaceRangeWith(d,d,o.content.firstChild):u.replaceRange(d,d,o),u.doc.eq(h))return;let p=u.doc.resolve(d);if(f&&N.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new N(p));else{let m=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),u.setSelection(Cl(n,p,u.doc.resolve(m)))}n.focus(),n.dispatch(u.setMeta("uiEvent","drop"))};he.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&<(n)},20))};he.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};he.beforeinput=(n,e)=>{if(ae&&it&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Pt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in pe)he[n]=pe[n];function Rr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}c(Rr,"compareObjs");const xs=class xs{constructor(e,t){this.toDOM=e,this.spec=t||Qt,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ae(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof xs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};c(xs,"WidgetType");let Oi=xs;const Mr=class Mr{constructor(e,t){this.attrs=e,this.spec=t||Qt}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ae(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Mr&&Rr(this.attrs,e.attrs)&&Rr(this.spec,e.spec)}static is(e){return e.type instanceof Mr}destroy(){}};c(Mr,"InlineType");let Xt=Mr;const Ss=class Ss{constructor(e,t){this.attrs=e,this.spec=t||Qt}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ae(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ss&&Rr(this.attrs,e.attrs)&&Rr(this.spec,e.spec)}destroy(){}};c(Ss,"NodeType");let Wo=Ss;const Ut=class Ut{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ut(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ut(e,e,new Oi(t,r))}static inline(e,t,r,i){return new Ut(e,t,new Xt(r,i))}static node(e,t,r,i){return new Ut(e,t,new Wo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Xt}get widget(){return this.type instanceof Oi}};c(Ut,"Decoration");let Ae=Ut;const bn=[],Qt={},He=class He{constructor(e,t){this.local=e.length?e:bn,this.children=t.length?t:bn}static create(e,t){return t.length?Ni(t,e,0,Qt):le}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&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]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==le||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Qt)}mapInner(e,t,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(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?ig(this.children,o||[],e,t,r,i,s):o?new He(o.sort(Zt),bn):le}add(e,t){return t.length?this==le?He.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let u=a+r,d;if(d=Wd(t,l,u)){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,d,u+1):i.splice(s,0,a,a+l.nodeSize,Ni(d,l,u+1,Qt)),s+=3}});let o=Ud(s?Kd(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new He(o.length?this.local.concat(o).sort(Zt):this.local,i||this.children)}remove(e){return e.length==0||this==le?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+t,a=r[s+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,l+1);u!=le?r[s+2]=u:(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,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new He(i,r):le}forChild(e,t){if(this==le)return this;if(t.isLeaf)return He.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+t.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 Xt){let u=Math.max(s,a.from)-s,d=Math.min(o,a.to)-s;u<d&&(i||(i=[])).push(a.copy(u,d))}}if(i){let l=new He(i.sort(Zt),bn);return r?new Ai([l,r]):l}return r||le}eq(e){if(this==e)return!0;if(!(e instanceof He)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Al(this.localsInner(e))}localsInner(e){if(this==le)return bn;if(e.inlineContent||!this.local.some(Xt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Xt||t.push(this.local[r]);return t}forEachSet(e){e(this)}};c(He,"DecorationSet");let oe=He;oe.empty=new oe([],[]);oe.removeOverlap=Al;const le=oe.empty,kt=class kt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Qt));return kt.from(r)}forChild(e,t){if(t.isLeaf)return oe.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=le&&(s instanceof kt?r=r.concat(s.members):r.push(s))}return kt.from(r)}eq(e){if(!(e instanceof kt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Al(r?t:t.sort(Zt)):bn}static from(e){switch(e.length){case 0:return le;case 1:return e[0];default:return new kt(e.every(t=>t instanceof oe)?e:e.reduce((t,r)=>t.concat(r instanceof oe?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};c(kt,"DecorationGroup");let Ai=kt;function ig(n,e,t,r,i,s,o){let l=n.slice();for(let u=0,d=s;u<t.maps.length;u++){let f=0;t.maps[u].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||h>k+d-f)continue;let x=l[b]+d-f;p>=x?l[b+1]=h<=x?-2:-1:h>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+s),f=d-i;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[u+1]+s,-1),p=h-i,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let b=l[u+2].mapInner(t,y,d+1,n[u]+s+1,o);b!=le?(l[u]=f,l[u+1]=p,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=sg(l,n,e,t,i,s,o),d=Ni(u,r,0,o);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new oe(e.sort(Zt),l)}c(ig,"mapChildren");function Ud(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Ae(i.from+e,i.to+e,i.type))}return t}c(Ud,"moveSpans");function sg(n,e,t,r,i,s,o){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,i,u);f?t.push(f):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}c(l,"gather");for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}c(sg,"mapAndGatherRemainingDecorations");function Wd(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}c(Wd,"takeSpansForNode");function Kd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}c(Kd,"withoutNulls");function Ni(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let u=Wd(n,l,a+t);if(u){s=!0;let d=Ni(u,l,t+a+1,r);d!=le&&i.push(a,a+l.nodeSize,d)}});let o=Ud(s?Kd(n):n,-t).sort(Zt);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 oe(o,i):le}c(Ni,"buildTree");function Zt(n,e){return n.from-e.from||n.to-e.to}c(Zt,"byPos");function Al(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Nc(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Nc(e,i,r.copy(s.from,r.to)));break}}}return e}c(Al,"removeOverlap");function Nc(n,e,t){for(;e<n.length&&Zt(t,n[e])>0;)e++;n.splice(e,0,t)}c(Nc,"insertAhead");function Zs(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=le&&e.push(r)}),n.cursorWrapper&&e.push(oe.create(n.state.doc,[n.cursorWrapper.deco])),Ai.from(e)}c(Zs,"viewDecorations");const og={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lg=ye&&Ct<=11,za=class za{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}};c(za,"SelectionState");let Ko=za;const $a=class $a{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ko,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]);ye&&Ct<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),lg&&(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,og)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Sc(this.view)){if(this.suppressingSelectionUpdates)return lt(this.view);if(ye&&Ct<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Wn(s))t.add(s);for(let s=e.anchorNode;s;s=Wn(s))if(t.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Sc(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],a);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(l=!0))}if(Ee&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||ug(e,f)!=p)&&h.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Es(r)&&(u=vl(e))&&u.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,lt(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),ag(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||lt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ye&&Ct<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?re(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?re(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,a,1);return{from:l,to:u}}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})}};c($a,"DOMObserver");let qo=$a,Ic=new WeakMap,Rc=!1;function ag(n){if(!Ic.has(n)&&(Ic.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ee,Rc)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."),Rc=!0}}c(ag,"checkCSS");function Dc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return cn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}c(Dc,"rangeToSelectionRange");function cg(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Dc(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return c(r,"read"),n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Dc(n,t):null}c(cg,"safariShadowSelectionRange");function ug(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}c(ug,"blockParent");function dg(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),u,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:a.anchorOffset}],Es(a)||u.push({node:a.focusNode,offset:a.focusOffset})),ae&&n.input.lastKeyCode===8)for(let y=s;y>i;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let f=n.state.doc,h=n.someProp("domParser")||Yt.fromSchema(n.state.schema),p=f.resolve(o),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:fg,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),m={anchor:y+o,head:b+o}}return{doc:g,sel:m,from:o,to:l}}c(dg,"parseBetween");function fg(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(fe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||fe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}c(fg,"ruleFromNode");const hg=/^(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 pg(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let C=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=vl(n,C);if(A&&!n.state.selection.eq(A)){if(ae&&it&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",R=>R(n,Pt(13,"Enter"))))return;let D=n.state.tr.setSelection(A);C=="pointer"?D.setMeta("pointer",!0):C=="key"&&D.scrollIntoView(),s&&D.setMeta("composition",s),n.dispatch(D)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,u=dg(n,e,t),d=n.state.doc,f=d.slice(u.from,u.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=yg(f.content,u.doc.content,u.from,h,p);if(m&&n.input.domChangeCount++,(Kn&&n.input.lastIOSEnter>Date.now()-225||it)&&i.some(C=>C.nodeType==1&&!hg.test(C.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",C=>C(n,Pt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let C=Lc(n,n.state.doc,u.sel);if(C&&!C.eq(n.state.selection)){let A=n.state.tr.setSelection(C);s&&A.setMeta("composition",s),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof L&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),ye&&Ct<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Kn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!k&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",C=>C(n,Pt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&gg(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",C=>C(n,Pt(8,"Backspace")))){it&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),it&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(C){return C(n,Pt(13,"Enter"))})},20));let x=m.start,M=m.endA,w=c(C=>{let A=C||n.state.tr.replace(x,M,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let D=Lc(n,A.doc,u.sel);D&&!(ae&&n.composing&&D.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(D.head==x||D.head==A.mapping.map(M)-1)||ye&&D.empty&&D.head==x)&&A.setSelection(D)}return s&&A.setMeta("composition",s),A.scrollIntoView()},"mkTr"),E;if(k)if(g.pos==y.pos){ye&&Ct<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>lt(n),20));let C=w(n.state.tr.delete(x,M)),A=d.resolve(m.start).marksAcross(d.resolve(m.endA));A&&C.ensureMarks(A),n.dispatch(C)}else if(m.endA==m.endB&&(E=mg(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let C=w(n.state.tr);E.type=="add"?C.addMark(x,M,E.mark):C.removeMark(x,M,E.mark),n.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,y.parentOffset),A=c(()=>w(n.state.tr.insertText(C,x,M)),"deflt");n.someProp("handleTextInput",D=>D(n,x,M,C,A))||n.dispatch(A())}else n.dispatch(w());else n.dispatch(w())}c(pg,"readDOMChange");function Lc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Cl(n,e.resolve(t.anchor),e.resolve(t.head))}c(Lc,"resolveSelection");function mg(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=c(d=>d.mark(l.addToSet(d.marks)),"update");else if(i.length==0&&s.length==1)l=s[0],o="remove",a=c(d=>d.mark(l.removeFromSet(d.marks)),"update");else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(a(e.child(d)));if(v.from(u).eq(n))return{mark:l,type:o}}c(mg,"isMarkChange");function gg(n,e,t,r,i){if(t-e<=i.pos-r.pos||eo(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(eo(s,!0,!0));return!o.parent.isTextblock||o.pos>t||eo(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}c(gg,"looksLikeBackspace");function eo(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}c(eo,"skipClosingAndOpening");function yg(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&n.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&Pc(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<n.size&&Pc(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}c(yg,"findDiff");function Pc(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}c(Pc,"isSurrogatePair");const Fa=class Fa{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Vo,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Hc),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=$c(this),zc(this),this.nodeViews=Fc(this),this.docView=gc(this.state.doc,Bc(this),Zs(this),this.dom,this),this.domObserver=new qo(this,(r,i,s,o)=>pg(this,r,i,s,o)),this.domObserver.start(),Hm(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&jo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Hc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Hd(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Fc(this);kg(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&jo(this),this.editable=$c(this),zc(this);let a=Zs(this),u=Bc(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&im(this);if(o){this.domObserver.stop();let p=f&&(ye||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&bg(i.selection,e.selection);if(f){let m=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qm(this)),(s||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=gc(e.doc,u,a,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Mm(this))?lt(this,p):(Od(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&sm(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof N){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&uc(this,t.getBoundingClientRect(),e)}else uc(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Ei(e.slice,e.move,i<0?void 0:N.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(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=t?t(l):l))return i}}hasFocus(){if(ye){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&&om(this.dom),lt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return dm(this,e)}coordsAtPos(e,t=1){return Sd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return gm(this,t||this.state,e)}pasteHTML(e,t){return Ir(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ir(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ml(this,e)}destroy(){this.docView&&(Vm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Um(this,e)}domSelectionRange(){let e=this.domSelection();return e?fe&&this.root.nodeType===11&&Qp(this.dom.ownerDocument)==this.dom&&cg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};c(Fa,"EditorView");let Ii=Fa;Ii.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Bc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ae.node(0,n.state.doc.content.size,e)]}c(Bc,"computeDocDeco");function zc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ae.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}c(zc,"updateCursorWrapper");function $c(n){return!n.someProp("editable",e=>e(n.state)===!1)}c($c,"getEditable");function bg(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}c(bg,"selectionContextChanged");function Fc(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return c(t,"add"),n.someProp("nodeViews",t),n.someProp("markViews",t),e}c(Fc,"buildNodeViews");function kg(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}c(kg,"changedNodeViews");function Hc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}c(Hc,"checkStateComponent");var At={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:"'"},Ri={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wg=typeof navigator<"u"&&/Mac/.test(navigator.platform),xg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ie=0;ie<10;ie++)At[48+ie]=At[96+ie]=String(ie);for(var ie=1;ie<=24;ie++)At[ie+111]="F"+ie;for(var ie=65;ie<=90;ie++)At[ie]=String.fromCharCode(ie+32),Ri[ie]=String.fromCharCode(ie);for(var to in At)Ri.hasOwnProperty(to)||(Ri[to]=At[to]);function Sg(n){var e=wg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||xg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ri:At)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}c(Sg,"keyName");const vg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Cg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Mg(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let 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))vg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}c(Mg,"normalizeKeyName$1");function Tg(n){let e=Object.create(null);for(let t in n)e[Mg(t)]=n[t];return e}c(Tg,"normalize");function no(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}c(no,"modifiers");function Eg(n){return new H({props:{handleKeyDown:Nl(n)}})}c(Eg,"keymap");function Nl(n){let e=Tg(n);return function(t,r){let i=Sg(r),s,o=e[no(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[no(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Cg&&r.ctrlKey&&r.altKey)&&(s=At[r.keyCode])&&s!=i){let l=e[no(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}c(Nl,"keydownHandler");var Og=Object.defineProperty,Il=c((n,e)=>{for(var t in e)Og(n,t,{get:e[t],enumerable:!0})},"__export$1");function As(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}c(As,"createChainableState");var En,Ns=(En=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,c((...d)=>{const f=a(...d)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f},"method")]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,u=e||s.tr,d=c(()=>(!a&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),l.every(h=>h===!0)),"run3"),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,c((...g)=>{const y=this.buildProps(u,t),b=p(...g)(y);return l.push(b),f},"chainedCommand")])),run:d};return f}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,u])=>[a,(...d)=>u(...d)({...o,dispatch:void 0})])),chain:c(()=>this.createChain(s,i),"chain")}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:As({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:c(()=>this.createChain(e,t),"chain"),can:c(()=>this.createCan(e),"can"),get commands(){return Object.fromEntries(Object.entries(r).map(([a,u])=>[a,(...d)=>u(...d)(l)]))}};return l}},c(En,"CommandManager"),En),qd={};Il(qd,{blur:c(()=>Ag,"blur"),clearContent:c(()=>Ng,"clearContent"),clearNodes:c(()=>Ig,"clearNodes"),command:c(()=>Rg,"command"),createParagraphNear:c(()=>Dg,"createParagraphNear"),cut:c(()=>Lg,"cut"),deleteCurrentNode:c(()=>Pg,"deleteCurrentNode"),deleteNode:c(()=>Bg,"deleteNode"),deleteRange:c(()=>zg,"deleteRange"),deleteSelection:c(()=>$g,"deleteSelection"),enter:c(()=>Fg,"enter"),exitCode:c(()=>Hg,"exitCode"),extendMarkRange:c(()=>Vg,"extendMarkRange"),first:c(()=>jg,"first"),focus:c(()=>Wg,"focus"),forEach:c(()=>Kg,"forEach"),insertContent:c(()=>qg,"insertContent"),insertContentAt:c(()=>Gg,"insertContentAt"),joinBackward:c(()=>Qg,"joinBackward"),joinDown:c(()=>Xg,"joinDown"),joinForward:c(()=>Zg,"joinForward"),joinItemBackward:c(()=>ey,"joinItemBackward"),joinItemForward:c(()=>ty,"joinItemForward"),joinTextblockBackward:c(()=>ny,"joinTextblockBackward"),joinTextblockForward:c(()=>ry,"joinTextblockForward"),joinUp:c(()=>Yg,"joinUp"),keyboardShortcut:c(()=>sy,"keyboardShortcut"),lift:c(()=>oy,"lift"),liftEmptyBlock:c(()=>ly,"liftEmptyBlock"),liftListItem:c(()=>ay,"liftListItem"),newlineInCode:c(()=>cy,"newlineInCode"),resetAttributes:c(()=>uy,"resetAttributes"),scrollIntoView:c(()=>dy,"scrollIntoView"),selectAll:c(()=>fy,"selectAll"),selectNodeBackward:c(()=>hy,"selectNodeBackward"),selectNodeForward:c(()=>py,"selectNodeForward"),selectParentNode:c(()=>my,"selectParentNode"),selectTextblockEnd:c(()=>gy,"selectTextblockEnd"),selectTextblockStart:c(()=>yy,"selectTextblockStart"),setContent:c(()=>by,"setContent"),setMark:c(()=>Py,"setMark"),setMeta:c(()=>By,"setMeta"),setNode:c(()=>zy,"setNode"),setNodeSelection:c(()=>$y,"setNodeSelection"),setTextSelection:c(()=>Fy,"setTextSelection"),sinkListItem:c(()=>Hy,"sinkListItem"),splitBlock:c(()=>Vy,"splitBlock"),splitListItem:c(()=>jy,"splitListItem"),toggleList:c(()=>Uy,"toggleList"),toggleMark:c(()=>Wy,"toggleMark"),toggleNode:c(()=>Ky,"toggleNode"),toggleWrap:c(()=>qy,"toggleWrap"),undoInputRule:c(()=>Jy,"undoInputRule"),unsetAllMarks:c(()=>_y,"unsetAllMarks"),unsetMark:c(()=>Gy,"unsetMark"),updateAttributes:c(()=>Yy,"updateAttributes"),wrapIn:c(()=>Xy,"wrapIn"),wrapInList:c(()=>Qy,"wrapInList")});var Ag=c(()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),"blur"),Ng=c((n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),"clearContent"),Ig=c(()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),h=u.resolve(d.map(a+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Qn(p);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},"clearNodes"),Rg=c(n=>e=>n(e),"command"),Dg=c(()=>({state:n,dispatch:e})=>fd(n,e),"createParagraphNear"),Lg=c((n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new L(r.doc.resolve(Math.max(o-1,0)))),!0},"cut"),Pg=c(()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.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);n.delete(l,a).scrollIntoView()}return!0}return!1},"deleteCurrentNode");function G(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}c(G,"getNodeType");var Bg=c(n=>({tr:e,state:t,dispatch:r})=>{const i=G(n,t.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),u=s.after(o);e.delete(a,u).scrollIntoView()}return!0}return!1},"deleteNode"),zg=c(n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},"deleteRange"),$g=c(()=>({state:n,dispatch:e})=>yl(n,e),"deleteSelection"),Fg=c(()=>({commands:n})=>n.keyboardShortcut("Enter"),"enter"),Hg=c(()=>({state:n,dispatch:e})=>Rp(n,e),"exitCode");function Rl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}c(Rl,"isRegExp");function Di(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Rl(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}c(Di,"objectIncludes");function Jd(n,e,t={}){return n.find(r=>r.type===e&&Di(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}c(Jd,"findMarkInSet");function Vc(n,e,t={}){return!!Jd(n,e,t)}c(Vc,"isMarkInSet");function Dl(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!Jd([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,u=l+i.node.nodeSize;for(;o>0&&Vc([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&Vc([...n.parent.child(a).marks],e,t);)u+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}c(Dl,"getMarkRange");function ct(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}c(ct,"getMarkType");var Vg=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=ct(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:u,to:d}=l;if(i){const f=Dl(a,s,e);if(f&&f.from<=u&&f.to>=d){const h=L.create(o,f.from,f.to);t.setSelection(h)}}return!0},"extendMarkRange"),jg=c(n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1},"first");function Ll(n){return n instanceof L}c(Ll,"isTextSelection");function st(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}c(st,"minMax");function _d(n,e=null){if(!e)return null;const t=I.atStart(n),r=I.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?L.create(n,st(0,i,s),st(n.content.size,i,s)):L.create(n,st(e,i,s),st(e,i,s))}c(_d,"resolveFocusPosition");function Ug(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}c(Ug,"isAndroid");function Pl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}c(Pl,"isiOS");var Wg=c((n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=c(()=>{(Pl()||Ug())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})},"delayedFocus");if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Ll(t.state.selection))return o(),!0;const l=_d(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},"focus"),Kg=c((n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),"forEach"),qg=c((n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),"insertContent"),Gd=c(n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Gd(r)}return n},"removeWhitespaces");function qr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Gd(t)}c(qr,"elementFromString");function Dr(n,e,t){if(n instanceof vt||n instanceof v)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return v.fromArray(n.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),Dr("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="";const a=new hi({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(u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null),"getAttrs")}]}})});if(t.slice?Yt.fromSchema(a).parseSlice(qr(n),t.parseOptions):Yt.fromSchema(a).parse(qr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Yt.fromSchema(e);return t.slice?s.parseSlice(qr(n),t.parseOptions).content:s.parse(qr(n),t.parseOptions)}return Dr("",e,t)}c(Dr,"createNodeFromContent");function Jg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof we||i instanceof ce))return;const s=n.mapping.maps[r];let o=0;s.forEach((l,a,u,d)=>{o===0&&(o=d)}),n.setSelection(I.near(n.doc.resolve(o),t))}c(Jg,"selectionToInsertionEnd");var _g=c(n=>!("type"in n),"isFragment"),Gg=c((n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=c(y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:c(()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)},"disableCollaboration")})},"emitContentError"),u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Dr(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Dr(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((_g(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===f&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof v){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,f)}else{g=l;const y=r.doc.resolve(d),b=y.node(),k=y.parentOffset===0,x=b.isText||b.isTextblock,M=b.content.size>0;k&&x&&M&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&Jg(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},"insertContentAt"),Yg=c(()=>({state:n,dispatch:e})=>Ap(n,e),"joinUp"),Xg=c(()=>({state:n,dispatch:e})=>Np(n,e),"joinDown"),Qg=c(()=>({state:n,dispatch:e})=>sd(n,e),"joinBackward"),Zg=c(()=>({state:n,dispatch:e})=>cd(n,e),"joinForward"),ey=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ms(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemBackward"),ty=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ms(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemForward"),ny=c(()=>({state:n,dispatch:e})=>Ep(n,e),"joinTextblockBackward"),ry=c(()=>({state:n,dispatch:e})=>Op(n,e),"joinTextblockForward");function Yd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}c(Yd,"isMacOS");function iy(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");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))Pl()||Yd()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}c(iy,"normalizeKeyName");var sy=c(n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=iy(n).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a?.steps.forEach(u=>{const d=u.map(r.mapping);d&&i&&r.maybeStep(d)}),!0},"keyboardShortcut");function Nt(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?G(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const a=i-r,u=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Di(f.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=a}c(Nt,"isNodeActive");var oy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return Nt(t,i,e)?Ip(t,r):!1},"lift"),ly=c(()=>({state:n,dispatch:e})=>hd(n,e),"liftEmptyBlock"),ay=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return Up(r)(e,t)},"liftListItem"),cy=c(()=>({state:n,dispatch:e})=>dd(n,e),"newlineInCode");function Is(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}c(Is,"getSchemaTypeNameByName");function jc(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}c(jc,"deleteProps");var uy=c((n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Is(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ct(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(u,d)=>{s&&s===u.type&&t.setNodeMarkup(d,void 0,jc(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&t.addMark(d,d+u.nodeSize,o.create(jc(f.attrs,e)))})})}),!0):!1},"resetAttributes"),dy=c(()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),"scrollIntoView"),fy=c(()=>({tr:n,dispatch:e})=>{if(e){const t=new Re(n.doc);n.setSelection(t)}return!0},"selectAll"),hy=c(()=>({state:n,dispatch:e})=>ld(n,e),"selectNodeBackward"),py=c(()=>({state:n,dispatch:e})=>ud(n,e),"selectNodeForward"),my=c(()=>({state:n,dispatch:e})=>Pp(n,e),"selectParentNode"),gy=c(()=>({state:n,dispatch:e})=>$p(n,e),"selectTextblockEnd"),yy=c(()=>({state:n,dispatch:e})=>zp(n,e),"selectTextblockStart");function Jo(n,e,t={},r={}){return Dr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}c(Jo,"createDocument");var by=c((n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const u=Jo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})},"setContent");function Xd(n,e){const t=ct(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}c(Xd,"getMarkAttributes");function Qd(n,e){const t=new bi(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}c(Qd,"combineTransactionSteps");function ky(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}c(ky,"defaultBlockAt");function wy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}c(wy,"findChildrenInRange");function xy(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}c(xy,"findParentNodeClosestToPos");function Hr(n){return e=>xy(e.$from,n)}c(Hr,"findParentNode");function O(n,e,t){return n.config[e]===void 0&&n.parent?O(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?O(n.parent,e,t):null}):n.config[e]}c(O,"getExtensionField");function Bl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=O(e,"addExtensions",t);return r?[e,...Bl(r())]:e}).flat(10)}c(Bl,"flattenExtensions");function zl(n,e){const t=an.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}c(zl,"getHTMLFromFragment");function Zd(n){return typeof n=="function"}c(Zd,"isFunction");function z(n,e=void 0,...t){return Zd(n)?e?n.bind(e)(...t):n(...t):n}c(z,"callOrReturn");function Sy(n={}){return Object.keys(n).length===0&&n.constructor===Object}c(Sy,"isEmptyObject");function Lr(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}c(Lr,"splitExtensions");function ef(n){const e=[],{nodeExtensions:t,markExtensions:r}=Lr(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=O(o,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=O(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([d,f])=>{const h={...s,...f};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}c(ef,"getAttributesFromExtensions");function Y(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).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(" "):[],u=l.filter(d=>!a.includes(d));r[i]=[...a,...u].join(" ")}else if(i==="style"){const l=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;a.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),l.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),r[i]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else r[i]=s}),r},{})}c(Y,"mergeAttributes");function Li(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Y(t,r),{})}c(Li,"getRenderedAttributes");function vy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}c(vy,"fromString");function Uc(n,e){return"style"in n?n:{...n,getAttrs:c(t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):vy(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}},"getAttrs")}}c(Uc,"injectExtensionAttributesToParseRule");function Wc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Sy(t)?!1:t!=null))}c(Wc,"cleanUpSchemaItem");function Cy(n,e){var t;const r=ef(n),{nodeExtensions:i,markExtensions:s}=Lr(n),o=(t=i.find(u=>O(u,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(u=>{const d=r.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((b,k)=>{const x=O(k,"extendNodeSchema",f);return{...b,...x?x(u):{}}},{}),p=Wc({...h,content:z(O(u,"content",f)),marks:z(O(u,"marks",f)),group:z(O(u,"group",f)),inline:z(O(u,"inline",f)),atom:z(O(u,"atom",f)),selectable:z(O(u,"selectable",f)),draggable:z(O(u,"draggable",f)),code:z(O(u,"code",f)),whitespace:z(O(u,"whitespace",f)),linebreakReplacement:z(O(u,"linebreakReplacement",f)),defining:z(O(u,"defining",f)),isolating:z(O(u,"isolating",f)),attrs:Object.fromEntries(d.map(b=>{var k,x;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),m=z(O(u,"parseHTML",f));m&&(p.parseDOM=m.map(b=>Uc(b,d)));const g=O(u,"renderHTML",f);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Li(b,d)}));const y=O(u,"renderText",f);return y&&(p.toText=y),[u.name,p]})),a=Object.fromEntries(s.map(u=>{const d=r.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((y,b)=>{const k=O(b,"extendMarkSchema",f);return{...y,...k?k(u):{}}},{}),p=Wc({...h,inclusive:z(O(u,"inclusive",f)),excludes:z(O(u,"excludes",f)),group:z(O(u,"group",f)),spanning:z(O(u,"spanning",f)),code:z(O(u,"code",f)),attrs:Object.fromEntries(d.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=z(O(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>Uc(y,d)));const g=O(u,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Li(y,d)})),[u.name,p]}));return new hi({topNode:o,nodes:l,marks:a})}c(Cy,"getSchemaByResolvedExtensions");function My(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}c(My,"findDuplicates");function $l(n){return n.sort((t,r)=>{const i=O(t,"priority")||100,s=O(r,"priority")||100;return i>s?-1:i<s?1:0})}c($l,"sortExtensions");function tf(n){const e=$l(Bl(n)),t=My(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}c(tf,"resolveExtensions");function nf(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
11
|
-
|
|
12
|
-
`,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,u,d,f)=>{var h;a.isBlock&&u>r&&(l+=s);const p=o?.[a.type.name];if(p)return d&&(l+=p({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,u)-u,i-u))}),l}c(nf,"getTextBetween");function rf(n,e){const t={from:0,to:n.content.size};return nf(n,t,e)}c(rf,"getText");function Fl(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}c(Fl,"getTextSerializersFromSchema");function Ty(n,e){const t=G(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}c(Ty,"getNodeAttributes");function sf(n,e){const t=Is(typeof e=="string"?e:e.name,n.schema);return t==="node"?Ty(n,e):t==="mark"?Xd(n,e):{}}c(sf,"getAttributes");function Ey(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}c(Ey,"removeDuplicates");function Oy(n){const e=Ey(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}c(Oy,"simplifyChangedRanges");function of(n){const{mapping:e,steps:t}=n,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}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const u=e.slice(s).map(l,-1),d=e.slice(s).map(a),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),Oy(r)}c(of,"getChangedRanges");function Hl(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=Dl(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}c(Hl,"getMarksBetween");var Ay=c((n,e,t,r=20)=>{const i=n.doc.resolve(t);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]},"getNodeAtPosition");function ro(n,e){return e.nodes[n]||e.marks[n]||null}c(ro,"getSchemaTypeByName");function si(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}c(si,"getSplittedAttributes");var Ny=c((n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,u;const d=((u=(a=i.type.spec).toText)==null?void 0:u.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t},"getTextContentFromNodes");function _o(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?ct(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Di(f.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;n.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(p,y),k=Math.min(m,y+g.nodeSize),x=k-b;o+=x,l.push(...g.marks.map(M=>({mark:M,from:b,to:k})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Di(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(a>0?a+u:a)>=o}c(_o,"isMarkActive");function Iy(n,e,t={}){if(!e)return Nt(n,null,t)||_o(n,null,t);const r=Is(e,n.schema);return r==="node"?Nt(n,e,t):r==="mark"?_o(n,e,t):!1}c(Iy,"isActive");var Ry=c((n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=Hr(l=>l.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},"isAtEndOfNode"),Dy=c(n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)},"isAtStartOfNode");function Kc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}c(Kc,"isExtensionRulesEnabled");function qc(n,e){const{nodeExtensions:t}=Lr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=z(O(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}c(qc,"isList");function Rs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(Rs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}c(Rs,"isNodeEmpty");function lf(n){return n instanceof N}c(lf,"isNodeSelection");function Vl(n,e,t){const i=n.state.doc.content.size,s=st(e,0,i),o=st(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),u=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),h=Math.max(l.right,a.right),p=h-f,m=d-u,b={top:u,bottom:d,left:f,right:h,width:p,height:m,x:f,y:u};return{...b,toJSON:c(()=>b,"toJSON")}}c(Vl,"posToDOMRect");function Ly(n,e,t){var r;const{selection:i}=e;let s=null;if(Ll(i)&&(s=i.$cursor),s){const l=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(u=>u.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=p&&m}return!u}),u})}c(Ly,"canSetMark");var Py=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=ct(n,r.schema);if(i)if(o){const u=Xd(r,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,f);h.marks.find(b=>b.type===a)?h.marks.forEach(b=>{a===b.type&&t.addMark(m,g,a.create({...b.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return Ly(r,t,a)},"setMark"),By=c((n,e)=>({tr:t})=>(t.setMeta(n,e),!0),"setMeta"),zy=c((n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=G(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>lc(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>lc(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},"setNode"),$y=c(n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=st(n,0,r.content.size),s=N.create(r,i);e.setSelection(s)}return!0},"setNodeSelection"),Fy=c(n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=L.atStart(r).from,l=L.atEnd(r).to,a=st(i,o,l),u=st(s,o,l),d=L.create(r,a,u);e.setSelection(d)}return!0},"setTextSelection"),Hy=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return qp(r)(e,t)},"sinkListItem");function Jc(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}c(Jc,"ensureMarks");var Vy=c(({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,u=i.extensionManager.attributes,d=si(u,l.node().type.name,l.node().attrs);if(s instanceof N&&s.node.isBlock)return!l.parentOffset||!ot(o,l.pos)?!1:(r&&(n&&Jc(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:ky(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=ot(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&ot(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(m&&(s instanceof L&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}n&&Jc(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},"splitBlock"),jy=c((n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const l=G(n,r.schema),{$from:a,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.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 b=v.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-k;A>=a.depth-3;A-=1)b=v.from(a.node(A).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...si(h,a.node().type.name,a.node().attrs),...e},w=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(M))||void 0;b=b.append(v.from(l.createAndFill(null,w)||void 0));const E=a.before(a.depth-(k-1));t.replace(E,a.after(-x),new T(b,4-k,0));let C=-1;t.doc.nodesBetween(E,t.doc.content.size,(A,D)=>{if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=D+1)}),C>-1&&t.setSelection(L.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const p=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...si(h,f.type.name,f.attrs),...e},g={...si(h,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!ot(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:x}=s.extensionManager,M=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!M||!i)return!0;const w=M.filter(E=>x.includes(E.type.name));t.ensureMarks(w)}return!0},"splitListItem"),io=c((n,e)=>{const t=Hr(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Rt(n.doc,t.pos)&&n.join(t.pos),!0},"joinListBackwards"),so=c((n,e)=>{const t=Hr(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Rt(n.doc,r)&&n.join(r),!0},"joinListForwards"),Uy=c((n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=G(n,o.schema),m=G(e,o.schema),{selection:g,storedMarks:y}=o,{$from:b,$to:k}=g,x=b.blockRange(k),M=y||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const w=Hr(E=>qc(E.type.name,f))(g);if(x.depth>=1&&w&&x.depth-w.depth<=1){if(w.node.type===p)return u.liftListItem(m);if(qc(w.node.type.name,f)&&p.validContent(w.node.content)&&l)return a().command(()=>(s.setNodeMarkup(w.pos,p),!0)).command(()=>io(s,p)).command(()=>so(s,p)).run()}return!t||!M||!l?a().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>io(s,p)).command(()=>so(s,p)).run():a().command(()=>{const E=d().wrapInList(p,r),C=M.filter(A=>h.includes(A.type.name));return s.ensureMarks(C),E?!0:u.clearNodes()}).wrapInList(p,r).command(()=>io(s,p)).command(()=>so(s,p)).run()},"toggleList"),Wy=c((n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ct(n,r.schema);return _o(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},"toggleMark"),Ky=c((n,e,t={})=>({state:r,commands:i})=>{const s=G(n,r.schema),o=G(e,r.schema),l=Nt(r,s,t);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,...t})},"toggleNode"),qy=c((n,e={})=>({state:t,commands:r})=>{const i=G(n,t.schema);return Nt(t,i,e)?r.lift(i):r.wrapIn(i,e)},"toggleWrap"),Jy=c(()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.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,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},"undoInputRule"),_y=c(()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},"unsetAllMarks"),Gy=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=ct(n,r.schema),{$from:u,empty:d,ranges:f}=l;if(!i)return!0;if(d&&o){let{from:h,to:p}=l;const m=(s=u.marks().find(y=>y.type===a))==null?void 0:s.attrs,g=Dl(u,a,m);g&&(h=g.from,p=g.to),t.removeMark(h,p,a)}else f.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,a)});return t.removeStoredMark(a),!0},"unsetMark"),Yy=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Is(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ct(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const u=a.$from.pos,d=a.$to.pos;let f,h,p,m;t.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g),y>=u&&y<=d&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(b=>{if(o===b.type){const k=Math.max(y,u),x=Math.min(y+g.nodeSize,d);t.addMark(k,x,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&t.addMark(p,m,o.create({...g.attrs,...e}))}))}),!0):!1},"updateAttributes"),Xy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return Fp(i,e)(t,r)},"wrapIn"),Qy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return Hp(i,e)(t,r)},"wrapInList"),On,Zy=(On=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=c((...i)=>{this.off(e,r),t.apply(this,i)},"onceFn");return this.on(e,r)}removeAllListeners(){this.callbacks={}}},c(On,"EventEmitter"),On),An,Ds=(An=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},c(An,"InputRule"),An),e0=c((n,e)=>{if(Rl(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r},"inputRuleMatcherHandler");function Jr(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Ny(u)+s;return o.forEach(h=>{if(d)return;const p=e0(f,h.find);if(!p)return;const m=a.state.tr,g=As({state:a.state,transaction:m}),y={from:r-(p[0].length-s.length),to:i},{commands:b,chain:k,can:x}=new Ns({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:k,can:x})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:s}),a.dispatch(m),d=!0)}),d}c(Jr,"run$2");function t0(n){const{editor:e,rules:t}=n,r=new H({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:d}=a;typeof d=="string"?d=d:d=zl(v.from(d),o.schema);const{from:f}=a,h=f+d.length;Jr({editor:e,from:f,to:h,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Jr({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:c(i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Jr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1),"compositionend")},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Jr({editor:e,from:o.pos,to:o.pos,text:`
|
|
13
|
-
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}c(t0,"inputRulesPlugin");function n0(n){return Object.prototype.toString.call(n).slice(8,-1)}c(n0,"getType");function _r(n){return n0(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}c(_r,"isPlainObject");function af(n,e){const t={...n};return _r(n)&&_r(e)&&Object.keys(e).forEach(r=>{_r(e[r])&&_r(n[r])?t[r]=af(n[r],e[r]):t[r]=e[r]}),t}c(af,"mergeDeep");var Nn,jl=(Nn=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...z(O(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...z(O(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:c(()=>af(this.options,e),"addOptions")});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},c(Nn,"Extendable"),Nn),nn,pn=(nn=class extends jl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new nn(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>u?.type.name===t.name))return!1;const a=o.find(u=>u?.type.name===t.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 t=typeof e=="function"?e():e;return super.extend(t)}},c(nn,"_Mark"),nn);function r0(n){return typeof n=="number"}c(r0,"isNumber");var In,i0=(In=class{constructor(e){this.find=e.find,this.handler=e.handler}},c(In,"PasteRule"),In),s0=c((n,e,t)=>{if(Rl(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,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}):[]},"pasteRuleMatcherHandler");function o0(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:u,can:d}=new Ns({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,b,k,x;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const M=(x=(k=(b=p.content)==null?void 0:b.size)!=null?k:p.nodeSize)!=null?x:0,w=Math.max(r,m),E=Math.min(i,m+M);if(w>=E)return;const C=p.isText?p.text||"":p.textBetween(w-m,E-m,void 0,"");s0(C,s.find,o).forEach(D=>{if(D.index===void 0)return;const R=w+D.index+1,V=R+D[0].length,W={from:t.tr.mapping.map(R),to:t.tr.mapping.map(V)},_=s.handler({state:t,range:W,match:D,commands:a,chain:u,can:d,pasteEvent:o,dropEvent:l});f.push(_)})}),f.every(p=>p!==null)}c(o0,"run2");var Gr=null,l0=c(n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t},"createClipboardPasteEvent");function a0(n){const{editor:e,rules:t}=n;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=c(({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,y=As({state:d,transaction:g});if(!(!o0({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}},"processEvent");return t.map(d=>new H({view(f){const h=c(m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Gr=e)},"handleDragstart"),p=c(()=>{Gr&&(Gr=null)},"handleDragend");return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:c((f,h)=>{if(s=r===f.dom.parentElement,l=h,!s){const p=Gr;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},"drop"),paste:c((f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return o=h,i=!!m?.includes("data-pm-slice"),!1},"paste")}},appendTransaction:c((f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:w}=b;typeof w=="string"?w=w:w=zl(v.from(w),p.schema);const{from:E}=b,C=E+w.length,A=l0(w);return a({rule:d,state:p,from:E,to:{b:C},pasteEvt:A})}const x=h.doc.content.findDiffStart(p.doc.content),M=h.doc.content.findDiffEnd(p.doc.content);if(!(!r0(x)||!M||x===M.b))return a({rule:d,state:p,from:x,to:M,pasteEvt:o})},"appendTransaction")}))}c(a0,"pasteRulesPlugin");var Rn,Ls=(Rn=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=tf(e),this.schema=Cy(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:ro(t.name,this.schema)},i=O(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this;return $l([...this.extensions].reverse()).flatMap(i=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:ro(i.name,this.schema)},o=[],l=O(i,"addKeyboardShortcuts",s);let a={};if(i.type==="mark"&&O(i,"exitable",s)&&(a.ArrowRight=()=>pn.handleExit({editor:e,mark:i})),l){const p=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:e})]));a={...a,...p}}const u=Eg(a);o.push(u);const d=O(i,"addInputRules",s);if(Kc(i,e.options.enableInputRules)&&d){const p=d();if(p&&p.length){const m=t0({editor:e,rules:p}),g=Array.isArray(m)?m:[m];o.push(...g)}}const f=O(i,"addPasteRules",s);if(Kc(i,e.options.enablePasteRules)&&f){const p=f();if(p&&p.length){const m=a0({editor:e,rules:p});o.push(...m)}}const h=O(i,"addProseMirrorPlugins",s);if(h){const p=h();o.push(...p)}return o})}get attributes(){return ef(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Lr(this.extensions);return Object.fromEntries(t.filter(r=>!!O(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:G(r.name,this.schema)},o=O(r,"addNodeView",s);if(!o)return[];const l=c((a,u,d,f,h)=>{const p=Li(a,i);return o()({node:a,view:u,getPos:d,decorations:f,innerDecorations:h,editor:e,extension:r,HTMLAttributes:p})},"nodeview");return[r.name,l]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=Lr(this.extensions);return Object.fromEntries(t.filter(r=>!!O(r,"addMarkView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ct(r.name,this.schema)},o=O(r,"addMarkView",s);if(!o)return[];const l=c((a,u,d)=>{const f=Li(a,i);return o()({mark:a,view:u,inline:d,editor:e,extension:r,HTMLAttributes:f,updateAttributes:c(h=>{S0(a,e,h)},"updateAttributes")})},"markView");return[r.name,l]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var r;const i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:ro(t.name,this.schema)};t.type==="mark"&&((r=z(O(t,"keepOnSplit",i)))==null||r)&&this.splittableMarks.push(t.name);const s=O(t,"onBeforeCreate",i),o=O(t,"onCreate",i),l=O(t,"onUpdate",i),a=O(t,"onSelectionUpdate",i),u=O(t,"onTransaction",i),d=O(t,"onFocus",i),f=O(t,"onBlur",i),h=O(t,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}},c(Rn,"ExtensionManager"),Rn);Ls.resolve=tf;Ls.sort=$l;Ls.flatten=Bl;var c0={};Il(c0,{ClipboardTextSerializer:c(()=>cf,"ClipboardTextSerializer"),Commands:c(()=>uf,"Commands"),Delete:c(()=>df,"Delete"),Drop:c(()=>ff,"Drop"),Editable:c(()=>hf,"Editable"),FocusEvents:c(()=>mf,"FocusEvents"),Keymap:c(()=>gf,"Keymap"),Paste:c(()=>yf,"Paste"),Tabindex:c(()=>bf,"Tabindex"),focusEventsPluginKey:c(()=>pf,"focusEventsPluginKey")});var rn,J=(rn=class extends jl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new rn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(rn,"_Extension"),rn),cf=J.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new H({key:new U("clipboardTextSerializer"),props:{clipboardTextSerializer:c(()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$to.pos)),a=Fl(t);return nf(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})},"clipboardTextSerializer")}})]}}),uf=J.create({name:"commands",addCommands(){return{...qd}}}),df=J.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=c(()=>{var o,l,a,u;if((u=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=Qd(n.before,[n,...e]);of(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof Ot){const b=h.slice(m).map(p.from,-1),k=h.slice(m).map(p.to),x=h.invert().map(b,-1),M=h.invert().map(k),w=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),E=(y=d.doc.nodeAt(k))==null?void 0:y.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:x,to:M},newRange:{from:b,to:k},partial:!!(E||w),editor:this.editor,transaction:n,combinedTransform:d})}})},"callback");(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),ff=J.create({name:"drop",addProseMirrorPlugins(){return[new H({key:new U("tiptapDrop"),props:{handleDrop:c((n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})},"handleDrop")}})]}}),hf=J.create({name:"editable",addProseMirrorPlugins(){return[new H({key:new U("editable"),props:{editable:c(()=>this.editor.options.editable,"editable")}})]}}),pf=new U("focusEvents"),mf=J.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new H({key:pf,props:{handleDOMEvents:{focus:c((e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},"focus"),blur:c((e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},"blur")}}})]}}),gf=J.create({name:"keymap",addKeyboardShortcuts(){const n=c(()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:d,$anchor:f}=a,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:I.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),"handleBackspace"),e=c(()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),"handleDelete"),r={Enter:c(()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"handleEnter"),"Mod-Enter":c(()=>this.editor.commands.exitCode(),"Mod-Enter"),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":c(()=>this.editor.commands.selectAll(),"Mod-a")},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":c(()=>this.editor.commands.selectTextblockStart(),"Ctrl-a"),"Ctrl-e":c(()=>this.editor.commands.selectTextblockEnd(),"Ctrl-e")};return Pl()||Yd()?s:i},addProseMirrorPlugins(){return[new H({key:new U("clearDocument"),appendTransaction:c((n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=I.atStart(e.doc).from,u=I.atEnd(e.doc).to;if(s||!(o===a&&l===u)||!Rs(t.doc))return;const h=t.tr,p=As({state:t,transaction:h}),{commands:m}=new Ns({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h},"appendTransaction")})]}}),yf=J.create({name:"paste",addProseMirrorPlugins(){return[new H({key:new U("tiptapPaste"),props:{handlePaste:c((n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})},"handlePaste")}})]}}),bf=J.create({name:"tabindex",addProseMirrorPlugins(){return[new H({key:new U("tabindex"),props:{attributes:c(()=>this.editor.isEditable?{tabindex:"0"}:{},"attributes")}})]}}),Ie,u0=(Ie=class{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,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 t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Ie(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ie(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 Ie(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;const a=new Ie(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Ie(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==t[a])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},c(Ie,"_NodePos"),Ie),d0=`.ProseMirror {
|
|
14
|
-
position: relative;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ProseMirror {
|
|
18
|
-
word-wrap: break-word;
|
|
19
|
-
white-space: pre-wrap;
|
|
20
|
-
white-space: break-spaces;
|
|
21
|
-
-webkit-font-variant-ligatures: none;
|
|
22
|
-
font-variant-ligatures: none;
|
|
23
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.ProseMirror [contenteditable="false"] {
|
|
27
|
-
white-space: normal;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
-
white-space: pre-wrap;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ProseMirror pre {
|
|
35
|
-
white-space: pre-wrap;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
img.ProseMirror-separator {
|
|
39
|
-
display: inline !important;
|
|
40
|
-
border: none !important;
|
|
41
|
-
margin: 0 !important;
|
|
42
|
-
width: 0 !important;
|
|
43
|
-
height: 0 !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ProseMirror-gapcursor {
|
|
47
|
-
display: none;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
position: absolute;
|
|
50
|
-
margin: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ProseMirror-gapcursor:after {
|
|
54
|
-
content: "";
|
|
55
|
-
display: block;
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: -2px;
|
|
58
|
-
width: 20px;
|
|
59
|
-
border-top: 1px solid black;
|
|
60
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@keyframes ProseMirror-cursor-blink {
|
|
64
|
-
to {
|
|
65
|
-
visibility: hidden;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ProseMirror-hideselection *::selection {
|
|
70
|
-
background: transparent;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
-
background: transparent;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ProseMirror-hideselection * {
|
|
78
|
-
caret-color: transparent;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
-
display: block;
|
|
83
|
-
}`;function f0(n,e,t){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=n,document.getElementsByTagName("head")[0].appendChild(i),i}c(f0,"createStyleTag");var Dn,h0=(Dn=class extends Zy{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:c(()=>null,"onBeforeCreate"),onCreate:c(()=>null,"onCreate"),onMount:c(()=>null,"onMount"),onUnmount:c(()=>null,"onUnmount"),onUpdate:c(()=>null,"onUpdate"),onSelectionUpdate:c(()=>null,"onSelectionUpdate"),onTransaction:c(()=>null,"onTransaction"),onFocus:c(()=>null,"onFocus"),onBlur:c(()=>null,"onBlur"),onDestroy:c(()=>null,"onDestroy"),onContentError:c(({error:i})=>{throw i},"onContentError"),onPaste:c(()=>null,"onPaste"),onDrop:c(()=>null,"onDrop"),onDelete:c(()=>null,"onDelete")},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=_d(t,this.options.autofocus);this.editorState=Oo.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=f0(d0,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:c(e=>{this.editorState=e},"updateState"),dispatch:c(e=>{this.dispatchTransaction(e)},"dispatch"),composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:c((e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)},"get")})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=Zd(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(l=>!l.key.startsWith(o))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[hf,cf.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),uf,mf,gf,bf,ff,yf,df].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ls(i,this)}createCommandManager(){this.commandManager=new Ns({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Jo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:c(()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()},"disableCollaboration")}),e=Jo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ii(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=l?.getMeta("focus"),u=l?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return sf(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Iy(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return zl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
84
|
-
|
|
85
|
-
`,textSerializers:r={}}=e||{};return rf(this.state.doc,{blockSeparator:t,textSerializers:{...Fl(this.schema),...r}})}get isEmpty(){return Rs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new u0(t,this)}get $doc(){return this.$pos(0)}},c(Dn,"Editor"),Dn);function Jn(n){return new Ds({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=z(n.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/),u=t.from+l.indexOf(o),d=u+o.length;if(Hl(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;d<t.to&&s.delete(d,t.to),u>t.from&&s.delete(t.from+a,u);const h=t.from+a+o.length;s.addMark(t.from+a,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},"handler"),undoable:n.undoable})}c(Jn,"markInputRule");function p0(n){return new Ds({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=z(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=o+u;d>l?d=l:l=d+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(d,l,a)}else if(r[0]){const u=n.type.isInline?o:o-1;s.insert(u,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},"handler"),undoable:n.undoable})}c(p0,"nodeInputRule");function Go(n){return new Ds({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=z(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},"handler"),undoable:n.undoable})}c(Go,"textblockTypeInputRule");function _n(n){return new Ds({find:n.find,handler:c(({state:e,range:t,match:r,chain:i})=>{const s=z(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),u=a&&gl(a,n.type,s);if(!u)return null;if(o.wrap(a,u),n.keepMarks&&n.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=n.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Rt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},"handler"),undoable:n.undoable})}c(_n,"wrappingInputRule");function m0(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof N){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}c(m0,"canInsertNode");var g0={};Il(g0,{createAtomBlockMarkdownSpec:c(()=>y0,"createAtomBlockMarkdownSpec"),createBlockMarkdownSpec:c(()=>b0,"createBlockMarkdownSpec"),createInlineMarkdownSpec:c(()=>x0,"createInlineMarkdownSpec"),parseAttributes:c(()=>Ul,"parseAttributes"),parseIndentedBlocks:c(()=>Yo,"parseIndentedBlocks"),renderNestedMarkdownContent:c(()=>Kl,"renderNestedMarkdownContent"),serializeAttributes:c(()=>Wl,"serializeAttributes")});function Ul(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(d=>d.trim().slice(1));e.class=u.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(([,u,d])=>{var f;const h=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[u]=p.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}c(Ul,"parseAttributes");function Wl(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}c(Wl,"serializeAttributes");function y0(n){const{nodeName:e,name:t,parseAttributes:r=Ul,serializeAttributes:i=Wl,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=n,a=t||e,u=c(d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f},"filterAttributes");return{parseMarkdown:c((d,f)=>{const h={...s,...d.attributes};return f.createNode(e,h,[])},"parseMarkdown"),markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){const p=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!o.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:c(d=>{const f=u(d.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${a}${p} :::`},"renderMarkdown")}}c(y0,"createAtomBlockMarkdownSpec");function b0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Ul,serializeAttributes:s=Wl,defaultAttributes:o={},content:l="block",allowedAttributes:a}=n,u=t||e,d=c(f=>{if(!a)return f;const h={};return a.forEach(p=>{p in f&&(h[p]=f[p])}),h},"filterAttributes");return{parseMarkdown:c((f,h)=>{let p;if(r){const g=r(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...o,...f.attributes};return h.createNode(e,m,p)},"parseMarkdown"),markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${u}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,x=i(k);let M=1;const w=b.length;let E="";const C=/^:::([\w-]*)(\s.*)?/gm,A=f.slice(w);for(C.lastIndex=0;;){const D=C.exec(A);if(D===null)break;const R=D.index,V=D[1];if(!((m=D[2])!=null&&m.endsWith(":::"))){if(V)M+=1;else if(M-=1,M===0){const W=A.slice(0,R);E=W.trim();const _=f.slice(0,w+R+D[0].length);let B=[];if(E)if(l==="block")for(B=p.blockTokens(W),B.forEach(F=>{F.text&&(!F.tokens||F.tokens.length===0)&&(F.tokens=p.inlineTokens(F.text))});B.length>0;){const F=B[B.length-1];if(F.type==="paragraph"&&(!F.text||F.text.trim()===""))B.pop();else break}else B=p.inlineTokens(E);return{type:e,raw:_,attributes:x,content:E,tokens:B}}}}}},renderMarkdown:c((f,h)=>{const p=d(f.attrs||{}),m=s(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
|
|
86
|
-
|
|
87
|
-
`);return`:::${u}${g}
|
|
88
|
-
|
|
89
|
-
${y}
|
|
90
|
-
|
|
91
|
-
:::`},"renderMarkdown")}}c(b0,"createBlockMarkdownSpec");function k0(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}c(k0,"parseShortcodeAttributes");function w0(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}c(w0,"serializeShortcodeAttributes");function x0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=k0,serializeAttributes:s=w0,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=c(h=>{if(!a)return h;const p={};return a.forEach(m=>{m in h&&(p[m]=h[m])}),p},"filterAttributes"),f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:c((h,p)=>{const m={...o,...h.attributes};if(l)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},"parseMarkdown"),markdownTokenizer:{name:e,level:"inline",start(h){const p=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),g=m?.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(g);if(!y)return;let b="",k="";if(l){const[,M]=y;k=M}else{const[,M,w]=y;k=M,b=w||""}const x=i(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:x}}},renderMarkdown:c(h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(h.attrs||{}),g=s(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`},"renderMarkdown")}}c(x0,"createInlineMarkdownSpec");function Yo(n,e,t){var r,i,s,o;const l=n.split(`
|
|
92
|
-
`),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const h=l[d],p=h.match(e.itemPattern);if(!p){if(a.length>0)break;if(h.trim()===""){d+=1;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;u=`${u}${h}
|
|
93
|
-
`;const b=[y];for(d+=1;d<l.length;){const w=l[d];if(w.trim()===""){const C=l.slice(d+1).findIndex(R=>R.trim()!=="");if(C===-1)break;if((((i=(r=l[d+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){b.push(w),u=`${u}${w}
|
|
94
|
-
`,d+=1;continue}else break}if((((o=(s=w.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>g)b.push(w),u=`${u}${w}
|
|
95
|
-
`,d+=1;else break}let k;const x=b.slice(1);if(x.length>0){const w=x.map(E=>E.slice(g+f)).join(`
|
|
96
|
-
`);w.trim()&&(e.customNestedParser?k=e.customNestedParser(w):k=t.blockTokens(w))}const M=e.createToken(m,k);a.push(M)}if(a.length!==0)return{items:a,raw:u.trim()}}c(Yo,"parseIndentedBlocks");function Kl(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,l=e.renderChildren([s]),a=[`${i}${l}`];return o&&o.length>0&&o.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
|
|
97
|
-
`).map(h=>h?e.indent(h):"").join(`
|
|
98
|
-
`);a.push(f)}}),a.join(`
|
|
99
|
-
`)}c(Kl,"renderNestedMarkdownContent");function S0(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((l,a)=>{const u=s.mapping.map(a),d=s.mapping.map(a)+l.nodeSize;let f=null;if(l.marks.forEach(p=>{if(p!==o)return!1;f=p}),!f)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==f.attrs[p]&&(h=!0)}),h){const p=n.type.create({...n.attrs,...t});s.removeMark(u,d,n.type),s.addMark(u,d,p)}}),s.docChanged&&e.view.dispatch(s)}c(S0,"updateMarkViewAttributes");var sn,xe=(sn=class extends jl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new sn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(sn,"_Node"),sn);function dn(n){return new i0({find:n.find,handler:c(({state:e,range:t,match:r,pasteEvent:i})=>{const s=z(n.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 u=t.to;if(l){const d=a.search(/\S/),f=t.from+a.indexOf(l),h=f+l.length;if(Hl(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;h<t.to&&o.delete(h,t.to),f>t.from&&o.delete(t.from+d,f),u=t.from+d+l.length,o.addMark(t.from+d,u,n.type.create(s||{})),o.removeStoredMark(n.type)}},"handler")})}c(dn,"markPasteRule");var Pi=c((n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},"h"),v0=/^\s*>\s$/,C0=xe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Pi("blockquote",{...Y(this.options.HTMLAttributes,n),children:Pi("slot",{})})},parseMarkdown:c((n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(i=>{const o=e.renderChildren(i).split(`
|
|
100
|
-
`).map(l=>`> ${l}`).join(`
|
|
101
|
-
`);t.push(o)}),t.flatMap(i=>[i,"> "]).slice(0,-1).join(`
|
|
102
|
-
`)},"renderMarkdown"),addCommands(){return{setBlockquote:c(()=>({commands:n})=>n.wrapIn(this.name),"setBlockquote"),toggleBlockquote:c(()=>({commands:n})=>n.toggleWrap(this.name),"toggleBlockquote"),unsetBlockquote:c(()=>({commands:n})=>n.lift(this.name),"unsetBlockquote")}},addKeyboardShortcuts(){return{"Mod-Shift-b":c(()=>this.editor.commands.toggleBlockquote(),"Mod-Shift-b")}},addInputRules(){return[_n({find:v0,type:this.type})]}}),M0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,T0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,E0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,O0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,A0=pn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:c(n=>n.style.fontWeight!=="normal"&&null,"getAttrs")},{style:"font-weight=400",clearMark:c(n=>n.type.name===this.name,"clearMark")},{style:"font-weight",getAttrs:c(n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return Pi("strong",{...Y(this.options.HTMLAttributes,n),children:Pi("slot",{})})},markdownTokenName:"strong",parseMarkdown:c((n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`**${e.renderChildren(n)}**`,"renderMarkdown"),addCommands(){return{setBold:c(()=>({commands:n})=>n.setMark(this.name),"setBold"),toggleBold:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleBold"),unsetBold:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetBold")}},addKeyboardShortcuts(){return{"Mod-b":c(()=>this.editor.commands.toggleBold(),"Mod-b"),"Mod-B":c(()=>this.editor.commands.toggleBold(),"Mod-B")}},addInputRules(){return[Jn({find:M0,type:this.type}),Jn({find:E0,type:this.type})]},addPasteRules(){return[dn({find:T0,type:this.type}),dn({find:O0,type:this.type})]}}),N0=/(^|[^`])`([^`]+)`(?!`)$/,I0=/(^|[^`])`([^`]+)`(?!`)/g,R0=pn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:c((n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"","renderMarkdown"),addCommands(){return{setCode:c(()=>({commands:n})=>n.setMark(this.name),"setCode"),toggleCode:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleCode"),unsetCode:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetCode")}},addKeyboardShortcuts(){return{"Mod-e":c(()=>this.editor.commands.toggleCode(),"Mod-e")}},addInputRules(){return[Jn({find:N0,type:this.type})]},addPasteRules(){return[dn({find:I0,type:this.type})]}}),oo=4,D0=/^```([a-z]+)?[\s\n]$/,L0=/^~~~([a-z]+)?[\s\n]$/,P0=xe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:oo,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:c(n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},"parseHTML"),rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Y(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:c((n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
|
|
103
|
-
`):r=`\`\`\`${i}
|
|
104
|
-
|
|
105
|
-
\`\`\``,r},"renderMarkdown"),addCommands(){return{setCodeBlock:c(n=>({commands:e})=>e.setNode(this.name,n),"setCodeBlock"),toggleCodeBlock:c(n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n),"toggleCodeBlock")}},addKeyboardShortcuts(){return{"Mod-Alt-c":c(()=>this.editor.commands.toggleCodeBlock(),"Mod-Alt-c"),Backspace:c(()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},"Backspace"),Tab:c(({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:oo,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(t);return o?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:u,to:d}=i,p=r.doc.textBetween(u,d,`
|
|
106
|
-
`,`
|
|
107
|
-
`).split(`
|
|
108
|
-
`).map(m=>l+m).join(`
|
|
109
|
-
`);return a.replaceWith(u,d,r.schema.text(p)),!0})},"Tab"),"Shift-Tab":c(({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:oo,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:l})=>{var a;const{pos:u}=s,d=s.start(),f=s.end(),p=r.doc.textBetween(d,f,`
|
|
110
|
-
`,`
|
|
111
|
-
`).split(`
|
|
112
|
-
`);let m=0,g=0;const y=u-d;for(let E=0;E<p.length;E+=1){if(g+p[E].length>=y){m=E;break}g+=p[E].length+1}const k=((a=p[m].match(/^ */))==null?void 0:a[0])||"",x=Math.min(k.length,t);if(x===0)return!0;let M=d;for(let E=0;E<m;E+=1)M+=p[E].length+1;return l.delete(M,M+x),u-M<=x&&l.setSelection(L.create(l.doc,M)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:u}=i,h=r.doc.textBetween(a,u,`
|
|
113
|
-
`,`
|
|
114
|
-
`).split(`
|
|
115
|
-
`).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return p.slice(y)}).join(`
|
|
116
|
-
`);return l.replaceWith(a,u,r.schema.text(h)),!0})},"Shift-Tab"),Enter:c(({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
117
|
-
|
|
118
|
-
`);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},"Enter"),ArrowDown:c(({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;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)?n.commands.command(({tr:u})=>(u.setSelection(I.near(r.resolve(l))),!0)):n.commands.exitCode()},"ArrowDown")}},addInputRules(){return[Go({find:D0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")}),Go({find:L0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")})]},addProseMirrorPlugins(){return[new H({key:new U("codeBlockVSCodeHandler"),props:{handlePaste:c((n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
|
|
119
|
-
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(L.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0},"handlePaste")}})]}}),B0=xe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
|
|
120
|
-
|
|
121
|
-
`):"","renderMarkdown")}),z0=xe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Y(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
122
|
-
`},renderMarkdown:c((n,e)=>e.indent(`
|
|
123
|
-
`),"renderMarkdown"),addCommands(){return{setHardBreak:c(()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;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:u,dispatch:d})=>{if(d&&a&&o){const f=a.filter(h=>l.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})]),"setHardBreak")}},addKeyboardShortcuts(){return{"Mod-Enter":c(()=>this.editor.commands.setHardBreak(),"Mod-Enter"),"Shift-Enter":c(()=>this.editor.commands.setHardBreak(),"Shift-Enter")}}}),$0=xe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown:c((n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},"renderMarkdown"),addCommands(){return{setHeading:c(n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,"setHeading"),toggleHeading:c(n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1,"toggleHeading")}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Go({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),F0=xe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Y(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:c((n,e)=>e.createNode("horizontalRule"),"parseMarkdown"),renderMarkdown:c(()=>"---","renderMarkdown"),addCommands(){return{setHorizontalRule:c(()=>({chain:n,state:e})=>{if(!m0(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return lf(t)?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,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(L.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(N.create(o.doc,a.pos)):o.setSelection(L.create(o.doc,a.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=d?.create();f&&(o.insert(u,f),o.setSelection(L.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()},"setHorizontalRule")}},addInputRules(){return[p0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),H0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,V0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,j0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,U0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,W0=pn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:c(n=>n.style.fontStyle!=="normal"&&null,"getAttrs")},{style:"font-style=normal",clearMark:c(n=>n.type.name===this.name,"clearMark")},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Y(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:c(()=>({commands:n})=>n.setMark(this.name),"setItalic"),toggleItalic:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleItalic"),unsetItalic:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetItalic")}},markdownTokenName:"em",parseMarkdown:c((n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`*${e.renderChildren(n)}*`,"renderMarkdown"),addKeyboardShortcuts(){return{"Mod-i":c(()=>this.editor.commands.toggleItalic(),"Mod-i"),"Mod-I":c(()=>this.editor.commands.toggleItalic(),"Mod-I")}},addInputRules(){return[Jn({find:H0,type:this.type}),Jn({find:j0,type:this.type})]},addPasteRules(){return[dn({find:V0,type:this.type}),dn({find:U0,type:this.type})]}});const K0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",q0="ελ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",Xo="numeric",Qo="ascii",Zo="alpha",fr="asciinumeric",or="alphanumeric",el="domain",kf="emoji",J0="scheme",_0="slashscheme",lo="whitespace";function G0(n,e){return n in e||(e[n]=[]),e[n]}c(G0,"registerGroup");function Jt(n,e,t){e[Xo]&&(e[fr]=!0,e[or]=!0),e[Qo]&&(e[fr]=!0,e[Zo]=!0),e[fr]&&(e[or]=!0),e[Zo]&&(e[or]=!0),e[or]&&(e[el]=!0),e[kf]&&(e[el]=!0);for(const r in e){const i=G0(r,t);i.indexOf(n)<0&&i.push(n)}}c(Jt,"addToGroups");function Y0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}c(Y0,"flagsForToken");function ge(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}c(ge,"State");ge.groups={};ge.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||ge.groups;let i;return e&&e.j?i=e:(i=new ge(e),t&&r&&Jt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||ge.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,l=i.go(n);if(l?(o=new ge,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new ge,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(Y0(o.t,r),t);Jt(s,a,r)}else t&&Jt(s,t,r);o.t=s}return i.j[n]=o,o}};const P=c((n,e,t,r,i)=>n.ta(e,t,r,i),"ta"),q=c((n,e,t,r,i)=>n.tr(e,t,r,i),"tr"),_c=c((n,e,t,r,i)=>n.ts(e,t,r,i),"ts"),S=c((n,e,t,r,i)=>n.tt(e,t,r,i),"tt"),et="WORD",tl="UWORD",wf="ASCIINUMERICAL",xf="ALPHANUMERICAL",Pr="LOCALHOST",nl="TLD",rl="UTLD",oi="SCHEME",kn="SLASH_SCHEME",ql="NUM",il="WS",Jl="NL",hr="OPENBRACE",pr="CLOSEBRACE",Bi="OPENBRACKET",zi="CLOSEBRACKET",$i="OPENPAREN",Fi="CLOSEPAREN",Hi="OPENANGLEBRACKET",Vi="CLOSEANGLEBRACKET",ji="FULLWIDTHLEFTPAREN",Ui="FULLWIDTHRIGHTPAREN",Wi="LEFTCORNERBRACKET",Ki="RIGHTCORNERBRACKET",qi="LEFTWHITECORNERBRACKET",Ji="RIGHTWHITECORNERBRACKET",_i="FULLWIDTHLESSTHAN",Gi="FULLWIDTHGREATERTHAN",Yi="AMPERSAND",Xi="APOSTROPHE",Qi="ASTERISK",gt="AT",Zi="BACKSLASH",es="BACKTICK",ts="CARET",xt="COLON",_l="COMMA",ns="DOLLAR",ze="DOT",rs="EQUALS",Gl="EXCLAMATION",Ce="HYPHEN",mr="PERCENT",is="PIPE",ss="PLUS",ls="POUND",gr="QUERY",Yl="QUOTE",Sf="FULLWIDTHMIDDLEDOT",Xl="SEMI",$e="SLASH",yr="TILDE",as="UNDERSCORE",vf="EMOJI",cs="SYM";var Cf=Object.freeze({__proto__:null,ALPHANUMERICAL:xf,AMPERSAND:Yi,APOSTROPHE:Xi,ASCIINUMERICAL:wf,ASTERISK:Qi,AT:gt,BACKSLASH:Zi,BACKTICK:es,CARET:ts,CLOSEANGLEBRACKET:Vi,CLOSEBRACE:pr,CLOSEBRACKET:zi,CLOSEPAREN:Fi,COLON:xt,COMMA:_l,DOLLAR:ns,DOT:ze,EMOJI:vf,EQUALS:rs,EXCLAMATION:Gl,FULLWIDTHGREATERTHAN:Gi,FULLWIDTHLEFTPAREN:ji,FULLWIDTHLESSTHAN:_i,FULLWIDTHMIDDLEDOT:Sf,FULLWIDTHRIGHTPAREN:Ui,HYPHEN:Ce,LEFTCORNERBRACKET:Wi,LEFTWHITECORNERBRACKET:qi,LOCALHOST:Pr,NL:Jl,NUM:ql,OPENANGLEBRACKET:Hi,OPENBRACE:hr,OPENBRACKET:Bi,OPENPAREN:$i,PERCENT:mr,PIPE:is,PLUS:ss,POUND:ls,QUERY:gr,QUOTE:Yl,RIGHTCORNERBRACKET:Ki,RIGHTWHITECORNERBRACKET:Ji,SCHEME:oi,SEMI:Xl,SLASH:$e,SLASH_SCHEME:kn,SYM:cs,TILDE:yr,TLD:nl,UNDERSCORE:as,UTLD:rl,UWORD:tl,WORD:et,WS:il});const Qe=/[a-z]/,rr=new RegExp("\\p{L}","u"),ao=new RegExp("\\p{Emoji}","u"),Ze=/\d/,co=/\s/,Gc="\r",uo=`
|
|
124
|
-
`,X0="️",Q0="",fo="";let Yr=null,Xr=null;function Z0(n=[]){const e={};ge.groups=e;const t=new ge;Yr==null&&(Yr=Yc(K0)),Xr==null&&(Xr=Yc(q0)),S(t,"'",Xi),S(t,"{",hr),S(t,"}",pr),S(t,"[",Bi),S(t,"]",zi),S(t,"(",$i),S(t,")",Fi),S(t,"<",Hi),S(t,">",Vi),S(t,"(",ji),S(t,")",Ui),S(t,"「",Wi),S(t,"」",Ki),S(t,"『",qi),S(t,"』",Ji),S(t,"<",_i),S(t,">",Gi),S(t,"&",Yi),S(t,"*",Qi),S(t,"@",gt),S(t,"`",es),S(t,"^",ts),S(t,":",xt),S(t,",",_l),S(t,"$",ns),S(t,".",ze),S(t,"=",rs),S(t,"!",Gl),S(t,"-",Ce),S(t,"%",mr),S(t,"|",is),S(t,"+",ss),S(t,"#",ls),S(t,"?",gr),S(t,'"',Yl),S(t,"/",$e),S(t,";",Xl),S(t,"~",yr),S(t,"_",as),S(t,"\\",Zi),S(t,"・",Sf);const r=q(t,Ze,ql,{[Xo]:!0});q(r,Ze,r);const i=q(r,Qe,wf,{[fr]:!0}),s=q(r,rr,xf,{[or]:!0}),o=q(t,Qe,et,{[Qo]:!0});q(o,Ze,i),q(o,Qe,o),q(i,Ze,i),q(i,Qe,i);const l=q(t,rr,tl,{[Zo]:!0});q(l,Qe),q(l,Ze,s),q(l,rr,l),q(s,Ze,s),q(s,Qe),q(s,rr,s);const a=S(t,uo,Jl,{[lo]:!0}),u=S(t,Gc,il,{[lo]:!0}),d=q(t,co,il,{[lo]:!0});S(t,fo,d),S(u,uo,a),S(u,fo,d),q(u,co,d),S(d,Gc),S(d,uo),q(d,co,d),S(d,fo,d);const f=q(t,ao,vf,{[kf]:!0});S(f,"#"),q(f,ao,f),S(f,X0,f);const h=S(f,Q0);S(h,"#"),q(h,ao,f);const p=[[Qe,o],[Ze,i]],m=[[Qe,null],[rr,l],[Ze,s]];for(let g=0;g<Yr.length;g++)ht(t,Yr[g],nl,et,p);for(let g=0;g<Xr.length;g++)ht(t,Xr[g],rl,tl,m);Jt(nl,{tld:!0,ascii:!0},e),Jt(rl,{utld:!0,alpha:!0},e),ht(t,"file",oi,et,p),ht(t,"mailto",oi,et,p),ht(t,"http",kn,et,p),ht(t,"https",kn,et,p),ht(t,"ftp",kn,et,p),ht(t,"ftps",kn,et,p),Jt(oi,{scheme:!0,ascii:!0},e),Jt(kn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[J0]:!0}:{[_0]:!0};y.indexOf("-")>=0?k[el]=!0:Qe.test(y)?Ze.test(y)?k[fr]=!0:k[Qo]=!0:k[Xo]=!0,_c(t,y,y,k)}return _c(t,"localhost",Pr,{ascii:!0}),t.jd=new ge(cs),{start:t,tokens:Object.assign({groups:e},Cf)}}c(Z0,"init$2");function Mf(n,e){const t=eb(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,u=0,d=null,f=-1,h=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(f=0,h=0,d=l):f>=0&&(f+=t[o].length,h++),u+=t[o].length,s+=t[o].length,o++;s-=f,o-=h,u-=f,i.push({t:d.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}c(Mf,"run$1");function eb(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}c(eb,"stringToArray");function ht(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new ge(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new ge(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}c(ht,"fastts");function Yc(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}c(Yc,"decodeTlds");const Br={defaultProtocol:"http",events:null,format:Xc,formatHref:Xc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ql(n,e=null){let t=Object.assign({},Br);n&&(t=Object.assign(t,n instanceof Ql?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}c(Ql,"Options");Ql.prototype={o:Br,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Br[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Xc(n){return n}c(Xc,"noop");function Tf(n,e){this.t="token",this.v=n,this.tk=e}c(Tf,"MultiToken");Tf.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Br.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:f}}};function Ps(n,e){const r=class r extends Tf{constructor(s,o){super(s,o),this.t=n}};c(r,"Token");let t=r;for(const i in e)t.prototype[i]=e[i];return t.t=n,t}c(Ps,"createTokenClass");const Qc=Ps("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Zc=Ps("text"),tb=Ps("nl"),Qr=Ps("url",{isLink:!0,toHref(n=Br.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Pr&&n[1].t===xt}}),ve=c(n=>new ge(n),"makeState");function nb({groups:n}){const e=n.domain.concat([Yi,Qi,gt,Zi,es,ts,ns,rs,Ce,ql,mr,is,ss,ls,$e,cs,yr,as]),t=[Xi,xt,_l,ze,Gl,mr,gr,Yl,Xl,Hi,Vi,hr,pr,zi,Bi,$i,Fi,ji,Ui,Wi,Ki,qi,Ji,_i,Gi],r=[Yi,Xi,Qi,Zi,es,ts,ns,rs,Ce,hr,pr,mr,is,ss,ls,gr,$e,cs,yr,as],i=ve(),s=S(i,yr);P(s,r,s),P(s,n.domain,s);const o=ve(),l=ve(),a=ve();P(i,n.domain,o),P(i,n.scheme,l),P(i,n.slashscheme,a),P(o,r,s),P(o,n.domain,o);const u=S(o,gt);S(s,gt,u),S(l,gt,u),S(a,gt,u);const d=S(s,ze);P(d,r,s),P(d,n.domain,s);const f=ve();P(u,n.domain,f),P(f,n.domain,f);const h=S(f,ze);P(h,n.domain,f);const p=ve(Qc);P(h,n.tld,p),P(h,n.utld,p),S(u,Pr,p);const m=S(f,Ce);S(m,Ce,m),P(m,n.domain,f),P(p,n.domain,f),S(p,ze,h),S(p,Ce,m);const g=S(p,xt);P(g,n.numeric,Qc);const y=S(o,Ce),b=S(o,ze);S(y,Ce,y),P(y,n.domain,o),P(b,r,s),P(b,n.domain,o);const k=ve(Qr);P(b,n.tld,k),P(b,n.utld,k),P(k,n.domain,o),P(k,r,s),S(k,ze,b),S(k,Ce,y),S(k,gt,u);const x=S(k,xt),M=ve(Qr);P(x,n.numeric,M);const w=ve(Qr),E=ve();P(w,e,w),P(w,t,E),P(E,e,w),P(E,t,E),S(k,$e,w),S(M,$e,w);const C=S(l,xt),A=S(a,xt),D=S(A,$e),R=S(D,$e);P(l,n.domain,o),S(l,ze,b),S(l,Ce,y),P(a,n.domain,o),S(a,ze,b),S(a,Ce,y),P(C,n.domain,w),S(C,$e,w),S(C,gr,w),P(R,n.domain,w),P(R,e,w),S(R,$e,w);const V=[[hr,pr],[Bi,zi],[$i,Fi],[Hi,Vi],[ji,Ui],[Wi,Ki],[qi,Ji],[_i,Gi]];for(let W=0;W<V.length;W++){const[_,B]=V[W],F=S(w,_);S(E,_,F),S(F,B,w);const X=ve(Qr);P(F,e,X);const Q=ve();P(F,t),P(X,e,X),P(X,t,Q),P(Q,e,X),P(Q,t,Q),S(X,B,w),S(Q,B,w)}return S(i,Pr,k),S(i,Jl,tb),{start:i,tokens:Cf}}c(nb,"init$1");function rb(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,u=null,d=0,f=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(u=a||l.go(t[i].t));)a=null,l=u,l.accepts()?(h=0,f=l):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(ho(Zc,e,o)),o=[]),i-=h,d-=h;const p=f.t,m=t.slice(i-d,i);s.push(ho(p,e,m))}}return o.length>0&&s.push(ho(Zc,e,o)),s}c(rb,"run");function ho(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}c(ho,"initMultiToken");const ib=typeof console<"u"&&console&&console.warn||(()=>{}),sb="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",j={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ob(){return ge.groups={},j.scanner=null,j.parser=null,j.tokenQueue=[],j.pluginQueue=[],j.customSchemes=[],j.initialized=!1,j}c(ob,"reset");function eu(n,e=!1){if(j.initialized&&ib(`linkifyjs: already initialized - will not register custom scheme "${n}" ${sb}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
125
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
126
|
-
2. Cannot start or end with "-"
|
|
127
|
-
3. "-" cannot repeat`);j.customSchemes.push([n,e])}c(eu,"registerCustomProtocol");function lb(){j.scanner=Z0(j.customSchemes);for(let n=0;n<j.tokenQueue.length;n++)j.tokenQueue[n][1]({scanner:j.scanner});j.parser=nb(j.scanner.tokens);for(let n=0;n<j.pluginQueue.length;n++)j.pluginQueue[n][1]({scanner:j.scanner,parser:j.parser});return j.initialized=!0,j}c(lb,"init");function Zl(n){return j.initialized||lb(),rb(j.parser.start,n,Mf(j.scanner.start,n))}c(Zl,"tokenize");Zl.scan=Mf;function Ef(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Ql(t),i=Zl(n),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}c(Ef,"find");var ea="[\0- -\u2029 ]",ab=new RegExp(ea),cb=new RegExp(`${ea}$`),ub=new RegExp(ea,"g");function db(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}c(db,"isValidLinkStructure");function fb(n){return new H({key:new U("autolink"),appendTransaction:c((e,t,r)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Qd(t.doc,[...e]);if(of(l).forEach(({newRange:u})=>{const d=wy(r.doc,u,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!cb.test(p))return;f=d[0],h=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&h){const p=h.split(ab).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Zl(m).map(b=>b.toObject(n.defaultProtocol));if(!db(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Hl(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o},"appendTransaction")})}c(fb,"autolink");function hb(n){return new H({key:new U("handleClickLink"),props:{handleClick:c((e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;o=f.find(h=>h.nodeName==="A")}if(!o)return!1;const l=sf(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,u=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,u),!0):!1},"handleClick")}})}c(hb,"clickHandler");function pb(n){return new H({key:new U("handlePasteLink"),props:{handlePaste:c((e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const u=Ef(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!u||i!==void 0&&!i(u.href)?!1:n.editor.commands.setMark(n.type,{href:u.href})},"handlePaste")}})}c(pb,"pasteHandler");function Lt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(ub,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}c(Lt,"isAllowedUri");var mb=pn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){eu(n);return}eu(n.scheme,n.optionalSlashes)})},onDestroy(){ob()},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:c((n,e)=>!!Lt(n,e.protocols),"isAllowedUri"),validate:c(n=>!!n,"validate"),shouldAutoLink:c(n=>!!n,"shouldAutoLink")}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:c(n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:c(t=>!!Lt(t,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null},"getAttrs")}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:c(e=>!!Lt(e,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Y(this.options.HTMLAttributes,n),0]:["a",Y(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:c((n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},"renderMarkdown"),addCommands(){return{setLink:c(n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:c(r=>!!Lt(r,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},"setLink"),toggleLink:c(n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:c(r=>!!Lt(r,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},"toggleLink"),unsetLink:c(()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),"unsetLink")}},addPasteRules(){return[dn({find:c(n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Ef(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:c(o=>!!Lt(o,t),"defaultValidate"),protocols:t,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},"find"),type:this.type,getAttributes:c(n=>{var e;return{href:(e=n.data)==null?void 0:e.href}},"getAttributes")})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(fb({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:c(r=>this.options.isAllowedUri(r,{defaultValidate:c(i=>!!Lt(i,e),"defaultValidate"),protocols:e,defaultProtocol:t}),"validate"),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(hb({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(pb({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),gb=Object.defineProperty,yb=c((n,e)=>{for(var t in e)gb(n,t,{get:e[t],enumerable:!0})},"__export"),bb="listItem",tu="textStyle",nu=/^\s*([-+*])\s$/,Of=xe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:c((n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
|
|
128
|
-
`):"","renderMarkdown"),markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:c(()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bb,this.editor.getAttributes(tu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),"toggleBulletList")}},addKeyboardShortcuts(){return{"Mod-Shift-8":c(()=>this.editor.commands.toggleBulletList(),"Mod-Shift-8")}},addInputRules(){let n=_n({find:nu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:nu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(()=>this.editor.getAttributes(tu),"getAttributes"),editor:this.editor})),[n]}}),Af=xe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:c((n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=n.tokens.slice(1),l=e.parseChildren(o);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},"parseMarkdown"),renderMarkdown:c((n,e,t)=>Kl(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),"renderMarkdown"),addKeyboardShortcuts(){return{Enter:c(()=>this.editor.commands.splitListItem(this.name),"Enter"),Tab:c(()=>this.editor.commands.sinkListItem(this.name),"Tab"),"Shift-Tab":c(()=>this.editor.commands.liftListItem(this.name),"Shift-Tab")}}}),kb={};yb(kb,{findListItemPos:c(()=>Vr,"findListItemPos"),getNextListDepth:c(()=>ta,"getNextListDepth"),handleBackspace:c(()=>sl,"handleBackspace"),handleDelete:c(()=>ol,"handleDelete"),hasListBefore:c(()=>Nf,"hasListBefore"),hasListItemAfter:c(()=>wb,"hasListItemAfter"),hasListItemBefore:c(()=>If,"hasListItemBefore"),listItemHasSubList:c(()=>Rf,"listItemHasSubList"),nextListIsDeeper:c(()=>Df,"nextListIsDeeper"),nextListIsHigher:c(()=>Lf,"nextListIsHigher")});var Vr=c((n,e)=>{const{$from:t}=e.selection,r=G(n,e.schema);let i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},"findListItemPos"),ta=c((n,e)=>{const t=Vr(n,e);if(!t)return!1;const[,r]=Ay(e,n,t.$pos.pos+4);return r},"getNextListDepth"),Nf=c((n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},"hasListBefore"),If=c((n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},"hasListItemBefore"),Rf=c((n,e,t)=>{if(!t)return!1;const r=G(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},"listItemHasSubList"),sl=c((n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Nt(n.state,e)&&Nf(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),u=[];a.node().descendants((h,p)=>{h.type.name===e&&u.push({node:h,pos:p})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Nt(n.state,e)||!Dy(n.state))return!1;const r=Vr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Rf(e,n.state,s);return If(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},"handleBackspace"),Df=c((n,e)=>{const t=ta(n,e),r=Vr(n,e);return!r||!t?!1:t>r.depth},"nextListIsDeeper"),Lf=c((n,e)=>{const t=ta(n,e),r=Vr(n,e);return!r||!t?!1:t<r.depth},"nextListIsHigher"),ol=c((n,e)=>{if(!Nt(n.state,e)||!Ry(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Df(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Lf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},"handleDelete"),wb=c((n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},"hasListItemAfter"),Pf=J.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ol(n,t)&&(e=!0)}),e},"Delete"),"Mod-Delete":c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ol(n,t)&&(e=!0)}),e},"Mod-Delete"),Backspace:c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&sl(n,t,r)&&(e=!0)}),e},"Backspace"),"Mod-Backspace":c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&sl(n,t,r)&&(e=!0)}),e},"Mod-Backspace")}}}),ru=/^(\s*)(\d+)\.\s+(.*)$/,xb=/^\s/;function Sb(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(ru);if(!s)break;const[,o,l,a]=s,u=o.length;let d=a,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(ru))break;if(p.trim()==="")h.push(p),d+=`
|
|
129
|
-
`,f+=1;else if(p.match(xb))h.push(p),d+=`
|
|
130
|
-
${p.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:h.join(`
|
|
131
|
-
`)}),r=f,t=f}return[e,r]}c(Sb,"collectOrderedListItems");function Bf(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const l=o.content.split(`
|
|
132
|
-
`),a=((r=l[0])==null?void 0:r.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
|
|
133
|
-
`).trim();if(d){const p=t.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<n.length&&n[f].indent>e;)h.push(n[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=Bf(h,p,t);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
|
|
134
|
-
`)})}i.push({type:"list_item",raw:o.raw,tokens:u}),s=f}else s+=1}return i}c(Bf,"buildNestedStructure");function vb(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.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}})}c(vb,"parseListItems");var Cb="listItem",iu="textStyle",su=/^(\d+)\.\s$/,zf=xe.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:c(n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1,"parseHTML")},type:{default:null,parseHTML:c(n=>n.getAttribute("type"),"parseHTML")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Y(this.options.HTMLAttributes,t),0]:["ol",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:c((n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?vb(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
|
|
135
|
-
`):"","renderMarkdown"),markdownTokenizer:{name:"orderedList",level:"block",start:c(n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},"start"),tokenize:c((n,e,t)=>{var r;const i=n.split(`
|
|
136
|
-
`),[s,o]=Sb(i);if(s.length===0)return;const l=Bf(s,0,t);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(`
|
|
137
|
-
`)}},"tokenize")},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:c(()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cb,this.editor.getAttributes(iu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),"toggleOrderedList")}},addKeyboardShortcuts(){return{"Mod-Shift-7":c(()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-7")}},addInputRules(){let n=_n({find:su,type:this.type,getAttributes:c(e=>({start:+e[1]}),"getAttributes"),joinPredicate:c((e,t)=>t.childCount+t.attrs.start===+e[1],"joinPredicate")});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:su,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(e=>({start:+e[1],...this.editor.getAttributes(iu)}),"getAttributes"),joinPredicate:c((e,t)=>t.childCount+t.attrs.start===+e[1],"joinPredicate"),editor:this.editor})),[n]}}),Mb=/^\s*(\[([( |x])?\])\s$/,Tb=xe.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:c(n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},"parseHTML"),renderHTML:c(n=>({"data-checked":n.checked}),"renderHTML")}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Y(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:c((n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Kl(n,e,i)},"renderMarkdown"),addKeyboardShortcuts(){const n={Enter:c(()=>this.editor.commands.splitListItem(this.name),"Enter"),"Shift-Tab":c(()=>this.editor.commands.liftListItem(this.name),"Shift-Tab")};return this.options.nested?{...n,Tab:c(()=>this.editor.commands.sinkListItem(this.name),"Tab")}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=c(d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`},"updateA11Y");return u(n),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:f}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)}),{dom:i,contentDOM:a,update:c(d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d),!0),"update")}}},addInputRules(){return[_n({find:Mb,type:this.type,getAttributes:c(n=>({checked:n[n.length-1]==="x"}),"getAttributes")})]}}),Eb=xe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Y(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:c((n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
|
|
138
|
-
`):"","renderMarkdown"),markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=c(s=>{const o=Yo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c(l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),"extractItemData"),createToken:c((l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),"createToken"),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},"parseTaskListContent"),i=Yo(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c(s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),"extractItemData"),createToken:c((s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),"createToken"),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:c(()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName),"toggleTaskList")}},addKeyboardShortcuts(){return{"Mod-Shift-9":c(()=>this.editor.commands.toggleTaskList(),"Mod-Shift-9")}}});J.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Of.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Af.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Pf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(zf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Tb.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Eb.configure(this.options.taskList)),n}});var Ob=xe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Y(this.options.HTMLAttributes,n),0]},parseMarkdown:c((n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},"parseMarkdown"),renderMarkdown:c((n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),"renderMarkdown"),addCommands(){return{setParagraph:c(()=>({commands:n})=>n.setNode(this.name),"setParagraph")}},addKeyboardShortcuts(){return{"Mod-Alt-0":c(()=>this.editor.commands.setParagraph(),"Mod-Alt-0")}}}),Ab=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ib=pn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:c(n=>n.includes("line-through")?{}:!1,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return["s",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:c((n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`~~${e.renderChildren(n)}~~`,"renderMarkdown"),addCommands(){return{setStrike:c(()=>({commands:n})=>n.setMark(this.name),"setStrike"),toggleStrike:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleStrike"),unsetStrike:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetStrike")}},addKeyboardShortcuts(){return{"Mod-Shift-s":c(()=>this.editor.commands.toggleStrike(),"Mod-Shift-s")}},addInputRules(){return[Jn({find:Ab,type:this.type})]},addPasteRules(){return[dn({find:Nb,type:this.type})]}}),Rb=xe.create({name:"text",group:"inline",parseMarkdown:c(n=>({type:"text",text:n.text||""}),"parseMarkdown"),renderMarkdown:c(n=>n.text||"","renderMarkdown")}),Db=pn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:c(n=>n.includes("underline")?{}:!1,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return["u",Y(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:c(()=>({commands:n})=>n.setMark(this.name),"setUnderline"),toggleUnderline:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleUnderline"),unsetUnderline:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetUnderline")}},addKeyboardShortcuts(){return{"Mod-u":c(()=>this.editor.commands.toggleUnderline(),"Mod-u"),"Mod-U":c(()=>this.editor.commands.toggleUnderline(),"Mod-U")}}});function Lb(n={}){return new H({view(e){return new ll(e,n)}})}c(Lb,"dropCursor");const Ha=class Ha{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=c(o=>{this[i](o)},"handler");return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;u=f.left-a.scrollLeft*h,d=f.top-a.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/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 t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Xu(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)}};c(Ha,"DropCursorView");let ll=Ha;const Ve=class Ve extends I{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Ve.valid(r)?new Ve(r):I.near(r)}content(){return T.empty}eq(e){return e instanceof Ve&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ve(e.resolve(t.pos))}getBookmark(){return new al(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Pb(e)||!Bb(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Ve.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(Ve.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!N.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(Ve.valid(l))return l}return null}}};c(Ve,"GapCursor");let ue=Ve;ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;I.jsonID("gapcursor",ue);const vs=class vs{constructor(e){this.pos=e}map(e){return new vs(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):I.near(t)}};c(vs,"GapBookmark");let al=vs;function $f(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}c($f,"needsGap");function Pb(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||$f(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(Pb,"closedBefore");function Bb(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||$f(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(Bb,"closedAfter");function zb(){return new H({props:{decorations:Vb,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:Fb,handleKeyDown:$b,handleDOMEvents:{beforeinput:Hb}}})}c(zb,"gapCursor");const $b=Nl({ArrowLeft:Zr("horiz",-1),ArrowRight:Zr("horiz",1),ArrowUp:Zr("vert",-1),ArrowDown:Zr("vert",1)});function Zr(n,e){const t=n=="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 L){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ue.findGapCursorFrom(l,e,a);return u?(i&&i(r.tr.setSelection(new ue(u))),!0):!1}}c(Zr,"arrow$3");function Fb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&N.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}c(Fb,"handleClick");function Hb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=v.empty;for(let o=r.length-1;o>=0;o--)i=v.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new T(i,0,0));return s.setSelection(L.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}c(Hb,"beforeinput");function Vb(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",oe.create(n.doc,[Ae.widget(n.selection.head,e,{key:"gapcursor"})])}c(Vb,"drawGapCursor");var us=200,Z=c(function(){},"RopeSequence");Z.prototype.append=c(function(e){return e.length?(e=Z.from(e),!this.length&&e||e.length<us&&this.leafAppend(e)||this.length<us&&e.leafPrepend(this)||this.appendInner(e)):this},"append");Z.prototype.prepend=c(function(e){return e.length?Z.from(e).append(this):this},"prepend");Z.prototype.appendInner=c(function(e){return new jb(this,e)},"appendInner");Z.prototype.slice=c(function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Z.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},"slice");Z.prototype.get=c(function(e){if(!(e<0||e>=this.length))return this.getInner(e)},"get");Z.prototype.forEach=c(function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},"forEach");Z.prototype.map=c(function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i},"map");Z.from=c(function(e){return e instanceof Z?e:e&&e.length?new Ff(e):Z.empty},"from");var Ff=(function(n){function e(r){n.call(this),this.values=r}c(e,"Leaf"),n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=c(function(){return this.values},"flatten"),e.prototype.sliceInner=c(function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},"sliceInner"),e.prototype.getInner=c(function(i){return this.values[i]},"getInner"),e.prototype.forEachInner=c(function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},"forEachInner"),e.prototype.forEachInvertedInner=c(function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},"forEachInvertedInner"),e.prototype.leafAppend=c(function(i){if(this.length+i.length<=us)return new e(this.values.concat(i.flatten()))},"leafAppend"),e.prototype.leafPrepend=c(function(i){if(this.length+i.length<=us)return new e(i.flatten().concat(this.values))},"leafPrepend"),t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Z);Z.empty=new Ff([]);var jb=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return c(e,"Append"),n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=c(function(){return this.left.flatten().concat(this.right.flatten())},"flatten"),e.prototype.getInner=c(function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},"getInner"),e.prototype.forEachInner=c(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},"forEachInner"),e.prototype.forEachInvertedInner=c(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},"forEachInvertedInner"),e.prototype.sliceInner=c(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))},"sliceInner"),e.prototype.leafAppend=c(function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},"leafAppend"),e.prototype.leafPrepend=c(function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},"leafPrepend"),e.prototype.appendInner=c(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)},"appendInner"),e})(Z);const Ub=500,wt=class wt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(f);return}if(i){d.push(new Fe(f.map));let p=f.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new Fe(m,void 0,void 0,u.length+d.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,a=new wt(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new Fe(e.mapping.maps[d],f,t),p;(p=a&&a.merge(h))&&(h=p,d?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),i||(a=h)}let u=o-r.depth;return u>Kb&&(l=Wb(l,u),o-=u),new wt(l.append(s),o)}remapping(e,t){let r=new mi;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,t),r}addMaps(e){return this.eventCount==0?this:new wt(this.items.append(e.map(t=>new Fe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let p=s.getMirror(--a);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(s.slice(a+1,p));y&&l++,r.push(new Fe(m,g,y))}else r.push(new Fe(m))},i);let u=[];for(let h=t;h<o;h++)u.push(new Fe(s.maps[h]));let d=this.items.slice(0,i).append(u).append(r),f=new wt(d,l);return f.emptyItemCount()>Ub&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,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(t.slice(r)),u=a&&a.getMap();if(r--,u&&t.appendMap(u,r),a){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let f=new Fe(u.invert(),a,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&r--},this.items.length,0),new wt(Z.from(i.reverse()),s)}};c(wt,"Branch");let fn=wt;fn.empty=new fn(Z.empty,0);function Wb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}c(Wb,"cutOffEvents");const Cs=class Cs{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Cs(t.getMap().invert(),t,this.selection)}}};c(Cs,"Item");let Fe=Cs;const Va=class Va{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}};c(Va,"HistoryState");let je=Va;const Kb=20;function qb(n,e,t,r){let i=t.getMeta(en),s;if(i)return i.historyState;t.getMeta(Gb)&&(n=new je(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(en))return o.getMeta(en).redo?new je(n.done.addTransform(t,void 0,r,li(e)),n.undone,ou(t.mapping.maps),n.prevTime,n.prevComposition):new je(n.done,n.undone.addTransform(t,void 0,r,li(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Jb(t,n.prevRanges)),u=o?po(n.prevRanges,t.mapping):ou(t.mapping.maps);return new je(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,li(e)),fn.empty,u,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new je(n.done.rebased(t,s),n.undone.rebased(t,s),po(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new je(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),po(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}c(qb,"applyTransaction");function Jb(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}c(Jb,"isAdjacentTo");function ou(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}c(ou,"rangesFor");function po(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}c(po,"mapRanges");function _b(n,e,t){let r=li(e),i=en.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new je(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(en,{redo:t,historyState:a})}c(_b,"histTransaction");let mo=!1,lu=null;function li(n){let e=n.plugins;if(lu!=e){mo=!1,lu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){mo=!0;break}}return mo}c(li,"mustPreserveItems");const en=new U("history"),Gb=new U("closeHistory");function Yb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new H({key:en,state:{init(){return new je(fn.empty,fn.empty,null,0,-1)},apply(e,t,r){return qb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Vf:r=="historyRedo"?jf:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}c(Yb,"history");function Hf(n,e){return(t,r)=>{let i=en.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=_b(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}c(Hf,"buildCommand");const Vf=Hf(!1,!0),jf=Hf(!0,!0);J.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:c(n=>n.length,"textCounter"),wordCounter:c(n=>n.split(" ").filter(e=>e!=="").length,"wordCounter")}},addStorage(){return{characters:c(()=>0,"characters"),words:c(()=>0,"words")}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new H({key:new U("characterCount"),appendTransaction:c((e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!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 u=r.tr.deleteRange(l,a);return n=!0,u}n=!0},"appendTransaction"),filterTransaction:c((e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.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,u=l-a,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)},"filterTransaction")})]}});var Xb=J.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Lb(this.options)]}});J.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new H({key:new U("focus"),props:{decorations:c(({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return oe.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(a.isText)return;if(!(i>=u&&i<=u+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,u)=>{if(a.isText||!(i>=u&&i<=u+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(Ae.node(u,u+a.nodeSize,{class:this.options.className}))}),oe.create(n,s)},"decorations")}})]}});var Qb=J.create({name:"gapCursor",addProseMirrorPlugins(){return[zb()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=z(O(n,"allowGapCursor",t)))!=null?e:null}}}),Zb=J.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new H({key:new U("placeholder"),props:{decorations:c(({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,l)=>{const a=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&Rs(o);if((a||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=Ae.node(l,l+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),oe.create(n,i)},"decorations")}})]}});J.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new H({key:new U("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||lf(t.selection)||n.view.dragging?null:oe.create(t.doc,[Ae.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function au({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}c(au,"nodeEqualsType");var ek=J.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new U(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new H({key:e,appendTransaction:c((i,s,o)=>{const{doc:l,tr:a,schema:u}=o,d=e.getState(o),f=l.content.size,h=u.nodes[t];if(d)return a.insert(f,h.create())},"appendTransaction"),state:{init:c((i,s)=>{const o=s.tr.doc.lastChild;return!au({node:o,types:r})},"init"),apply:c((i,s)=>{if(!i.docChanged)return s;const o=i.doc.lastChild;return!au({node:o,types:r})},"apply")}})]}}),tk=J.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:c(()=>({state:n,dispatch:e})=>Vf(n,e),"undo"),redo:c(()=>({state:n,dispatch:e})=>jf(n,e),"redo")}},addProseMirrorPlugins(){return[Yb(this.options)]},addKeyboardShortcuts(){return{"Mod-z":c(()=>this.editor.commands.undo(),"Mod-z"),"Shift-Mod-z":c(()=>this.editor.commands.redo(),"Shift-Mod-z"),"Mod-y":c(()=>this.editor.commands.redo(),"Mod-y"),"Mod-я":c(()=>this.editor.commands.undo(),"Mod-я"),"Shift-Mod-я":c(()=>this.editor.commands.redo(),"Shift-Mod-я")}}}),nk=J.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(A0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(C0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Of.configure(this.options.bulletList)),this.options.code!==!1&&i.push(R0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(P0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(B0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Xb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Qb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(z0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push($0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(tk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(F0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(W0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Af.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Pf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(mb.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(zf.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Ob.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Ib.configure(this.options.strike)),this.options.text!==!1&&i.push(Rb.configure(this.options.text)),this.options.underline!==!1&&i.push(Db.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(ek.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),rk=nk;function cu(n){return Sh((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}c(cu,"useDebouncedRef");var Ln,ik=(Ln=class extends h0{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=cu(this.view.state),this.reactiveExtensionStorage=cu(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),xh(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const r=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},c(Ln,"Editor"),Ln),sk=Cu({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=kh(),t=Ch();return wh(()=>{const r=n.editor;r&&r.options.element&&e.value&&Tu(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.firstChild))return;const s=vh(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),Mu(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return yo("div",{ref:c(n=>{this.rootEl=n},"ref")})}});const Uf=["top","right","bottom","left"],uu=["start","end"],du=Uf.reduce((n,e)=>n.concat(e,e+"-"+uu[0],e+"-"+uu[1]),[]),_e=Math.min,de=Math.max,ds=Math.round,We=c(n=>({x:n,y:n}),"createCoords"),ok={left:"right",right:"left",bottom:"top",top:"bottom"},lk={start:"end",end:"start"};function cl(n,e,t){return de(n,_e(e,t))}c(cl,"clamp");function ut(n,e){return typeof n=="function"?n(e):n}c(ut,"evaluate");function Ne(n){return n.split("-")[0]}c(Ne,"getSide");function De(n){return n.split("-")[1]}c(De,"getAlignment");function Wf(n){return n==="x"?"y":"x"}c(Wf,"getOppositeAxis");function na(n){return n==="y"?"height":"width"}c(na,"getAxisLength");const ak=new Set(["top","bottom"]);function Ue(n){return ak.has(Ne(n))?"y":"x"}c(Ue,"getSideAxis");function ra(n){return Wf(Ue(n))}c(ra,"getAlignmentAxis");function Kf(n,e,t){t===void 0&&(t=!1);const r=De(n),i=ra(n),s=na(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=hs(o)),[o,hs(o)]}c(Kf,"getAlignmentSides");function ck(n){const e=hs(n);return[fs(n),e,fs(e)]}c(ck,"getExpandedPlacements");function fs(n){return n.replace(/start|end/g,e=>lk[e])}c(fs,"getOppositeAlignmentPlacement");const fu=["left","right"],hu=["right","left"],uk=["top","bottom"],dk=["bottom","top"];function fk(n,e,t){switch(n){case"top":case"bottom":return t?e?hu:fu:e?fu:hu;case"left":case"right":return e?uk:dk;default:return[]}}c(fk,"getSideList");function hk(n,e,t,r){const i=De(n);let s=fk(Ne(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(fs)))),s}c(hk,"getOppositeAxisPlacements");function hs(n){return n.replace(/left|right|bottom|top/g,e=>ok[e])}c(hs,"getOppositePlacement");function pk(n){return{top:0,right:0,bottom:0,left:0,...n}}c(pk,"expandPaddingObject");function ia(n){return typeof n!="number"?pk(n):{top:n,right:n,bottom:n,left:n}}c(ia,"getPaddingObject");function Gn(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}c(Gn,"rectToClientRect");function pu(n,e,t){let{reference:r,floating:i}=n;const s=Ue(e),o=ra(e),l=na(o),a=Ne(e),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(De(e)){case"start":p[o]-=h*(t&&u?-1:1);break;case"end":p[o]+=h*(t&&u?-1:1);break}return p}c(pu,"computeCoordsFromPlacement");const mk=c(async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:f}=pu(u,r,a),h=r,p={},m=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x:k,y:x,data:M,reset:w}=await b({x:d,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:o,elements:{reference:n,floating:e}});d=k??d,f=x??f,p={...p,[y]:{...p[y],...M}},w&&m<=50&&(m++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(u=w.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):w.rects),{x:d,y:f}=pu(u,h,a)),g=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}},"computePosition$1");async function Yn(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=ut(e,n),m=ia(p),y=l[h?f==="floating"?"reference":"floating":f],b=Gn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:a})),k=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},w=Gn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:x,strategy:a}):k);return{top:(b.top-w.top+m.top)/M.y,bottom:(w.bottom-b.bottom+m.bottom)/M.y,left:(b.left-w.left+m.left)/M.x,right:(w.right-b.right+m.right)/M.x}}c(Yn,"detectOverflow");const gk=c(n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:a}=e,{element:u,padding:d=0}=ut(n,e)||{};if(u==null)return{};const f=ia(d),h={x:t,y:r},p=ra(i),m=na(p),g=await o.getDimensions(u),y=p==="y",b=y?"top":"left",k=y?"bottom":"right",x=y?"clientHeight":"clientWidth",M=s.reference[m]+s.reference[p]-h[p]-s.floating[m],w=h[p]-s.reference[p],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=E?E[x]:0;(!C||!await(o.isElement==null?void 0:o.isElement(E)))&&(C=l.floating[x]||s.floating[m]);const A=M/2-w/2,D=C/2-g[m]/2-1,R=_e(f[b],D),V=_e(f[k],D),W=R,_=C-g[m]-V,B=C/2-g[m]/2+A,F=cl(W,B,_),X=!a.arrow&&De(i)!=null&&B!==F&&s.reference[m]/2-(B<W?R:V)-g[m]/2<0,Q=X?B<W?B-W:B-_:0;return{[p]:h[p]+Q,data:{[p]:F,centerOffset:B-F-Q,...X&&{alignmentOffset:Q}},reset:X}}}),"arrow$2");function yk(n,e,t){return(n?[...t.filter(i=>De(i)===n),...t.filter(i=>De(i)!==n)]:t.filter(i=>Ne(i)===i)).filter(i=>n?De(i)===n||(e?fs(i)!==i:!1):!0)}c(yk,"getPlacementList");const bk=c(function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:s,middlewareData:o,placement:l,platform:a,elements:u}=e,{crossAxis:d=!1,alignment:f,allowedPlacements:h=du,autoAlignment:p=!0,...m}=ut(n,e),g=f!==void 0||h===du?yk(f||null,p,h):h,y=await Yn(e,m),b=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[b];if(k==null)return{};const x=Kf(k,s,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==k)return{reset:{placement:g[0]}};const M=[y[Ne(k)],y[x[0]],y[x[1]]],w=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:M}],E=g[b+1];if(E)return{data:{index:b+1,overflows:w},reset:{placement:E}};const C=w.map(R=>{const V=De(R.placement);return[R.placement,V&&d?R.overflows.slice(0,2).reduce((W,_)=>W+_,0):R.overflows[0],R.overflows]}).sort((R,V)=>R[1]-V[1]),D=((i=C.filter(R=>R[2].slice(0,De(R[0])?2:3).every(V=>V<=0))[0])==null?void 0:i[0])||C[0][0];return D!==l?{data:{index:b+1,overflows:w},reset:{placement:D}}:{}}}},"autoPlacement$1"),kk=c(function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=ut(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=Ne(i),k=Ue(l),x=Ne(l)===l,M=await(a.isRTL==null?void 0:a.isRTL(u.floating)),w=h||(x||!g?[hs(l)]:ck(l)),E=m!=="none";!h&&E&&w.push(...hk(l,g,m,M));const C=[l,...w],A=await Yn(e,y),D=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(A[b]),f){const B=Kf(i,o,M);D.push(A[B[0]],A[B[1]])}if(R=[...R,{placement:i,overflows:D}],!D.every(B=>B<=0)){var V,W;const B=(((V=s.flip)==null?void 0:V.index)||0)+1,F=C[B];if(F&&(!(f==="alignment"?k!==Ue(F):!1)||R.every(be=>Ue(be.placement)===k?be.overflows[0]>0:!0)))return{data:{index:B,overflows:R},reset:{placement:F}};let X=(W=R.filter(Q=>Q.overflows[0]<=0).sort((Q,be)=>Q.overflows[1]-be.overflows[1])[0])==null?void 0:W.placement;if(!X)switch(p){case"bestFit":{var _;const Q=(_=R.filter(be=>{if(E){const ft=Ue(be.placement);return ft===k||ft==="y"}return!0}).map(be=>[be.placement,be.overflows.filter(ft=>ft>0).reduce((ft,yh)=>ft+yh,0)]).sort((be,ft)=>be[1]-ft[1])[0])==null?void 0:_[0];Q&&(X=Q);break}case"initialPlacement":X=l;break}if(i!==X)return{reset:{placement:X}}}return{}}}},"flip$1");function mu(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}c(mu,"getSideOffsets");function gu(n){return Uf.some(e=>n[e]>=0)}c(gu,"isAnySideFullyClipped");const wk=c(function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=ut(n,e);switch(r){case"referenceHidden":{const s=await Yn(e,{...i,elementContext:"reference"}),o=mu(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:gu(o)}}}case"escaped":{const s=await Yn(e,{...i,altBoundary:!0}),o=mu(s,t.floating);return{data:{escapedOffsets:o,escaped:gu(o)}}}default:return{}}}}},"hide$1");function qf(n){const e=_e(...n.map(s=>s.left)),t=_e(...n.map(s=>s.top)),r=de(...n.map(s=>s.right)),i=de(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}c(qf,"getBoundingRect");function xk(n){const e=n.slice().sort((i,s)=>i.y-s.y),t=[];let r=null;for(let i=0;i<e.length;i++){const s=e[i];!r||s.y-r.y>r.height/2?t.push([s]):t[t.length-1].push(s),r=s}return t.map(i=>Gn(qf(i)))}c(xk,"getRectsByLine");const Sk=c(function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:s,strategy:o}=e,{padding:l=2,x:a,y:u}=ut(n,e),d=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),f=xk(d),h=Gn(qf(d)),p=ia(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&u!=null)return f.find(y=>a>y.left-p.left&&a<y.right+p.right&&u>y.top-p.top&&u<y.bottom+p.bottom)||h;if(f.length>=2){if(Ue(t)==="y"){const R=f[0],V=f[f.length-1],W=Ne(t)==="top",_=R.top,B=V.bottom,F=W?R.left:V.left,X=W?R.right:V.right,Q=X-F,be=B-_;return{top:_,bottom:B,left:F,right:X,width:Q,height:be,x:F,y:_}}const y=Ne(t)==="left",b=de(...f.map(R=>R.right)),k=_e(...f.map(R=>R.left)),x=f.filter(R=>y?R.left===k:R.right===b),M=x[0].top,w=x[x.length-1].bottom,E=k,C=b,A=C-E,D=w-M;return{top:M,bottom:w,left:E,right:C,width:A,height:D,x:E,y:M}}return h}c(m,"getBoundingClientRect");const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},"inline$1"),vk=new Set(["left","top"]);async function Ck(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ne(t),l=De(t),a=Ue(t)==="y",u=vk.has(o)?-1:1,d=s&&a?-1:1,f=ut(e,n);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),a?{x:p*d,y:h*u}:{x:h*u,y:p*d}}c(Ck,"convertValueToCoords");const Mk=c(function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await Ck(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},"offset$1"),Tk=c(function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:c(y=>{let{x:b,y:k}=y;return{x:b,y:k}},"fn")},...a}=ut(n,e),u={x:t,y:r},d=await Yn(e,a),f=Ue(Ne(i)),h=Wf(f);let p=u[h],m=u[f];if(s){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",k=p+d[y],x=p-d[b];p=cl(k,p,x)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=m+d[y],x=m-d[b];m=cl(k,m,x)}const g=l.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[h]:s,[f]:o}}}}}},"shift$1"),Ek=c(function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:a=c(()=>{},"apply"),...u}=ut(n,e),d=await Yn(e,u),f=Ne(i),h=De(i),p=Ue(i)==="y",{width:m,height:g}=s.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const k=g-d.top-d.bottom,x=m-d.left-d.right,M=_e(g-d[y],k),w=_e(m-d[b],x),E=!e.middlewareData.shift;let C=M,A=w;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(A=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=k),E&&!h){const R=de(d.left,0),V=de(d.right,0),W=de(d.top,0),_=de(d.bottom,0);p?A=m-2*(R!==0||V!==0?R+V:de(d.left,d.right)):C=g-2*(W!==0||_!==0?W+_:de(d.top,d.bottom))}await a({...e,availableWidth:A,availableHeight:C});const D=await o.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}},"size$1");function Bs(){return typeof window<"u"}c(Bs,"hasWindow");function Zn(n){return Jf(n)?(n.nodeName||"").toLowerCase():"#document"}c(Zn,"getNodeName");function ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}c(ke,"getWindow");function dt(n){var e;return(e=(Jf(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}c(dt,"getDocumentElement");function Jf(n){return Bs()?n instanceof Node||n instanceof ke(n).Node:!1}c(Jf,"isNode");function Le(n){return Bs()?n instanceof Element||n instanceof ke(n).Element:!1}c(Le,"isElement");function Ge(n){return Bs()?n instanceof HTMLElement||n instanceof ke(n).HTMLElement:!1}c(Ge,"isHTMLElement");function yu(n){return!Bs()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ke(n).ShadowRoot}c(yu,"isShadowRoot");const Ok=new Set(["inline","contents"]);function jr(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Pe(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Ok.has(i)}c(jr,"isOverflowElement");const Ak=new Set(["table","td","th"]);function Nk(n){return Ak.has(Zn(n))}c(Nk,"isTableElement");const Ik=[":popover-open",":modal"];function zs(n){return Ik.some(e=>{try{return n.matches(e)}catch{return!1}})}c(zs,"isTopLayer");const Rk=["transform","translate","scale","rotate","perspective"],Dk=["transform","translate","scale","rotate","perspective","filter"],Lk=["paint","layout","strict","content"];function sa(n){const e=oa(),t=Le(n)?Pe(n):n;return Rk.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Dk.some(r=>(t.willChange||"").includes(r))||Lk.some(r=>(t.contain||"").includes(r))}c(sa,"isContainingBlock");function Pk(n){let e=It(n);for(;Ge(e)&&!Xn(e);){if(sa(e))return e;if(zs(e))return null;e=It(e)}return null}c(Pk,"getContainingBlock");function oa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}c(oa,"isWebKit");const Bk=new Set(["html","body","#document"]);function Xn(n){return Bk.has(Zn(n))}c(Xn,"isLastTraversableNode");function Pe(n){return ke(n).getComputedStyle(n)}c(Pe,"getComputedStyle$1");function $s(n){return Le(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}c($s,"getNodeScroll");function It(n){if(Zn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||yu(n)&&n.host||dt(n);return yu(e)?e.host:e}c(It,"getParentNode");function _f(n){const e=It(n);return Xn(e)?n.ownerDocument?n.ownerDocument.body:n.body:Ge(e)&&jr(e)?e:_f(e)}c(_f,"getNearestOverflowAncestor");function Gf(n,e,t){var r;e===void 0&&(e=[]);const i=_f(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=ke(i);return s?(ul(o),e.concat(o,o.visualViewport||[],jr(i)?i:[],[])):e.concat(i,Gf(i,[]))}c(Gf,"getOverflowAncestors");function ul(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}c(ul,"getFrameElement");function Yf(n){const e=Pe(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ge(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=ds(t)!==s||ds(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}c(Yf,"getCssDimensions");function Xf(n){return Le(n)?n:n.contextElement}c(Xf,"unwrapElement");function Mn(n){const e=Xf(n);if(!Ge(e))return We(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Yf(e);let o=(s?ds(t.width):t.width)/r,l=(s?ds(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}c(Mn,"getScale");const zk=We(0);function Qf(n){const e=ke(n);return!oa()||!e.visualViewport?zk:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}c(Qf,"getVisualOffsets");function $k(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==ke(n)?!1:e}c($k,"shouldAddVisualOffsets");function zr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=Xf(n);let o=We(1);e&&(r?Le(r)&&(o=Mn(r)):o=Mn(n));const l=$k(s,t,r)?Qf(s):We(0);let a=(i.left+l.x)/o.x,u=(i.top+l.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(s){const h=ke(s),p=r&&Le(r)?ke(r):r;let m=h,g=ul(m);for(;g&&r&&p!==m;){const y=Mn(g),b=g.getBoundingClientRect(),k=Pe(g),x=b.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,M=b.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,u*=y.y,d*=y.x,f*=y.y,a+=x,u+=M,m=ke(g),g=ul(m)}}return Gn({width:d,height:f,x:a,y:u})}c(zr,"getBoundingClientRect");function Fs(n,e){const t=$s(n).scrollLeft;return e?e.left+t:zr(dt(n)).left+t}c(Fs,"getWindowScrollBarX");function Zf(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-Fs(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}c(Zf,"getHTMLOffset");function Fk(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=dt(r),l=e?zs(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},u=We(1);const d=We(0),f=Ge(r);if((f||!f&&!s)&&((Zn(r)!=="body"||jr(o))&&(a=$s(r)),Ge(r))){const p=zr(r);u=Mn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=o&&!f&&!s?Zf(o,a):We(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+d.x+h.x,y:t.y*u.y-a.scrollTop*u.y+d.y+h.y}}c(Fk,"convertOffsetParentRelativeRectToViewportRelativeRect");function Hk(n){return Array.from(n.getClientRects())}c(Hk,"getClientRects");function Vk(n){const e=dt(n),t=$s(n),r=n.ownerDocument.body,i=de(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=de(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Fs(n);const l=-t.scrollTop;return Pe(r).direction==="rtl"&&(o+=de(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}c(Vk,"getDocumentRect");const bu=25;function jk(n,e){const t=ke(n),r=dt(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const d=oa();(!d||d&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const u=Fs(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=bu&&(s-=m)}else u<=bu&&(s+=u);return{width:s,height:o,x:l,y:a}}c(jk,"getViewportRect");const Uk=new Set(["absolute","fixed"]);function Wk(n,e){const t=zr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Ge(n)?Mn(n):We(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,u=r*s.y;return{width:o,height:l,x:a,y:u}}c(Wk,"getInnerBoundingClientRect");function ku(n,e,t){let r;if(e==="viewport")r=jk(n,t);else if(e==="document")r=Vk(dt(n));else if(Le(e))r=Wk(e,t);else{const i=Qf(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Gn(r)}c(ku,"getClientRectFromClippingAncestor");function eh(n,e){const t=It(n);return t===e||!Le(t)||Xn(t)?!1:Pe(t).position==="fixed"||eh(t,e)}c(eh,"hasFixedPositionAncestor");function Kk(n,e){const t=e.get(n);if(t)return t;let r=Gf(n,[]).filter(l=>Le(l)&&Zn(l)!=="body"),i=null;const s=Pe(n).position==="fixed";let o=s?It(n):n;for(;Le(o)&&!Xn(o);){const l=Pe(o),a=sa(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&Uk.has(i.position)||jr(o)&&!a&&eh(n,o))?r=r.filter(d=>d!==o):i=l,o=It(o)}return e.set(n,r),r}c(Kk,"getClippingElementAncestors");function qk(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?zs(e)?[]:Kk(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((u,d)=>{const f=ku(e,d,i);return u.top=de(f.top,u.top),u.right=_e(f.right,u.right),u.bottom=_e(f.bottom,u.bottom),u.left=de(f.left,u.left),u},ku(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}c(qk,"getClippingRect");function Jk(n){const{width:e,height:t}=Yf(n);return{width:e,height:t}}c(Jk,"getDimensions");function _k(n,e,t){const r=Ge(e),i=dt(e),s=t==="fixed",o=zr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=We(0);function u(){a.x=Fs(i)}if(c(u,"setLeftRTLScrollbarOffset"),r||!r&&!s)if((Zn(e)!=="body"||jr(i))&&(l=$s(e)),r){const p=zr(e,!0,s,e);a.x=p.x+e.clientLeft,a.y=p.y+e.clientTop}else i&&u();s&&!r&&i&&u();const d=i&&!r&&!s?Zf(i,l):We(0),f=o.left+l.scrollLeft-a.x-d.x,h=o.top+l.scrollTop-a.y-d.y;return{x:f,y:h,width:o.width,height:o.height}}c(_k,"getRectRelativeToOffsetParent");function go(n){return Pe(n).position==="static"}c(go,"isStaticPositioned");function wu(n,e){if(!Ge(n)||Pe(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return dt(n)===t&&(t=t.ownerDocument.body),t}c(wu,"getTrueOffsetParent");function th(n,e){const t=ke(n);if(zs(n))return t;if(!Ge(n)){let i=It(n);for(;i&&!Xn(i);){if(Le(i)&&!go(i))return i;i=It(i)}return t}let r=wu(n,e);for(;r&&Nk(r)&&go(r);)r=wu(r,e);return r&&Xn(r)&&go(r)&&!sa(r)?t:r||Pk(n)||t}c(th,"getOffsetParent");const Gk=c(async function(n){const e=this.getOffsetParent||th,t=this.getDimensions,r=await t(n.floating);return{reference:_k(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},"getElementRects");function Yk(n){return Pe(n).direction==="rtl"}c(Yk,"isRTL");const Xk={convertOffsetParentRelativeRectToViewportRelativeRect:Fk,getDocumentElement:dt,getClippingRect:qk,getOffsetParent:th,getElementRects:Gk,getClientRects:Hk,getDimensions:Jk,getScale:Mn,isElement:Le,isRTL:Yk},nh=Mk,rh=bk,ih=Tk,sh=kk,oh=Ek,lh=wk,ah=gk,ch=Sk,uh=c((n,e,t)=>{const r=new Map,i={platform:Xk,...t},s={...i.platform,_c:r};return mk(n,e,{...i,platform:s})},"computePosition");var dl,fl;if(typeof WeakMap<"u"){let n=new WeakMap;dl=c(e=>n.get(e),"readFromCache"),fl=c((e,t)=>(n.set(e,t),t),"addToCache")}else{const n=[];let t=0;dl=c(r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},"readFromCache"),fl=c((r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i),"addToCache")}var Pn,rt=(Pn=class{constructor(e,t,r,i){this.width=e,this.height=t,this.map=r,this.problems=i}findCell(e){for(let t=0;t<this.map.length;t++){const r=this.map[t];if(r!=e)continue;const i=t%this.width,s=t/this.width|0;let o=i+1,l=s+1;for(let a=1;o<this.width&&this.map[t+a]==r;a++)o++;for(let a=1;l<this.height&&this.map[t+this.width*a]==r;a++)l++;return{left:i,top:s,right:o,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){const{left:i,right:s,top:o,bottom:l}=this.findCell(e);return t=="horiz"?(r<0?i==0:s==this.width)?null:this.map[o*this.width+(r<0?i-1:s)]:(r<0?o==0:l==this.height)?null:this.map[i+this.width*(r<0?o-1:l)]}rectBetween(e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(e),{left:l,right:a,top:u,bottom:d}=this.findCell(t);return{left:Math.min(r,l),top:Math.min(s,u),right:Math.max(i,a),bottom:Math.max(o,d)}}cellsInRect(e){const t=[],r={};for(let i=e.top;i<e.bottom;i++)for(let s=e.left;s<e.right;s++){const o=i*this.width+s,l=this.map[o];r[l]||(r[l]=!0,!(s==e.left&&s&&this.map[o-1]==l||i==e.top&&i&&this.map[o-this.width]==l)&&t.push(l))}return t}positionAt(e,t,r){for(let i=0,s=0;;i++){const o=s+r.child(i).nodeSize;if(i==e){let l=t+e*this.width;const a=(e+1)*this.width;for(;l<a&&this.map[l]<s;)l++;return l==a?o-1:this.map[l]}s=o}}static get(e){return dl(e)||fl(e,Qk(e))}},c(Pn,"TableMap"),Pn);function Qk(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Zk(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,d=e*t;u<d;u++)r[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;i<r.length&&r[i]!=0;)i++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let x=0;x<b;x++){if(x+u>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:b-x});break}const M=i+x*e;for(let w=0;w<y;w++){r[M+w]==0?r[M+w]=d:(s||(s=[])).push({type:"collision",row:u,pos:d,n:y-w});const E=k&&k[w];if(E){const C=(M+w)%e*2,A=o[C];A==null||A!=E&&o[C+1]==1?(o[C]=E,o[C+1]=1):A==E&&o[C+1]++}}}i+=y,d+=g.nodeSize}const h=(u+1)*e;let p=0;for(;i<h;)r[i++]==0&&p++;p&&(s||(s=[])).push({type:"missing",row:u,n:p}),d++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new rt(e,t,r,s);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<t&&(a=!0);return a&&e1(l,o,n),l}c(Qk,"computeMap");function Zk(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}c(Zk,"findWidth");function e1(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const d=(i+u)%n.width,f=e[d*2];f!=null&&(!a.colwidth||a.colwidth[u]!=f)&&((l||(l=t1(a)))[u]=f)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}c(e1,"findBadColWidths");function t1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}c(t1,"freshColWidth");function la(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}c(la,"tableNodeTypes");new U("selectingCells");function n1(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}c(n1,"cellAround");function dh(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}c(dh,"isInTable");function r1(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=n1(e.$head)||i1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}c(r1,"selectionCell");function i1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}c(i1,"cellNear");function xu(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}c(xu,"pointsAtCell");function fh(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}c(fh,"inSameTable");function hh(n,e,t){const r=n.node(-1),i=rt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}c(hh,"nextCell");function Su(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}c(Su,"removeColSpan");var me,Ke=(me=class extends I{constructor(e,t=e){const r=e.node(-1),i=rt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const u=a.map(d=>{const f=r.nodeAt(d);if(!f)throw RangeError(`No cell with offset ${d} found`);const h=s+d+1;return new ki(l.resolve(h),l.resolve(h+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(xu(r)&&xu(i)&&fh(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?me.rowSelection(r,i):s&&this.isColSelection()?me.colSelection(r,i):new me(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=rt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const u=[];for(let d=a*t.width+i.left,f=i.left;f<i.right;f++,d++){const h=t.map[d];if(s[h])continue;s[h]=!0;const p=t.findCell(h);let m=e.nodeAt(h);if(!m)throw RangeError(`No cell with offset ${h} found`);const g=i.left-p.left,y=p.right-i.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Su(b,0,g)),y>0&&(b=Su(b,b.colspan-y,y)),p.left<i.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<i.top||p.bottom>i.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}o.push(e.child(a).copy(v.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new T(v.from(l),1,1)}replace(e,t=T.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(a.pos),o?T.empty:t)}const s=I.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new T(v.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=rt.get(t),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;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.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&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=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 me(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=rt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.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)==t.width}eq(e){return e instanceof me&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.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&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=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 me(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new me(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new me(e.resolve(t),e.resolve(r))}getBookmark(){return new s1(this.$anchorCell.pos,this.$headCell.pos)}},c(me,"_CellSelection"),me);Ke.prototype.visible=!1;I.jsonID("cell",Ke);var on,s1=(on=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new on(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&fh(t,r)?new Ke(t,r):I.near(r,1)}},c(on,"_CellBookmark"),on);new U("fix-tables");function ph(n){const e=n.selection,t=r1(n),r=t.node(-1),i=t.start(-1),s=rt.get(r);return{...e instanceof Ke?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}c(ph,"selectedRect");function o1(n){return function(e,t){if(!dh(e))return!1;if(t){const r=la(e.schema),i=ph(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=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);t(s)}return!0}}c(o1,"deprecated_toggleHeader");function vu(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}c(vu,"isHeaderEnabledByType");function aa(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?o1(n):function(t,r){if(!dh(t))return!1;if(r){const i=la(t.schema),s=ph(t),o=t.tr,l=vu("row",s,i),a=vu("column",s,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,f=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,h=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(f).forEach(p=>{const m=p+s.tableStart,g=o.doc.nodeAt(m);g&&o.setNodeMarkup(m,h,g.attrs)}),r(o)}return!0}}c(aa,"toggleHeader");aa("row",{useDeprecatedLogic:!0});aa("column",{useDeprecatedLogic:!0});aa("cell",{useDeprecatedLogic:!0});function ei(n,e){const t=n.selection;if(!(t instanceof Ke))return!1;if(e){const r=n.tr,i=la(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new T(i,0,0))}),r.docChanged&&e(r)}return!0}c(ei,"deleteCellSelection");Nl({ArrowLeft:ti("horiz",-1),ArrowRight:ti("horiz",1),ArrowUp:ti("vert",-1),ArrowDown:ti("vert",1),"Shift-ArrowLeft":ni("horiz",-1),"Shift-ArrowRight":ni("horiz",1),"Shift-ArrowUp":ni("vert",-1),"Shift-ArrowDown":ni("vert",1),Backspace:ei,"Mod-Backspace":ei,Delete:ei,"Mod-Delete":ei});function ai(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}c(ai,"maybeSetSelection");function ti(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof Ke)return ai(t,r,I.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=mh(i,n,e);if(o==null)return!1;if(n=="horiz")return ai(t,r,I.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=hh(l,n,e);let u;return a?u=I.near(a,1):e<0?u=I.near(t.doc.resolve(l.before(-1)),-1):u=I.near(t.doc.resolve(l.after(-1)),1),ai(t,r,u)}}}c(ti,"arrow");function ni(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof Ke)o=s;else{const a=mh(i,n,e);if(a==null)return!1;o=new Ke(t.doc.resolve(a))}const l=hh(o.$headCell,n,e);return l?ai(t,r,new Ke(o.$anchorCell,l)):!1}}c(ni,"shiftArrow");function mh(n,e,t){if(!(n.state.selection instanceof L))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}c(mh,"atEndOfCell");new U("tableColumnResizing");function l1(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,l=r-t,a=i,u=t;return new DOMRect(a,u,o,l)}c(l1,"combineDOMRects");var Bn,a1=(Bn=class{constructor({editor:e,element:t,view:r,updateDelay:i=250,resizeDelay:s=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:a,options:u}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:f,state:h,from:p,to:m})=>{const{doc:g,selection:y}=h,{empty:b}=y,k=!g.textBetween(p,m).length&&Ll(h.selection),x=this.element.contains(document.activeElement);return!(!(f.hasFocus()||x)||b||k||!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:f})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}f?.relatedTarget&&((h=this.element.parentNode)!=null&&h.contains(f.relatedTarget))||f?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(f,h)=>{const p=!h?.selection.eq(f.state.selection),m=!h?.doc.eq(f.state.doc);!p&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(f,p,m,h)},this.updateDelay))},this.updateHandler=(f,h,p,m)=>{const{composing:g}=f;if(g||!h&&!p)return;if(!this.getShouldShow(m)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:f})=>{f.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var d;this.editor=e,this.element=t,this.view=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=(d=u?.scrollTarget)!=null?d:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...u},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(r,r.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(sh(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(ih(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(nh(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(ah(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(oh(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(rh(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(lh(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(ch(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e;const{selection:t}=this.editor.state,r=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(r)return r;const i=Vl(this.view,t.from,t.to);let s={getBoundingClientRect:c(()=>i,"getBoundingClientRect"),getClientRects:c(()=>[i],"getClientRects")};if(t instanceof N){let o=this.view.nodeDOM(t.from);const l=o.dataset.nodeViewWrapper?o:o.querySelector("[data-node-view-wrapper]");l&&(o=l),o&&(s={getBoundingClientRect:c(()=>o.getBoundingClientRect(),"getBoundingClientRect"),getClientRects:c(()=>[o.getBoundingClientRect()],"getClientRects")})}if(t instanceof Ke){const{$anchorCell:o,$headCell:l}=t,a=o?o.pos:l.pos,u=l?l.pos:o.pos,d=this.view.nodeDOM(a),f=this.view.nodeDOM(u);if(!d||!f)return;const h=d===f?d.getBoundingClientRect():l1(d.getBoundingClientRect(),f.getBoundingClientRect());s={getBoundingClientRect:c(()=>h,"getBoundingClientRect"),getClientRects:c(()=>[h],"getClientRects")}}return s}updatePosition(){const e=this.virtualElement;e&&uh(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:r,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${t}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,s,o,t)}getShouldShow(e){var t;const{state:r}=this.view,{selection:i}=r,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:r,oldState:e,from:o,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.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}),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()}},c(Bn,"BubbleMenuView"),Bn),gh=c(n=>new H({key:typeof n.pluginKey=="string"?new U(n.pluginKey):n.pluginKey,view:c(e=>new a1({view:e,...n}),"view")}),"BubbleMenuPlugin");J.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[gh({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 c1=Cu({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:c(()=>({}),"default")},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=document.createElement("div");return Mh(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}=n;r.style.visibility="hidden",r.style.position="absolute",r.remove(),Tu(()=>{i.registerPlugin(gh({editor:i,element:r,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}))})}),Mu(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return yo(Th,{to:r},yo("div",{...t,ref:"root"},(i=e.default)==null?void 0:i.call(e)))}}}),zn,u1=(zn=class{constructor({editor:e,element:t,view:r,options:i,appendTo:s,shouldShow:o}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:l,state:a})=>{const{selection:u}=a,{$anchor:d,empty:f}=u,h=d.depth===1,p=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent&&d.parent.childCount===0&&!this.getTextContent(d.parent);return!(!l.hasFocus()||!f||!h||!p||!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=(l,a,u,d)=>{const{composing:f}=l;if(f||!a&&!u)return;if(!this.getShouldShow(d)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=e,this.element=t,this.view=r,this.appendTo=s,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(r,r.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return rf(e,{textSerializers:Fl(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(sh(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(ih(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(nh(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(ah(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(oh(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(rh(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(lh(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(ch(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:r}=this.view,{selection:i}=r,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:r,oldState:e,from:o,to:l})}updatePosition(){const{selection:e}=this.editor.state,t=Vl(this.view,e.from,e.to);uh({getBoundingClientRect:c(()=>t,"getBoundingClientRect"),getClientRects:c(()=>[t],"getClientRects")},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:i,y:s,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${i}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const r=!t?.selection.eq(e.state.selection),i=!t?.doc.eq(e.state.doc);this.updateHandler(e,r,i,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.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}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},c(zn,"FloatingMenuView"),zn),d1=c(n=>new H({key:typeof n.pluginKey=="string"?new U(n.pluginKey):n.pluginKey,view:c(e=>new u1({view:e,...n}),"view")}),"FloatingMenuPlugin");J.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[d1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var f1=Zb,h1=Object.defineProperty,p1=Object.getOwnPropertyDescriptor,Ur=c((n,e,t,r)=>{for(var i=r>1?void 0:r?p1(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&h1(e,t,i),i},"__decorateClass"),$n;let hn=($n=class extends Bh{defaultButtonsTheme="pink";activeButtonsTheme="purple";placeholder="";components={EditorContent:sk,BubbleMenu:c1,VSTButton:Oh,VSTStringField:Eh,NoSymbolIcon:zh};editor=void 0;isEditable=!0;showMenu=!0;vstTextId="";showLinkModal=!1;linkUrl="";beforeMount(){this.vstTextId=`vst-text-field-${this.VST.generateRandomKey()}`}mounted(){this.editor=new ik({extensions:[rk,f1.configure({placeholder:this.placeholder?this.placeholder:"Введите текст"})]}),this.editor.commands.setContent(this.value=`
|
|
139
|
-
Hey, try ***to*** select *some* text <b>here</b>. There will https://smartrus.org a menu for selecting some inline styles. Remember: you have full control about content and styling of this menu.
|
|
140
|
-
<li>Select any item to display a global menu</li>
|
|
141
|
-
<li>Item 1</li>
|
|
142
|
-
<li>Item 2</li>
|
|
143
|
-
<li>Item 3</li>
|
|
144
|
-
<li>Item 4</li>
|
|
145
|
-
`)}addLink(){this.editor.chain().focus().setLink({href:this.linkUrl}).run(),this.showLinkModal=!1,this.linkUrl=""}beforeUnmount(){}getListVirtualElement(){const e=this.editor,t=Hr(r=>r.type.name==="bulletList"||r.type.name==="orderedList")(e.state.selection);if(t){const r=Vl(e.view,t.start,t.start+t.node.nodeSize);return{getBoundingClientRect:c(()=>r,"getBoundingClientRect"),getClientRects:c(()=>[r],"getClientRects")}}return null}toggleListType(){const e=this.editor,t=e.chain().focus();e.isActive("bulletList")?t.toggleOrderedList():t.toggleBulletList(),t.run()}_isEditableWatch(e){this.editor.setEditable(e)}},c($n,"TextField"),$n);Ur([hl(String)],hn.prototype,"defaultButtonsTheme",2);Ur([hl(String)],hn.prototype,"activeButtonsTheme",2);Ur([hl(String)],hn.prototype,"placeholder",2);Ur([Ah("isEditable")],hn.prototype,"_isEditableWatch",1);hn=Ur([Nh],hn);const m1=["id"],g1={class:"bubble-menu"};function y1(n,e,t,r,i,s){const o=er("VSTButton"),l=er("BubbleMenu"),a=er("EditorContent"),u=er("NoSymbolIcon"),d=er("VSTStringField");return tr(),Hs("div",{class:"vst-field-editor container relative",id:n.vstTextId},[n.editor&&n.showMenu?(tr(),ja(l,{key:0,class:"bubble-menu",editor:n.editor,options:{placement:"bottom",offset:8}},{default:Be(()=>[K("div",g1,[Se(o,{theme:n.editor.isActive("bold")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[0]||(e[0]=f=>n.editor.chain().focus().toggleBold().run())},{default:Be(()=>[K("div",{class:Ye(["h18px mt-0",{"fw-bold":n.editor.isActive("bold")}])},"B",2)]),_:1},8,["theme"]),Se(o,{theme:n.editor.isActive("italic")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[1]||(e[1]=f=>n.editor.chain().focus().toggleItalic().run())},{default:Be(()=>[K("div",{class:Ye(["h18px mt-0",{italic:n.editor.isActive("italic")}])},"I",2)]),_:1},8,["theme"]),Se(o,{theme:n.editor.isActive("underline")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[2]||(e[2]=f=>n.editor.chain().focus().toggleUnderline().run())},{default:Be(()=>[K("div",{class:Ye(["h18px mt-0",{underline:n.editor.isActive("underline")}])},"U",2)]),_:1},8,["theme"]),Se(o,{onClick:e[3]||(e[3]=f=>n.showLinkModal=!0)},{default:Be(()=>[...e[13]||(e[13]=[js("Link",-1)])]),_:1}),Se(o,{class:"p-0",theme:n.editor.isActive("strike")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[4]||(e[4]=f=>n.editor.chain().focus().toggleStrike().run())},{default:Be(()=>[K("div",{class:Ye(["h18px mt-0",{italic:n.editor.isActive("strike")}]),style:Ih({textDecoration:n.editor.isActive("strike")?"line-through":void 0,textDecorationColor:n.editor.isActive("strike")?"#fff":void 0})},"S",6)]),_:1},8,["theme"]),Se(o,{theme:n.editor.isActive("bulletList")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[5]||(e[5]=f=>n.editor.chain().focus().toggleBulletList().run()),class:Ye({"fw-bold!":n.editor.isActive("bulletList")})},{default:Be(()=>[...e[14]||(e[14]=[K("svg",{class:"icon icon-tabler icons-tabler-outline icon-tabler-list fs-1rem",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[K("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),K("path",{d:"M9 6l11 0"}),K("path",{d:"M9 12l11 0"}),K("path",{d:"M9 18l11 0"}),K("path",{d:"M5 6l0 .01"}),K("path",{d:"M5 12l0 .01"}),K("path",{d:"M5 18l0 .01"})],-1)])]),_:1},8,["theme","class"]),Se(o,{theme:n.editor.isActive("orderedList")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[6]||(e[6]=f=>n.editor.chain().focus().toggleOrderedList().run()),class:Ye({"fw-bold!":n.editor.isActive("orderedList"),"text-white! fill-white! stroke-white!":!0})},{default:Be(()=>[...e[15]||(e[15]=[K("svg",{class:"icon icon-tabler icons-tabler-outline icon-tabler-list-numbers fs-1rem",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[K("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),K("path",{d:"M11 6h9",stroke:"currentColor",fill:"none"}),K("path",{d:"M11 12h9",stroke:"currentColor",fill:"none"}),K("path",{d:"M12 18h8",stroke:"currentColor",fill:"none"}),K("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4",stroke:"currentColor",fill:"none"}),K("path",{d:"M6 10v-6l-2 2",stroke:"currentColor",fill:"none"})],-1)])]),_:1},8,["theme","class"]),Se(o,{onClick:e[7]||(e[7]=f=>n.editor.chain().focus().toggleHeading({level:1}).run()),class:Ye({"is-active":n.editor.isActive("heading",{level:1})})},{default:Be(()=>[...e[16]||(e[16]=[js("H1",-1)])]),_:1},8,["class"]),Se(o,{onClick:e[8]||(e[8]=f=>n.editor.chain().focus().toggleHeading({level:2}).run()),class:Ye({"is-active":n.editor.isActive("heading",{level:2})})},{default:Be(()=>[...e[17]||(e[17]=[js("H2",-1)])]),_:1},8,["class"])])]),_:1},8,["editor"])):Vs("",!0),Se(a,{editor:n.editor},null,8,["editor"]),!n.disabled&&n.value?(tr(),Hs("div",{key:1,class:Ye(["w25px h25px text-stone absolute t-10px r-12px z4 cursor-pointer hover:scale-130",{}])},[Se(u,{onClick:e[9]||(e[9]=f=>n._onInput(""))})])):Vs("",!0),n.showLinkModal?(tr(),Hs("div",{key:2,onClose:e[12]||(e[12]=f=>n.showLinkModal=!1)},[Rh(K("input",{"onUpdate:modelValue":e[10]||(e[10]=f=>n.linkUrl=f),placeholder:"URL"},null,512),[[Dh,n.linkUrl]]),K("button",{onClick:e[11]||(e[11]=(...f)=>n.addLink&&n.addLink(...f))},"Вставить ссылку")],32)):Vs("",!0),(tr(),ja(Lh("style"))),K("div",null,[Se(d,{inputValue:"Для ссылок, например"})])],8,m1)}c(y1,"render");const S1=Ph(hn,[["render",y1]]);export{S1 as default};
|