vue-spear-tip 0.2.11 → 0.2.13
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-CgV8TKSe.js → Button-AT1tkLRU.js} +1 -1
- package/dist/{Button-CHi5q2B8.cjs → Button-D8_z61Ku.cjs} +1 -1
- package/dist/{CodeHighlight-qlVamFnM.js → CodeHighlight-DyDayHRK.js} +1 -1
- package/dist/{CodeHighlight-DAFFU7u2.cjs → CodeHighlight-UMxs9Vkf.cjs} +1 -1
- package/dist/{DateField-D0Ilkfym.js → DateField-Bh8myc_m.js} +106 -109
- package/dist/{DateField-BQYZQsBb.cjs → DateField-C39--66z.cjs} +3 -3
- package/dist/{FieldComponent.vue_vue_type_script_lang-hfVg8AIM.js → FieldComponent.vue_vue_type_script_lang-ByNypXQJ.js} +1 -1
- package/dist/{FieldComponent.vue_vue_type_script_lang-C9JoaDDS.cjs → FieldComponent.vue_vue_type_script_lang-CKIGPh72.cjs} +1 -1
- package/dist/Interfaces/IVueClass.d.ts +1 -1
- package/dist/{SelectField-BXQn9OAW.js → SelectField-BYCLVi2Z.js} +2 -2
- package/dist/{SelectField-lpNn-0fg.cjs → SelectField-kLPwlp6_.cjs} +1 -1
- package/dist/{StringField-C9YQH_Va.cjs → StringField-LKU8BrFg.cjs} +1 -1
- package/dist/{StringField-BMGdDwHw.js → StringField-dhAukChr.js} +16 -15
- package/dist/SwitchField-B9X9s4oC.cjs +1 -0
- package/dist/{SwitchField-C2rvdoqS.js → SwitchField-Cx0ih-Pq.js} +18 -18
- package/dist/{Tabs-B76h25-X.js → Tabs-B9ceJt8G.js} +1 -1
- package/dist/{Tabs-BnfWPt_y.cjs → Tabs-CeC1C4GS.cjs} +1 -1
- package/dist/TextField-9rvZGnMh.js +24354 -0
- package/dist/TextField-DA1nC21o.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 +2 -1
- package/dist/{index-BhdXUlye.js → index-BYxsEEyC.js} +5 -5
- package/dist/{index-CWmP8TIW.cjs → index-Bx8MBlOo.cjs} +1 -1
- 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-Bunv2LWC.js → Button-Wcmhg4_A.js} +1 -1
- package/docs/static/{CodeHighlight-DQBcinnM.js → CodeHighlight-4bpHBQbZ.js} +1 -1
- package/docs/static/{DateField-CsIlYupR.js → DateField-Cmifejky.js} +2 -2
- package/docs/static/{FieldComponent.vue_vue_type_script_lang-CQ-4feGL.js → FieldComponent.vue_vue_type_script_lang-DNMlGnCe.js} +1 -1
- package/docs/static/{NoSymbolIcon-BbyqUoRs.js → NoSymbolIcon-joZpMvQg.js} +1 -1
- package/docs/static/{SelectField-CViiMPQ4.js → SelectField-uk0sMTaD.js} +1 -1
- package/docs/static/{StringField-FTm4hPIh.css → StringField-BJ5e1NcF.css} +1 -1
- package/docs/static/{StringField-CCJHJt0B.js → StringField-DeFFxwy7.js} +1 -1
- package/docs/static/SwitchField-Ct85pbvZ.css +1 -0
- package/docs/static/SwitchField-DUj2uIpj.js +1 -0
- package/docs/static/{Tabs-CtPaTerA.js → Tabs-CcgvVEoC.js} +1 -1
- package/docs/static/TextField-vLqdts6S.js +169 -0
- package/docs/static/_commonjsHelpers-CV2jkJYL.js +1 -0
- package/docs/static/index-BRwSOXEK.js +2 -0
- package/docs/static/{main-C0xMdd--.js → main-fCY1fm9G.js} +14 -3
- package/docs/static/main-kVqkj31w.css +1 -0
- package/package.json +1 -1
- package/dist/SwitchField-CaTcotfe.cjs +0 -1
- package/dist/TextField-BbNAxetT.cjs +0 -145
- package/dist/TextField-SGxKqPAt.js +0 -19557
- package/docs/static/SwitchField-DTAyMrZv.js +0 -1
- package/docs/static/SwitchField-igvaNnA4.css +0 -1
- package/docs/static/TextField--uApzzsN.js +0 -145
- package/docs/static/index-DVVP040D.js +0 -2
- package/docs/static/main-CKD4jD7A.css +0 -1
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";var oh=Object.defineProperty;var c=(n,e)=>oh(n,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vue"),rn=require("./index-CWmP8TIW.cjs"),lh=require("./FieldComponent.vue_vue_type_script_lang-C9JoaDDS.cjs"),ah=require("./NoSymbolIcon-BoH28Kep.cjs"),ch=require("./_plugin-vue_export-helper-BaHX9ZKS.cjs");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 pd(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=pd(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}c(pd,"findDiffStart");function md(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 d=0,u=Math.min(o.text.length,l.text.length);for(;d<u&&o.text[o.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let d=md(o.content,l.content,t-1,r-1);if(d)return d}t-=a,r-=a}}c(md,"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],d=l+a.nodeSize;if(d>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=d}}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 d=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&&d||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,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 pd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return md(this,e,t,r)}findIndex(e){if(e==0)return Vr(0,e);if(e==this.size)return Vr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Vr(t+1,s):Vr(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 C=te;C.empty=new C([],0);const Bs={index:0,offset:0};function Vr(n,e){return Bs.index=n,Bs.offset=e,Bs}c(Vr,"retIndex");function si(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(!si(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!si(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}c(si,"compareDeep");var vt;let F=(vt=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&&si(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 vt.none;if(e instanceof vt)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}},c(vt,"Mark"),vt);F.none=[];const ea=class ea extends Error{};c(ea,"ReplaceError");let zn=ea;const pt=class pt{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=yd(this.content,e+this.openStart,t);return r&&new pt(r,this.openStart,this.openEnd)}removeBetween(e,t){return new pt(gd(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 pt.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 pt(C.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 pt(e,r,i)}};c(pt,"Slice");let E=pt;E.empty=new E(C.empty,0,0);function gd(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(gd(s.content,e-i-1,t-i-1)))}c(gd,"removeRange");function yd(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=yd(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}c(yd,"insertInto");function dh(n,e,t){if(t.openStart>n.depth)throw new zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new zn("Inconsistent open depths");return bd(n,e,t,0)}c(dh,"replace");function bd(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=bd(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 qt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=uh(t,n);return qt(s,wd(n,o,l,e,r))}else return qt(s,oi(n,e,r))}c(bd,"replaceOuter");function kd(n,e){if(!e.type.compatibleContent(n.type))throw new zn("Cannot join "+e.type.name+" onto "+n.type.name)}c(kd,"checkJoin");function co(n,e,t){let r=n.node(t);return kd(r,e.node(t)),r}c(co,"joinable$1");function Kt(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(Kt,"addNode");function rr(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&&(Kt(n.nodeAfter,r),s++));for(let l=s;l<o;l++)Kt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Kt(e.nodeBefore,r)}c(rr,"addRange");function qt(n,e){return n.type.checkContent(e),n.copy(e)}c(qt,"close");function wd(n,e,t,r,i){let s=n.depth>i&&co(n,e,i+1),o=r.depth>i&&co(t,r,i+1),l=[];return rr(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(kd(s,o),Kt(qt(s,wd(n,e,t,r,i+1)),l)):(s&&Kt(qt(s,oi(n,e,i+1)),l),rr(e,t,i,l),o&&Kt(qt(o,oi(t,r,i+1)),l)),rr(r,null,i,l),new C(l)}c(wd,"replaceThreeWay");function oi(n,e,t){let r=[];if(rr(null,n,t,r),n.depth>t){let i=co(n,e,t+1);Kt(qt(i,oi(n,e,t+1)),r)}return rr(e,null,t,r),new C(r)}c(oi,"replaceTwoWay");function uh(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(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}c(uh,"prepareSliceForReplace");const pr=class pr{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 F.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 $n(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),d=s-a;if(r.push(o,l,i+a),!d||(o=o.child(l),o.isText))break;s=d-1,i+=a+1}return new pr(t,r,s)}static resolveCached(e,t){let r=Da.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 Da.set(e,r=new uo);let i=r.elts[r.i]=pr.resolve(e,t);return r.i=(r.i+1)%fh,i}};c(pr,"ResolvedPos");let li=pr;const ta=class ta{constructor(){this.elts=[],this.i=0}};c(ta,"ResolveCache");let uo=ta;const fh=12,Da=new WeakMap,na=class na{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(na,"NodeRange");let $n=na;const hh=Object.create(null);var Ct;let wt=(Ct=class{constructor(e,t,r,i=F.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.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&&si(this.attrs,t||e.defaultAttrs||hh)&&F.sameSet(this.marks,r||F.none)}copy(e=null){return e==this.content?this:new Ct(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ct(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 E.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),d=i.node(o).content.cut(i.pos-l,s.pos-l);return new E(d,i.depth-o,s.depth-o)}replace(e,t,r){return dh(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 li.resolveCached(this,e)}resolveNoCache(e){return li.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()+")"),xd(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=C.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=F.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(!F.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=C.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}},c(Ct,"Node"),Ct);wt.prototype.text=void 0;const mr=class mr extends wt{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):xd(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 mr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new mr(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(mr,"TextNode");let fo=mr;function xd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}c(xd,"wrapMarks");const ds=class ds{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ho(e,t);if(r.next==null)return ds.empty;let i=Sd(r);r.next&&r.err("Unexpected trailing text");let s=wh(kh(i));return xh(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 C.from(l.map(d=>d.createAndFill()));for(let d=0;d<o.next.length;d++){let{type:u,next:f}=o.next[d];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,l.concat(u));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(ds,"ContentMatch");let sn=ds;sn.empty=new sn(!0);const ra=class ra{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(ra,"TokenStream");let ho=ra;function Sd(n){let e=[];do e.push(ph(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}c(Sd,"parseExpr");function ph(n){let e=[];do e.push(mh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}c(ph,"parseExprSeq");function mh(n){let e=bh(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=gh(n,e);else break;return e}c(mh,"parseExprSubscript");function Pa(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}c(Pa,"parseNum");function gh(n,e){let t=Pa(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pa(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}c(gh,"parseExprRange");function yh(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(yh,"resolveName");function bh(n){if(n.eat("(")){let e=Sd(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=yh(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(bh,"parseExprAtom");function kh(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 d={term:a,to:l};return e[o].push(d),d}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,d)=>a.concat(s(d,l)),[]);if(o.type=="seq")for(let a=0;;a++){let d=s(o.exprs[a],l);if(a==o.exprs.length-1)return d;i(d,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 d=0;d<o.min;d++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let d=o.min;d<o.max;d++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}c(s,"compile")}c(kh,"nfa");function vd(n,e){return e-n}c(vd,"cmp");function La(n,e){let t=[];return r(e),t.sort(vd);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(La,"nullFrom");function wh(n){let e=Object.create(null);return t(La(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let d;for(let u=0;u<i.length;u++)i[u][0]==l&&(d=i[u][1]);La(n,a).forEach(u=>{d||i.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let s=e[r.join(",")]=new sn(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(vd);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}c(wh,"dfa");function xh(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:d}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}c(xh,"checkForDeadEnds");function Cd(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(Cd,"defaultAttrs");function Md(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(Md,"computeAttrs");function Td(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(Td,"checkAttrs");function Ed(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new po(n,r,e[r]);return t}c(Ed,"initAttrs");var Qt;let Ba=(Qt=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=Ed(e,r.attrs),this.defaultAttrs=Cd(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==sn.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:Md(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wt(this,this.computeAttrs(e),C.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new wt(this,this.computeAttrs(e),t,F.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.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(C.empty,!0);return s?new wt(this,e,t.append(s),F.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){Td(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:F.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Qt(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(Qt,"NodeType"),Qt);function Sh(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(Sh,"validateType");const ia=class ia{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Sh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}};c(ia,"Attribute");let po=ia;const us=class us{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ed(e,i.attrs),this.excluded=null;let s=Cd(this.attrs);this.instance=s?new F(this,s):null}create(e=null){return!e&&this.instance?this.instance:new F(this,Md(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new us(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){Td(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}};c(us,"MarkType");let ai=us;const sa=class sa{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=Ba.compile(this.spec.nodes,this),this.marks=ai.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]=sn.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?za(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==""?[]:za(this,o.split(" "))}this.nodeFromJSON=i=>wt.fromJSON(this,i),this.markFromJSON=i=>F.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 Ba){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 fo(r,r.defaultAttrs,e,F.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(sa,"Schema");let ci=sa;function za(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(za,"gatherMarks");function vh(n){return n.tag!=null}c(vh,"isTagRule");function Ch(n){return n.style!=null}c(Ch,"isStyleRule");const gr=class gr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(vh(i))this.tags.push(i);else if(Ch(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 di(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new di(this,t,!0);return r.addAll(e,F.none,t.from,t.to),E.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(Eh(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=Fa(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=Fa(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gr(e,gr.schemaRules(e)))}};c(gr,"DOMParser");let Jt=gr;const Od={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},Mh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ad={ol:!0,ul:!0},Sr=1,mo=2,ir=4;function $a(n,e,t){return e!=null?(e?Sr:0)|(e==="full"?mo:0):n&&n.whitespace=="pre"?Sr|mo:t&~ir}c($a,"wsOptionsFor");const oa=class oa{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=F.none,this.match=s||(o&ir?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.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&Sr)){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=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.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&&!Od.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}};c(oa,"NodeContext");let bn=oa;const la=class la{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?ir:0);i?s=new bn(i.type,i.attrs,F.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new bn(null,null,F.none,!0,null,o):s=new bn(e.schema.topNodeType,null,F.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&mo?"full":this.localPreserveWS||(i.options&Sr)>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;Ad.hasOwnProperty(o)&&this.parser.normalizeLists&&Th(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Mh.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 d,u=this.needsBlock;if(Od.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(s),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,a,d,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(d=>!a.clearMark(d)):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],d=a.findWrapping(e);if(d&&(!i||i.length>d.length+l)&&(i=d,s=a,!d.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=F.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Va(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&ir&&o.content.length==0&&(l|=ir);let a=F.none;return r=r.filter(d=>(o.type?o.type.allowsMarkType(d.type):Va(d.type,e))?(a=d.addToSet(a),!1):!0),this.nodes.push(new bn(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|=Sr)}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 d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=d&&!u.isInGroup(d))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(la,"ParseContext");let di=la;function Th(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ad.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}c(Th,"normalizeList");function Eh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}c(Eh,"matches");function Fa(n){let e={};for(let t in n)e[t]=n[t];return e}c(Fa,"copy");function Va(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:d,next:u}=l.edge(a);if(d==e||s.indexOf(u)<0&&o(u))return!0}},"scan");if(o(i.contentMatch))return!0}}c(Va,"markMayApply");const fs=class fs{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=zs(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 d=o.marks[a];if(!this.marks[d.type.name]){a++;continue}if(!d.eq(s[l][0])||d.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let d=o.marks[a++],u=this.serializeMark(d,o.isInline,t);u&&(s.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Zr(zs(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&&Zr(zs(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Zr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fs(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ha(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ha(e.marks)}};c(fs,"DOMSerializer");let on=fs;function Ha(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}c(Ha,"gatherToDOM");function zs(n){return n.document||window.document}c(zs,"doc$1");const ja=new WeakMap;function Oh(n){let e=ja.get(n);return e===void 0&&ja.set(n,e=Ah(n)),e}c(Oh,"suspiciousAttributes");function Ah(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(Ah,"suspiciousAttributesInner");function Zr(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=Oh(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),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),d[f]):f=="style"&&a.style?a.style.cssText=d[f]:a.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)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}=Zr(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(Zr,"renderSpec");const Nd=65535,Id=Math.pow(2,16);function Nh(n,e){return n+e*Id}c(Nh,"makeRecover");function Ua(n){return n&Nd}c(Ua,"recoverIndex");function Ih(n){return(n-(n&Nd))/Id}c(Ih,"recoverOffset");const Rd=1,Dd=2,ei=4,Pd=8,aa=class aa{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Pd)>0}get deletedBefore(){return(this.delInfo&(Rd|ei))>0}get deletedAfter(){return(this.delInfo&(Dd|ei))>0}get deletedAcross(){return(this.delInfo&ei)>0}};c(aa,"MapResult");let vr=aa;const mt=class mt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&mt.empty)return mt.empty}recover(e){let t=0,r=Ua(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+Ih(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 d=this.ranges[l+s],u=this.ranges[l+o],f=a+d;if(e<=f){let h=d?e==a?-1:e==f?1:t:t,p=a+i+(h<0?0:u);if(r)return p;let m=e==(t<0?a:f)?null:Nh(l/3,e-a),g=e==a?Dd:e==f?Rd:ei;return(t<0?e!=a:e!=f)&&(g|=Pd),new vr(p,g,m)}i+=u-d}return r?e+i:new vr(e+i,0,null)}touches(e,t){let r=0,i=Ua(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 d=this.ranges[l+s],u=a+d;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-d}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),d=this.ranges[i+t],u=this.ranges[i+r];e(l,l+d,a,a+u),s+=u-d}}invert(){return new mt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?mt.empty:new mt(e<0?[0,-e,0]:[0,0,e])}};c(mt,"StepMap");let st=mt;st.empty=new st([]);const yr=class yr{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 yr(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 yr;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 vr(e,i,null)}};c(yr,"Mapping");let ui=yr;const $s=Object.create(null),ca=class ca{getMap(){return st.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=$s[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 $s)throw new RangeError("Duplicate use of step JSON ID "+e);return $s[e]=t,t.prototype.jsonID=e,t}};c(ca,"Step");let ee=ca;const Dt=class Dt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Dt(e,null)}static fail(e){return new Dt(null,e)}static fromReplace(e,t,r,i){try{return Dt.ok(e.replace(t,r,i))}catch(s){if(s instanceof zn)return Dt.fail(s.message);throw s}}};c(Dt,"StepResult");let se=Dt;function sl(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(sl(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}c(sl,"mapFragment");const Pt=class Pt 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 E(sl(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 Mt(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 Pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(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 Pt(t.from,t.to,e.markFromJSON(t.mark))}};c(Pt,"AddMarkStep");let Cr=Pt;ee.jsonID("addMark",Cr);const Lt=class Lt 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 E(sl(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 Cr(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 Lt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lt(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 Lt(t.from,t.to,e.markFromJSON(t.mark))}};c(Lt,"RemoveMarkStep");let Mt=Lt;ee.jsonID("removeMark",Mt);const Bt=class Bt 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 E(C.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 Bt(this.pos,t.marks[i]);return new Bt(this.pos,this.mark)}}return new Fn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bt(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 Bt(t.pos,e.markFromJSON(t.mark))}};c(Bt,"AddNodeMarkStep");let Mr=Bt;ee.jsonID("addNodeMark",Mr);const br=class br 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 E(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new br(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 br(t.pos,e.markFromJSON(t.mark))}};c(br,"RemoveNodeMarkStep");let Fn=br;ee.jsonID("removeNodeMark",Fn);const Ze=class Ze 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&&go(e,this.from,this.to)?se.fail("Structure replace would overwrite content"):se.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new st([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ze(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 Ze(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ze)||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?E.empty:new E(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ze(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?E.empty:new E(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ze(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 Ze(t.from,t.to,E.fromJSON(e,t.slice),!!t.structure)}};c(Ze,"ReplaceStep");let we=Ze;ee.jsonID("replace",we);const kn=class kn 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&&(go(e,this.from,this.gapFrom)||go(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 st([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 kn(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 kn(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 kn(t.from,t.to,t.gapFrom,t.gapTo,E.fromJSON(e,t.slice),t.insert,!!t.structure)}};c(kn,"ReplaceAroundStep");let ce=kn;ee.jsonID("replaceAround",ce);function go(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(go,"contentBetween");function Rh(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,d,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+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 Mt(h,p,f[g])));l&&l.to==h?l.to=p:s.push(l=new Cr(h,p,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}c(Rh,"addMark");function Dh(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 ai){let d=o.marks,u;for(;u=r.isInSet(d);)(a||(a=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let d=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let f=a[u],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=d,h.step=s):i.push({style:f,from:Math.max(l,e),to:d,step:s})}}}),i.forEach(o=>n.step(new Mt(o.from,o.to,o.style)))}c(Dh,"removeMark");function ol(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 d=s.child(a),u=l+d.nodeSize,f=r.matchType(d.type);if(!f)o.push(new we(l,u,E.empty));else{r=f;for(let h=0;h<d.marks.length;h++)t.allowsMarkType(d.marks[h].type)||n.step(new Mt(l,u,d.marks[h]));if(i&&d.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new E(C.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),o.push(new we(l+h.index,l+h.index+h[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(l,l,new E(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}c(ol,"clearIncompatible");function Ph(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}c(Ph,"canCut");function Yn(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||!Ph(i,s,o))break}return null}c(Yn,"liftTarget");function Lh(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,d=l,u=C.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=C.from(r.node(m).copy(u)),f++):a--;let h=C.empty,p=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=C.from(i.node(m).copy(h)),p++):d++;n.step(new ce(a,d,o,l,new E(u.append(h),f,p),u.size-f,!0))}c(Lh,"lift$2");function ll(n,e,t=null,r=n){let i=Bh(n,e),s=i&&zh(r,e);return s?i.map(Wa).concat({type:e,attrs:t}).concat(s.map(Wa)):null}c(ll,"findWrapping");function Wa(n){return{type:n,attrs:null}}c(Wa,"withAttrs");function Bh(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(Bh,"findWrappingOutside");function zh(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 d=r;a&&d<i;d++)a=a.matchType(t.child(d).type);return!a||!a.validEnd?null:o}c(zh,"findWrappingInside");function $h(n,e,t){let r=C.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=C.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 E(r,0,0),t.length,!0))}c($h,"wrap");function Fh(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)&&Vh(n.doc,n.mapping.slice(s).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?d=!1:!p&&m&&(d=!0)}d===!1&&Bd(n,o,l,s),ol(n,n.mapping.slice(s).map(l,1),r,void 0,d===null);let u=n.mapping.slice(s),f=u.map(l,1),h=u.map(l+o.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new E(C.from(r.create(a,null,o.marks)),0,0),1,!0)),d===!0&&Ld(n,o,l,s),!1}})}c(Fh,"setBlockType$1");function Ld(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(Ld,"replaceNewlines");function Bd(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(Bd,"replaceLinebreaks");function Vh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}c(Vh,"canChangeType");function Hh(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 E(C.from(o),0,0),1,!0))}c(Hh,"setNodeMarkup");function rt(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 d=i.depth-1,u=t-2;d>s;d--,u--){let f=i.node(d),h=i.index(d);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||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(rt,"canSplit");function jh(n,e,t=1,r){let i=n.doc.resolve(e),s=C.empty,o=C.empty;for(let l=i.depth,a=i.depth-t,d=t-1;l>a;l--,d--){s=C.from(i.node(l).copy(s));let u=r&&r[d];o=C.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new we(e,e,new E(s.append(o),t,t),!0))}c(jh,"split");function At(n,e){let t=n.resolve(e),r=t.index();return zd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}c(At,"canJoin");function Uh(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(Uh,"canAppendWithSubstitutedLinebreaks");function zd(n,e){return!!(n&&e&&!n.isLeaf&&Uh(n,e))}c(zd,"joinable");function xs(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&&zd(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(xs,"joinPoint");function Wh(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 u=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Bd(n,u.node(),u.before(),l)}o.inlineContent&&ol(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new we(d,a.map(e+t,-1),E.empty,!0)),r===!0){let u=n.doc.resolve(d);Ld(n,u.node(),u.before(),n.steps.length)}return n}c(Wh,"join");function Kh(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(Kh,"insertPoint");function $d(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),d=r.node(o),u=!1;if(s==1)u=d.canReplace(a,a,i);else{let f=d.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}c($d,"dropPoint");function Ss(n,e,t=e,r=E.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fd(i,s,r)?new we(e,t,r):new yo(i,s,r).fit()}c(Ss,"replaceStep");function Fd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}c(Fd,"fitsTrivially");const da=class da{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.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=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,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 E(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=Fs(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:d}=this.frontier[l],u,f=null;if(t==1&&(o?d.matchType(o.type)||(f=d.fillBefore(C.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(u=d.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Fs(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new E(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=Fs(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new E(er(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new E(er(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,d=0,u=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(o.content.size-o.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(Vd(g.mark(h.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?p:-1)))}let m=d==l.childCount;m||(p=-1),this.placed=tr(this.placed,t,C.from(u)),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?E.empty:new E(er(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new E(er(o.content,e,d),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Vs(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=Vs(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=Vs(e,l,d,a,!0);if(!u||u.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=tr(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=tr(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=tr(this.placed,this.frontier.length,t))}};c(da,"Fitter");let yo=da;function er(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(er(n.firstChild.content,e-1,t)))}c(er,"dropFromFragment");function tr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(tr(n.lastChild.content,e-1,t)))}c(tr,"addToFragment");function Fs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}c(Fs,"contentAt");function Vd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Vd(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(C.empty,!0)))),n.copy(r)}c(Vd,"closeNodeStart");function Vs(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&&!qh(t,s.content,o)?l:null}c(Vs,"contentAfterFits");function qh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}c(qh,"invalidMarks");function Jh(n){return n.spec.defining||n.spec.definingForContent}c(Jh,"definesContent");function _h(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Fd(i,s,r))return n.step(new we(e,t,r));let o=jd(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),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=Jh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=d[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),S=i.index(y-1);if(k.canReplaceWith(S,S,m.type,m.marks))return n.replace(i.before(y),b?s.after(y):t,new E(Hd(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(_h,"replaceRange");function Hd(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Hd(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(C.empty,!0))}return n}c(Hd,"closeFragment");function Gh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Kh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new E(C.from(r),0,0))}c(Gh,"replaceRangeWith");function Yh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=jd(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(Yh,"deleteRange$1");function jd(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(jd,"coveredDepths");const wn=class wn 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 E(C.from(i),0,t.isLeaf?0:1))}getMap(){return st.empty}invert(e){return new wn(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 wn(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 wn(t.pos,t.attr,t.value)}};c(wn,"AttrStep");let fi=wn;ee.jsonID("attr",fi);const kr=class kr 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 st.empty}invert(e){return new kr(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 kr(t.attr,t.value)}};c(kr,"DocAttrStep");let hi=kr;ee.jsonID("docAttr",hi);var Cn;let Vn=(Cn=class extends Error{},c(Cn,"TransformError"),Cn);Vn=c(function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},"TransformError");Vn.prototype=Object.create(Error.prototype);Vn.prototype.constructor=Vn;Vn.prototype.name="TransformError";const ua=class ua{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ui}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Vn(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=E.empty){let i=Ss(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new E(C.from(r),0,0))}delete(e,t){return this.replace(e,t,E.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _h(this,e,t,r),this}replaceRangeWith(e,t,r){return Gh(this,e,t,r),this}deleteRange(e,t){return Yh(this,e,t),this}lift(e,t){return Lh(this,e,t),this}join(e,t=1){return Wh(this,e,t),this}wrap(e,t){return $h(this,e,t),this}setBlockType(e,t=e,r,i=null){return Fh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Hh(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new fi(e,t,r)),this}setDocAttribute(e,t){return this.step(new hi(e,t)),this}addNodeMark(e,t){return this.step(new Mr(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 F)t.isInSet(r.marks)&&this.step(new Fn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Fn(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 jh(this,e,t,r),this}addMark(e,t,r){return Rh(this,e,t,r),this}removeMark(e,t,r){return Dh(this,e,t,r),this}clearIncompatible(e,t,r){return ol(this,e,t,r),this}};c(ua,"Transform");let pi=ua;const Hs=Object.create(null),fa=class fa{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new mi(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=E.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:d}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(d.pos),l?E.empty:t),l==0&&Ja(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),d=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Ja(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):mn(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?mn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):mn(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 Ie(e.node(0))}static atStart(e){return mn(e,e,0,0,1)||new Ie(e)}static atEnd(e){return mn(e,e,e.content.size,e.childCount,-1)||new Ie(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Hs[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 Hs)throw new RangeError("Duplicate use of selection JSON ID "+e);return Hs[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}};c(fa,"Selection");let R=fa;R.prototype.visible=!0;const ha=class ha{constructor(e,t){this.$from=e,this.$to=t}};c(ha,"SelectionRange");let mi=ha,Ka=!1;function qa(n){!Ka&&!n.parent.inlineContent&&(Ka=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}c(qa,"checkTextSelection");const zt=class zt extends R{constructor(e,t=e){qa(e),qa(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 R.near(r);let i=e.resolve(t.map(this.anchor));return new zt(i.parent.inlineContent?i:r,r)}replace(e,t=E.empty){if(super.replace(e,t),t==E.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gi(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 zt(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=R.findFrom(t,r,!0)||R.findFrom(t,-r,!0);if(s)t=s.$head;else return R.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new zt(e,t)}};c(zt,"TextSelection");let L=zt;R.jsonID("text",L);const hs=class hs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new hs(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}};c(hs,"TextBookmark");let gi=hs;const $t=class $t extends R{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?R.near(s):new $t(s)}content(){return new E(C.from(this.node),0,0)}eq(e){return e instanceof $t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $t(e.resolve(t.anchor))}static create(e,t){return new $t(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};c($t,"NodeSelection");let I=$t;I.prototype.visible=!1;R.jsonID("node",I);const ps=class ps{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new gi(r,r):new ps(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&I.isSelectable(r)?new I(t):R.near(t)}};c(ps,"NodeBookmark");let bo=ps;const xn=class xn extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=E.empty){if(t==E.empty){e.delete(0,e.doc.content.size);let r=R.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new xn(e)}map(e){return new xn(e)}eq(e){return e instanceof xn}getBookmark(){return Xh}};c(xn,"AllSelection");let Ie=xn;R.jsonID("all",Ie);const Xh={map(){return this},resolve(n){return new Ie(n)}};function mn(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&&I.isSelectable(l))return I.create(n,t-(i<0?l.nodeSize:0))}else{let a=mn(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}c(mn,"findSelectionIn");function Ja(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,d,u)=>{o==null&&(o=u)}),n.setSelection(R.near(n.doc.resolve(o),t))}c(Ja,"selectionToInsertionEnd$1");const _a=1,Hr=2,Ga=4,pa=class pa extends pi{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|_a)&~Hr,this.storedMarks=null,this}get selectionSet(){return(this.updated&_a)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Hr,this}ensureMarks(e){return F.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&Hr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Hr,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)||F.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(R.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|=Ga,this}get scrolledIntoView(){return(this.updated&Ga)>0}};c(pa,"Transaction");let ko=pa;function Ya(n,e){return!e||!n?n:n.bind(e)}c(Ya,"bind");const ma=class ma{constructor(e,t,r){this.name=e,this.init=Ya(t.init,r),this.apply=Ya(t.apply,r)}};c(ma,"FieldDesc");let Ht=ma;const Qh=[new Ht("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ht("selection",{init(n,e){return n.selection||R.atStart(e.doc)},apply(n){return n.selection}}),new Ht("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ht("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],ga=class ga{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Qh.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 Ht(r.key,r.spec.state,r))})}};c(ga,"Configuration");let sr=ga;const Ft=class Ft{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,d=i?i[o].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,d,r);if(u&&r.filterTransaction(u,o)){if(u.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(u),r=r.applyInner(u),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 Ft(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 ko(this)}static create(e){let t=new sr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ft(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 sr(this.schema,e.plugins),r=t.fields,i=new Ft(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 sr(e.schema,e.plugins),s=new Ft(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=wt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=R.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],d=a.spec.state;if(a.key==o.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=d.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};c(Ft,"EditorState");let wo=Ft;function Ud(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ud(i,e,{})),t[r]=i}return t}c(Ud,"bindProps");const ya=class ya{constructor(e){this.spec=e,this.props={},e.props&&Ud(e.props,this,this.props),this.key=e.key?e.key.key:Wd("plugin")}getState(e){return e[this.key]}};c(ya,"Plugin");let H=ya;const js=Object.create(null);function Wd(n){return n in js?n+"$"+ ++js[n]:(js[n]=0,n+"$")}c(Wd,"createKey");const ba=class ba{constructor(e="key"){this.key=Wd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};c(ba,"PluginKey");let W=ba;const al=c((n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0),"deleteSelection$1");function Kd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}c(Kd,"atBlockStart");const qd=c((n,e,t)=>{let r=Kd(n,t);if(!r)return!1;let i=cl(r);if(!i){let o=r.blockRange(),l=o&&Yn(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(tu(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Hn(s,"end")||I.isSelectable(s)))for(let o=r.depth;;o--){let l=Ss(n.doc,r.before(o),r.after(o),E.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Hn(s,"end")?R.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):I.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"),Zh=c((n,e,t)=>{let r=Kd(n,t);if(!r)return!1;let i=cl(r);return i?Jd(n,i,e):!1},"joinTextblockBackward$1"),ep=c((n,e,t)=>{let r=Gd(n,t);if(!r)return!1;let i=dl(r);return i?Jd(n,i,e):!1},"joinTextblockForward$1");function Jd(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 u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Ss(n.doc,s,a,E.empty);if(!d||d.from!=s||d instanceof we&&d.slice.size>=a-s)return!1;if(t){let u=n.tr.step(d);u.setSelection(L.create(u.doc,s)),t(u.scrollIntoView())}return!0}c(Jd,"joinTextblocksAround");function Hn(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(Hn,"textblockAt");const _d=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=cl(r)}let o=s&&s.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)},"selectNodeBackward$1");function cl(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(cl,"findCutBefore");function Gd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}c(Gd,"atBlockEnd");const Yd=c((n,e,t)=>{let r=Gd(n,t);if(!r)return!1;let i=dl(r);if(!i)return!1;let s=i.nodeAfter;if(tu(n,i,e,1))return!0;if(r.parent.content.size==0&&(Hn(s,"start")||I.isSelectable(s))){let o=Ss(n.doc,r.before(),r.after(),E.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Hn(s,"start")?R.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):I.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"),Xd=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=dl(r)}let o=s&&s.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,s.pos)).scrollIntoView()),!0)},"selectNodeForward$1");function dl(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(dl,"findCutAfter");const tp=c((n,e)=>{let t=n.selection,r=t instanceof I,i;if(r){if(t.node.isTextblock||!At(n.doc,t.from))return!1;i=t.from}else if(i=xs(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(I.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 I){if(t.node.isTextblock||!At(n.doc,t.to))return!1;r=t.to}else if(r=xs(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},"joinDown$1"),rp=c((n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Yn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},"lift$1"),Qd=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 ul(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(ul,"defaultBlockAt$1");const ip=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=ul(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(R.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},"exitCode$1"),Zd=c((n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ie||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ul(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"),eu=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(rt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Yn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},"liftEmptyBlock$1");function sp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof I&&e.selection.node.isBlock)return!r.parentOffset||!rt(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,d=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),d=r.start(p)==r.pos-(r.depth-p),l=ul(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 u=e.tr;(e.selection instanceof L||e.selection instanceof Ie)&&u.deleteSelection();let f=u.mapping.map(r.pos),h=rt(u.doc,f,s.length,s);if(h||(s[0]=l?{type:l}:null,h=rt(u.doc,f,s.length,s)),!h)return!1;if(u.split(f,s.length,s),!a&&d&&r.node(o).type!=l){let p=u.mapping.map(r.before(o)),m=u.doc.resolve(p);l&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return t&&t(u.scrollIntoView()),!0}}c(sp,"splitBlockAs");const op=sp(),lp=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(I.create(n.doc,i))),!0)},"selectParentNode$1");function ap(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||At(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}c(ap,"joinMaybeClear");function tu(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&ap(n,e,t))return!0;let d=!a&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(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=C.empty;for(let b=o.length-1;b>=0;b--)m=C.from(o[b].create(null,m));m=C.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new E(m,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&At(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:R.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&Yn(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(d&&Hn(s,"start",!0)&&Hn(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=C.empty;for(let S=m.length-1;S>=0;S--)b=C.from(m[S].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 E(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}c(tu,"deleteBarrier");function nu(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(nu,"selectTextblockSide");const cp=nu(-1),dp=nu(1);function up(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&ll(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}c(up,"wrapIn$1");function Xa(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,d)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(d),f=u.index();i=u.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(Xa,"setBlockType");function fl(...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(fl,"chainCommands");fl(al,qd,_d);fl(al,Yd,Xd);fl(Qd,Zd,eu,op);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function fp(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 hp(l,o,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}c(fp,"wrapInList$1");function hp(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 $n(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new $n(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=ll(s,t,r,e);return l?(n&&pp(n,e,l,i,t),!0):!1}c(hp,"wrapRangeInList");function pp(n,e,t,r,i){let s=C.empty;for(let u=t.length-1;u>=0;u--)s=C.from(t[u].type.create(t[u].attrs,s));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new E(s,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==i&&(o=u+1);let l=t.length-o,a=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&rt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=d.child(u).nodeSize;return n}c(pp,"doWrapInList");function mp(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?gp(e,t,n,s):yp(e,t,s):!0:!1}}c(mp,"liftListItem$1");function gp(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 E(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new $n(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Yn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return At(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}c(gp,"liftToOuterList");function yp(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,d=s.node(-1),u=s.index(-1);if(!d.canReplace(u+(l?0:1),u+1,o.content.append(a?C.empty:C.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 E((l?C.empty:C.from(i.copy(C.empty))).append(a?C.empty:C.from(i.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}c(yp,"liftOutOfList");function bp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,d=>d.childCount>0&&d.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 d=a.lastChild&&a.lastChild.type==l.type,u=C.from(d?n.create():null),f=new E(C.from(n.create(null,C.from(l.type.create(null,u)))),d?3:1,0),h=s.start,p=s.end;t(e.tr.step(new ce(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}c(bp,"sinkListItem$1");const re=c(function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},"domIndex"),jn=c(function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},"parentNode");let xo=null;const Qe=c(function(n,e,t){let r=xo||(xo=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},"textRange"),kp=c(function(){xo=null},"clearReusedRange"),ln=c(function(n,e,t,r){return t&&(Qa(n,e,t,r,-1)||Qa(n,e,t,r,1))},"isEquivalentPosition"),wp=/^(img|br|input|textarea|hr)$/i;function Qa(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Me(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Pr(n)||wp.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?Me(n):0}else return!1}}c(Qa,"scanFor");function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(Me,"nodeSize");function xp(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=Me(n)}else if(n.parentNode&&!Pr(n))e=re(n),n=n.parentNode;else return null}}c(xp,"textNodeBefore$1");function Sp(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&&!Pr(n))e=re(n)+1,n=n.parentNode;else return null}}c(Sp,"textNodeAfter$1");function vp(n,e,t){for(let r=e==0,i=e==Me(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==Me(n)}}c(vp,"isOnEdge");function Pr(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(Pr,"hasBlockDesc");const vs=c(function(n){return n.focusNode&&ln(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)},"selectionCollapsed");function Rt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}c(Rt,"keyEvent");function Cp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}c(Cp,"deepActiveElement");function Mp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Me(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Me(r.startContainer),r.startOffset)}}}c(Mp,"caretFromPoint");const We=typeof navigator<"u"?navigator:null,Za=typeof document<"u"?document:null,Nt=We&&We.userAgent||"",So=/Edge\/(\d+)/.exec(Nt),ru=/MSIE \d/.exec(Nt),vo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Nt),ye=!!(ru||vo||So),xt=ru?document.documentMode:vo?+vo[1]:So?+So[1]:0,Te=!ye&&/gecko\/(\d+)/i.test(Nt);Te&&+(/Firefox\/(\d+)/.exec(Nt)||[0,0])[1];const Co=!ye&&/Chrome\/(\d+)/.exec(Nt),ae=!!Co,iu=Co?+Co[1]:0,fe=!ye&&!!We&&/Apple Computer/.test(We.vendor),Un=fe&&(/Mobile\/\w+/.test(Nt)||!!We&&We.maxTouchPoints>2),Ce=Un||(We?/Mac/.test(We.platform):!1),Tp=We?/Win/.test(We.platform):!1,tt=/Android \d/.test(Nt),Lr=!!Za&&"webkitFontSmoothing"in Za.documentElement.style,Ep=Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Op(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(Op,"windowRect");function _e(n,e){return typeof n=="number"?n:n[e]}c(_e,"getSide$1");function Ap(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(Ap,"clientRect");function ec(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=jn(o);continue}let l=o,a=l==s.body,d=a?Op(s):Ap(l),u=0,f=0;if(e.top<d.top+_e(r,"top")?f=-(d.top-e.top+_e(i,"top")):e.bottom>d.bottom-_e(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_e(i,"top")-d.top:e.bottom-d.bottom+_e(i,"bottom")),e.left<d.left+_e(r,"left")?u=-(d.left-e.left+_e(i,"left")):e.right>d.right-_e(r,"right")&&(u=e.right-d.right+_e(i,"right")),u||f)if(a)s.defaultView.scrollBy(u,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);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:jn(o)}}c(ec,"scrollRectIntoView");function Np(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:su(n.dom)}}c(Np,"storeScrollPos");function su(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=jn(r));return e}c(su,"scrollStack");function Ip({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ou(t,r==0?0:r-e)}c(Ip,"resetScrollPos");function ou(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(ou,"restoreScrollStack");let hn=null;function Rp(n){if(n.setActive)return n.setActive();if(hn)return n.focus(hn);let e=su(n);n.focus(hn==null?{get preventScroll(){return hn={preventScroll:!0},!0}}:void 0),hn||(hn=!1,ou(e,0))}c(Rp,"focusPreventScroll");function lu(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Qe(u).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=u,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=d,r=0),t&&t.nodeType==3?Dp(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:lu(t,i)}c(lu,"findOffsetInNode");function Dp(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=ut(r,1);if(s.top!=s.bottom&&hl(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}c(Dp,"findOffsetInText");function hl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}c(hl,"inRect");function Pp(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}c(Pp,"targetKludge");function Lp(n,e,t){let{node:r,offset:i}=lu(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(Lp,"posFromElement");function Bp(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(Bp,"posFromCaret");function au(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 d=l[a];if(hl(e,d))return au(o,e,d)}}if((s=(s+1)%r)==i)break}return n}c(au,"elementFromPoint");function zp(n,e){let t=n.dom.ownerDocument,r,i=0,s=Mp(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 d=n.dom.getBoundingClientRect();if(!hl(e,d)||(o=au(n.dom,e,d),!o))return null}if(fe)for(let d=o;r&&d;d=jn(d))d.draggable&&(r=void 0);if(o=Pp(o,e),r){if(Te&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let d;Lr&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.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=Bp(n,r,i,e))}l==null&&(l=Lp(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}c(zp,"posAtCoords");function tc(n){return n.top<n.bottom||n.left<n.right}c(tc,"nonZero");function ut(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(tc(r))return r}return Array.prototype.find.call(t,tc)||n.getBoundingClientRect()}c(ut,"singleRect");const $p=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function cu(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Lr||Te;if(r.nodeType==3)if(o&&($p.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=ut(Qe(r,i,i),t);if(Te&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=ut(Qe(r,i-1,i-1),-1);if(d.top==a.top){let u=ut(Qe(r,i,i+1),-1);if(u.top!=a.top)return Qn(u,u.left<d.left)}}return a}else{let a=i,d=i,u=t<0?1:-1;return t<0&&!i?(d++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:d++,Qn(ut(Qe(r,a,d),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Me(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Us(a.getBoundingClientRect(),!1)}if(s==null&&i<Me(r)){let a=r.childNodes[i];if(a.nodeType==1)return Us(a.getBoundingClientRect(),!0)}return Us(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Me(r))){let a=r.childNodes[i-1],d=a.nodeType==3?Qe(a,Me(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(d)return Qn(ut(d,1),!1)}if(s==null&&i<Me(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let d=a?a.nodeType==3?Qe(a,0,o?0:1):a.nodeType==1?a:null:null;if(d)return Qn(ut(d,-1),!0)}return Qn(ut(r.nodeType==3?Qe(r):r,-t),t>=0)}c(cu,"coordsAtPos");function Qn(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(Qn,"flattenV");function Us(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(Us,"flattenH");function du(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(du,"withFlushedState");function Fp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return du(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=cu(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=Qe(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<a.length;d++){let u=a[d];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}c(Fp,"endOfTextblockVertical");const Vp=/[\u0590-\u08ac]/;function Hp(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?!Vp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:du(n,e,()=>{let{focusNode:a,focusOffset:d,anchorNode:u,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&&d==g;try{l.collapse(u,f),a&&(a!=u||d!=f)&&l.extend&&l.extend(a,d)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}c(Hp,"endOfTextblockHorizontal");let nc=null,rc=null,ic=!1;function jp(n,e,t){return nc==e&&rc==t?ic:(nc=e,rc=t,ic=t=="up"||t=="down"?Fp(n,e,t):Hp(n,e,t))}c(jp,"endOfTextblock");const Ee=0,sc=1,jt=2,Ke=3,ka=class ka{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Ee,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 ki){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 yi&&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],d=o+a.size;if(i==-1&&e<=d){let u=o+a.border;if(e>=u&&t<=d-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);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&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];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=d}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),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Te||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(Te&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&fe)&&ln(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ln(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&Te)){d.collapse(l.node,l.offset);try{e!=t&&d.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),d.removeAllRanges(),d.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?jt:sc,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ke:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?jt:Ke}r=o}this.dirty=jt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?jt:sc;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};c(ka,"ViewDesc");let an=ka;const wa=class wa extends an{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==Ee&&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(wa,"WidgetViewDesc");let yi=wa;const xa=class xa extends an{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(xa,"CompositionViewDesc");let Mo=xa;const wr=class wr extends an{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=on.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wr(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ke||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ke&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ee){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ee}}slice(e,t,r){let i=wr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=Ao(s,t,o,r)),e>0&&(s=Ao(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(wr,"MarkViewDesc");let Wn=wr;const ms=class ms extends an{constructor(e,t,r,i,s,o,l,a,d){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,d=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=on.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=hu(u,r,t),d?a=new To(e,t,r,i,u,f||null,h,d,s,o+1):t.isText?new bi(e,t,r,i,u,h,s):new ms(e,t,r,i,u,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=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==Ee&&e.eq(this.node)&&wi(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 Oo(this,o&&o.node,e);qp(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?F.none:this.node.child(u).marks,r,e),a.placeWidget(d,e,i)},(d,u,f,h)=>{a.syncToMarks(d.marks,r,e);let p;a.findNodeMatch(d,u,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(d,u,f,p,e)||a.updateNextNode(d,u,f,e,h,i)||a.addNode(d,u,f,e,i),i+=d.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==jt)&&(o&&this.protectLocalComposition(e,o),uu(this.contentDOM,this.children,e),Un&&Jp(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=_p(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 Mo(this,s,t,i);e.input.compositionNodes.push(o),this.children=Ao(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Ke||!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=Ee}updateOuterDeco(e){if(wi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fu(this.dom,this.nodeDOM,Eo(this.outerDeco,this.node,t),Eo(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(ms,"NodeViewDesc");let St=ms;function oc(n,e,t,r,i){hu(r,e,n);let s=new St(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}c(oc,"docViewDesc");const gs=class gs extends St{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==Ke||this.dirty!=Ee&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ee||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=Ee,!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 gs(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=Ke)}get domAtom(){return!1}isText(e){return this.node.text==e}};c(gs,"TextViewDesc");let bi=gs;const Sa=class Sa extends an{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ee&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}};c(Sa,"TrailingHackViewDesc");let ki=Sa;const va=class va extends St{constructor(e,t,r,i,s,o,l,a,d,u){super(e,t,r,i,s,o,l,d,u),this.spec=a}update(e,t,r,i){if(this.dirty==Ke)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(va,"CustomNodeViewDesc");let To=va;function uu(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=lc(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof Wn){let a=r?r.previousSibling:n.lastChild;uu(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=lc(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}c(uu,"renderDescs");const or=c(function(n){n&&(this.nodeName=n)},"OuterDecoLevel");or.prototype=Object.create(null);const Ut=[new or];function Eo(n,e,t){if(n.length==0)return Ut;let r=t?Ut[0]:new or,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new or(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new or(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(Eo,"computeOuterDeco");function fu(n,e,t,r){if(t==Ut&&r==Ut)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=Ut[0]),i=a}Up(i,l||Ut[0],o)}return i}c(fu,"patchOuterDeco");function Up(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(Up,"patchAttributes");function hu(n,e,t){return fu(n,n,Ut,Eo(e,t,n.nodeType!=1))}c(hu,"applyOuterDeco");function wi(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(wi,"sameOuterDeco");function lc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}c(lc,"rm");const Ca=class Ca{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Wp(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=Ee,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 d=this.top.children[a];if(d.matchesMark(e[s])&&!this.isLocked(d.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=Wn.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 d=this.top.children[l];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){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==Ke&&o.dom==o.contentDOM&&(o.dirty=jt),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 St){let d=this.preMatch.matched.get(a);if(d!=null&&d!=s)return!1;let u=a.dom,f,h=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ke&&wi(t,a.outerDeco));if(!h&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(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=jt,f.updateChildren(i,o+1),f.dirty=Ee),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)||!wi(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=St.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=St.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 yi(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 Wn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof bi)||/\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 ki(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(Ca,"ViewTreeUpdater");let Oo=Ca;function Wp(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 d=t.children[r-1];if(d instanceof Wn)t=d,r=d.children.length;else{l=d,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(Wp,"preMatch");function Kp(n,e){return n.type.side-e.type.side}c(Kp,"compareSide");function qp(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,i,e.forChild(s,u),d),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let d=0;;){let u,f;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(Kp);for(let y=0;y<f.length;y++)t(f[y],d,!!a)}else t(u,d,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(d<n.childCount)p=d,h=n.child(d++);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(qp,"iterDeco");function Jp(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(Jp,"iosHacks");function _p(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 d=n.child(i++);if(s+=d.nodeSize,!d.isText)break;a+=d.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?a.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}c(_p,"findTextInFragment");function Ao(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],d=l,u=l+=a.size;d>=t||u<=e?s.push(a):(d<e&&s.push(a.slice(0,e-d,r)),i&&(s.push(i),i=void 0),u>t&&s.push(a.slice(t-d,a.size,r)))}return s}c(Ao,"replaceNodes");function pl(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,d;if(vs(t)){for(a=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&I.isSelectable(f)&&i.parent&&!(f.isInline&&vp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;d=new I(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 u=r.resolve(a);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;d=ml(n,u,l,f)}return d}c(pl,"selectionFromDOM");function pu(n){return n.editable?n.hasFocus():gu(n)&&document.activeElement&&document.activeElement.contains(n.dom)}c(pu,"editorOwnsSelection");function it(n,e=!1){let t=n.state.selection;if(mu(n,t),!!pu(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ln(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Yp(n);else{let{anchor:r,head:i}=t,s,o;ac&&!(t instanceof L)&&(t.$from.parent.inlineContent||(s=cc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=cc(n,t.to))),n.docView.setSelection(r,i,n,e),ac&&(s&&dc(s),o&&dc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Gp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}c(it,"selectionToDOM");const ac=fe||ae&&iu<63;function cc(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 Ws(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ws(i);if(s)return Ws(s)}}c(cc,"temporarilyEditableNear");function Ws(n){return n.contentEditable="true",fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}c(Ws,"setEditable");function dc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}c(dc,"resetEditable");function Gp(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(()=>{(!pu(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}c(Gp,"removeClassOnSelectionChange");function Yp(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&&xt<=11&&(t.disabled=!0,t.disabled=!1)}c(Yp,"selectCursorWrapper");function mu(n,e){if(e instanceof I){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(uc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else uc(n)}c(mu,"syncNodeSelection");function uc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}c(uc,"clearNodeSelection");function ml(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}c(ml,"selectionBetween");function fc(n){return n.editable&&!n.hasFocus()?!1:gu(n)}c(fc,"hasFocusAndSelection");function gu(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(gu,"hasSelection");function Xp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return ln(e.node,e.offset,t.anchorNode,t.anchorOffset)}c(Xp,"anchorInRightPlace");function No(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&&R.findFrom(s,e)}c(No,"moveSelectionBlock");function ft(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}c(ft,"apply");function hc(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 ft(n,new L(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=No(n.state,e);return i&&i instanceof I?ft(n,i):!1}else if(!(Ce&&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?I.isSelectable(s)?ft(n,new I(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Lr?ft(n,new L(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return ft(n,new L(e>0?r.$to:r.$from));{let i=No(n.state,e);return i?ft(n,i):!1}}}c(hc,"selectHorizontally");function xi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(xi,"nodeLen");function lr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}c(lr,"isIgnorable");function pn(n,e){return e<0?Qp(n):Zp(n)}c(pn,"skipIgnoredNodes");function Qp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Te&&t.nodeType==1&&r<xi(t)&&lr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(lr(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(yu(t))break;{let l=t.previousSibling;for(;l&&lr(l,-1);)i=t.parentNode,s=re(l),l=l.previousSibling;if(l)t=l,r=xi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Io(n,t,r):i&&Io(n,i,s)}c(Qp,"skipIgnoredNodesBefore");function Zp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=xi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(lr(l,1))s=t,o=++r;else break}else{if(yu(t))break;{let l=t.nextSibling;for(;l&&lr(l,1);)s=l.parentNode,o=re(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=xi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Io(n,s,o)}c(Zp,"skipIgnoredNodesAfter");function yu(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}c(yu,"isBlockNode");function em(n,e){for(;n&&e==n.childNodes.length&&!Pr(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(em,"textNodeAfter");function tm(n,e){for(;n&&!e&&!Pr(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(tm,"textNodeBefore");function Io(n,e,t){if(e.nodeType!=3){let s,o;(o=em(e,t))?(e=o,t=0):(s=tm(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(vs(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&&it(n)},50)}c(Io,"setSelFocus");function pc(n,e){let t=n.state.doc.resolve(e);if(!(ae||Tp)&&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(pc,"findDirection");function mc(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||Ce&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=No(n.state,e);if(o&&o instanceof I)return ft(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Ie?R.near(o,e):R.findFrom(o,e);return l?ft(n,l):!1}return!1}c(mc,"selectVertically");function gc(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(gc,"stopNativeHorizontalDelete");function yc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}c(yc,"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;yc(n,r,"true"),setTimeout(()=>yc(n,r,"false"),20)}return!1}c(nm,"safariDownArrowBug");function rm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}c(rm,"getMods");function im(n,e){let t=e.keyCode,r=rm(e);if(t==8||Ce&&t==72&&r=="c")return gc(n,-1)||pn(n,-1);if(t==46&&!e.shiftKey||Ce&&t==68&&r=="c")return gc(n,1)||pn(n,1);if(t==13||t==27)return!0;if(t==37||Ce&&t==66&&r=="c"){let i=t==37?pc(n,n.state.selection.from)=="ltr"?-1:1:-1;return hc(n,i,r)||pn(n,i)}else if(t==39||Ce&&t==70&&r=="c"){let i=t==39?pc(n,n.state.selection.from)=="ltr"?1:-1:1;return hc(n,i,r)||pn(n,i)}else{if(t==38||Ce&&t==80&&r=="c")return mc(n,-1,r)||pn(n,-1);if(t==40||Ce&&t==78&&r=="c")return nm(n)||mc(n,1,r)||pn(n,1);if(r==(Ce?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}c(im,"captureKeyDown");function gl(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")||on.fromSchema(n.state.schema),l=vu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let d=a.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Su[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=l.createElement(u[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}d=a.firstChild}d&&d.nodeType==1&&d.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(gl,"serializeForClipboard");function bu(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 E(C.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=on.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=am(t),Lr&&cm(o);let d=o&&o.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let 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")||Jt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!sm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=dm(bc(l,+u[1],+u[2]),u[4]);else if(l=E.maxOpen(om(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=bc(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}c(bu,"parseFromClipboard");const sm=/^(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 om(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),d;if(!a)return o=null;if(d=o.length&&s.length&&wu(a,s,l,o[o.length-1],0))o[o.length-1]=d;else{o.length&&(o[o.length-1]=xu(o[o.length-1],s.length));let u=ku(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return C.from(o)}return n}c(om,"normalizeSiblings");function ku(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}c(ku,"withWrappers");function wu(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=wu(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(C.from(ku(t,n,i+1))))}}c(wu,"addToSibling");function xu(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,xu(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}c(xu,"closeRight");function Ro(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=Ro(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(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}c(Ro,"closeRange");function bc(n,e,t){return e<n.openStart&&(n=new E(Ro(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new E(Ro(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}c(bc,"closeSlice");const Su={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 kc=null;function vu(){return kc||(kc=document.implementation.createHTMLDocument("title"))}c(vu,"detachedDoc");let Ks=null;function lm(n){let e=window.trustedTypes;return e?(Ks||(Ks=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:c(t=>t,"createHTML")})),Ks.createHTML(n)):n}c(lm,"maybeWrapTrusted");function am(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=vu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Su[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=lm(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}c(am,"readHTML");function cm(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(cm,"restoreReplacedSpaces");function dm(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=C.from(a.create(r[l+1],i)),s++,o++}return new E(i,s,o)}c(dm,"addContext");const he={},pe={},um={touchstart:!0,touchmove:!0},Ma=class Ma{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(Ma,"InputState");let Do=Ma;function fm(n){for(let e in he){let t=he[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{pm(n,r)&&!yl(n,r)&&(n.editable||!(r.type in pe))&&t(n,r)},um[e]?{passive:!0}:void 0)}fe&&n.dom.addEventListener("input",()=>null),Po(n)}c(fm,"initInput");function kt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}c(kt,"setSelectionOrigin");function hm(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(hm,"destroyInput");function Po(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>yl(n,r))})}c(Po,"ensureListeners");function yl(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}c(yl,"runCustomHandler");function pm(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(pm,"eventBelongsToView");function mm(n,e){!yl(n,e)&&he[e.type]&&(n.editable||!(e.type in pe))&&he[e.type](n,e)}c(mm,"dispatchEvent");pe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Mu(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(tt&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Un&&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,Rt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||im(n,t)?t.preventDefault():kt(n,"key")};pe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};pe.keypress=(n,e)=>{let t=e;if(Mu(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ce&&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 Cs(n){return{left:n.clientX,top:n.clientY}}c(Cs,"eventCoords");function gm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}c(gm,"isNear");function bl(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(bl,"runHandlerOnContext");function Sn(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(Sn,"updateSelection");function ym(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(Sn(n,new I(t)),!0):!1}c(ym,"selectClickedLeaf");function bm(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof I&&(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(I.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?(Sn(n,I.create(n.state.doc,i)),!0):!1}c(bm,"selectClickedNode");function km(n,e,t,r,i){return bl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?bm(n,t):ym(n,t))}c(km,"handleSingleClick");function wm(n,e,t,r){return bl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}c(wm,"handleDoubleClick");function xm(n,e,t,r){return bl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Sm(n,t,r)}c(xm,"handleTripleClick");function Sm(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Sn(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)Sn(n,L.create(r,l+1,l+1+o.content.size));else if(I.isSelectable(o))Sn(n,I.create(r,l));else continue;return!0}}c(Sm,"defaultTripleClick");function kl(n){return Si(n)}c(kl,"forceDOMFlush");const Cu=Ce?"metaKey":"ctrlKey";he.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=kl(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&gm(t,n.input.lastClick)&&!t[Cu]&&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(Cs(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Lo(n,o,t,!!r)):(s=="doubleClick"?wm:xm)(n,o.pos,o.inside,t)?t.preventDefault():kt(n,"pointer"))};const Ta=class Ta{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[Cu],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof I&&d.from<=o&&d.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Te&&!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)),kt(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(()=>it(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(Cs(e))),this.updateAllowDefault(e),this.allowDefault||!t?kt(this.view,"pointer"):km(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)?(Sn(this.view,R.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):kt(this.view,"pointer")}move(e){this.updateAllowDefault(e),kt(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(Ta,"MouseDown");let Lo=Ta;he.touchstart=n=>{n.input.lastTouch=Date.now(),kl(n),kt(n,"pointer")};he.touchmove=n=>{n.input.lastTouch=Date.now(),kt(n,"pointer")};he.contextmenu=n=>kl(n);function Mu(n,e){return n.composing?!0:fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}c(Mu,"inOrNearComposition");const vm=tt?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(),Si(n,!0),n.markCursor=null;else if(Si(n,!e.selection.empty),Te&&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}Tu(n,vm)};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++,Tu(n,20))};function Tu(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Si(n),e))}c(Tu,"scheduleComposeEnd");function Eu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Mm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}c(Eu,"clearComposition");function Cm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=xp(e.focusNode,e.focusOffset),r=Sp(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(Cm,"findCompositionNode");function Mm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}c(Mm,"timestampFromCustomEvent");function Si(n,e=!1){if(!(tt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Eu(n),e||n.docView&&n.docView.dirty){let t=pl(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(Si,"endComposition");function Tm(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(Tm,"captureCopy");const Tr=ye&&xt<15||Un&&Ep<604;he.copy=pe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Tr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=gl(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Tm(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Em(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}c(Em,"sliceSingleNode");function Om(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?Er(n,r.value,null,i,e):Er(n,r.textContent,r.innerHTML,i,e)},50)}c(Om,"capturePaste");function Er(n,e,t,r,i){let s=bu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||E.empty)))return!0;if(!s)return!1;let o=Em(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(Er,"doPaste");function Ou(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(Ou,"getText$1");pe.paste=(n,e)=>{let t=e;if(n.composing&&!tt)return;let r=Tr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Er(n,Ou(r),r.getData("text/html"),i,t)?t.preventDefault():Om(n,t)};const Ea=class Ea{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};c(Ea,"Dragging");let vi=Ea;const Am=Ce?"altKey":"ctrlKey";function Au(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Am]}c(Au,"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(Cs(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof I?i.to-1:i.to))){if(r&&r.mightDrag)o=I.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=I.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:d,slice:u}=gl(n,l);(!t.dataTransfer.files.length||!ae||iu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Tr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Tr||t.dataTransfer.setData("text/plain",d),n.dragging=new vi(u,Au(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(Cs(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=bu(n,Ou(t.dataTransfer),Tr?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&Au(n,t));if(n.someProp("handleDrop",m=>m(n,t,o||E.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?$d(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let d=n.state.tr;if(l){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=d.doc;if(f?d.replaceRangeWith(u,u,o.content.firstChild):d.replaceRange(u,u,o),d.doc.eq(h))return;let p=d.doc.resolve(u);if(f&&I.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))d.setSelection(new I(p));else{let m=d.mapping.map(a);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),d.setSelection(ml(n,p,d.doc.resolve(m)))}n.focus(),n.dispatch(d.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())&&it(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&&tt&&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,Rt(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 Or(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(Or,"compareObjs");const ys=class ys{constructor(e,t){this.toDOM=e,this.spec=t||Gt,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 Oe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ys&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Or(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};c(ys,"WidgetType");let Ci=ys;const xr=class xr{constructor(e,t){this.attrs=e,this.spec=t||Gt}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 Oe(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xr&&Or(this.attrs,e.attrs)&&Or(this.spec,e.spec)}static is(e){return e.type instanceof xr}destroy(){}};c(xr,"InlineType");let _t=xr;const bs=class bs{constructor(e,t){this.attrs=e,this.spec=t||Gt}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 Oe(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 bs&&Or(this.attrs,e.attrs)&&Or(this.spec,e.spec)}destroy(){}};c(bs,"NodeType");let Bo=bs;const Vt=class Vt{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Vt(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 Vt(e,e,new Ci(t,r))}static inline(e,t,r,i){return new Vt(e,t,new _t(r,i))}static node(e,t,r,i){return new Vt(e,t,new Bo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof _t}get widget(){return this.type instanceof Ci}};c(Vt,"Decoration");let Oe=Vt;const gn=[],Gt={},$e=class $e{constructor(e,t){this.local=e.length?e:gn,this.children=t.length?t:gn}static create(e,t){return t.length?Ti(t,e,0,Gt):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||Gt)}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?Nm(this.children,o||[],e,t,r,i,s):o?new $e(o.sort(Yt),gn):le}add(e,t){return t.length?this==le?$e.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let d=a+r,u;if(u=Iu(t,l,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,d+1):i.splice(s,0,a,a+l.nodeSize,Ti(u,l,d+1,Gt)),s+=3}});let o=Nu(s?Ru(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new $e(o.length?this.local.concat(o).sort(Yt):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 u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(o,l+1);d!=le?r[s+2]=d:(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 $e(i,r):le}forChild(e,t){if(this==le)return this;if(t.isLeaf)return $e.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 _t){let d=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;d<u&&(i||(i=[])).push(a.copy(d,u))}}if(i){let l=new $e(i.sort(Yt),gn);return r?new Mi([l,r]):l}return r||le}eq(e){if(this==e)return!0;if(!(e instanceof $e)||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 wl(this.localsInner(e))}localsInner(e){if(this==le)return gn;if(e.inlineContent||!this.local.some(_t.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _t||t.push(this.local[r]);return t}forEachSet(e){e(this)}};c($e,"DecorationSet");let oe=$e;oe.empty=new oe([],[]);oe.removeOverlap=wl;const le=oe.empty,gt=class gt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Gt));return gt.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 gt?r=r.concat(s.members):r.push(s))}return gt.from(r)}eq(e){if(!(e instanceof gt)||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?wl(r?t:t.sort(Yt)):gn}static from(e){switch(e.length){case 0:return le;case 1:return e[0];default:return new gt(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(gt,"DecorationGroup");let Mi=gt;function Nm(n,e,t,r,i,s,o){let l=n.slice();for(let d=0,u=s;d<t.maps.length;d++){let f=0;t.maps[d].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+u-f)continue;let S=l[b]+u-f;p>=S?l[b+1]=h<=S?-2:-1:h>=u&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let a=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){a=!0,l[d+1]=-1;continue}let u=t.map(n[d]+s),f=u-i;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[d+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[d+2].mapInner(t,y,u+1,n[d]+s+1,o);b!=le?(l[d]=f,l[d+1]=p,l[d+2]=b):(l[d+1]=-2,a=!0)}else a=!0}if(a){let d=Im(l,n,e,t,i,s,o),u=Ti(d,r,0,o);e=u.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<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new oe(e.sort(Yt),l)}c(Nm,"mapChildren");function Nu(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 Oe(i.from+e,i.to+e,i.type))}return t}c(Nu,"moveSpans");function Im(n,e,t,r,i,s,o){function l(a,d){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,i,d);f?t.push(f):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+d+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(Im,"mapAndGatherRemainingDecorations");function Iu(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(Iu,"takeSpansForNode");function Ru(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}c(Ru,"withoutNulls");function Ti(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let d=Iu(n,l,a+t);if(d){s=!0;let u=Ti(d,l,t+a+1,r);u!=le&&i.push(a,a+l.nodeSize,u)}});let o=Nu(s?Ru(n):n,-t).sort(Yt);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(Ti,"buildTree");function Yt(n,e){return n.from-e.from||n.to-e.to}c(Yt,"byPos");function wl(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),wc(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),wc(e,i,r.copy(s.from,r.to)));break}}}return e}c(wl,"removeOverlap");function wc(n,e,t){for(;e<n.length&&Yt(t,n[e])>0;)e++;n.splice(e,0,t)}c(wc,"insertAhead");function qs(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])),Mi.from(e)}c(qs,"viewDecorations");const Rm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dm=ye&&xt<=11,Oa=class Oa{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(Oa,"SelectionState");let zo=Oa;const Aa=class Aa{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new zo,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&&xt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Dm&&(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,Rm)),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(fc(this.view)){if(this.suppressingSelectionUpdates)return it(this.view);if(ye&&xt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ln(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=jn(s))t.add(s);for(let s=e.anchorNode;s;s=jn(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)&&fc(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],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(Te&&a.length){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Bm(e,f)!=p)&&h.remove()}}}let d=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&vs(r)&&(d=pl(e))&&d.eq(R.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,it(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Pm(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||it(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ye&&xt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!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,d=r.localPosFromDOM(e.target,a,1);return{from:l,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}};c(Aa,"DOMObserver");let $o=Aa,xc=new WeakMap,Sc=!1;function Pm(n){if(!xc.has(n)&&(xc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Te,Sc)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."),Sc=!0}}c(Pm,"checkCSS");function vc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return ln(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}c(vc,"rangeToSelectionRange");function Lm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return vc(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?vc(n,t):null}c(Lm,"safariShadowSelectionRange");function Bm(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(Bm,"blockParent");function zm(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),d,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:a.anchorOffset}],vs(a)||d.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")||Jt.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:d,ruleFromNode:$m,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+o,head:b+o}}return{doc:g,sel:m,from:o,to:l}}c(zm,"parseBetween");function $m(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($m,"ruleFromNode");const Fm=/^(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 Vm(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,N=pl(n,M);if(N&&!n.state.selection.eq(N)){if(ae&&tt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,Rt(13,"Enter"))))return;let P=n.state.tr.setSelection(N);M=="pointer"?P.setMeta("pointer",!0):M=="key"&&P.scrollIntoView(),s&&P.setMeta("composition",s),n.dispatch(P)}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,d=zm(n,e,t),u=n.state.doc,f=u.slice(d.from,d.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=Um(f.content,d.doc.content,d.from,h,p);if(m&&n.input.domChangeCount++,(Un&&n.input.lastIOSEnter>Date.now()-225||tt)&&i.some(M=>M.nodeType==1&&!Fm.test(M.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",M=>M(n,Rt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(d.sel){let M=Cc(n,n.state.doc,d.sel);if(M&&!M.eq(n.state.selection)){let N=n.state.tr.setSelection(M);s&&N.setMeta("composition",s),n.dispatch(N)}}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>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),ye&&xt<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Un&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,Rt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&jm(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,Rt(8,"Backspace")))){tt&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),tt&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Rt(13,"Enter"))})},20));let S=m.start,T=m.endA,x=c(M=>{let N=M||n.state.tr.replace(S,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let P=Cc(n,N.doc,d.sel);P&&!(ae&&n.composing&&P.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(P.head==S||P.head==N.mapping.map(T)-1)||ye&&P.empty&&P.head==S)&&N.setSelection(P)}return s&&N.setMeta("composition",s),N.scrollIntoView()},"mkTr"),O;if(k)if(g.pos==y.pos){ye&&xt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>it(n),20));let M=x(n.state.tr.delete(S,T)),N=u.resolve(m.start).marksAcross(u.resolve(m.endA));N&&M.ensureMarks(N),n.dispatch(M)}else if(m.endA==m.endB&&(O=Hm(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let M=x(n.state.tr);O.type=="add"?M.addMark(S,T,O.mark):M.removeMark(S,T,O.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,y.parentOffset),N=c(()=>x(n.state.tr.insertText(M,S,T)),"deflt");n.someProp("handleTextInput",P=>P(n,S,T,M,N))||n.dispatch(N())}else n.dispatch(x());else n.dispatch(x())}c(Vm,"readDOMChange");function Cc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ml(n,e.resolve(t.anchor),e.resolve(t.head))}c(Cc,"resolveSelection");function Hm(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=c(u=>u.mark(l.addToSet(u.marks)),"update");else if(i.length==0&&s.length==1)l=s[0],o="remove",a=c(u=>u.mark(l.removeFromSet(u.marks)),"update");else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(a(e.child(u)));if(C.from(d).eq(n))return{mark:l,type:o}}c(Hm,"isMarkChange");function jm(n,e,t,r,i){if(t-e<=i.pos-r.pos||Js(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(Js(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Js(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}c(jm,"looksLikeBackspace");function Js(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(Js,"skipClosingAndOpening");function Um(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&&Mc(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&&Mc(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}c(Um,"findDiff");function Mc(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(Mc,"isSurrogatePair");const Na=class Na{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 Do,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Nc),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=Oc(this),Ec(this),this.nodeViews=Ac(this),this.docView=oc(this.state.doc,Tc(this),qs(this),this.dom,this),this.domObserver=new $o(this,(r,i,s,o)=>Vm(this,r,i,s,o)),this.domObserver.start(),fm(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&&Po(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nc),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&&(Eu(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=Ac(this);Km(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Po(this),this.editable=Oc(this),Ec(this);let a=qs(this),d=Tc(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,d,a);(f||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Np(this);if(o){this.domObserver.stop();let p=f&&(ye||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Wm(i.selection,e.selection);if(f){let m=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Cm(this)),(s||!this.docView.update(e.doc,d,a,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=oc(e.doc,d,a,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xp(this))?it(this,p):(mu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&Ip(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 I){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ec(this,t.getBoundingClientRect(),e)}else ec(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 vi(e.slice,e.move,i<0?void 0:I.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&&Rp(this.dom),it(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 zp(this,e)}coordsAtPos(e,t=1){return cu(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 jp(this,t||this.state,e)}pasteHTML(e,t){return Er(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Er(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return gl(this,e)}destroy(){this.docView&&(hm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,kp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return mm(this,e)}domSelectionRange(){let e=this.domSelection();return e?fe&&this.root.nodeType===11&&Cp(this.dom.ownerDocument)==this.dom&&Lm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};c(Na,"EditorView");let Ei=Na;Ei.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Tc(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"),[Oe.node(0,n.state.doc.content.size,e)]}c(Tc,"computeDocDeco");function Ec(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:Oe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}c(Ec,"updateCursorWrapper");function Oc(n){return!n.someProp("editable",e=>e(n.state)===!1)}c(Oc,"getEditable");function Wm(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(Wm,"selectionContextChanged");function Ac(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(Ac,"buildNodeViews");function Km(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(Km,"changedNodeViews");function Nc(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(Nc,"checkStateComponent");var Tt={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:"'"},Oi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qm=typeof navigator<"u"&&/Mac/.test(navigator.platform),Jm=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ie=0;ie<10;ie++)Tt[48+ie]=Tt[96+ie]=String(ie);for(var ie=1;ie<=24;ie++)Tt[ie+111]="F"+ie;for(var ie=65;ie<=90;ie++)Tt[ie]=String.fromCharCode(ie+32),Oi[ie]=String.fromCharCode(ie);for(var _s in Tt)Oi.hasOwnProperty(_s)||(Oi[_s]=Tt[_s]);function _m(n){var e=qm&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Jm&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Oi:Tt)[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(_m,"keyName");const Gm=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ym=typeof navigator<"u"&&/Win/.test(navigator.platform);function Xm(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))Gm?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(Xm,"normalizeKeyName$1");function Qm(n){let e=Object.create(null);for(let t in n)e[Xm(t)]=n[t];return e}c(Qm,"normalize");function Gs(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(Gs,"modifiers");function Zm(n){return new H({props:{handleKeyDown:xl(n)}})}c(Zm,"keymap");function xl(n){let e=Qm(n);return function(t,r){let i=_m(r),s,o=e[Gs(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Gs(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ym&&r.ctrlKey&&r.altKey)&&(s=Tt[r.keyCode])&&s!=i){let l=e[Gs(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}c(xl,"keydownHandler");var eg=Object.defineProperty,Sl=c((n,e)=>{for(var t in e)eg(n,t,{get:e[t],enumerable:!0})},"__export$1");function Ms(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(Ms,"createChainableState");var Mn,Ts=(Mn=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((...u)=>{const f=a(...u)(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,d=e||s.tr,u=c(()=>(!a&&t&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(d),l.every(h=>h===!0)),"run3"),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,c((...g)=>{const y=this.buildProps(d,t),b=p(...g)(y);return l.push(b),f},"chainedCommand")])),run:u};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,d])=>[a,(...u)=>d(...u)({...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:Ms({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,d])=>[a,(...u)=>d(...u)(l)]))}};return l}},c(Mn,"CommandManager"),Mn),Du={};Sl(Du,{blur:c(()=>tg,"blur"),clearContent:c(()=>ng,"clearContent"),clearNodes:c(()=>rg,"clearNodes"),command:c(()=>ig,"command"),createParagraphNear:c(()=>sg,"createParagraphNear"),cut:c(()=>og,"cut"),deleteCurrentNode:c(()=>lg,"deleteCurrentNode"),deleteNode:c(()=>ag,"deleteNode"),deleteRange:c(()=>cg,"deleteRange"),deleteSelection:c(()=>dg,"deleteSelection"),enter:c(()=>ug,"enter"),exitCode:c(()=>fg,"exitCode"),extendMarkRange:c(()=>hg,"extendMarkRange"),first:c(()=>pg,"first"),focus:c(()=>gg,"focus"),forEach:c(()=>yg,"forEach"),insertContent:c(()=>bg,"insertContent"),insertContentAt:c(()=>xg,"insertContentAt"),joinBackward:c(()=>Cg,"joinBackward"),joinDown:c(()=>vg,"joinDown"),joinForward:c(()=>Mg,"joinForward"),joinItemBackward:c(()=>Tg,"joinItemBackward"),joinItemForward:c(()=>Eg,"joinItemForward"),joinTextblockBackward:c(()=>Og,"joinTextblockBackward"),joinTextblockForward:c(()=>Ag,"joinTextblockForward"),joinUp:c(()=>Sg,"joinUp"),keyboardShortcut:c(()=>Ig,"keyboardShortcut"),lift:c(()=>Rg,"lift"),liftEmptyBlock:c(()=>Dg,"liftEmptyBlock"),liftListItem:c(()=>Pg,"liftListItem"),newlineInCode:c(()=>Lg,"newlineInCode"),resetAttributes:c(()=>Bg,"resetAttributes"),scrollIntoView:c(()=>zg,"scrollIntoView"),selectAll:c(()=>$g,"selectAll"),selectNodeBackward:c(()=>Fg,"selectNodeBackward"),selectNodeForward:c(()=>Vg,"selectNodeForward"),selectParentNode:c(()=>Hg,"selectParentNode"),selectTextblockEnd:c(()=>jg,"selectTextblockEnd"),selectTextblockStart:c(()=>Ug,"selectTextblockStart"),setContent:c(()=>Wg,"setContent"),setMark:c(()=>ly,"setMark"),setMeta:c(()=>ay,"setMeta"),setNode:c(()=>cy,"setNode"),setNodeSelection:c(()=>dy,"setNodeSelection"),setTextSelection:c(()=>uy,"setTextSelection"),sinkListItem:c(()=>fy,"sinkListItem"),splitBlock:c(()=>hy,"splitBlock"),splitListItem:c(()=>py,"splitListItem"),toggleList:c(()=>my,"toggleList"),toggleMark:c(()=>gy,"toggleMark"),toggleNode:c(()=>yy,"toggleNode"),toggleWrap:c(()=>by,"toggleWrap"),undoInputRule:c(()=>ky,"undoInputRule"),unsetAllMarks:c(()=>wy,"unsetAllMarks"),unsetMark:c(()=>xy,"unsetMark"),updateAttributes:c(()=>Sy,"updateAttributes"),wrapIn:c(()=>vy,"wrapIn"),wrapInList:c(()=>Cy,"wrapInList")});var tg=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"),rg=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:d,mapping:u}=e,f=d.resolve(u.map(a)),h=d.resolve(u.map(a+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Yn(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"),ig=c(n=>e=>n(e),"command"),sg=c(()=>({state:n,dispatch:e})=>Zd(n,e),"createParagraphNear"),og=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"),lg=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 ag=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),d=s.after(o);e.delete(a,d).scrollIntoView()}return!0}return!1},"deleteNode"),cg=c(n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},"deleteRange"),dg=c(()=>({state:n,dispatch:e})=>al(n,e),"deleteSelection"),ug=c(()=>({commands:n})=>n.keyboardShortcut("Enter"),"enter"),fg=c(()=>({state:n,dispatch:e})=>ip(n,e),"exitCode");function vl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}c(vl,"isRegExp");function Ai(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:vl(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}c(Ai,"objectIncludes");function Pu(n,e,t={}){return n.find(r=>r.type===e&&Ai(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}c(Pu,"findMarkInSet");function Ic(n,e,t={}){return!!Pu(n,e,t)}c(Ic,"isMarkInSet");function Cl(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!Pu([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,d=l+i.node.nodeSize;for(;o>0&&Ic([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&Ic([...n.parent.child(a).marks],e,t);)d+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:d}}c(Cl,"getMarkRange");function ot(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(ot,"getMarkType");var hg=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=ot(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:d,to:u}=l;if(i){const f=Cl(a,s,e);if(f&&f.from<=d&&f.to>=u){const h=L.create(o,f.from,f.to);t.setSelection(h)}}return!0},"extendMarkRange"),pg=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 Ml(n){return n instanceof L}c(Ml,"isTextSelection");function nt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}c(nt,"minMax");function Lu(n,e=null){if(!e)return null;const t=R.atStart(n),r=R.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,nt(0,i,s),nt(n.content.size,i,s)):L.create(n,nt(e,i,s),nt(e,i,s))}c(Lu,"resolveFocusPosition");function mg(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}c(mg,"isAndroid");function Tl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}c(Tl,"isiOS");var gg=c((n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=c(()=>{(Tl()||mg())&&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&&!Ml(t.state.selection))return o(),!0;const l=Lu(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"),yg=c((n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),"forEach"),bg=c((n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),"insertContent"),Bu=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&&Bu(r)}return n},"removeWhitespaces");function jr(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 Bu(t)}c(jr,"elementFromString");function Ar(n,e,t){if(n instanceof wt||n instanceof C)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 C.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),Ar("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="";const a=new ci({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(d=>(o=!0,l=typeof d=="string"?d:d.outerHTML,null),"getAttrs")}]}})});if(t.slice?Jt.fromSchema(a).parseSlice(jr(n),t.parseOptions):Jt.fromSchema(a).parse(jr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Jt.fromSchema(e);return t.slice?s.parseSlice(jr(n),t.parseOptions).content:s.parse(jr(n),t.parseOptions)}return Ar("",e,t)}c(Ar,"createNodeFromContent");function kg(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,d,u)=>{o===0&&(o=u)}),n.setSelection(R.near(n.doc.resolve(o),t))}c(kg,"selectionToInsertionEnd");var wg=c(n=>!("type"in n),"isFragment"),xg=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"),d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ar(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Ar(e,s.schema,{parseOptions:d,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((wg(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),u===f&&p){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof C){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=l;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,S=b.isText||b.isTextblock,T=b.content.size>0;k&&S&&T&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&kg(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},"insertContentAt"),Sg=c(()=>({state:n,dispatch:e})=>tp(n,e),"joinUp"),vg=c(()=>({state:n,dispatch:e})=>np(n,e),"joinDown"),Cg=c(()=>({state:n,dispatch:e})=>qd(n,e),"joinBackward"),Mg=c(()=>({state:n,dispatch:e})=>Yd(n,e),"joinForward"),Tg=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=xs(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemBackward"),Eg=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=xs(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemForward"),Og=c(()=>({state:n,dispatch:e})=>Zh(n,e),"joinTextblockBackward"),Ag=c(()=>({state:n,dispatch:e})=>ep(n,e),"joinTextblockForward");function zu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}c(zu,"isMacOS");function Ng(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))Tl()||zu()?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(Ng,"normalizeKeyName");var Ig=c(n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=Ng(n).split(/-(?!$)/),o=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),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",d=>d(t,l))});return a?.steps.forEach(d=>{const u=d.map(r.mapping);u&&i&&r.maybeStep(u)}),!0},"keyboardShortcut");function Et(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,d=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Ai(f.node.attrs,t,{strict:!1}));return s?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=a}c(Et,"isNodeActive");var Rg=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return Et(t,i,e)?rp(t,r):!1},"lift"),Dg=c(()=>({state:n,dispatch:e})=>eu(n,e),"liftEmptyBlock"),Pg=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return mp(r)(e,t)},"liftListItem"),Lg=c(()=>({state:n,dispatch:e})=>Qd(n,e),"newlineInCode");function Es(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}c(Es,"getSchemaTypeNameByName");function Rc(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(Rc,"deleteProps");var Bg=c((n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Es(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ot(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(d,u)=>{s&&s===d.type&&t.setNodeMarkup(u,void 0,Rc(d.attrs,e)),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&t.addMark(u,u+d.nodeSize,o.create(Rc(f.attrs,e)))})})}),!0):!1},"resetAttributes"),zg=c(()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),"scrollIntoView"),$g=c(()=>({tr:n,dispatch:e})=>{if(e){const t=new Ie(n.doc);n.setSelection(t)}return!0},"selectAll"),Fg=c(()=>({state:n,dispatch:e})=>_d(n,e),"selectNodeBackward"),Vg=c(()=>({state:n,dispatch:e})=>Xd(n,e),"selectNodeForward"),Hg=c(()=>({state:n,dispatch:e})=>lp(n,e),"selectParentNode"),jg=c(()=>({state:n,dispatch:e})=>dp(n,e),"selectTextblockEnd"),Ug=c(()=>({state:n,dispatch:e})=>cp(n,e),"selectTextblockStart");function Fo(n,e,t={},r={}){return Ar(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}c(Fo,"createDocument");var Wg=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 d=Fo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,d).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 $u(n,e){const t=ot(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($u,"getMarkAttributes");function Fu(n,e){const t=new pi(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}c(Fu,"combineTransactionSteps");function Kg(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(Kg,"defaultBlockAt");function qg(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}c(qg,"findChildrenInRange");function Jg(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(Jg,"findParentNodeClosestToPos");function Br(n){return e=>Jg(e.$from,n)}c(Br,"findParentNode");function A(n,e,t){return n.config[e]===void 0&&n.parent?A(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?A(n.parent,e,t):null}):n.config[e]}c(A,"getExtensionField");function El(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=A(e,"addExtensions",t);return r?[e,...El(r())]:e}).flat(10)}c(El,"flattenExtensions");function Ol(n,e){const t=on.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}c(Ol,"getHTMLFromFragment");function Vu(n){return typeof n=="function"}c(Vu,"isFunction");function $(n,e=void 0,...t){return Vu(n)?e?n.bind(e)(...t):n(...t):n}c($,"callOrReturn");function _g(n={}){return Object.keys(n).length===0&&n.constructor===Object}c(_g,"isEmptyObject");function Nr(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(Nr,"splitExtensions");function Hu(n){const e=[],{nodeExtensions:t,markExtensions:r}=Nr(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=A(o,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(f=>{Object.entries(u.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=A(o,"addAttributes",l);if(!a)return;const d=a();Object.entries(d).forEach(([u,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:u,attribute:h})})}),e}c(Hu,"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(" "):[],d=l.filter(u=>!a.includes(u));r[i]=[...a,...d].join(" ")}else if(i==="style"){const l=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;a.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),l.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),r[i]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=s}),r},{})}c(Y,"mergeAttributes");function Ni(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(Ni,"getRenderedAttributes");function Gg(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}c(Gg,"fromString");function Dc(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):Gg(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}},"getAttrs")}}c(Dc,"injectExtensionAttributesToParseRule");function Pc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&_g(t)?!1:t!=null))}c(Pc,"cleanUpSchemaItem");function Yg(n,e){var t;const r=Hu(n),{nodeExtensions:i,markExtensions:s}=Nr(n),o=(t=i.find(d=>A(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(d=>{const u=r.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((b,k)=>{const S=A(k,"extendNodeSchema",f);return{...b,...S?S(d):{}}},{}),p=Pc({...h,content:$(A(d,"content",f)),marks:$(A(d,"marks",f)),group:$(A(d,"group",f)),inline:$(A(d,"inline",f)),atom:$(A(d,"atom",f)),selectable:$(A(d,"selectable",f)),draggable:$(A(d,"draggable",f)),code:$(A(d,"code",f)),whitespace:$(A(d,"whitespace",f)),linebreakReplacement:$(A(d,"linebreakReplacement",f)),defining:$(A(d,"defining",f)),isolating:$(A(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,S;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(S=b?.attribute)==null?void 0:S.validate}]}))}),m=$(A(d,"parseHTML",f));m&&(p.parseDOM=m.map(b=>Dc(b,u)));const g=A(d,"renderHTML",f);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Ni(b,u)}));const y=A(d,"renderText",f);return y&&(p.toText=y),[d.name,p]})),a=Object.fromEntries(s.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((y,b)=>{const k=A(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),p=Pc({...h,inclusive:$(A(d,"inclusive",f)),excludes:$(A(d,"excludes",f)),group:$(A(d,"group",f)),spanning:$(A(d,"spanning",f)),code:$(A(d,"code",f)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=$(A(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>Dc(y,u)));const g=A(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Ni(y,u)})),[d.name,p]}));return new ci({topNode:o,nodes:l,marks:a})}c(Yg,"getSchemaByResolvedExtensions");function Xg(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}c(Xg,"findDuplicates");function Al(n){return n.sort((t,r)=>{const i=A(t,"priority")||100,s=A(r,"priority")||100;return i>s?-1:i<s?1:0})}c(Al,"sortExtensions");function ju(n){const e=Al(El(n)),t=Xg(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(ju,"resolveExtensions");function Uu(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
11
|
-
|
|
12
|
-
`,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,d,u,f)=>{var h;a.isBlock&&d>r&&(l+=s);const p=o?.[a.type.name];if(p)return u&&(l+=p({node:a,pos:d,parent:u,index:f,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,d)-d,i-d))}),l}c(Uu,"getTextBetween");function Wu(n,e){const t={from:0,to:n.content.size};return Uu(n,t,e)}c(Wu,"getText");function Nl(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}c(Nl,"getTextSerializersFromSchema");function Qg(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(Qg,"getNodeAttributes");function Ku(n,e){const t=Es(typeof e=="string"?e:e.name,n.schema);return t==="node"?Qg(n,e):t==="mark"?$u(n,e):{}}c(Ku,"getAttributes");function Zg(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(Zg,"removeDuplicates");function ey(n){const e=Zg(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(ey,"simplifyChangedRanges");function qu(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 d=e.slice(s).map(l,-1),u=e.slice(s).map(a),f=e.invert().map(d,-1),h=e.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:d,to:u}})})}),ey(r)}c(qu,"getChangedRanges");function Il(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=Cl(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(Il,"getMarksBetween");var ty=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 Ys(n,e){return e.nodes[n]||e.marks[n]||null}c(Ys,"getSchemaTypeByName");function ti(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(ti,"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,d;const u=((d=(a=i.type.spec).toText)==null?void 0:d.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),t},"getTextContentFromNodes");function Vo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?ot(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Ai(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),S=k-b;o+=S,l.push(...g.marks.map(T=>({mark:T,from:b,to:k})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Ai(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),d=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+d:a)>=o}c(Vo,"isMarkActive");function ry(n,e,t={}){if(!e)return Et(n,null,t)||Vo(n,null,t);const r=Es(e,n.schema);return r==="node"?Et(n,e,t):r==="mark"?Vo(n,e,t):!1}c(ry,"isActive");var iy=c((n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=Br(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"),sy=c(n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)},"isAtStartOfNode");function Lc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}c(Lc,"isExtensionRulesEnabled");function Bc(n,e){const{nodeExtensions:t}=Nr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=$(A(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}c(Bc,"isList");function Os(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&&(Os(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}c(Os,"isNodeEmpty");function Ju(n){return n instanceof I}c(Ju,"isNodeSelection");function Rl(n,e,t){const i=n.state.doc.content.size,s=nt(e,0,i),o=nt(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),d=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),h=Math.max(l.right,a.right),p=h-f,m=u-d,b={top:d,bottom:u,left:f,right:h,width:p,height:m,x:f,y:d};return{...b,toJSON:c(()=>b,"toJSON")}}c(Rl,"posToDOMRect");function oy(n,e,t){var r;const{selection:i}=e;let s=null;if(Ml(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(d=>d.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,f,h)=>{if(d)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=p&&m}return!d}),d})}c(oy,"canSetMark");var ly=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=ot(n,r.schema);if(i)if(o){const d=$u(r,a);t.addStoredMark(a.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),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 oy(r,t,a)},"setMark"),ay=c((n,e)=>({tr:t})=>(t.setMeta(n,e),!0),"setMeta"),cy=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})=>Xa(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Xa(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},"setNode"),dy=c(n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=nt(n,0,r.content.size),s=I.create(r,i);e.setSelection(s)}return!0},"setNodeSelection"),uy=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=nt(i,o,l),d=nt(s,o,l),u=L.create(r,a,d);e.setSelection(u)}return!0},"setTextSelection"),fy=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return bp(r)(e,t)},"sinkListItem");function zc(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(zc,"ensureMarks");var hy=c(({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,d=i.extensionManager.attributes,u=ti(d,l.node().type.name,l.node().attrs);if(s instanceof I&&s.node.isBlock)return!l.parentOffset||!rt(o,l.pos)?!1:(r&&(n&&zc(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:Kg(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=rt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&rt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]: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&&zc(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},"splitBlock"),py=c((n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const l=G(n,r.schema),{$from:a,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(d))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=C.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let N=a.depth-k;N>=a.depth-3;N-=1)b=C.from(a.node(N).copy(b));const S=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,T={...ti(h,a.node().type.name,a.node().attrs),...e},x=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(T))||void 0;b=b.append(C.from(l.createAndFill(null,x)||void 0));const O=a.before(a.depth-(k-1));t.replace(O,a.after(-S),new E(b,4-k,0));let M=-1;t.doc.nodesBetween(O,t.doc.content.size,(N,P)=>{if(M>-1)return!1;N.isTextblock&&N.content.size===0&&(M=P+1)}),M>-1&&t.setSelection(L.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const p=d.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...ti(h,f.type.name,f.attrs),...e},g={...ti(h,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,d.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!rt(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:S}=s.extensionManager,T=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!T||!i)return!0;const x=T.filter(O=>S.includes(O.type.name));t.ensureMarks(x)}return!0},"splitListItem"),Xs=c((n,e)=>{const t=Br(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&&At(n.doc,t.pos)&&n.join(t.pos),!0},"joinListBackwards"),Qs=c((n,e)=>{const t=Br(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&&At(n.doc,r)&&n.join(r),!0},"joinListForwards"),my=c((n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:d,can:u})=>{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,S=b.blockRange(k),T=y||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const x=Br(O=>Bc(O.type.name,f))(g);if(S.depth>=1&&x&&S.depth-x.depth<=1){if(x.node.type===p)return d.liftListItem(m);if(Bc(x.node.type.name,f)&&p.validContent(x.node.content)&&l)return a().command(()=>(s.setNodeMarkup(x.pos,p),!0)).command(()=>Xs(s,p)).command(()=>Qs(s,p)).run()}return!t||!T||!l?a().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>Xs(s,p)).command(()=>Qs(s,p)).run():a().command(()=>{const O=u().wrapInList(p,r),M=T.filter(N=>h.includes(N.type.name));return s.ensureMarks(M),O?!0:d.clearNodes()}).wrapInList(p,r).command(()=>Xs(s,p)).command(()=>Qs(s,p)).run()},"toggleList"),gy=c((n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ot(n,r.schema);return Vo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},"toggleMark"),yy=c((n,e,t={})=>({state:r,commands:i})=>{const s=G(n,r.schema),o=G(e,r.schema),l=Et(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"),by=c((n,e={})=>({state:t,commands:r})=>{const i=G(n,t.schema);return Et(t,i,e)?r.lift(i):r.wrapIn(i,e)},"toggleWrap"),ky=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"),wy=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"),xy=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=ot(n,r.schema),{$from:d,empty:u,ranges:f}=l;if(!i)return!0;if(u&&o){let{from:h,to:p}=l;const m=(s=d.marks().find(y=>y.type===a))==null?void 0:s.attrs,g=Cl(d,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"),Sy=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Es(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ot(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const d=a.$from.pos,u=a.$to.pos;let f,h,p,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,y)=>{s&&s===g.type&&(p=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,h=g)}):r.doc.nodesBetween(d,u,(g,y)=>{y<d&&s&&s===g.type&&(p=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,h=g),y>=d&&y<=u&&(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,d),S=Math.min(y+g.nodeSize,u);t.addMark(k,S,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"),vy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return up(i,e)(t,r)},"wrapIn"),Cy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return fp(i,e)(t,r)},"wrapInList"),Tn,My=(Tn=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(Tn,"EventEmitter"),Tn),En,As=(En=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},c(En,"InputRule"),En),Ty=c((n,e)=>{if(vl(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 Ur(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 d=a.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=ny(d)+s;return o.forEach(h=>{if(u)return;const p=Ty(f,h.find);if(!p)return;const m=a.state.tr,g=Ms({state:a.state,transaction:m}),y={from:r-(p[0].length-s.length),to:i},{commands:b,chain:k,can:S}=new Ts({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:k,can:S})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:s}),a.dispatch(m),u=!0)}),u}c(Ur,"run$2");function Ey(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:u}=a;typeof u=="string"?u=u:u=Ol(C.from(u),o.schema);const{from:f}=a,h=f+u.length;Ur({editor:e,from:f,to:h,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Ur({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:c(i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ur({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?Ur({editor:e,from:o.pos,to:o.pos,text:`
|
|
13
|
-
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}c(Ey,"inputRulesPlugin");function Oy(n){return Object.prototype.toString.call(n).slice(8,-1)}c(Oy,"getType");function Wr(n){return Oy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}c(Wr,"isPlainObject");function _u(n,e){const t={...n};return Wr(n)&&Wr(e)&&Object.keys(e).forEach(r=>{Wr(e[r])&&Wr(n[r])?t[r]=_u(n[r],e[r]):t[r]=e[r]}),t}c(_u,"mergeDeep");var On,Dl=(On=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{...$(A(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...$(A(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:c(()=>_u(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(On,"Extendable"),On),Zt,fn=(Zt=class extends Dl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Zt(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(d=>d?.type.name===t.name))return!1;const a=o.find(d=>d?.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(Zt,"_Mark"),Zt);function Ay(n){return typeof n=="number"}c(Ay,"isNumber");var An,Ny=(An=class{constructor(e){this.find=e.find,this.handler=e.handler}},c(An,"PasteRule"),An),Iy=c((n,e,t)=>{if(vl(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 Ry(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:d,can:u}=new Ts({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,b,k,S;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const T=(S=(k=(b=p.content)==null?void 0:b.size)!=null?k:p.nodeSize)!=null?S:0,x=Math.max(r,m),O=Math.min(i,m+T);if(x>=O)return;const M=p.isText?p.text||"":p.textBetween(x-m,O-m,void 0,"");Iy(M,s.find,o).forEach(P=>{if(P.index===void 0)return;const D=x+P.index+1,j=D+P[0].length,K={from:t.tr.mapping.map(D),to:t.tr.mapping.map(j)},_=s.handler({state:t,range:K,match:P,commands:a,chain:d,can:u,pasteEvent:o,dropEvent:l});f.push(_)})}),f.every(p=>p!==null)}c(Ry,"run2");var Kr=null,Dy=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 Py(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:u,from:f,to:h,rule:p,pasteEvt:m})=>{const g=u.tr,y=Ms({state:u,transaction:g});if(!(!Ry({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(u=>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&&(Kr=e)},"handleDragstart"),p=c(()=>{Kr&&(Kr=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=Kr;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:x}=b;typeof x=="string"?x=x:x=Ol(C.from(x),p.schema);const{from:O}=b,M=O+x.length,N=Dy(x);return a({rule:u,state:p,from:O,to:{b:M},pasteEvt:N})}const S=h.doc.content.findDiffStart(p.doc.content),T=h.doc.content.findDiffEnd(p.doc.content);if(!(!Ay(S)||!T||S===T.b))return a({rule:u,state:p,from:S,to:T,pasteEvt:o})},"appendTransaction")}))}c(Py,"pasteRulesPlugin");var Nn,Ns=(Nn=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=ju(e),this.schema=Yg(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:Ys(t.name,this.schema)},i=A(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this;return Al([...this.extensions].reverse()).flatMap(i=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ys(i.name,this.schema)},o=[],l=A(i,"addKeyboardShortcuts",s);let a={};if(i.type==="mark"&&A(i,"exitable",s)&&(a.ArrowRight=()=>fn.handleExit({editor:e,mark:i})),l){const p=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:e})]));a={...a,...p}}const d=Zm(a);o.push(d);const u=A(i,"addInputRules",s);if(Lc(i,e.options.enableInputRules)&&u){const p=u();if(p&&p.length){const m=Ey({editor:e,rules:p}),g=Array.isArray(m)?m:[m];o.push(...g)}}const f=A(i,"addPasteRules",s);if(Lc(i,e.options.enablePasteRules)&&f){const p=f();if(p&&p.length){const m=Py({editor:e,rules:p});o.push(...m)}}const h=A(i,"addProseMirrorPlugins",s);if(h){const p=h();o.push(...p)}return o})}get attributes(){return Hu(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Nr(this.extensions);return Object.fromEntries(t.filter(r=>!!A(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=A(r,"addNodeView",s);if(!o)return[];const l=c((a,d,u,f,h)=>{const p=Ni(a,i);return o()({node:a,view:d,getPos:u,decorations:f,innerDecorations:h,editor:e,extension:r,HTMLAttributes:p})},"nodeview");return[r.name,l]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=Nr(this.extensions);return Object.fromEntries(t.filter(r=>!!A(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:ot(r.name,this.schema)},o=A(r,"addMarkView",s);if(!o)return[];const l=c((a,d,u)=>{const f=Ni(a,i);return o()({mark:a,view:d,inline:u,editor:e,extension:r,HTMLAttributes:f,updateAttributes:c(h=>{_y(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:Ys(t.name,this.schema)};t.type==="mark"&&((r=$(A(t,"keepOnSplit",i)))==null||r)&&this.splittableMarks.push(t.name);const s=A(t,"onBeforeCreate",i),o=A(t,"onCreate",i),l=A(t,"onUpdate",i),a=A(t,"onSelectionUpdate",i),d=A(t,"onTransaction",i),u=A(t,"onFocus",i),f=A(t,"onBlur",i),h=A(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),d&&this.editor.on("transaction",d),u&&this.editor.on("focus",u),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}},c(Nn,"ExtensionManager"),Nn);Ns.resolve=ju;Ns.sort=Al;Ns.flatten=El;var Ly={};Sl(Ly,{ClipboardTextSerializer:c(()=>Gu,"ClipboardTextSerializer"),Commands:c(()=>Yu,"Commands"),Delete:c(()=>Xu,"Delete"),Drop:c(()=>Qu,"Drop"),Editable:c(()=>Zu,"Editable"),FocusEvents:c(()=>tf,"FocusEvents"),Keymap:c(()=>nf,"Keymap"),Paste:c(()=>rf,"Paste"),Tabindex:c(()=>sf,"Tabindex"),focusEventsPluginKey:c(()=>ef,"focusEventsPluginKey")});var en,J=(en=class extends Dl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new en(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(en,"_Extension"),en),Gu=J.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new H({key:new W("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(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=Nl(t);return Uu(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})},"clipboardTextSerializer")}})]}}),Yu=J.create({name:"commands",addCommands(){return{...Du}}}),Xu=J.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=c(()=>{var o,l,a,d;if((d=(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?d:n.getMeta("y-sync$"))return;const u=Fu(n.before,[n,...e]);qu(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.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:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,y;if(p instanceof Mt){const b=h.slice(m).map(p.from,-1),k=h.slice(m).map(p.to),S=h.invert().map(b,-1),T=h.invert().map(k),x=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(M=>M.eq(p.mark)),O=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(M=>M.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:S,to:T},newRange:{from:b,to:k},partial:!!(O||x),editor:this.editor,transaction:n,combinedTransform:u})}})},"callback");(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Qu=J.create({name:"drop",addProseMirrorPlugins(){return[new H({key:new W("tiptapDrop"),props:{handleDrop:c((n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})},"handleDrop")}})]}}),Zu=J.create({name:"editable",addProseMirrorPlugins(){return[new H({key:new W("editable"),props:{editable:c(()=>this.editor.options.editable,"editable")}})]}}),ef=new W("focusEvents"),tf=J.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new H({key:ef,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")}}})]}}),nf=J.create({name:"keymap",addKeyboardShortcuts(){const n=c(()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:d}=l,{empty:u,$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:R.atStart(d).from===h;return!u||!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 Tl()||zu()?s:i},addProseMirrorPlugins(){return[new H({key:new W("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=R.atStart(e.doc).from,d=R.atEnd(e.doc).to;if(s||!(o===a&&l===d)||!Os(t.doc))return;const h=t.tr,p=Ms({state:t,transaction:h}),{commands:m}=new Ts({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h},"appendTransaction")})]}}),rf=J.create({name:"paste",addProseMirrorPlugins(){return[new H({key:new W("tiptapPaste"),props:{handlePaste:c((n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})},"handlePaste")}})]}}),sf=J.create({name:"tabindex",addProseMirrorPlugins(){return[new H({key:new W("tabindex"),props:{attributes:c(()=>this.editor.isEditable?{tabindex:"0"}:{},"attributes")}})]}}),Ne,By=(Ne=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 Ne(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 Ne(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 Ne(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 Ne(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Ne(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(Ne,"_NodePos"),Ne),zy=`.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 $y(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($y,"createStyleTag");var In,Fy=(In=class extends My{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=Lu(t,this.options.autofocus);this.editorState=wo.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=$y(zy,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=Vu(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?[Zu,Gu.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Yu,tf,nf,sf,Qu,rf,Xu].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 Ns(i,this)}createCommandManager(){this.commandManager=new Ts({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Fo(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=Fo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ei(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(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});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(u=>u.getMeta("focus")||u.getMeta("blur")),a=l?.getMeta("focus"),d=l?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return Ku(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return ry(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ol(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
84
|
-
|
|
85
|
-
`,textSerializers:r={}}=e||{};return Wu(this.state.doc,{blockSeparator:t,textSerializers:{...Nl(this.schema),...r}})}get isEmpty(){return Os(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 By(t,this)}get $doc(){return this.$pos(0)}},c(In,"Editor"),In);function Kn(n){return new As({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=$(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/),d=t.from+l.indexOf(o),u=d+o.length;if(Il(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>d).length)return null;u<t.to&&s.delete(u,t.to),d>t.from&&s.delete(t.from+a,d);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(Kn,"markInputRule");function Vy(n){return new As({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=$(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 d=r[0].lastIndexOf(r[1]);let u=o+d;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,l,a)}else if(r[0]){const d=n.type.isInline?o:o-1;s.insert(d,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},"handler"),undoable:n.undoable})}c(Vy,"nodeInputRule");function Ho(n){return new As({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=$(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(Ho,"textblockTypeInputRule");function qn(n){return new As({find:n.find,handler:c(({state:e,range:t,match:r,chain:i})=>{const s=$(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),d=a&&ll(a,n.type,s);if(!d)return null;if(o.wrap(a,d),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 u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&At(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},"handler"),undoable:n.undoable})}c(qn,"wrappingInputRule");function Hy(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof I){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(Hy,"canInsertNode");var jy={};Sl(jy,{createAtomBlockMarkdownSpec:c(()=>Uy,"createAtomBlockMarkdownSpec"),createBlockMarkdownSpec:c(()=>Wy,"createBlockMarkdownSpec"),createInlineMarkdownSpec:c(()=>Jy,"createInlineMarkdownSpec"),parseAttributes:c(()=>Pl,"parseAttributes"),parseIndentedBlocks:c(()=>jo,"parseIndentedBlocks"),renderNestedMarkdownContent:c(()=>Bl,"renderNestedMarkdownContent"),serializeAttributes:c(()=>Ll,"serializeAttributes")});function Pl(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const d=i.map(u=>u.trim().slice(1));e.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,d,u])=>{var f;const h=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[d]=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(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}c(Pl,"parseAttributes");function Ll(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(Ll,"serializeAttributes");function Uy(n){const{nodeName:e,name:t,parseAttributes:r=Pl,serializeAttributes:i=Ll,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=n,a=t||e,d=c(u=>{if(!l)return u;const f={};return l.forEach(h=>{h in u&&(f[h]=u[h])}),f},"filterAttributes");return{parseMarkdown:c((u,f)=>{const h={...s,...u.attributes};return f.createNode(e,h,[])},"parseMarkdown"),markdownTokenizer:{name:e,level:"block",start(u){var f;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),p=(f=u.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(u,f,h){const p=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.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(u=>{const f=d(u.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${a}${p} :::`},"renderMarkdown")}}c(Uy,"createAtomBlockMarkdownSpec");function Wy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Pl,serializeAttributes:s=Ll,defaultAttributes:o={},content:l="block",allowedAttributes:a}=n,d=t||e,u=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(`^:::${d}`,"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(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,S=i(k);let T=1;const x=b.length;let O="";const M=/^:::([\w-]*)(\s.*)?/gm,N=f.slice(x);for(M.lastIndex=0;;){const P=M.exec(N);if(P===null)break;const D=P.index,j=P[1];if(!((m=P[2])!=null&&m.endsWith(":::"))){if(j)T+=1;else if(T-=1,T===0){const K=N.slice(0,D);O=K.trim();const _=f.slice(0,x+D+P[0].length);let z=[];if(O)if(l==="block")for(z=p.blockTokens(K),z.forEach(V=>{V.text&&(!V.tokens||V.tokens.length===0)&&(V.tokens=p.inlineTokens(V.text))});z.length>0;){const V=z[z.length-1];if(V.type==="paragraph"&&(!V.text||V.text.trim()===""))z.pop();else break}else z=p.inlineTokens(O);return{type:e,raw:_,attributes:S,content:O,tokens:z}}}}}},renderMarkdown:c((f,h)=>{const p=u(f.attrs||{}),m=s(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
|
|
86
|
-
|
|
87
|
-
`);return`:::${d}${g}
|
|
88
|
-
|
|
89
|
-
${y}
|
|
90
|
-
|
|
91
|
-
:::`},"renderMarkdown")}}c(Wy,"createBlockMarkdownSpec");function Ky(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(Ky,"parseShortcodeAttributes");function qy(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}c(qy,"serializeShortcodeAttributes");function Jy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Ky,serializeAttributes:s=qy,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=n,d=t||e,u=c(h=>{if(!a)return h;const p={};return a.forEach(m=>{m in h&&(p[m]=h[m])}),p},"filterAttributes"),f=d.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[,T]=y;k=T}else{const[,T,x]=y;k=T,b=x||""}const S=i(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:S}}},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=u(h.attrs||{}),g=s(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${p}[/${d}]`},"renderMarkdown")}}c(Jy,"createInlineMarkdownSpec");function jo(n,e,t){var r,i,s,o;const l=n.split(`
|
|
92
|
-
`),a=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const h=l[u],p=h.match(e.itemPattern);if(!p){if(a.length>0)break;if(h.trim()===""){u+=1;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;d=`${d}${h}
|
|
93
|
-
`;const b=[y];for(u+=1;u<l.length;){const x=l[u];if(x.trim()===""){const M=l.slice(u+1).findIndex(D=>D.trim()!=="");if(M===-1)break;if((((i=(r=l[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){b.push(x),d=`${d}${x}
|
|
94
|
-
`,u+=1;continue}else break}if((((o=(s=x.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>g)b.push(x),d=`${d}${x}
|
|
95
|
-
`,u+=1;else break}let k;const S=b.slice(1);if(S.length>0){const x=S.map(O=>O.slice(g+f)).join(`
|
|
96
|
-
`);x.trim()&&(e.customNestedParser?k=e.customNestedParser(x):k=t.blockTokens(x))}const T=e.createToken(m,k);a.push(T)}if(a.length!==0)return{items:a,raw:d.trim()}}c(jo,"parseIndentedBlocks");function Bl(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(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
|
|
97
|
-
`).map(h=>h?e.indent(h):"").join(`
|
|
98
|
-
`);a.push(f)}}),a.join(`
|
|
99
|
-
`)}c(Bl,"renderNestedMarkdownContent");function _y(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((l,a)=>{const d=s.mapping.map(a),u=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(d,u,n.type),s.addMark(d,u,p)}}),s.docChanged&&e.view.dispatch(s)}c(_y,"updateMarkViewAttributes");var tn,xe=(tn=class extends Dl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new tn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(tn,"_Node"),tn);function cn(n){return new Ny({find:n.find,handler:c(({state:e,range:t,match:r,pasteEvent:i})=>{const s=$(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 d=t.to;if(l){const u=a.search(/\S/),f=t.from+a.indexOf(l),h=f+l.length;if(Il(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+u,f),d=t.from+u+l.length,o.addMark(t.from+u,d,n.type.create(s||{})),o.removeStoredMark(n.type)}},"handler")})}c(cn,"markPasteRule");var Ii=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"),Gy=/^\s*>\s$/,Yy=xe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Ii("blockquote",{...Y(this.options.HTMLAttributes,n),children:Ii("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[qn({find:Gy,type:this.type})]}}),Xy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Qy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Zy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,e0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,t0=fn.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 Ii("strong",{...Y(this.options.HTMLAttributes,n),children:Ii("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[Kn({find:Xy,type:this.type}),Kn({find:Zy,type:this.type})]},addPasteRules(){return[cn({find:Qy,type:this.type}),cn({find:e0,type:this.type})]}}),n0=/(^|[^`])`([^`]+)`(?!`)$/,r0=/(^|[^`])`([^`]+)`(?!`)/g,i0=fn.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[Kn({find:n0,type:this.type})]},addPasteRules(){return[cn({find:r0,type:this.type})]}}),Zs=4,s0=/^```([a-z]+)?[\s\n]$/,o0=/^~~~([a-z]+)?[\s\n]$/,l0=xe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Zs,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:Zs,{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:d,to:u}=i,p=r.doc.textBetween(d,u,`
|
|
106
|
-
`,`
|
|
107
|
-
`).split(`
|
|
108
|
-
`).map(m=>l+m).join(`
|
|
109
|
-
`);return a.replaceWith(d,u,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:Zs,{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:d}=s,u=s.start(),f=s.end(),p=r.doc.textBetween(u,f,`
|
|
110
|
-
`,`
|
|
111
|
-
`).split(`
|
|
112
|
-
`);let m=0,g=0;const y=d-u;for(let O=0;O<p.length;O+=1){if(g+p[O].length>=y){m=O;break}g+=p[O].length+1}const k=((a=p[m].match(/^ */))==null?void 0:a[0])||"",S=Math.min(k.length,t);if(S===0)return!0;let T=u;for(let O=0;O<m;O+=1)T+=p[O].length+1;return l.delete(T,T+S),d-T<=S&&l.setSelection(L.create(l.doc,T)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:d}=i,h=r.doc.textBetween(a,d,`
|
|
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,d,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:d})=>(d.setSelection(R.near(r.resolve(l))),!0)):n.commands.exitCode()},"ArrowDown")}},addInputRules(){return[Ho({find:s0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")}),Ho({find:o0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")})]},addProseMirrorPlugins(){return[new H({key:new W("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")}})]}}),a0=xe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
|
|
120
|
-
|
|
121
|
-
`):"","renderMarkdown")}),c0=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:d,dispatch:u})=>{if(u&&a&&o){const f=a.filter(h=>l.includes(h.type.name));d.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")}}}),d0=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=>Ho({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),u0=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(!Hy(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Ju(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,d=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(L.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(I.create(o.doc,a.pos)):o.setSelection(L.create(o.doc,a.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=u?.create();f&&(o.insert(d,f),o.setSelection(L.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()},"setHorizontalRule")}},addInputRules(){return[Vy({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),f0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,h0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,p0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,m0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,g0=fn.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[Kn({find:f0,type:this.type}),Kn({find:p0,type:this.type})]},addPasteRules(){return[cn({find:h0,type:this.type}),cn({find:m0,type:this.type})]}});const y0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",b0="ελ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",Uo="numeric",Wo="ascii",Ko="alpha",ar="asciinumeric",nr="alphanumeric",qo="domain",of="emoji",k0="scheme",w0="slashscheme",eo="whitespace";function x0(n,e){return n in e||(e[n]=[]),e[n]}c(x0,"registerGroup");function Wt(n,e,t){e[Uo]&&(e[ar]=!0,e[nr]=!0),e[Wo]&&(e[ar]=!0,e[Ko]=!0),e[ar]&&(e[nr]=!0),e[Ko]&&(e[nr]=!0),e[nr]&&(e[qo]=!0),e[of]&&(e[qo]=!0);for(const r in e){const i=x0(r,t);i.indexOf(n)<0&&i.push(n)}}c(Wt,"addToGroups");function S0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}c(S0,"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&&Wt(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(S0(o.t,r),t);Wt(s,a,r)}else t&&Wt(s,t,r);o.t=s}return i.j[n]=o,o}};const B=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"),v=c((n,e,t,r,i)=>n.tt(e,t,r,i),"tt"),Xe="WORD",Jo="UWORD",lf="ASCIINUMERICAL",af="ALPHANUMERICAL",Ir="LOCALHOST",_o="TLD",Go="UTLD",ni="SCHEME",yn="SLASH_SCHEME",zl="NUM",Yo="WS",$l="NL",cr="OPENBRACE",dr="CLOSEBRACE",Ri="OPENBRACKET",Di="CLOSEBRACKET",Pi="OPENPAREN",Li="CLOSEPAREN",Bi="OPENANGLEBRACKET",zi="CLOSEANGLEBRACKET",$i="FULLWIDTHLEFTPAREN",Fi="FULLWIDTHRIGHTPAREN",Vi="LEFTCORNERBRACKET",Hi="RIGHTCORNERBRACKET",ji="LEFTWHITECORNERBRACKET",Ui="RIGHTWHITECORNERBRACKET",Wi="FULLWIDTHLESSTHAN",Ki="FULLWIDTHGREATERTHAN",qi="AMPERSAND",Ji="APOSTROPHE",_i="ASTERISK",ht="AT",Gi="BACKSLASH",Yi="BACKTICK",Xi="CARET",bt="COLON",Fl="COMMA",Qi="DOLLAR",Le="DOT",Zi="EQUALS",Vl="EXCLAMATION",ve="HYPHEN",ur="PERCENT",es="PIPE",ts="PLUS",ns="POUND",fr="QUERY",Hl="QUOTE",cf="FULLWIDTHMIDDLEDOT",jl="SEMI",Be="SLASH",hr="TILDE",rs="UNDERSCORE",df="EMOJI",is="SYM";var uf=Object.freeze({__proto__:null,ALPHANUMERICAL:af,AMPERSAND:qi,APOSTROPHE:Ji,ASCIINUMERICAL:lf,ASTERISK:_i,AT:ht,BACKSLASH:Gi,BACKTICK:Yi,CARET:Xi,CLOSEANGLEBRACKET:zi,CLOSEBRACE:dr,CLOSEBRACKET:Di,CLOSEPAREN:Li,COLON:bt,COMMA:Fl,DOLLAR:Qi,DOT:Le,EMOJI:df,EQUALS:Zi,EXCLAMATION:Vl,FULLWIDTHGREATERTHAN:Ki,FULLWIDTHLEFTPAREN:$i,FULLWIDTHLESSTHAN:Wi,FULLWIDTHMIDDLEDOT:cf,FULLWIDTHRIGHTPAREN:Fi,HYPHEN:ve,LEFTCORNERBRACKET:Vi,LEFTWHITECORNERBRACKET:ji,LOCALHOST:Ir,NL:$l,NUM:zl,OPENANGLEBRACKET:Bi,OPENBRACE:cr,OPENBRACKET:Ri,OPENPAREN:Pi,PERCENT:ur,PIPE:es,PLUS:ts,POUND:ns,QUERY:fr,QUOTE:Hl,RIGHTCORNERBRACKET:Hi,RIGHTWHITECORNERBRACKET:Ui,SCHEME:ni,SEMI:jl,SLASH:Be,SLASH_SCHEME:yn,SYM:is,TILDE:hr,TLD:_o,UNDERSCORE:rs,UTLD:Go,UWORD:Jo,WORD:Xe,WS:Yo});const Ge=/[a-z]/,Zn=new RegExp("\\p{L}","u"),to=new RegExp("\\p{Emoji}","u"),Ye=/\d/,no=/\s/,Fc="\r",ro=`
|
|
124
|
-
`,v0="️",C0="",io="";let qr=null,Jr=null;function M0(n=[]){const e={};ge.groups=e;const t=new ge;qr==null&&(qr=Vc(y0)),Jr==null&&(Jr=Vc(b0)),v(t,"'",Ji),v(t,"{",cr),v(t,"}",dr),v(t,"[",Ri),v(t,"]",Di),v(t,"(",Pi),v(t,")",Li),v(t,"<",Bi),v(t,">",zi),v(t,"(",$i),v(t,")",Fi),v(t,"「",Vi),v(t,"」",Hi),v(t,"『",ji),v(t,"』",Ui),v(t,"<",Wi),v(t,">",Ki),v(t,"&",qi),v(t,"*",_i),v(t,"@",ht),v(t,"`",Yi),v(t,"^",Xi),v(t,":",bt),v(t,",",Fl),v(t,"$",Qi),v(t,".",Le),v(t,"=",Zi),v(t,"!",Vl),v(t,"-",ve),v(t,"%",ur),v(t,"|",es),v(t,"+",ts),v(t,"#",ns),v(t,"?",fr),v(t,'"',Hl),v(t,"/",Be),v(t,";",jl),v(t,"~",hr),v(t,"_",rs),v(t,"\\",Gi),v(t,"・",cf);const r=q(t,Ye,zl,{[Uo]:!0});q(r,Ye,r);const i=q(r,Ge,lf,{[ar]:!0}),s=q(r,Zn,af,{[nr]:!0}),o=q(t,Ge,Xe,{[Wo]:!0});q(o,Ye,i),q(o,Ge,o),q(i,Ye,i),q(i,Ge,i);const l=q(t,Zn,Jo,{[Ko]:!0});q(l,Ge),q(l,Ye,s),q(l,Zn,l),q(s,Ye,s),q(s,Ge),q(s,Zn,s);const a=v(t,ro,$l,{[eo]:!0}),d=v(t,Fc,Yo,{[eo]:!0}),u=q(t,no,Yo,{[eo]:!0});v(t,io,u),v(d,ro,a),v(d,io,u),q(d,no,u),v(u,Fc),v(u,ro),q(u,no,u),v(u,io,u);const f=q(t,to,df,{[of]:!0});v(f,"#"),q(f,to,f),v(f,v0,f);const h=v(f,C0);v(h,"#"),q(h,to,f);const p=[[Ge,o],[Ye,i]],m=[[Ge,null],[Zn,l],[Ye,s]];for(let g=0;g<qr.length;g++)dt(t,qr[g],_o,Xe,p);for(let g=0;g<Jr.length;g++)dt(t,Jr[g],Go,Jo,m);Wt(_o,{tld:!0,ascii:!0},e),Wt(Go,{utld:!0,alpha:!0},e),dt(t,"file",ni,Xe,p),dt(t,"mailto",ni,Xe,p),dt(t,"http",yn,Xe,p),dt(t,"https",yn,Xe,p),dt(t,"ftp",yn,Xe,p),dt(t,"ftps",yn,Xe,p),Wt(ni,{scheme:!0,ascii:!0},e),Wt(yn,{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]?{[k0]:!0}:{[w0]:!0};y.indexOf("-")>=0?k[qo]=!0:Ge.test(y)?Ye.test(y)?k[ar]=!0:k[Wo]=!0:k[Uo]=!0,$c(t,y,y,k)}return $c(t,"localhost",Ir,{ascii:!0}),t.jd=new ge(is),{start:t,tokens:Object.assign({groups:e},uf)}}c(M0,"init$2");function ff(n,e){const t=T0(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,d=0,u=null,f=-1,h=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=t[o].length,h++),d+=t[o].length,s+=t[o].length,o++;s-=f,o-=h,d-=f,i.push({t:u.t,v:e.slice(s-d,s),s:s-d,e:s})}return i}c(ff,"run$1");function T0(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(T0,"stringToArray");function dt(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(dt,"fastts");function Vc(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(Vc,"decodeTlds");const Rr={defaultProtocol:"http",events:null,format:Hc,formatHref:Hc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ul(n,e=null){let t=Object.assign({},Rr);n&&(t=Object.assign(t,n instanceof Ul?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(Ul,"Options");Ul.prototype={o:Rr,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]:Rr[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 Hc(n){return n}c(Hc,"noop");function hf(n,e){this.t="token",this.v=n,this.tk=e}c(hf,"MultiToken");hf.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=Rr.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),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),d&&(o.rel=d),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:f}}};function Is(n,e){const r=class r extends hf{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(Is,"createTokenClass");const jc=Is("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Uc=Is("text"),E0=Is("nl"),_r=Is("url",{isLink:!0,toHref(n=Rr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ir&&n[1].t===bt}}),Se=c(n=>new ge(n),"makeState");function O0({groups:n}){const e=n.domain.concat([qi,_i,ht,Gi,Yi,Xi,Qi,Zi,ve,zl,ur,es,ts,ns,Be,is,hr,rs]),t=[Ji,bt,Fl,Le,Vl,ur,fr,Hl,jl,Bi,zi,cr,dr,Di,Ri,Pi,Li,$i,Fi,Vi,Hi,ji,Ui,Wi,Ki],r=[qi,Ji,_i,Gi,Yi,Xi,Qi,Zi,ve,cr,dr,ur,es,ts,ns,fr,Be,is,hr,rs],i=Se(),s=v(i,hr);B(s,r,s),B(s,n.domain,s);const o=Se(),l=Se(),a=Se();B(i,n.domain,o),B(i,n.scheme,l),B(i,n.slashscheme,a),B(o,r,s),B(o,n.domain,o);const d=v(o,ht);v(s,ht,d),v(l,ht,d),v(a,ht,d);const u=v(s,Le);B(u,r,s),B(u,n.domain,s);const f=Se();B(d,n.domain,f),B(f,n.domain,f);const h=v(f,Le);B(h,n.domain,f);const p=Se(jc);B(h,n.tld,p),B(h,n.utld,p),v(d,Ir,p);const m=v(f,ve);v(m,ve,m),B(m,n.domain,f),B(p,n.domain,f),v(p,Le,h),v(p,ve,m);const g=v(p,bt);B(g,n.numeric,jc);const y=v(o,ve),b=v(o,Le);v(y,ve,y),B(y,n.domain,o),B(b,r,s),B(b,n.domain,o);const k=Se(_r);B(b,n.tld,k),B(b,n.utld,k),B(k,n.domain,o),B(k,r,s),v(k,Le,b),v(k,ve,y),v(k,ht,d);const S=v(k,bt),T=Se(_r);B(S,n.numeric,T);const x=Se(_r),O=Se();B(x,e,x),B(x,t,O),B(O,e,x),B(O,t,O),v(k,Be,x),v(T,Be,x);const M=v(l,bt),N=v(a,bt),P=v(N,Be),D=v(P,Be);B(l,n.domain,o),v(l,Le,b),v(l,ve,y),B(a,n.domain,o),v(a,Le,b),v(a,ve,y),B(M,n.domain,x),v(M,Be,x),v(M,fr,x),B(D,n.domain,x),B(D,e,x),v(D,Be,x);const j=[[cr,dr],[Ri,Di],[Pi,Li],[Bi,zi],[$i,Fi],[Vi,Hi],[ji,Ui],[Wi,Ki]];for(let K=0;K<j.length;K++){const[_,z]=j[K],V=v(x,_);v(O,_,V),v(V,z,x);const X=Se(_r);B(V,e,X);const Q=Se();B(V,t),B(X,e,X),B(X,t,Q),B(Q,e,X),B(Q,t,Q),v(X,z,x),v(Q,z,x)}return v(i,Ir,k),v(i,$l,E0),{start:i,tokens:uf}}c(O0,"init$1");function A0(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,d=null,u=0,f=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(d=a||l.go(t[i].t));)a=null,l=d,l.accepts()?(h=0,f=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(so(Uc,e,o)),o=[]),i-=h,u-=h;const p=f.t,m=t.slice(i-u,i);s.push(so(p,e,m))}}return o.length>0&&s.push(so(Uc,e,o)),s}c(A0,"run");function so(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(so,"initMultiToken");const N0=typeof console<"u"&&console&&console.warn||(()=>{}),I0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",U={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R0(){return ge.groups={},U.scanner=null,U.parser=null,U.tokenQueue=[],U.pluginQueue=[],U.customSchemes=[],U.initialized=!1,U}c(R0,"reset");function Wc(n,e=!1){if(U.initialized&&N0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${I0}`),!/^[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`);U.customSchemes.push([n,e])}c(Wc,"registerCustomProtocol");function D0(){U.scanner=M0(U.customSchemes);for(let n=0;n<U.tokenQueue.length;n++)U.tokenQueue[n][1]({scanner:U.scanner});U.parser=O0(U.scanner.tokens);for(let n=0;n<U.pluginQueue.length;n++)U.pluginQueue[n][1]({scanner:U.scanner,parser:U.parser});return U.initialized=!0,U}c(D0,"init");function Wl(n){return U.initialized||D0(),A0(U.parser.start,n,ff(U.scanner.start,n))}c(Wl,"tokenize");Wl.scan=ff;function pf(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 Ul(t),i=Wl(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(pf,"find");var Kl="[\0- -\u2029 ]",P0=new RegExp(Kl),L0=new RegExp(`${Kl}$`),B0=new RegExp(Kl,"g");function z0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}c(z0,"isValidLinkStructure");function $0(n){return new H({key:new W("autolink"),appendTransaction:c((e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Fu(t.doc,[...e]);if(qu(l).forEach(({newRange:d})=>{const u=qg(r.doc,d,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(d.from,d.to," "," ");if(!L0.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(P0).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=Wl(m).map(b=>b.toObject(n.defaultProtocol));if(!z0(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=>{Il(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($0,"autolink");function F0(n){return new H({key:new W("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 u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;o=f.find(h=>h.nodeName==="A")}if(!o)return!1;const l=Ku(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,d=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,d),!0):!1},"handleClick")}})}c(F0,"clickHandler");function V0(n){return new H({key:new W("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(u=>{a+=u.textContent});const d=pf(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!d||i!==void 0&&!i(d.href)?!1:n.editor.commands.setMark(n.type,{href:d.href})},"handlePaste")}})}c(V0,"pasteHandler");function It(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(B0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}c(It,"isAllowedUri");var H0=fn.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"){Wc(n);return}Wc(n.scheme,n.optionalSlashes)})},onDestroy(){R0()},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)=>!!It(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=>!!It(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=>!!It(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=>!!It(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=>!!It(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[cn({find:c(n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=pf(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:c(o=>!!It(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($0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:c(r=>this.options.isAllowedUri(r,{defaultValidate:c(i=>!!It(i,e),"defaultValidate"),protocols:e,defaultProtocol:t}),"validate"),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(F0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(V0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),j0=Object.defineProperty,U0=c((n,e)=>{for(var t in e)j0(n,t,{get:e[t],enumerable:!0})},"__export"),W0="listItem",Kc="textStyle",qc=/^\s*([-+*])\s$/,mf=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(W0,this.editor.getAttributes(Kc)).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=qn({find:qc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=qn({find:qc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(()=>this.editor.getAttributes(Kc),"getAttributes"),editor:this.editor})),[n]}}),gf=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)=>Bl(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")}}}),K0={};U0(K0,{findListItemPos:c(()=>zr,"findListItemPos"),getNextListDepth:c(()=>ql,"getNextListDepth"),handleBackspace:c(()=>Xo,"handleBackspace"),handleDelete:c(()=>Qo,"handleDelete"),hasListBefore:c(()=>yf,"hasListBefore"),hasListItemAfter:c(()=>q0,"hasListItemAfter"),hasListItemBefore:c(()=>bf,"hasListItemBefore"),listItemHasSubList:c(()=>kf,"listItemHasSubList"),nextListIsDeeper:c(()=>wf,"nextListIsDeeper"),nextListIsHigher:c(()=>xf,"nextListIsHigher")});var zr=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"),ql=c((n,e)=>{const t=zr(n,e);if(!t)return!1;const[,r]=ty(e,n,t.$pos.pos+4);return r},"getNextListDepth"),yf=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"),bf=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"),kf=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"),Xo=c((n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Et(n.state,e)&&yf(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),d=[];a.node().descendants((h,p)=>{h.type.name===e&&d.push({node:h,pos:p})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(a.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Et(n.state,e)||!sy(n.state))return!1;const r=zr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=kf(e,n.state,s);return bf(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},"handleBackspace"),wf=c((n,e)=>{const t=ql(n,e),r=zr(n,e);return!r||!t?!1:t>r.depth},"nextListIsDeeper"),xf=c((n,e)=>{const t=ql(n,e),r=zr(n,e);return!r||!t?!1:t<r.depth},"nextListIsHigher"),Qo=c((n,e)=>{if(!Et(n.state,e)||!iy(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:wf(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():xf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},"handleDelete"),q0=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"),Sf=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&&Qo(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&&Qo(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&&Xo(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&&Xo(n,t,r)&&(e=!0)}),e},"Mod-Backspace")}}}),Jc=/^(\s*)(\d+)\.\s+(.*)$/,J0=/^\s/;function _0(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(Jc);if(!s)break;const[,o,l,a]=s,d=o.length;let u=a,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(Jc))break;if(p.trim()==="")h.push(p),u+=`
|
|
129
|
-
`,f+=1;else if(p.match(J0))h.push(p),u+=`
|
|
130
|
-
${p.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:h.join(`
|
|
131
|
-
`)}),r=f,t=f}return[e,r]}c(_0,"collectOrderedListItems");function vf(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())||"",d=[];a&&d.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const u=l.slice(1).join(`
|
|
133
|
-
`).trim();if(u){const p=t.blockTokens(u);d.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=vf(h,p,t);d.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:d}),s=f}else s+=1}return i}c(vf,"buildNestedStructure");function G0(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(G0,"parseListItems");var Y0="listItem",_c="textStyle",Gc=/^(\d+)\.\s$/,Cf=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?G0(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]=_0(i);if(s.length===0)return;const l=vf(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(Y0,this.editor.getAttributes(_c)).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=qn({find:Gc,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=qn({find:Gc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(e=>({start:+e[1],...this.editor.getAttributes(_c)}),"getAttributes"),joinPredicate:c((e,t)=>t.childCount+t.attrs.start===+e[1],"joinPredicate"),editor:this.editor})),[n]}}),X0=/^\s*(\[([( |x])?\])\s$/,Q0=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 Bl(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"),d=c(u=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`},"updateA11Y");return d(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=u.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(([u,f])=>{i.setAttribute(u,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([u,f])=>{i.setAttribute(u,f)}),{dom:i,contentDOM:a,update:c(u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,d(u),!0),"update")}}},addInputRules(){return[qn({find:X0,type:this.type,getAttributes:c(n=>({checked:n[n.length-1]==="x"}),"getAttributes")})]}}),Z0=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=jo(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=jo(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(mf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(gf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Sf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Cf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Q0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Z0.configure(this.options.taskList)),n}});var eb=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")}}}),tb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,nb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rb=fn.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[Kn({find:tb,type:this.type})]},addPasteRules(){return[cn({find:nb,type:this.type})]}}),ib=xe.create({name:"text",group:"inline",parseMarkdown:c(n=>({type:"text",text:n.text||""}),"parseMarkdown"),renderMarkdown:c(n=>n.text||"","renderMarkdown")}),sb=fn.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 ob(n={}){return new H({view(e){return new Zo(e,n)}})}c(ob,"dropCursor");const Ia=class Ia{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 d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;d=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-d)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let 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=$d(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(Ia,"DropCursorView");let Zo=Ia;const Fe=class Fe extends R{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):R.near(r)}content(){return E.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(t.pos))}getBookmark(){return new el(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!lb(e)||!ab(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&&Fe.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(Fe.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!I.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(Fe.valid(l))return l}return null}}};c(Fe,"GapCursor");let de=Fe;de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;R.jsonID("gapcursor",de);const ks=class ks{constructor(e){this.pos=e}map(e){return new ks(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return de.valid(t)?new de(t):R.near(t)}};c(ks,"GapBookmark");let el=ks;function Mf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}c(Mf,"needsGap");function lb(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||Mf(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(lb,"closedBefore");function ab(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||Mf(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(ab,"closedAfter");function cb(){return new H({props:{decorations:hb,createSelectionBetween(n,e,t){return e.pos==t.pos&&de.valid(t)?new de(t):null},handleClick:ub,handleKeyDown:db,handleDOMEvents:{beforeinput:fb}}})}c(cb,"gapCursor");const db=xl({ArrowLeft:Gr("horiz",-1),ArrowRight:Gr("horiz",1),ArrowUp:Gr("vert",-1),ArrowDown:Gr("vert",1)});function Gr(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 d=de.findGapCursorFrom(l,e,a);return d?(i&&i(r.tr.setSelection(new de(d))),!0):!1}}c(Gr,"arrow$3");function ub(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!de.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&I.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new de(r))),!0)}c(ub,"handleClick");function fb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof de))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=C.empty;for(let o=r.length-1;o>=0;o--)i=C.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new E(i,0,0));return s.setSelection(L.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}c(fb,"beforeinput");function hb(n){if(!(n.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",oe.create(n.doc,[Oe.widget(n.selection.head,e,{key:"gapcursor"})])}c(hb,"drawGapCursor");var ss=200,Z=c(function(){},"RopeSequence");Z.prototype.append=c(function(e){return e.length?(e=Z.from(e),!this.length&&e||e.length<ss&&this.leafAppend(e)||this.length<ss&&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 pb(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 Tf(e):Z.empty},"from");var Tf=(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<=ss)return new e(this.values.concat(i.flatten()))},"leafAppend"),e.prototype.leafPrepend=c(function(i){if(this.length+i.length<=ss)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 Tf([]);var pb=(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 mb=500,yt=class yt{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,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new ze(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],d.push(new ze(m,void 0,void 0,d.length+u.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 yt(this.items.slice(0,r).append(u.reverse().concat(d)),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 u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new ze(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),i||(a=h)}let d=o-r.depth;return d>yb&&(l=gb(l,d),o-=d),new yt(l.append(s),o)}remapping(e,t){let r=new ui;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 yt(this.items.append(e.map(t=>new ze(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 ze(m,g,y))}else r.push(new ze(m))},i);let d=[];for(let h=t;h<o;h++)d.push(new ze(s.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new yt(u,l);return f.emptyItemCount()>mb&&(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)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let f=new ze(d.invert(),a,u),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 yt(Z.from(i.reverse()),s)}};c(yt,"Branch");let dn=yt;dn.empty=new dn(Z.empty,0);function gb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}c(gb,"cutOffEvents");const ws=class ws{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 ws(t.getMap().invert(),t,this.selection)}}};c(ws,"Item");let ze=ws;const Ra=class Ra{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}};c(Ra,"HistoryState");let Ve=Ra;const yb=20;function bb(n,e,t,r){let i=t.getMeta(Xt),s;if(i)return i.historyState;t.getMeta(xb)&&(n=new Ve(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Xt))return o.getMeta(Xt).redo?new Ve(n.done.addTransform(t,void 0,r,ri(e)),n.undone,Yc(t.mapping.maps),n.prevTime,n.prevComposition):new Ve(n.done,n.undone.addTransform(t,void 0,r,ri(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||!kb(t,n.prevRanges)),d=o?oo(n.prevRanges,t.mapping):Yc(t.mapping.maps);return new Ve(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ri(e)),dn.empty,d,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Ve(n.done.rebased(t,s),n.undone.rebased(t,s),oo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ve(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),oo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}c(bb,"applyTransaction");function kb(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(kb,"isAdjacentTo");function Yc(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(Yc,"rangesFor");function oo(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(oo,"mapRanges");function wb(n,e,t){let r=ri(e),i=Xt.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 Ve(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Xt,{redo:t,historyState:a})}c(wb,"histTransaction");let lo=!1,Xc=null;function ri(n){let e=n.plugins;if(Xc!=e){lo=!1,Xc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){lo=!0;break}}return lo}c(ri,"mustPreserveItems");const Xt=new W("history"),xb=new W("closeHistory");function Sb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new H({key:Xt,state:{init(){return new Ve(dn.empty,dn.empty,null,0,-1)},apply(e,t,r){return bb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Of:r=="historyRedo"?Af:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}c(Sb,"history");function Ef(n,e){return(t,r)=>{let i=Xt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=wb(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}c(Ef,"buildCommand");const Of=Ef(!1,!0),Af=Ef(!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 W("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 d=r.tr.deleteRange(l,a);return n=!0,d}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,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)},"filterTransaction")})]}});var vb=J.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ob(this.options)]}});J.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new H({key:new W("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,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+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(Oe.node(d,d+a.nodeSize,{class:this.options.className}))}),oe.create(n,s)},"decorations")}})]}});var Cb=J.create({name:"gapCursor",addProseMirrorPlugins(){return[cb()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=$(A(n,"allowGapCursor",t)))!=null?e:null}}}),Mb=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 W("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,d=!o.isLeaf&&Os(o);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Oe.node(l,l+o.nodeSize,{class:u.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 W("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Ju(t.selection)||n.view.dragging?null:oe.create(t.doc,[Oe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Qc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}c(Qc,"nodeEqualsType");var Tb=J.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new W(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:d}=o,u=e.getState(o),f=l.content.size,h=d.nodes[t];if(u)return a.insert(f,h.create())},"appendTransaction"),state:{init:c((i,s)=>{const o=s.tr.doc.lastChild;return!Qc({node:o,types:r})},"init"),apply:c((i,s)=>{if(!i.docChanged)return s;const o=i.doc.lastChild;return!Qc({node:o,types:r})},"apply")}})]}}),Eb=J.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:c(()=>({state:n,dispatch:e})=>Of(n,e),"undo"),redo:c(()=>({state:n,dispatch:e})=>Af(n,e),"redo")}},addProseMirrorPlugins(){return[Sb(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-я")}}}),Ob=J.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(t0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Yy.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(mf.configure(this.options.bulletList)),this.options.code!==!1&&i.push(i0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(l0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(a0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(vb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Cb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(c0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(d0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Eb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(u0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(g0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(gf.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Sf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(H0.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Cf.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(eb.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(rb.configure(this.options.strike)),this.options.text!==!1&&i.push(ib.configure(this.options.text)),this.options.underline!==!1&&i.push(sb.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Tb.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Ab=Ob;function Zc(n){return w.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}c(Zc,"useDebouncedRef");var Rn,Nb=(Rn=class extends Fy{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Zc(this.view.state),this.reactiveExtensionStorage=Zc(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),w.markRaw(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(Rn,"Editor"),Rn),Ib=w.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=w.ref(),t=w.getCurrentInstance();return w.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&w.nextTick(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.firstChild))return;const s=w.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),w.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return w.h("div",{ref:c(n=>{this.rootEl=n},"ref")})}});w.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return w.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});w.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return w.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});w.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return w.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});const Nf=["top","right","bottom","left"],ed=["start","end"],td=Nf.reduce((n,e)=>n.concat(e,e+"-"+ed[0],e+"-"+ed[1]),[]),qe=Math.min,ue=Math.max,ls=Math.round,je=c(n=>({x:n,y:n}),"createCoords"),Rb={left:"right",right:"left",bottom:"top",top:"bottom"},Db={start:"end",end:"start"};function tl(n,e,t){return ue(n,qe(e,t))}c(tl,"clamp");function lt(n,e){return typeof n=="function"?n(e):n}c(lt,"evaluate");function Ae(n){return n.split("-")[0]}c(Ae,"getSide");function Re(n){return n.split("-")[1]}c(Re,"getAlignment");function If(n){return n==="x"?"y":"x"}c(If,"getOppositeAxis");function Jl(n){return n==="y"?"height":"width"}c(Jl,"getAxisLength");const Pb=new Set(["top","bottom"]);function He(n){return Pb.has(Ae(n))?"y":"x"}c(He,"getSideAxis");function _l(n){return If(He(n))}c(_l,"getAlignmentAxis");function Rf(n,e,t){t===void 0&&(t=!1);const r=Re(n),i=_l(n),s=Jl(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=cs(o)),[o,cs(o)]}c(Rf,"getAlignmentSides");function Lb(n){const e=cs(n);return[as(n),e,as(e)]}c(Lb,"getExpandedPlacements");function as(n){return n.replace(/start|end/g,e=>Db[e])}c(as,"getOppositeAlignmentPlacement");const nd=["left","right"],rd=["right","left"],Bb=["top","bottom"],zb=["bottom","top"];function $b(n,e,t){switch(n){case"top":case"bottom":return t?e?rd:nd:e?nd:rd;case"left":case"right":return e?Bb:zb;default:return[]}}c($b,"getSideList");function Fb(n,e,t,r){const i=Re(n);let s=$b(Ae(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(as)))),s}c(Fb,"getOppositeAxisPlacements");function cs(n){return n.replace(/left|right|bottom|top/g,e=>Rb[e])}c(cs,"getOppositePlacement");function Vb(n){return{top:0,right:0,bottom:0,left:0,...n}}c(Vb,"expandPaddingObject");function Gl(n){return typeof n!="number"?Vb(n):{top:n,right:n,bottom:n,left:n}}c(Gl,"getPaddingObject");function Jn(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(Jn,"rectToClientRect");function id(n,e,t){let{reference:r,floating:i}=n;const s=He(e),o=_l(e),l=Jl(o),a=Ae(e),d=s==="y",u=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:u,y:r.y-i.height};break;case"bottom":p={x:u,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(Re(e)){case"start":p[o]-=h*(t&&d?-1:1);break;case"end":p[o]+=h*(t&&d?-1:1);break}return p}c(id,"computeCoordsFromPlacement");const Hb=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 d=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:f}=id(d,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:S,data:T,reset:x}=await b({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:d,platform:o,elements:{reference:n,floating:e}});u=k??u,f=S??f,p={...p,[y]:{...p[y],...T}},x&&m<=50&&(m++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(d=x.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):x.rects),{x:u,y:f}=id(d,h,a)),g=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}},"computePosition$1");async function _n(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=lt(e,n),m=Gl(p),y=l[h?f==="floating"?"reference":"floating":f],b=Jn(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:d,rootBoundary:u,strategy:a})),k=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},x=Jn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:S,strategy:a}):k);return{top:(b.top-x.top+m.top)/T.y,bottom:(x.bottom-b.bottom+m.bottom)/T.y,left:(b.left-x.left+m.left)/T.x,right:(x.right-b.right+m.right)/T.x}}c(_n,"detectOverflow");const jb=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:d,padding:u=0}=lt(n,e)||{};if(d==null)return{};const f=Gl(u),h={x:t,y:r},p=_l(i),m=Jl(p),g=await o.getDimensions(d),y=p==="y",b=y?"top":"left",k=y?"bottom":"right",S=y?"clientHeight":"clientWidth",T=s.reference[m]+s.reference[p]-h[p]-s.floating[m],x=h[p]-s.reference[p],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let M=O?O[S]:0;(!M||!await(o.isElement==null?void 0:o.isElement(O)))&&(M=l.floating[S]||s.floating[m]);const N=T/2-x/2,P=M/2-g[m]/2-1,D=qe(f[b],P),j=qe(f[k],P),K=D,_=M-g[m]-j,z=M/2-g[m]/2+N,V=tl(K,z,_),X=!a.arrow&&Re(i)!=null&&z!==V&&s.reference[m]/2-(z<K?D:j)-g[m]/2<0,Q=X?z<K?z-K:z-_:0;return{[p]:h[p]+Q,data:{[p]:V,centerOffset:z-V-Q,...X&&{alignmentOffset:Q}},reset:X}}}),"arrow$2");function Ub(n,e,t){return(n?[...t.filter(i=>Re(i)===n),...t.filter(i=>Re(i)!==n)]:t.filter(i=>Ae(i)===i)).filter(i=>n?Re(i)===n||(e?as(i)!==i:!1):!0)}c(Ub,"getPlacementList");const Wb=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:d}=e,{crossAxis:u=!1,alignment:f,allowedPlacements:h=td,autoAlignment:p=!0,...m}=lt(n,e),g=f!==void 0||h===td?Ub(f||null,p,h):h,y=await _n(e,m),b=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[b];if(k==null)return{};const S=Rf(k,s,await(a.isRTL==null?void 0:a.isRTL(d.floating)));if(l!==k)return{reset:{placement:g[0]}};const T=[y[Ae(k)],y[S[0]],y[S[1]]],x=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:T}],O=g[b+1];if(O)return{data:{index:b+1,overflows:x},reset:{placement:O}};const M=x.map(D=>{const j=Re(D.placement);return[D.placement,j&&u?D.overflows.slice(0,2).reduce((K,_)=>K+_,0):D.overflows[0],D.overflows]}).sort((D,j)=>D[1]-j[1]),P=((i=M.filter(D=>D[2].slice(0,Re(D[0])?2:3).every(j=>j<=0))[0])==null?void 0:i[0])||M[0][0];return P!==l?{data:{index:b+1,overflows:x},reset:{placement:P}}:{}}}},"autoPlacement$1"),Kb=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:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=lt(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=Ae(i),k=He(l),S=Ae(l)===l,T=await(a.isRTL==null?void 0:a.isRTL(d.floating)),x=h||(S||!g?[cs(l)]:Lb(l)),O=m!=="none";!h&&O&&x.push(...Fb(l,g,m,T));const M=[l,...x],N=await _n(e,y),P=[];let D=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(N[b]),f){const z=Rf(i,o,T);P.push(N[z[0]],N[z[1]])}if(D=[...D,{placement:i,overflows:P}],!P.every(z=>z<=0)){var j,K;const z=(((j=s.flip)==null?void 0:j.index)||0)+1,V=M[z];if(V&&(!(f==="alignment"?k!==He(V):!1)||D.every(be=>He(be.placement)===k?be.overflows[0]>0:!0)))return{data:{index:z,overflows:D},reset:{placement:V}};let X=(K=D.filter(Q=>Q.overflows[0]<=0).sort((Q,be)=>Q.overflows[1]-be.overflows[1])[0])==null?void 0:K.placement;if(!X)switch(p){case"bestFit":{var _;const Q=(_=D.filter(be=>{if(O){const ct=He(be.placement);return ct===k||ct==="y"}return!0}).map(be=>[be.placement,be.overflows.filter(ct=>ct>0).reduce((ct,sh)=>ct+sh,0)]).sort((be,ct)=>be[1]-ct[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 sd(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}c(sd,"getSideOffsets");function od(n){return Nf.some(e=>n[e]>=0)}c(od,"isAnySideFullyClipped");const qb=c(function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=lt(n,e);switch(r){case"referenceHidden":{const s=await _n(e,{...i,elementContext:"reference"}),o=sd(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:od(o)}}}case"escaped":{const s=await _n(e,{...i,altBoundary:!0}),o=sd(s,t.floating);return{data:{escapedOffsets:o,escaped:od(o)}}}default:return{}}}}},"hide$1");function Df(n){const e=qe(...n.map(s=>s.left)),t=qe(...n.map(s=>s.top)),r=ue(...n.map(s=>s.right)),i=ue(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}c(Df,"getBoundingRect");function Jb(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=>Jn(Df(i)))}c(Jb,"getRectsByLine");const _b=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:d}=lt(n,e),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),f=Jb(u),h=Jn(Df(u)),p=Gl(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&d!=null)return f.find(y=>a>y.left-p.left&&a<y.right+p.right&&d>y.top-p.top&&d<y.bottom+p.bottom)||h;if(f.length>=2){if(He(t)==="y"){const D=f[0],j=f[f.length-1],K=Ae(t)==="top",_=D.top,z=j.bottom,V=K?D.left:j.left,X=K?D.right:j.right,Q=X-V,be=z-_;return{top:_,bottom:z,left:V,right:X,width:Q,height:be,x:V,y:_}}const y=Ae(t)==="left",b=ue(...f.map(D=>D.right)),k=qe(...f.map(D=>D.left)),S=f.filter(D=>y?D.left===k:D.right===b),T=S[0].top,x=S[S.length-1].bottom,O=k,M=b,N=M-O,P=x-T;return{top:T,bottom:x,left:O,right:M,width:N,height:P,x:O,y:T}}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"),Gb=new Set(["left","top"]);async function Yb(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ae(t),l=Re(t),a=He(t)==="y",d=Gb.has(o)?-1:1,u=s&&a?-1:1,f=lt(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*u,y:h*d}:{x:h*d,y:p*u}}c(Yb,"convertValueToCoords");const Xb=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 Yb(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"),Qb=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}=lt(n,e),d={x:t,y:r},u=await _n(e,a),f=He(Ae(i)),h=If(f);let p=d[h],m=d[f];if(s){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",k=p+u[y],S=p-u[b];p=tl(k,p,S)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=m+u[y],S=m-u[b];m=tl(k,m,S)}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"),Zb=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"),...d}=lt(n,e),u=await _n(e,d),f=Ae(i),h=Re(i),p=He(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-u.top-u.bottom,S=m-u.left-u.right,T=qe(g-u[y],k),x=qe(m-u[b],S),O=!e.middlewareData.shift;let M=T,N=x;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(N=S),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(M=k),O&&!h){const D=ue(u.left,0),j=ue(u.right,0),K=ue(u.top,0),_=ue(u.bottom,0);p?N=m-2*(D!==0||j!==0?D+j:ue(u.left,u.right)):M=g-2*(K!==0||_!==0?K+_:ue(u.top,u.bottom))}await a({...e,availableWidth:N,availableHeight:M});const P=await o.getDimensions(l.floating);return m!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}},"size$1");function Rs(){return typeof window<"u"}c(Rs,"hasWindow");function Xn(n){return Pf(n)?(n.nodeName||"").toLowerCase():"#document"}c(Xn,"getNodeName");function ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}c(ke,"getWindow");function at(n){var e;return(e=(Pf(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}c(at,"getDocumentElement");function Pf(n){return Rs()?n instanceof Node||n instanceof ke(n).Node:!1}c(Pf,"isNode");function De(n){return Rs()?n instanceof Element||n instanceof ke(n).Element:!1}c(De,"isElement");function Je(n){return Rs()?n instanceof HTMLElement||n instanceof ke(n).HTMLElement:!1}c(Je,"isHTMLElement");function ld(n){return!Rs()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ke(n).ShadowRoot}c(ld,"isShadowRoot");const ek=new Set(["inline","contents"]);function $r(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Pe(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!ek.has(i)}c($r,"isOverflowElement");const tk=new Set(["table","td","th"]);function nk(n){return tk.has(Xn(n))}c(nk,"isTableElement");const rk=[":popover-open",":modal"];function Ds(n){return rk.some(e=>{try{return n.matches(e)}catch{return!1}})}c(Ds,"isTopLayer");const ik=["transform","translate","scale","rotate","perspective"],sk=["transform","translate","scale","rotate","perspective","filter"],ok=["paint","layout","strict","content"];function Yl(n){const e=Xl(),t=De(n)?Pe(n):n;return ik.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)||sk.some(r=>(t.willChange||"").includes(r))||ok.some(r=>(t.contain||"").includes(r))}c(Yl,"isContainingBlock");function lk(n){let e=Ot(n);for(;Je(e)&&!Gn(e);){if(Yl(e))return e;if(Ds(e))return null;e=Ot(e)}return null}c(lk,"getContainingBlock");function Xl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}c(Xl,"isWebKit");const ak=new Set(["html","body","#document"]);function Gn(n){return ak.has(Xn(n))}c(Gn,"isLastTraversableNode");function Pe(n){return ke(n).getComputedStyle(n)}c(Pe,"getComputedStyle$1");function Ps(n){return De(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}c(Ps,"getNodeScroll");function Ot(n){if(Xn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||ld(n)&&n.host||at(n);return ld(e)?e.host:e}c(Ot,"getParentNode");function Lf(n){const e=Ot(n);return Gn(e)?n.ownerDocument?n.ownerDocument.body:n.body:Je(e)&&$r(e)?e:Lf(e)}c(Lf,"getNearestOverflowAncestor");function Bf(n,e,t){var r;e===void 0&&(e=[]);const i=Lf(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=ke(i);return s?(nl(o),e.concat(o,o.visualViewport||[],$r(i)?i:[],[])):e.concat(i,Bf(i,[]))}c(Bf,"getOverflowAncestors");function nl(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}c(nl,"getFrameElement");function zf(n){const e=Pe(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Je(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=ls(t)!==s||ls(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}c(zf,"getCssDimensions");function $f(n){return De(n)?n:n.contextElement}c($f,"unwrapElement");function vn(n){const e=$f(n);if(!Je(e))return je(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=zf(e);let o=(s?ls(t.width):t.width)/r,l=(s?ls(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}c(vn,"getScale");const ck=je(0);function Ff(n){const e=ke(n);return!Xl()||!e.visualViewport?ck:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}c(Ff,"getVisualOffsets");function dk(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==ke(n)?!1:e}c(dk,"shouldAddVisualOffsets");function Dr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=$f(n);let o=je(1);e&&(r?De(r)&&(o=vn(r)):o=vn(n));const l=dk(s,t,r)?Ff(s):je(0);let a=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=ke(s),p=r&&De(r)?ke(r):r;let m=h,g=nl(m);for(;g&&r&&p!==m;){const y=vn(g),b=g.getBoundingClientRect(),k=Pe(g),S=b.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,T=b.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,d*=y.y,u*=y.x,f*=y.y,a+=S,d+=T,m=ke(g),g=nl(m)}}return Jn({width:u,height:f,x:a,y:d})}c(Dr,"getBoundingClientRect");function Ls(n,e){const t=Ps(n).scrollLeft;return e?e.left+t:Dr(at(n)).left+t}c(Ls,"getWindowScrollBarX");function Vf(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-Ls(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}c(Vf,"getHTMLOffset");function uk(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=at(r),l=e?Ds(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},d=je(1);const u=je(0),f=Je(r);if((f||!f&&!s)&&((Xn(r)!=="body"||$r(o))&&(a=Ps(r)),Je(r))){const p=Dr(r);d=vn(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=o&&!f&&!s?Vf(o,a):je(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-a.scrollLeft*d.x+u.x+h.x,y:t.y*d.y-a.scrollTop*d.y+u.y+h.y}}c(uk,"convertOffsetParentRelativeRectToViewportRelativeRect");function fk(n){return Array.from(n.getClientRects())}c(fk,"getClientRects");function hk(n){const e=at(n),t=Ps(n),r=n.ownerDocument.body,i=ue(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ue(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Ls(n);const l=-t.scrollTop;return Pe(r).direction==="rtl"&&(o+=ue(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}c(hk,"getDocumentRect");const ad=25;function pk(n,e){const t=ke(n),r=at(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const u=Xl();(!u||u&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const d=Ls(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=ad&&(s-=m)}else d<=ad&&(s+=d);return{width:s,height:o,x:l,y:a}}c(pk,"getViewportRect");const mk=new Set(["absolute","fixed"]);function gk(n,e){const t=Dr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Je(n)?vn(n):je(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,d=r*s.y;return{width:o,height:l,x:a,y:d}}c(gk,"getInnerBoundingClientRect");function cd(n,e,t){let r;if(e==="viewport")r=pk(n,t);else if(e==="document")r=hk(at(n));else if(De(e))r=gk(e,t);else{const i=Ff(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Jn(r)}c(cd,"getClientRectFromClippingAncestor");function Hf(n,e){const t=Ot(n);return t===e||!De(t)||Gn(t)?!1:Pe(t).position==="fixed"||Hf(t,e)}c(Hf,"hasFixedPositionAncestor");function yk(n,e){const t=e.get(n);if(t)return t;let r=Bf(n,[]).filter(l=>De(l)&&Xn(l)!=="body"),i=null;const s=Pe(n).position==="fixed";let o=s?Ot(n):n;for(;De(o)&&!Gn(o);){const l=Pe(o),a=Yl(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&mk.has(i.position)||$r(o)&&!a&&Hf(n,o))?r=r.filter(u=>u!==o):i=l,o=Ot(o)}return e.set(n,r),r}c(yk,"getClippingElementAncestors");function bk(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Ds(e)?[]:yk(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((d,u)=>{const f=cd(e,u,i);return d.top=ue(f.top,d.top),d.right=qe(f.right,d.right),d.bottom=qe(f.bottom,d.bottom),d.left=ue(f.left,d.left),d},cd(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}c(bk,"getClippingRect");function kk(n){const{width:e,height:t}=zf(n);return{width:e,height:t}}c(kk,"getDimensions");function wk(n,e,t){const r=Je(e),i=at(e),s=t==="fixed",o=Dr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=je(0);function d(){a.x=Ls(i)}if(c(d,"setLeftRTLScrollbarOffset"),r||!r&&!s)if((Xn(e)!=="body"||$r(i))&&(l=Ps(e)),r){const p=Dr(e,!0,s,e);a.x=p.x+e.clientLeft,a.y=p.y+e.clientTop}else i&&d();s&&!r&&i&&d();const u=i&&!r&&!s?Vf(i,l):je(0),f=o.left+l.scrollLeft-a.x-u.x,h=o.top+l.scrollTop-a.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}c(wk,"getRectRelativeToOffsetParent");function ao(n){return Pe(n).position==="static"}c(ao,"isStaticPositioned");function dd(n,e){if(!Je(n)||Pe(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return at(n)===t&&(t=t.ownerDocument.body),t}c(dd,"getTrueOffsetParent");function jf(n,e){const t=ke(n);if(Ds(n))return t;if(!Je(n)){let i=Ot(n);for(;i&&!Gn(i);){if(De(i)&&!ao(i))return i;i=Ot(i)}return t}let r=dd(n,e);for(;r&&nk(r)&&ao(r);)r=dd(r,e);return r&&Gn(r)&&ao(r)&&!Yl(r)?t:r||lk(n)||t}c(jf,"getOffsetParent");const xk=c(async function(n){const e=this.getOffsetParent||jf,t=this.getDimensions,r=await t(n.floating);return{reference:wk(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},"getElementRects");function Sk(n){return Pe(n).direction==="rtl"}c(Sk,"isRTL");const vk={convertOffsetParentRelativeRectToViewportRelativeRect:uk,getDocumentElement:at,getClippingRect:bk,getOffsetParent:jf,getElementRects:xk,getClientRects:fk,getDimensions:kk,getScale:vn,isElement:De,isRTL:Sk},Uf=Xb,Wf=Wb,Kf=Qb,qf=Kb,Jf=Zb,_f=qb,Gf=jb,Yf=_b,Xf=c((n,e,t)=>{const r=new Map,i={platform:vk,...t},s={...i.platform,_c:r};return Hb(n,e,{...i,platform:s})},"computePosition");var rl,il;if(typeof WeakMap<"u"){let n=new WeakMap;rl=c(e=>n.get(e),"readFromCache"),il=c((e,t)=>(n.set(e,t),t),"addToCache")}else{const n=[];let t=0;rl=c(r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},"readFromCache"),il=c((r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i),"addToCache")}var Dn,et=(Dn=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:d,bottom:u}=this.findCell(t);return{left:Math.min(r,l),top:Math.min(s,d),right:Math.max(i,a),bottom:Math.max(o,u)}}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 rl(e)||il(e,Ck(e))}},c(Dn,"TableMap"),Dn);function Ck(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Mk(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;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 S=0;S<b;S++){if(S+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-S});break}const T=i+S*e;for(let x=0;x<y;x++){r[T+x]==0?r[T+x]=u:(s||(s=[])).push({type:"collision",row:d,pos:u,n:y-x});const O=k&&k[x];if(O){const M=(T+x)%e*2,N=o[M];N==null||N!=O&&o[M+1]==1?(o[M]=O,o[M+1]=1):N==O&&o[M+1]++}}}i+=y,u+=g.nodeSize}const h=(d+1)*e;let p=0;for(;i<h;)r[i++]==0&&p++;p&&(s||(s=[])).push({type:"missing",row:d,n:p}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new et(e,t,r,s);let a=!1;for(let d=0;!a&&d<o.length;d+=2)o[d]!=null&&o[d+1]<t&&(a=!0);return a&&Tk(l,o,n),l}c(Ck,"computeMap");function Mk(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 d=l.child(a);o+d.attrs.rowspan>r&&(s+=d.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(Mk,"findWidth");function Tk(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 d=0;d<a.colspan;d++){const u=(i+d)%n.width,f=e[u*2];f!=null&&(!a.colwidth||a.colwidth[d]!=f)&&((l||(l=Ek(a)))[d]=f)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}c(Tk,"findBadColWidths");function Ek(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}c(Ek,"freshColWidth");function Ql(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(Ql,"tableNodeTypes");new W("selectingCells");function Ok(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(Ok,"cellAround");function Qf(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(Qf,"isInTable");function Ak(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=Ok(e.$head)||Nk(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}c(Ak,"selectionCell");function Nk(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(Nk,"cellNear");function ud(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}c(ud,"pointsAtCell");function Zf(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}c(Zf,"inSameTable");function eh(n,e,t){const r=n.node(-1),i=et.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(eh,"nextCell");function fd(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(fd,"removeColSpan");var me,Ue=(me=class extends R{constructor(e,t=e){const r=e.node(-1),i=et.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(u=>u!=t.pos-s);a.unshift(t.pos-s);const d=a.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new mi(l.resolve(h),l.resolve(h+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(ud(r)&&ud(i)&&Zf(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=et.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 d=[];for(let u=a*t.width+i.left,f=i.left;f<i.right;f++,u++){const h=t.map[u];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=fd(b,0,g)),y>0&&(b=fd(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)}d.push(m)}o.push(e.child(a).copy(C.from(d)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new E(C.from(l),1,1)}replace(e,t=E.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],d=e.mapping.slice(r);e.replace(d.map(l.pos),d.map(a.pos),o?E.empty:t)}const s=R.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new E(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=et.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=et.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=et.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=et.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 Ik(this.$anchorCell.pos,this.$headCell.pos)}},c(me,"_CellSelection"),me);Ue.prototype.visible=!1;R.jsonID("cell",Ue);var nn,Ik=(nn=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nn(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&&Zf(t,r)?new Ue(t,r):R.near(r,1)}},c(nn,"_CellBookmark"),nn);new W("fix-tables");function th(n){const e=n.selection,t=Ak(n),r=t.node(-1),i=t.start(-1),s=et.get(r);return{...e instanceof Ue?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}c(th,"selectedRect");function Rk(n){return function(e,t){if(!Qf(e))return!1;if(t){const r=Ql(e.schema),i=th(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(Rk,"deprecated_toggleHeader");function hd(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(hd,"isHeaderEnabledByType");function Zl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Rk(n):function(t,r){if(!Qf(t))return!1;if(r){const i=Ql(t.schema),s=th(t),o=t.tr,l=hd("row",s,i),a=hd("column",s,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,f=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,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(Zl,"toggleHeader");Zl("row",{useDeprecatedLogic:!0});Zl("column",{useDeprecatedLogic:!0});Zl("cell",{useDeprecatedLogic:!0});function Yr(n,e){const t=n.selection;if(!(t instanceof Ue))return!1;if(e){const r=n.tr,i=Ql(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 E(i,0,0))}),r.docChanged&&e(r)}return!0}c(Yr,"deleteCellSelection");xl({ArrowLeft:Xr("horiz",-1),ArrowRight:Xr("horiz",1),ArrowUp:Xr("vert",-1),ArrowDown:Xr("vert",1),"Shift-ArrowLeft":Qr("horiz",-1),"Shift-ArrowRight":Qr("horiz",1),"Shift-ArrowUp":Qr("vert",-1),"Shift-ArrowDown":Qr("vert",1),Backspace:Yr,"Mod-Backspace":Yr,Delete:Yr,"Mod-Delete":Yr});function ii(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}c(ii,"maybeSetSelection");function Xr(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof Ue)return ii(t,r,R.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=nh(i,n,e);if(o==null)return!1;if(n=="horiz")return ii(t,r,R.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=eh(l,n,e);let d;return a?d=R.near(a,1):e<0?d=R.near(t.doc.resolve(l.before(-1)),-1):d=R.near(t.doc.resolve(l.after(-1)),1),ii(t,r,d)}}}c(Xr,"arrow");function Qr(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof Ue)o=s;else{const a=nh(i,n,e);if(a==null)return!1;o=new Ue(t.doc.resolve(a))}const l=eh(o.$headCell,n,e);return l?ii(t,r,new Ue(o.$anchorCell,l)):!1}}c(Qr,"shiftArrow");function nh(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(nh,"atEndOfCell");new W("tableColumnResizing");function Dk(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,d=t;return new DOMRect(a,d,o,l)}c(Dk,"combineDOMRects");var Pn,Pk=(Pn=class{constructor({editor:e,element:t,view:r,updateDelay:i=250,resizeDelay:s=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:a,options:d}){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&&Ml(h.selection),S=this.element.contains(document.activeElement);return!(!(f.hasFocus()||S)||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 u;this.editor=e,this.element=t,this.view=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=(u=d?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...d},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(qf(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Kf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Uf(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Gf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Jf(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Wf(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(_f(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Yf(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=Rl(this.view,t.from,t.to);let s={getBoundingClientRect:c(()=>i,"getBoundingClientRect"),getClientRects:c(()=>[i],"getClientRects")};if(t instanceof I){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 Ue){const{$anchorCell:o,$headCell:l}=t,a=o?o.pos:l.pos,d=l?l.pos:o.pos,u=this.view.nodeDOM(a),f=this.view.nodeDOM(d);if(!u||!f)return;const h=u===f?u.getBoundingClientRect():Dk(u.getBoundingClientRect(),f.getBoundingClientRect());s={getBoundingClientRect:c(()=>h,"getBoundingClientRect"),getClientRects:c(()=>[h],"getClientRects")}}return s}updatePosition(){const e=this.virtualElement;e&&Xf(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(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$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(Pn,"BubbleMenuView"),Pn),rh=c(n=>new H({key:typeof n.pluginKey=="string"?new W(n.pluginKey):n.pluginKey,view:c(e=>new Pk({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?[rh({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 Lk=w.defineComponent({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 w.onMounted(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:d,getReferencedVirtualElement:u,updateDelay:f}=n;r.style.visibility="hidden",r.style.position="absolute",r.remove(),w.nextTick(()=>{i.registerPlugin(rh({editor:i,element:r,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:d,getReferencedVirtualElement:u,updateDelay:f}))})}),w.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return w.h(w.Teleport,{to:r},w.h("div",{...t,ref:"root"},(i=e.default)==null?void 0:i.call(e)))}}}),Ln,Bk=(Ln=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:d}=a,{$anchor:u,empty:f}=d,h=u.depth===1,p=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.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,d,u)=>{const{composing:f}=l;if(f||!a&&!d)return;if(!this.getShouldShow(u)){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 Wu(e,{textSerializers:Nl(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(qf(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Kf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Uf(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Gf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Jf(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Wf(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(_f(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Yf(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(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$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=Rl(this.view,e.from,e.to);Xf({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(Ln,"FloatingMenuView"),Ln),ih=c(n=>new H({key:typeof n.pluginKey=="string"?new W(n.pluginKey):n.pluginKey,view:c(e=>new Bk({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?[ih({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});w.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:c(()=>({}),"default")},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=document.createElement("div"),i=w.ref(null);return w.onMounted(()=>{const{pluginKey:s,editor:o,options:l,appendTo:a,shouldShow:d}=n;i.value&&(r.style.visibility="hidden",r.style.position="absolute",r.remove(),o.registerPlugin(ih({pluginKey:s,editor:o,element:r,options:l,appendTo:a,shouldShow:d})))}),w.onBeforeUnmount(()=>{const{pluginKey:s,editor:o}=n;o.unregisterPlugin(s)}),()=>{var s;return w.h(w.Teleport,{to:r},w.h("div",{...t,ref:i},(s=e.default)==null?void 0:s.call(e)))}}});var zk=Mb,$k=Object.defineProperty,Fk=Object.getOwnPropertyDescriptor,Fr=c((n,e,t,r)=>{for(var i=r>1?void 0:r?Fk(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&&$k(e,t,i),i},"__decorateClass"),Bn;let un=(Bn=class extends lh.FieldComponentUnoCss{defaultButtonsTheme="pink";activeButtonsTheme="purple";placeholder="";components={EditorContent:Ib,BubbleMenu:Lk,VSTButton:rn.VSTButton,VSTStringField:rn.VSTStringField,NoSymbolIcon:ah.render};editor=void 0;isEditable=!0;showMenu=!0;vstTextId="";showLinkModal=!1;linkUrl="";beforeMount(){this.vstTextId=`vst-text-field-${this.VST.generateRandomKey()}`}mounted(){this.editor=new Nb({extensions:[Ab,zk.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=Br(r=>r.type.name==="bulletList"||r.type.name==="orderedList")(e.state.selection);if(t){const r=Rl(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(Bn,"TextField"),Bn);Fr([rn.Prop(String)],un.prototype,"defaultButtonsTheme",2);Fr([rn.Prop(String)],un.prototype,"activeButtonsTheme",2);Fr([rn.Prop(String)],un.prototype,"placeholder",2);Fr([rn.Watch("isEditable")],un.prototype,"_isEditableWatch",1);un=Fr([rn.VST],un);const Vk=["id"],Hk={class:"bubble-menu"};function jk(n,e,t,r,i,s){const o=w.resolveComponent("VSTButton"),l=w.resolveComponent("BubbleMenu"),a=w.resolveComponent("EditorContent"),d=w.resolveComponent("NoSymbolIcon"),u=w.resolveComponent("VSTStringField");return w.openBlock(),w.createElementBlock("div",{class:"vst-field-editor container relative",id:n.vstTextId},[n.editor&&n.showMenu?(w.openBlock(),w.createBlock(l,{key:0,class:"bubble-menu",editor:n.editor,options:{placement:"bottom",offset:8}},{default:w.withCtx(()=>[w.createElementVNode("div",Hk,[w.createVNode(o,{theme:n.editor.isActive("bold")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[0]||(e[0]=f=>n.editor.chain().focus().toggleBold().run())},{default:w.withCtx(()=>[w.createElementVNode("div",{class:w.normalizeClass(["h18px mt-0",{"fw-bold":n.editor.isActive("bold")}])},"B",2)]),_:1},8,["theme"]),w.createVNode(o,{theme:n.editor.isActive("italic")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[1]||(e[1]=f=>n.editor.chain().focus().toggleItalic().run())},{default:w.withCtx(()=>[w.createElementVNode("div",{class:w.normalizeClass(["h18px mt-0",{italic:n.editor.isActive("italic")}])},"I",2)]),_:1},8,["theme"]),w.createVNode(o,{theme:n.editor.isActive("underline")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[2]||(e[2]=f=>n.editor.chain().focus().toggleUnderline().run())},{default:w.withCtx(()=>[w.createElementVNode("div",{class:w.normalizeClass(["h18px mt-0",{underline:n.editor.isActive("underline")}])},"U",2)]),_:1},8,["theme"]),w.createVNode(o,{onClick:e[3]||(e[3]=f=>n.showLinkModal=!0)},{default:w.withCtx(()=>[...e[13]||(e[13]=[w.createTextVNode("Link",-1)])]),_:1}),w.createVNode(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:w.withCtx(()=>[w.createElementVNode("div",{class:w.normalizeClass(["h18px mt-0",{italic:n.editor.isActive("strike")}]),style:w.normalizeStyle({textDecoration:n.editor.isActive("strike")?"line-through":void 0,textDecorationColor:n.editor.isActive("strike")?"#fff":void 0})},"S",6)]),_:1},8,["theme"]),w.createVNode(o,{theme:n.editor.isActive("bulletList")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[5]||(e[5]=f=>n.editor.chain().focus().toggleBulletList().run()),class:w.normalizeClass({"fw-bold!":n.editor.isActive("bulletList")})},{default:w.withCtx(()=>[...e[14]||(e[14]=[w.createElementVNode("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"},[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w.createElementVNode("path",{d:"M9 6l11 0"}),w.createElementVNode("path",{d:"M9 12l11 0"}),w.createElementVNode("path",{d:"M9 18l11 0"}),w.createElementVNode("path",{d:"M5 6l0 .01"}),w.createElementVNode("path",{d:"M5 12l0 .01"}),w.createElementVNode("path",{d:"M5 18l0 .01"})],-1)])]),_:1},8,["theme","class"]),w.createVNode(o,{theme:n.editor.isActive("orderedList")?n.activeButtonsTheme:n.defaultButtonsTheme,onClick:e[6]||(e[6]=f=>n.editor.chain().focus().toggleOrderedList().run()),class:w.normalizeClass({"fw-bold!":n.editor.isActive("orderedList"),"text-white! fill-white! stroke-white!":!0})},{default:w.withCtx(()=>[...e[15]||(e[15]=[w.createElementVNode("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"},[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w.createElementVNode("path",{d:"M11 6h9",stroke:"currentColor",fill:"none"}),w.createElementVNode("path",{d:"M11 12h9",stroke:"currentColor",fill:"none"}),w.createElementVNode("path",{d:"M12 18h8",stroke:"currentColor",fill:"none"}),w.createElementVNode("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4",stroke:"currentColor",fill:"none"}),w.createElementVNode("path",{d:"M6 10v-6l-2 2",stroke:"currentColor",fill:"none"})],-1)])]),_:1},8,["theme","class"]),w.createVNode(o,{onClick:e[7]||(e[7]=f=>n.editor.chain().focus().toggleHeading({level:1}).run()),class:w.normalizeClass({"is-active":n.editor.isActive("heading",{level:1})})},{default:w.withCtx(()=>[...e[16]||(e[16]=[w.createTextVNode("H1",-1)])]),_:1},8,["class"]),w.createVNode(o,{onClick:e[8]||(e[8]=f=>n.editor.chain().focus().toggleHeading({level:2}).run()),class:w.normalizeClass({"is-active":n.editor.isActive("heading",{level:2})})},{default:w.withCtx(()=>[...e[17]||(e[17]=[w.createTextVNode("H2",-1)])]),_:1},8,["class"])])]),_:1},8,["editor"])):w.createCommentVNode("",!0),w.createVNode(a,{editor:n.editor},null,8,["editor"]),!n.disabled&&n.value?(w.openBlock(),w.createElementBlock("div",{key:1,class:w.normalizeClass(["w25px h25px text-stone absolute t-10px r-12px z4 cursor-pointer hover:scale-130",{}])},[w.createVNode(d,{onClick:e[9]||(e[9]=f=>n._onInput(""))})])):w.createCommentVNode("",!0),n.showLinkModal?(w.openBlock(),w.createElementBlock("div",{key:2,onClose:e[12]||(e[12]=f=>n.showLinkModal=!1)},[w.withDirectives(w.createElementVNode("input",{"onUpdate:modelValue":e[10]||(e[10]=f=>n.linkUrl=f),placeholder:"URL"},null,512),[[w.vModelText,n.linkUrl]]),w.createElementVNode("button",{onClick:e[11]||(e[11]=(...f)=>n.addLink&&n.addLink(...f))},"Вставить ссылку")],32)):w.createCommentVNode("",!0),(w.openBlock(),w.createBlock(w.resolveDynamicComponent("style"))),w.createElementVNode("div",null,[w.createVNode(u,{inputValue:"Для ссылок, например"})])],8,Vk)}c(jk,"render");const Uk=ch._export_sfc(un,[["render",jk]]);exports.default=Uk;
|