%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/
Upload File :
Create Path :
Current File : //www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/2137.1e98feff03b5fa3a46a7.js

/*! For license information please see 2137.1e98feff03b5fa3a46a7.js.LICENSE.txt */
"use strict";(self.webpackChunkncpasswords=self.webpackChunkncpasswords||[]).push([[2137],{1172:(e,t,n)=>{function r(e){this.content=e}n.d(t,{Ay:()=>Uy}),r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};const o=r;function i(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)n++;return n}if(o.content.size||s.content.size){let e=i(o.content,s.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function s(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let a=e.child(--o),l=t.child(--i),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let e=s(a.content,l.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class a{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l}),0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new a(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new a(n,r)}cutByIndex(e,t){return e==t?a.empty:0==e&&t==this.content.length?this:new a(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new a(r,o)}addToStart(e){return new a([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new a(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,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return i(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return s(this,e,t,n)}findIndex(e,t=-1){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?c(n+1,o):c(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return a.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return a.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new a(t||e,n)}static from(e){if(!e)return a.empty;if(e instanceof a)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new a([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}a.empty=new a([],0);const l={index:0,offset:0};function c(e,t){return l.index=e,l.offset=t,l}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class d{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||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&&u(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return d.none;if(e instanceof d)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}d.none=[];class p extends Error{}class h{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new h(n,this.openStart,this.openEnd)}removeBetween(e,t){return new h(f(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 h.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new h(a.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new h(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=m(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function g(e,t,n){if(n.openStart>e.depth)throw new p("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new p("Inconsistent open depths");return v(e,t,n,0)}function v(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=v(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(a.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return x(i,C(e,o,s,t,r))}{let r=e.parent,o=r.content;return x(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return x(i,T(e,t,r))}function y(e,t){if(!t.type.compatibleContent(e.type))throw new p("Cannot join "+t.type.name+" onto "+e.type.name)}function b(e,t,n){let r=e.node(n);return y(r,t.node(n)),r}function w(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function k(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(w(e.nodeAfter,r),i++));for(let e=i;e<s;e++)w(o.child(e),r);t&&t.depth==n&&t.textOffset&&w(t.nodeBefore,r)}function x(e,t){return e.type.checkContent(t),e.copy(t)}function C(e,t,n,r,o){let i=e.depth>o&&b(e,t,o+1),s=r.depth>o&&b(n,r,o+1),l=[];return k(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(y(i,s),w(x(i,C(e,t,n,r,o+1)),l)):(i&&w(x(i,T(e,t,o+1)),l),k(t,n,o,l),s&&w(x(s,T(n,r,o+1)),l)),k(r,null,o,l),new a(l)}function T(e,t,n){let r=[];return k(null,e,n,r),e.depth>n&&w(x(b(e,t,n+1),T(e,t,n+1)),r),k(t,null,n,r),new a(r)}h.empty=new h(a.empty,0,0);class M{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return d.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new O(this,e,n);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 n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new M(t,n,o)}static resolveCached(e,t){for(let n=0;n<S.length;n++){let r=S[n];if(r.pos==t&&r.doc==e)return r}let n=S[E]=M.resolve(e,t);return E=(E+1)%N,n}}let S=[],E=0,N=12;class O{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const D=Object.create(null);class A{constructor(e,t,n,r=d.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||a.empty}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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||D)&&d.sameSet(this.marks,n||d.none)}copy(e=null){return e==this.content?this:new A(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new A(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return h.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new h(a,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return M.resolveCached(this,e)}resolveNoCache(e){return M.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}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()+")"),I(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,n=a.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}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);let e=d.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!d.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.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((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=a.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}A.prototype.text=void 0;class L extends A{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):I(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 L(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new L(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function I(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class R{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new P(e,t);if(null==n.next)return R.empty;let r=B(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);j(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new R(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(V);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(j(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,i))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}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,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return a.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.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=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}R.empty=new R(!0);class P{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function B(e){let t=[];do{t.push(F(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function F(e){let t=[];do{t.push(H(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function H(e){let t=function(e){if(e.eat("(")){let t=B(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.groups.indexOf(t)>-1&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=q(e,t)}return t}function z(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function q(e,t){let n=z(e),r=n;return e.eat(",")&&(r="}"!=e.next?z(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function V(e,t){return t-e}function j(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(V)}function $(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function _(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function U(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new J(e[n]);return t}class W{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=U(n.attrs),this.defaultAttrs=$(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==R.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:_(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new A(this,this.computeAttrs(e),a.from(t),d.setFrom(n))}createChecked(e=null,t,n){return t=a.from(t),this.checkContent(t),new A(this,this.computeAttrs(e),t,d.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=a.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(a.empty,!0);return o?new A(this,e,t.append(o),d.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).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)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:d.none:e}static compile(e,t){let n=Object.create(null);e.forEach(((e,r)=>n[e]=new W(e,t,r)));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class J{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class K{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=U(r.attrs),this.excluded=null;let o=$(this.attrs);this.instance=o?new d(this,o):null}create(e=null){return!e&&this.instance?this.instance:new d(this,_(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new K(e,r++,t,o))),n}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class G{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=W.compile(this.spec.nodes,this),this.marks=K.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;t.contentMatch=n[r]||(n[r]=R.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==o?null:o?X(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:X(this,n.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof W))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new L(n,n.defaultAttrs,e,d.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return A.fromJSON(this,e)}markFromJSON(e){return d.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function X(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Z{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{!function(e){return null!=e.tag}(e)?function(e){return null!=e.style}(e)&&this.styles.push(e):this.tags.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new re(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new re(this,t,!0);return n.addAll(e,t.from,t.to),h.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=ie(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Z(e,Z.schemaRules(e)))}}const Q={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},Y={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ee={ol:!0,ul:!0};function te(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ne{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=d.none,this.stashMarks=[],this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(a.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=a.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):se(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Q.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class re{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=te(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ne(o.type,o.attrs,d.none,d.none,!0,t.topMatch||o.type.contentMatch,i):new ne(n?null:e.schema.topNodeType,null,d.none,d.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){3==e.nodeType?this.addTextNode(e):1==e.nodeType&&this.addElement(e)}withStyleRules(e,t){let n=e.getAttribute("style");if(!n)return t();let r=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(n));if(!r)return;let[o,i]=r,s=this.top;for(let e=0;e<i.length;e++)this.removePendingMark(i[e],s);for(let e=0;e<o.length;e++)this.addPendingMark(o[e]);t();for(let e=0;e<o.length;e++)this.removePendingMark(o[e],s);for(let e=0;e<i.length;e++)this.addPendingMark(i[e])}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ee.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ee.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:Y.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(Q.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);o&&o.skip?this.addAll(e):this.withStyleRules(e,(()=>this.addAll(e))),t&&this.sync(n),this.needsBlock=i}else this.withStyleRules(e,(()=>{this.addElementByRule(e,o,!1===o.consuming?n:void 0)}))}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=d.none,n=d.none;for(let r=0;r<e.length;r+=2)for(let o;;){let i=this.parser.matchStyle(e[r],e[r+1],this,o);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{i.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;o=i}return[t,n]}addElementByRule(e,t,n){let r,o,i;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let e=0;e<t.length;e++)this.enterInner(t[e],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=te(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ne(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ie(e){let t={};for(let n in e)t[n]=e[n];return t}function se(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class ae{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ce(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=ae.renderSpec(ce(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&ae.renderSpec(ce(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):s.setAttribute(e,a[e])}}for(let o=l;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:o}=ae.renderSpec(e,i,n);if(s.appendChild(t),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ae(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=le(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return le(e.marks)}}function le(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ce(e){return e.document||window.document}const ue=Math.pow(2,16);function de(e,t){return e+t*ue}function pe(e){return 65535&e}class he{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&fe.empty)return fe.empty}recover(e){let t=0,n=pe(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/ue}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(e<=u){let o=a+r+((l?e==a?-1:e==u?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:u)?null:de(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new he(o,d,i)}r+=c-l}return n?e+r:new he(e+r,0,null)}touches(e,t){let n=0,r=pe(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?fe.empty:new fe(e<0?[0,-e,0]:[0,0,e])}}fe.empty=new fe([]);class me{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new me(this.maps,this.mirror,e,t)}copy(){return new me(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r: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,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new me;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this.maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this.maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new he(e,r,null)}}const ge=Object.create(null);class ve{getMap(){return fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ge[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ge)throw new RangeError("Duplicate use of step JSON ID "+e);return ge[e]=t,t.prototype.jsonID=e,t}}class ye{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,t,n,r){try{return ye.ok(e.replace(t,n,r))}catch(e){if(e instanceof p)return ye.fail(e.message);throw e}}}function be(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(be(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return a.fromArray(r)}class we extends ve{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new h(be(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,o)}invert(){return new ke(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new we(t.pos,n.pos,this.mark)}merge(e){return e instanceof we&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new we(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new we(t.from,t.to,e.markFromJSON(t.mark))}}ve.jsonID("addMark",we);class ke extends ve{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new h(be(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,n)}invert(){return new we(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ke(t.pos,n.pos,this.mark)}merge(e){return e instanceof ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ke(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ke(t.from,t.to,e.markFromJSON(t.mark))}}ve.jsonID("removeMark",ke);class xe extends ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new h(a.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new xe(this.pos,t.marks[n]);return new xe(this.pos,this.mark)}}return new Ce(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xe(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xe(t.pos,e.markFromJSON(t.mark))}}ve.jsonID("addNodeMark",xe);class Ce extends ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new h(a.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new xe(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ce(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ce(t.pos,e.markFromJSON(t.mark))}}ve.jsonID("removeNodeMark",Ce);class Te extends ve{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Se(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new Te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Te(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof Te)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?h.empty:new h(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Te(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?h.empty:new h(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Te(this.from,this.to+(e.to-e.from),t,this.structure)}}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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Te(t.from,t.to,h.fromJSON(e,t.slice),!!t.structure)}}ve.jsonID("replace",Te);class Me extends ve{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Se(e,this.from,this.gapFrom)||Se(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ye.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?ye.fromReplace(e,this.from,this.to,n):ye.fail("Content does not fit in gap")}getMap(){return new fe([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 Me(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),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new Me(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Me(t.from,t.to,t.gapFrom,t.gapTo,h.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Se(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function Ee(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ne(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!Ee(r,o,i))break}return null}function Oe(e){return{type:e,attrs:null}}function De(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Ae(e,t){let n=e.resolve(t),r=n.index();return o=n.nodeBefore,i=n.nodeAfter,!(!o||!i||o.isLeaf||!o.canAppend(i))&&n.parent.canReplace(r,r+1);var o,i}function Le(e,t,n=t,r=h.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ie(o,i,r)?new Te(t,n,r):new Re(o,i,r).fit()}function Ie(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ve.jsonID("replaceAround",Me);class Re{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=a.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=a.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new h(o,i,s);return e>-1?new Me(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Te(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Fe(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:l}=this.frontier[e],c=null;if(1==t&&(o?l.matchType(o.type)||(c=l.fillBefore(a.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(2==t&&o&&(i=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&l.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Fe(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new h(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Fe(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new h(Pe(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new h(Pe(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,l=i.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)u.push(r.child(e));d=d.matchFragment(r)}let f=s.size+e-(i.content.size-i.openEnd);for(;c<s.childCount;){let e=s.child(c),t=d.matchType(e.type);if(!t)break;c++,(c>1||0==l||e.content.size)&&(d=t,u.push(He(e.mark(p.allowedMarks(e.marks)),1==c?l:0,c==s.childCount?f:-1)))}let m=c==s.childCount;m||(f=-1),this.placed=Be(this.placed,t,a.from(u)),this.frontier[t].match=d,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?h.empty:new h(Pe(i.content,e-1,1),e-1,f<0?i.openEnd:e-1):new h(Pe(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!ze(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=ze(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=ze(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?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=Be(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Be(this.placed,this.depth,a.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(a.empty,!0);e.childCount&&(this.placed=Be(this.placed,this.frontier.length,e))}}function Pe(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Pe(e.firstChild.content,t-1,n)))}function Be(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Be(e.lastChild.content,t-1,n)))}function Fe(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function He(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,He(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(a.empty,!0)))),e.copy(r)}function ze(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function qe(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(qe(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(a.empty,!0))}return e}function Ve(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class je extends ve{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ye.fromReplace(e,this.pos,this.pos+1,new h(a.from(r),0,t.isLeaf?0:1))}getMap(){return fe.empty}invert(e){return new je(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 je(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new je(t.pos,t.attr,t.value)}}ve.jsonID("attr",je);class $e extends ve{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ye.ok(n)}getMap(){return fe.empty}invert(e){return new $e(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("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new $e(t.attr,t.value)}}ve.jsonID("docAttr",$e);let _e=class extends Error{};_e=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(_e.prototype=Object.create(Error.prototype)).constructor=_e,_e.prototype.name="TransformError";class Ue{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new me}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new _e(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,n=h.empty){let r=Le(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new h(a.from(n),0,0))}delete(e,t){return this.replace(e,t,h.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Ie(o,i,r))return e.step(new Te(t,n,r));let s=Ve(o,e.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=c[e],n=(d=t.type).spec.defining||d.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))u=e;else if(n||!t.type.isTextblock)break}var d;for(let t=r.openStart;t>=0;t--){let a=(t+u+1)%(r.openStart+1),d=c[a];if(d)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],u=!0;c<0&&(u=!1,c=-c);let p=o.node(c-1),f=o.index(c-1);if(p.canReplaceWith(f,f,d.type,d.marks))return e.replace(o.before(c),u?i.after(c):n,new h(qe(r.content,0,r.openStart,a),a,r.openEnd))}}let p=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>p));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new h(a.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Ve(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i)return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),l=o.after(i+1),c=s,u=l,d=a.empty,p=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=a.from(r.node(e).copy(d)),p++):c--;let f=a.empty,m=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=a.from(o.node(e).copy(f)),m++):u++;e.step(new Me(c,u,s,l,new h(d.append(f),p,m),d.size-p,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=new Te(t-n,t+n,h.empty,!0);e.step(r)}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=a.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=a.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new Me(o,i,o,i,new h(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(r,o)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){e.clearIncompatible(e.mapping.slice(i).map(n,1),r);let s=e.mapping.slice(i),l=s.map(n,1),c=s.map(n+t.nodeSize,1);return e.step(new Me(l,c,l+1,c-1,new h(a.from(r.create(o,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Me(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new h(a.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new je(e,t,n)),this}setDocAttribute(e,t){return this.step(new $e(e,t)),this}addNodeMark(e,t){return this.step(new xe(e,t)),this}removeNodeMark(e,t){if(!(t instanceof d)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new Ce(e,t)),this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=a.empty,s=a.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){i=a.from(o.node(e).copy(i));let t=r&&r[l];s=a.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new Te(t,t,new h(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,((e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),p=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new ke(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new we(c,d,r))}})),s.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,((e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof K){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}})),o.forEach((t=>e.step(new ke(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,r=n.contentMatch){let o=e.doc.nodeAt(t),i=[],s=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),c=s+l.nodeSize,u=r.matchType(l.type);if(u){r=u;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new ke(s,c,l.marks[t]));if(l.isText&&!n.spec.code){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new h(a.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),i.push(new Te(s+e.index,s+e.index+e[0].length,t))}}else i.push(new Te(s,c,h.empty));s=c}if(!r.validEnd){let t=r.fillBefore(a.empty,!0);e.replace(s,s,new h(t,0,0))}for(let t=i.length-1;t>=0;t--)e.step(i[t])}(this,e,t,n),this}}const We=Object.create(null);class Je{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ke(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=h.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?h.empty:t),0==s&&ot(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),ot(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Ze(e):rt(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?rt(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):rt(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new tt(e.node(0))}static atStart(e){return rt(e,e,0,0,1)||new tt(e)}static atEnd(e){return rt(e,e,e.content.size,e.childCount,-1)||new tt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=We[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in We)throw new RangeError("Duplicate use of selection JSON ID "+e);return We[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ze.between(this.$anchor,this.$head).getBookmark()}}Je.prototype.visible=!0;class Ke{constructor(e,t){this.$from=e,this.$to=t}}let Ge=!1;function Xe(e){Ge||e.parent.inlineContent||(Ge=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ze extends Je{constructor(e,t=e){Xe(e),Xe(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Je.near(n);let r=e.resolve(t.map(this.anchor));return new Ze(r.parent.inlineContent?r:n,n)}replace(e,t=h.empty){if(super.replace(e,t),t==h.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Ze&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Qe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ze(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Je.findFrom(t,n,!0)||Je.findFrom(t,-n,!0);if(!e)return Je.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Je.findFrom(e,-n,!0)||Je.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Ze(e,t)}}Je.jsonID("text",Ze);class Qe{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Qe(e.map(this.anchor),e.map(this.head))}resolve(e){return Ze.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ye extends Je{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Je.near(o):new Ye(o)}content(){return new h(a.from(this.node),0,0)}eq(e){return e instanceof Ye&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new et(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ye(e.resolve(t.anchor))}static create(e,t){return new Ye(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Ye.prototype.visible=!1,Je.jsonID("node",Ye);class et{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Qe(n,n):new et(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ye.isSelectable(n)?new Ye(t):Je.near(t)}}class tt extends Je{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=h.empty){if(t==h.empty){e.delete(0,e.doc.content.size);let t=Je.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new tt(e)}map(e){return new tt(e)}eq(e){return e instanceof tt}getBookmark(){return nt}}Je.jsonID("all",tt);const nt={map(){return this},resolve:e=>new tt(e)};function rt(e,t,n,r,o,i=!1){if(t.inlineContent)return Ze.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Ye.isSelectable(r))return Ye.create(e,n-(o<0?r.nodeSize:0))}else{let t=rt(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function ot(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof Te||i instanceof Me)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==o&&(o=r)})),e.setSelection(Je.near(e.doc.resolve(o),n)))}class it extends Ue{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=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return d.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||d.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(Je.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function st(e,t){return t&&e?e.bind(t):e}class at{constructor(e,t,n){this.name=e,this.init=st(t.init,n),this.apply=st(t.apply,n)}}const lt=[new at("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new at("selection",{init:(e,t)=>e.selection||Je.atStart(t.doc),apply:e=>e.selection}),new at("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new at("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class ct{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=lt.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new at(e.key,e.spec.state,e))}))}}class ut{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ut(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new it(this)}static create(e){let t=new ct(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new ut(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new ct(this.schema,e.plugins),n=t.fields,r=new ut(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new ct(e.schema,e.plugins),o=new ut(r);return r.fields.forEach((r=>{if("doc"==r.name)o.doc=A.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Je.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}})),o}}function dt(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=dt(o,t,{})),n[r]=o}return n}class pt{constructor(e){this.spec=e,this.props={},e.props&&dt(e.props,this,this.props),this.key=e.key?e.key.key:ft("plugin")}getState(e){return e[this.key]}}const ht=Object.create(null);function ft(e){return e in ht?e+"$"+ ++ht[e]:(ht[e]=0,e+"$")}class mt{constructor(e="key"){this.key=ft(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const gt=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},vt=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let yt=null;const bt=function(e,t,n){let r=yt||(yt=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},wt=function(e,t,n,r){return n&&(xt(e,t,n,r,-1)||xt(e,t,n,r,1))},kt=/^(img|br|input|textarea|hr)$/i;function xt(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Ct(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Tt(e)||kt.test(e.nodeName)||"false"==e.contentEditable)return!1;t=gt(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?Ct(e):0}}}function Ct(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Tt(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Mt=function(e){return e.focusNode&&wt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function St(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Et="undefined"!=typeof navigator?navigator:null,Nt="undefined"!=typeof document?document:null,Ot=Et&&Et.userAgent||"",Dt=/Edge\/(\d+)/.exec(Ot),At=/MSIE \d/.exec(Ot),Lt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ot),It=!!(At||Lt||Dt),Rt=At?document.documentMode:Lt?+Lt[1]:Dt?+Dt[1]:0,Pt=!It&&/gecko\/(\d+)/i.test(Ot);Pt&&(/Firefox\/(\d+)/.exec(Ot)||[0,0])[1];const Bt=!It&&/Chrome\/(\d+)/.exec(Ot),Ft=!!Bt,Ht=Bt?+Bt[1]:0,zt=!It&&!!Et&&/Apple Computer/.test(Et.vendor),qt=zt&&(/Mobile\/\w+/.test(Ot)||!!Et&&Et.maxTouchPoints>2),Vt=qt||!!Et&&/Mac/.test(Et.platform),jt=!!Et&&/Win/.test(Et.platform),$t=/Android \d/.test(Ot),_t=!!Nt&&"webkitFontSmoothing"in Nt.documentElement.style,Ut=_t?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Wt(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Jt(e,t){return"number"==typeof e?e:e[t]}function Kt(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Gt(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=vt(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,a=n?Wt(i):Kt(e),l=0,c=0;if(t.top<a.top+Jt(r,"top")?c=-(a.top-t.top+Jt(o,"top")):t.bottom>a.bottom-Jt(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Jt(o,"top")-a.top:t.bottom-a.bottom+Jt(o,"bottom")),t.left<a.left+Jt(r,"left")?l=-(a.left-t.left+Jt(o,"left")):t.right>a.right-Jt(r,"right")&&(l=t.right-a.right+Jt(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Xt(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=vt(r));return t}function Zt(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Qt=null;function Yt(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(1==u.nodeType)e=u.getClientRects();else{if(3!=u.nodeType)continue;e=bt(u).getClientRects()}for(let p=0;p<e.length;p++){let h=e[p];if(h.top<=l&&h.bottom>=c){l=Math.max(h.bottom,l),c=Math.min(h.top,c);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==u.nodeType&&e&&(a=d+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!o&&h.left<=t.left&&h.right>=t.left&&(o=u,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(a=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=on(r,1);if(n.top!=n.bottom&&en(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Yt(n,r)}function en(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tn(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(en(t,o))return tn(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function nn(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!en(t,n))return null;if(a=tn(e.dom,t,n),!a)return null}if(zt)for(let e=a;n&&e;e=vt(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(Pt&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;_t&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!i||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!i&&(i=!0,e.left>r.left||e.top>r.top?o=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(o=t.posAfter)),!t.contentDOM&&o<0&&!t.node.isText)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}n=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Yt(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function rn(e){return e.top<e.bottom||e.left<e.right}function on(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(rn(e))return e}return Array.prototype.find.call(n,rn)||e.getBoundingClientRect()}const sn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function an(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=_t||Pt;if(3==r.nodeType){if(!s||!sn.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,ln(on(bt(r,e,t),i),i<0)}{let e=on(bt(r,o,o),n);if(Pt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=on(bt(r,o-1,o-1),-1);if(t.top==e.top){let n=on(bt(r,o,o+1),-1);if(n.top!=e.top)return ln(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Ct(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return cn(e.getBoundingClientRect(),!1)}if(null==i&&o<Ct(r)){let e=r.childNodes[o];if(1==e.nodeType)return cn(e.getBoundingClientRect(),!0)}return cn(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Ct(r))){let e=r.childNodes[o-1],t=3==e.nodeType?bt(e,Ct(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return ln(on(t,1),!1)}if(null==i&&o<Ct(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?bt(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return ln(on(t,-1),!0)}return ln(on(3==r.nodeType?bt(r):r,-n),n>=0)}function ln(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function cn(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function un(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const dn=/[\u0590-\u08ac]/;let pn=null,hn=null,fn=!1;class mn{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>gt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof xn){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof gn&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?gt(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?gt(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=gt(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=gt(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.getSelection(),c=!1;if((Pt||zt)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(c=!(!t||"\n"!=e.nodeValue[t-1]),c&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:gt(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Pt&&l.focusNode&&l.focusNode!=a.node&&1==l.focusNode.nodeType){let e=l.focusNode.childNodes[l.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&zt)&&wt(s.node,s.offset,l.anchorNode,l.anchorOffset)&&wt(a.node,a.offset,l.focusNode,l.focusOffset))return;let u=!1;if((l.extend||e==t)&&!c){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class gn extends mn{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class vn extends mn{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}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"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class yn extends mn{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=ae.renderSpec(document,t.type.spec.toDOM(t,n))),new yn(e,t,i.dom,i.contentDOM||i.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=yn.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Pn(o,t,i,n)),e>0&&(o=Pn(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}}class bn extends mn{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i),n,r),c=l&&l.dom,u=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else c||({dom:c,contentDOM:u}=ae.renderSpec(document,t.type.spec.toDOM(t)));u||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let d=c;return c=Dn(c,n,t),l?s=new Cn(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new kn(e,t,n,r,c,d,o):new bn(e,t,n,r,c,u||null,d,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>a.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&An(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new In(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d,p,h;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(Rn);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)h=-1,p=l,l=null;else{if(!(c<e.childCount))break;h=c,p=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+p.nodeSize;if(p.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=p.cut(e-i),p=p.cut(0,e-i),f=e,h=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(p,p.isInline&&!p.isLeaf?a.filter((e=>!e.inline)):a.slice(),t.forChild(i,p),h),i=f}}(this.node,this.innerDeco,((t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?d.none:this.node.child(o).marks,n,e),a.placeWidget(t,e,r)}),((t,i,l,c)=>{let u;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,u,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Tn(this.contentDOM,this.children,e),qt&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Ze)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new vn(this,o,t,r);e.input.compositionNodes.push(i),this.children=Pn(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(An(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Nn(this.dom,this.nodeDOM,En(this.outerDeco,this.node,t),En(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function wn(e,t,n,r,o){Dn(r,t,e);let i=new bn(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class kn extends bn{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new kn(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class xn extends mn{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Cn extends bn{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Tn(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=Ln(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof yn){let t=r?r.previousSibling:e.lastChild;Tn(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Ln(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Mn=function(e){e&&(this.nodeName=e)};Mn.prototype=Object.create(null);const Sn=[new Mn];function En(e,t,n){if(0==e.length)return Sn;let r=n?Sn[0]:new Mn,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Mn(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Mn(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Nn(e,t,n,r){if(n==Sn&&r==Sn)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=Sn[0]),o=t}On(o,s||Sn[0],i)}return o}function On(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Dn(e,t,n){return Nn(e,e,Sn,En(t,n,1!=e.nodeType))}function An(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Ln(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class In{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof yn)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=yn.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof bn){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&An(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let s=bn.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=bn.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new gn(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof yn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof kn)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((zt||Ft)&&e&&"false"==e.dom.contentEditable&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new xn(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Rn(e,t){return e.type.side-t.type.side}function Pn(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Bn(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Mt(n)){for(a=c;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Ye.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Ct(e);r||o;){if(e==n)return!0;let t=gt(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Ct(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Ye(s==e?c:r.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;a=r.resolve(t)}return l||(l=Un(e,a,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)),l}function Fn(e){return e.editable?e.hasFocus():Jn(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Hn(e,t=!1){let n=e.state.selection;if($n(e,n),Fn(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ft){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&wt(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,gt(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&It&&Rt<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!zn||n instanceof Ze||(n.$from.parent.inlineContent||(r=qn(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=qn(e,n.to))),e.docView.setSelection(i,s,e.root,t),zn&&(r&&jn(r),o&&jn(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Fn(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const zn=zt||Ft&&Ht<63;function qn(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(zt&&o&&"false"==o.contentEditable)return Vn(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Vn(o);if(i)return Vn(i)}}function Vn(e){return e.contentEditable="true",zt&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function jn(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function $n(e,t){if(t instanceof Ye){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(_n(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else _n(e)}function _n(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Un(e,t,n,r){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||Ze.between(t,n,r)}function Wn(e){return!(e.editable&&!e.hasFocus())&&Jn(e)}function Jn(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Kn(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Je.findFrom(i,t)}function Gn(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Xn(e,t,n){let r=e.state.selection;if(!(r instanceof Ze)){if(r instanceof Ye&&r.node.isInline)return Gn(e,new Ze(t>0?r.$to:r.$from));{let n=Kn(e.state,t);return!!n&&Gn(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return Gn(e,new Ze(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Kn(e.state,t);return!!(n&&n instanceof Ye)&&Gn(e,n)}if(!(Vt&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Ye.isSelectable(i)?Gn(e,new Ye(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!_t&&Gn(e,new Ze(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Zn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Qn(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Yn(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(Pt&&1==n.nodeType&&r<Zn(n)&&Qn(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Qn(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(er(n))break;{let t=n.previousSibling;for(;t&&Qn(t,-1);)o=n.parentNode,i=gt(t),t=t.previousSibling;if(t)n=t,r=Zn(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?tr(e,n,r):o&&tr(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Zn(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Qn(n.childNodes[r],1))break;o=n,i=++r}else{if(er(n))break;{let t=n.nextSibling;for(;t&&Qn(t,1);)o=t.parentNode,i=gt(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Zn(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&tr(e,o,i)}(e)}function er(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function tr(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Tt(e);)t=gt(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Tt(e);)t=gt(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(Mt(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&Hn(e)}),50)}function nr(e,t){let n=e.state.doc.resolve(t);if(!Ft&&!jt&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function rr(e,t,n){let r=e.state.selection;if(r instanceof Ze&&!r.empty||n.indexOf("s")>-1)return!1;if(Vt&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Kn(e.state,t);if(n&&n instanceof Ye)return Gn(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof tt?Je.near(n,t):Je.findFrom(n,t);return!!s&&Gn(e,s)}return!1}function or(e,t){if(!(e.state.selection instanceof Ze))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function ir(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function sr(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||ae.fromSchema(e.state.schema),a=gr(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=fr[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),d++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n")}}function ar(e,t,n,r,o){let i,s,l=o.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(n=>{t=n(t,l||r,e)})),l)return t?new h(a.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):h.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,o,r,e)));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=ae.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=gr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&fr[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),_t&&function(e){let t=e.querySelectorAll(Ft?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let u=i&&i.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Z.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!c&&!d),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||lr.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=a.from(t.create(n[e+1],o)),i++,s++}return new h(o,i,s)}(hr(s,+d[1],+d[2]),d[4]);else if(s=h.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach((e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&ur(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=dr(i[i.length-1],r.length));let t=cr(e,n);i.push(t),o=o.matchType(t.type),r=n}})),i)return a.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=hr(s,e,t)}return e.someProp("transformPasted",(t=>{s=t(s,e)})),s}const lr=/^(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 cr(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,a.from(e));return e}function ur(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=ur(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(a.from(cr(n,e,o+1))))}}function dr(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,dr(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(a.empty,!0);return e.copy(n.append(r))}function pr(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(i=0),o<r-1&&(l=pr(l,t,n,r,o+1,i)),o>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(a.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function hr(e,t,n){return t<e.openStart&&(e=new h(pr(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new h(pr(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const fr={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 mr=null;function gr(){return mr||(mr=document.implementation.createHTMLDocument("title"))}const vr={},yr={},br={touchstart:!0,touchmove:!0};class wr{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function kr(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function xr(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Cr(e,t))}))}function Cr(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Tr(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Mr(e){return{left:e.clientX,top:e.clientY}}function Sr(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function Er(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Nr(e,t,n,r){return Sr(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function Or(e,t,n,r){return Sr(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(n=>n(e,t,r)))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Er(e,Ze.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)Er(e,Ze.create(r,i+1,i+1+n.content.size),"pointer");else{if(!Ye.isSelectable(n))continue;Er(e,Ye.create(r,i),"pointer")}return!0}}(e,n,r)}function Dr(e){return Fr(e)}yr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Ir(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!$t||!Ft||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!qt||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||Vt&&72==n&&"c"==r)return or(e,-1)||Yn(e,-1);if(46==n&&!t.shiftKey||Vt&&68==n&&"c"==r)return or(e,1)||Yn(e,1);if(13==n||27==n)return!0;if(37==n||Vt&&66==n&&"c"==r){let t=37==n?"ltr"==nr(e,e.state.selection.from)?-1:1:-1;return Xn(e,t,r)||Yn(e,t)}if(39==n||Vt&&70==n&&"c"==r){let t=39==n?"ltr"==nr(e,e.state.selection.from)?1:-1:1;return Xn(e,t,r)||Yn(e,t)}return 38==n||Vt&&80==n&&"c"==r?rr(e,-1,r)||Yn(e,-1):40==n||Vt&&78==n&&"c"==r?function(e){if(!zt||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;ir(e,n,"true"),setTimeout((()=>ir(e,n,"false")),20)}return!1}(e)||rr(e,1,r)||Yn(e,1):r==(Vt?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():kr(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,St(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},yr.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},yr.keypress=(e,t)=>{let n=t;if(Ir(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vt&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Ze&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,r.$from.pos,r.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const Ar=Vt?"metaKey":"ctrlKey";vr.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Dr(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Ar]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(Mr(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Lr(e,s,n,!!r)):("doubleClick"==i?Nr:Or)(e,s.pos,s.inside,n)?n.preventDefault():kr(e,"pointer"))};class Lr{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ar],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a?a.dom:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Ye&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Pt||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)),kr(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((()=>Hn(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(Mr(e))),this.updateAllowDefault(e),this.allowDefault||!t?kr(this.view,"pointer"):function(e,t,n,r,o){return Sr(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(n=>n(e,t,r)))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Ye&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(Ye.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(Er(e,Ye.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ye.isSelectable(r))&&(Er(e,new Ye(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||zt&&this.mightDrag&&!this.mightDrag.node.isAtom||Ft&&!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)?(Er(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):kr(this.view,"pointer")}move(e){this.updateAllowDefault(e),kr(this.view,"pointer"),0==e.buttons&&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)}}function Ir(e,t){return!!e.composing||!!(zt&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}vr.touchstart=e=>{e.input.lastTouch=Date.now(),Dr(e),kr(e,"pointer")},vr.touchmove=e=>{e.input.lastTouch=Date.now(),kr(e,"pointer")},vr.contextmenu=e=>Dr(e);const Rr=$t?5e3:-1;function Pr(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Fr(e)),t))}function Br(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Fr(e,t=!1){if(!($t&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Br(e),t||e.docView&&e.docView.dirty){let t=Bn(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}yr.compositionstart=yr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Fr(e,!0),e.markCursor=null;else if(Fr(e),Pt&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Pr(e,Rr)},yr.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Pr(e,20))};const Hr=It&&Rt<15||qt&&Ut<604;function zr(e,t,n,r,o){let i=ar(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,o,i||h.empty))))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function qr(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}vr.copy=yr.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Hr?null:n.clipboardData,s=r.content(),{dom:a,text:l}=sr(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},yr.paste=(e,t)=>{let n=t;if(e.composing&&!$t)return;let r=Hr?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&zr(e,qr(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?zr(e,r.value,null,o,t):zr(e,r.textContent,r.innerHTML,o,t)}),50)}(e,n)};class Vr{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const jr=Vt?"altKey":"ctrlKey";vr.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Mr(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Ye?i.to-1:i.to));else if(r&&r.mightDrag)o=Ye.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Ye.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c}=sr(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Hr?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hr||n.dataTransfer.setData("text/plain",c),e.dragging=new Vr(a,!n[jr],o)},vr.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},yr.dragover=yr.dragenter=(e,t)=>t.preventDefault(),yr.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(Mr(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",(t=>{s=t(s,e)})):s=ar(e,qr(n.dataTransfer),Hr?null:n.dataTransfer.getData("text/html"),!1,i);let a=!(!r||n[jr]);if(e.someProp("handleDrop",(t=>t(e,n,s||h.empty,a))))return void n.preventDefault();if(!s)return;n.preventDefault();let l=s?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let c=e.state.tr;if(a){let{node:e}=r;e?e.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let f=c.doc.resolve(u);if(d&&Ye.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Ye(f));else{let t=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),c.setSelection(Un(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},vr.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Hn(e)}),20))},vr.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},vr.beforeinput=(e,t)=>{if(Ft&&$t&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,St(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in yr)vr[e]=yr[e];function $r(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class _r{constructor(e,t){this.toDOM=e,this.spec=t||Gr,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Jr(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof _r&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&$r(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ur{constructor(e,t){this.attrs=e,this.spec=t||Gr}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Jr(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ur&&$r(this.attrs,e.attrs)&&$r(this.spec,e.spec)}static is(e){return e.type instanceof Ur}destroy(){}}class Wr{constructor(e,t){this.attrs=e,this.spec=t||Gr}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Jr(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Wr&&$r(this.attrs,e.attrs)&&$r(this.spec,e.spec)}destroy(){}}class Jr{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Jr(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Jr(e,e,new _r(t,n))}static inline(e,t,n,r){return new Jr(e,t,new Ur(n,r))}static node(e,t,n,r){return new Jr(e,t,new Wr(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ur}get widget(){return this.type instanceof _r}}const Kr=[],Gr={};class Xr{constructor(e,t){this.local=e.length?e:Kr,this.children=t.length?t:Kr}static create(e,t){return t.length?no(t,e,0,Gr):Zr}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Zr||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Gr)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s})),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),u=c-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[t+1]+i,-1)-o,{index:p,offset:h}=r.content.findIndex(u),f=r.maybeChild(p);if(f&&h==u&&h+f.nodeSize==d){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Zr?(a[t]=u,a[t+1]=d,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=no(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Xr(t.sort(ro),a)}(this.children,i||[],e,t,n,r,o):i?new Xr(i.sort(ro),Kr):Zr}add(e,t){return t.length?this==Zr?Xr.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,a=i+n;if(s=eo(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,no(s,e,a+1,Gr)),o+=3}}));let i=Yr(o?to(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new Xr(i.length?this.local.concat(i).sort(ro):this.local,r||this.children)}remove(e){return 0==e.length||this==Zr?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Zr?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Xr(r,n):Zr}forChild(e,t){if(this==Zr)return this;if(t.isLeaf)return Xr.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Ur){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new Xr(r.sort(ro),Kr);return n?new Qr([e,n]):e}return n||Zr}eq(e){if(this==e)return!0;if(!(e instanceof Xr)||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 oo(this.localsInner(e))}localsInner(e){if(this==Zr)return Kr;if(e.inlineContent||!this.local.some(Ur.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Ur||t.push(this.local[e]);return t}}Xr.empty=new Xr([],[]),Xr.removeOverlap=oo;const Zr=Xr.empty;class Qr{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,Gr)));return Qr.from(n)}forChild(e,t){if(t.isLeaf)return Xr.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Zr&&(o instanceof Qr?n=n.concat(o.members):n.push(o))}return Qr.from(n)}eq(e){if(!(e instanceof Qr)||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,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?oo(n?t:t.sort(ro)):Kr}static from(e){switch(e.length){case 0:return Zr;case 1:return e[0];default:return new Qr(e.every((e=>e instanceof Xr))?e:e.reduce(((e,t)=>e.concat(t instanceof Xr?t:t.members)),[]))}}}function Yr(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Jr(o.from+t,o.to+t,o.type))}return n}function eo(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function to(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function no(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let a=eo(e,t,s+n);if(a){i=!0;let e=no(a,t,n+s+1,r);e!=Zr&&o.push(s,s+t.nodeSize,e)}}));let s=Yr(i?to(e):e,-n).sort(ro);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new Xr(s,o):Zr}function ro(e,t){return e.from-t.from||e.to-t.to}function oo(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),io(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),io(t,o+1,i.copy(r.to,i.to)))}}return t}function io(e,t,n){for(;t<e.length&&ro(n,e[t])>0;)t++;e.splice(t,0,n)}function so(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=Zr&&t.push(r)})),e.cursorWrapper&&t.push(Xr.create(e.state.doc,[e.cursorWrapper.deco])),Qr.from(t)}const ao={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lo=It&&Rt<=11;class co{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class uo{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new co,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);It&&Rt<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),lo&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,ao)),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(Wn(this.view)){if(this.suppressingSelectionUpdates)return Hn(this.view);if(It&&Rt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&wt(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,n=new Set;for(let t=e.focusNode;t;t=vt(t))n.add(t);for(let r=e.anchorNode;r;r=vt(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 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 n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Wn(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(Pt&&a.length>1){let e=a.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Mt(n)&&(l=Bn(e))&&l.eq(Je.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Hn(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(!po.has(e)&&(po.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=Pt,ho)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."),ho=!0}}(e)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Hn(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(It&&Rt<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?gt(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?gt(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let po=new WeakMap,ho=!1;function fo(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return wt(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function mo(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(zt&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||zt&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const go=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vo(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Un(e,t.resolve(n.anchor),t.resolve(n.head))}function yo(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function bo(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class wo{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 wr,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Mo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Co(this),xo(this),this.nodeViews=To(this),this.docView=wn(this.state.doc,ko(this),so(this),this.dom,this),this.domObserver=new uo(this,((e,t,n,r)=>function(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Bn(e,t);if(n&&!e.state.selection.eq(n)){if(Ft&&$t&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,St(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),l=s.sharedDepth(n);t=s.before(l+1),n=e.state.doc.resolve(n).after(l+1);let c,u,d=e.state.selection,p=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:c.anchorOffset}],Mt(c)||r.push({node:c.focusNode,offset:c.focusOffset})),Ft&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let d=e.state.doc,p=e.someProp("domParser")||Z.fromSchema(e.state.schema),h=d.resolve(a),f=null,m=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:mo,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),h=e.state.doc,f=h.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,u="end"):(c=e.state.selection.from,u="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,a))-i),s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&bo(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&bo(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(f.content,p.doc.content,p.from,c,u);if((qt&&e.input.lastIOSEnter>Date.now()-225||$t)&&o.some((e=>1==e.nodeType&&!go.test(e.nodeName)))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",(t=>t(e,St(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!m){if(!(r&&d instanceof Ze&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let t=vo(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}m={start:d.from,endA:d.to,endB:d.to}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Ze&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),It&&Rt<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>p.from&&"  "==p.doc.textBetween(m.start-p.from-1,m.start-p.from+1)&&(m.start--,m.endA--,m.endB--);let g,v=p.doc.resolveNoCache(m.start-p.from),y=p.doc.resolveNoCache(m.endB-p.from),b=h.resolve(m.start),w=v.sameParent(y)&&v.parent.inlineContent&&b.end()>=m.endA;if((qt&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!w&&v.pos<p.doc.content.size&&!v.sameParent(y)&&(g=Je.findFrom(p.doc.resolve(v.pos+1),1,!0))&&g.head==y.pos)&&e.someProp("handleKeyDown",(t=>t(e,St(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>m.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||yo(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(yo(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||yo(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,m.start,m.endA,v,y)&&e.someProp("handleKeyDown",(t=>t(e,St(8,"Backspace")))))return void($t&&Ft&&e.domObserver.suppressSelectionUpdates());Ft&&$t&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),$t&&!w&&v.start()!=y.start()&&0==y.parentOffset&&v.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==m.endA&&(m.endB-=2,y=p.doc.resolveNoCache(m.endB-p.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,St(13,"Enter"))}))}),20));let k,x,C,T=m.start,M=m.endA;if(w)if(v.pos==y.pos)It&&Rt<=11&&0==v.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Hn(e)),20)),k=e.state.tr.delete(T,M),x=h.resolve(m.start).marksAcross(h.resolve(m.endA));else if(m.endA==m.endB&&(C=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,l=i,c=s;for(let e=0;e<s.length;e++)l=s[e].removeFromSet(l);for(let e=0;e<i.length;e++)c=i[e].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(o(t.child(e)));if(a.from(u).eq(e))return{mark:r,type:n}}(v.parent.content.cut(v.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start()))))k=e.state.tr,"add"==C.type?k.addMark(T,M,C.mark):k.removeMark(T,M,C.mark);else if(v.parent.child(v.index()).isText&&v.index()==y.index()-(y.textOffset?0:1)){let t=v.parent.textBetween(v.parentOffset,y.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,T,M,t))))return;k=e.state.tr.insertText(t,T,M)}if(k||(k=e.state.tr.replace(T,M,p.doc.slice(m.start-p.from,m.endB-p.from))),p.sel){let t=vo(e,k.doc,p.sel);t&&!(Ft&&$t&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==T||t.head==k.mapping.map(M)-1)||It&&t.empty&&t.head==T)&&k.setSelection(t)}x&&k.ensureMarks(x),i&&k.setMeta("composition",i),e.dispatch(k.scrollIntoView())}(this,e,t,n,r))),this.domObserver.start(),function(e){for(let t in vr){let n=vr[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Tr(e,t)||Cr(e,t)||!e.editable&&t.type in yr||n(e,t)},br[t]?{passive:!0}:void 0)}zt&&e.dom.addEventListener("input",(()=>null)),xr(e)}(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&&xr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Mo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(Br(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=To(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&xr(this),this.editable=Co(this),xo(this);let a=so(this),l=ko(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,l,a);!u&&e.selection.eq(r.selection)||(i=!0);let d="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:Xt(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(It||Ft)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(u){let n=Ft?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Ct(e=e.childNodes[t-1])}else{if(!e.parentNode||Tt(e))return null;t=gt(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Tt(e))return null;t=gt(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n}(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=wn(e.doc,l,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return wt(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Hn(this,t):($n(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Zt(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof Ye){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Gt(this,t.getBoundingClientRect(),e)}else Gt(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Vr(e.slice,e.move,r<0?void 0:Ye.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(It){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Qt)return e.focus(Qt);let t=Xt(e);e.focus(null==Qt?{get preventScroll(){return Qt={preventScroll:!0},!0}}:void 0),Qt||(Qt=!1,Zt(t,0))}(this.dom),Hn(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return nn(this,e)}coordsAtPos(e,t=1){return an(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return pn==t&&hn==n?fn:(pn=t,hn=n,fn="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return un(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=an(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=bt(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return dn.test(r.parent.textContent)&&a.modify?un(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),p=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),p})):"left"==n||"backward"==n?i:s}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return zr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return zr(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],so(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,yt=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Cr(e,t)||!vr[t.type]||!e.editable&&t.type in yr||vr[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return zt&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return fo(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?fo(e,n):null}(this,e)||e}domSelection(){return this.root.getSelection()}}function ko(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Jr.node(0,e.state.doc.content.size,t)]}function xo(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Jr.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Co(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function To(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Mo(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var So={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:"'"},Eo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},No="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Oo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Do=0;Do<10;Do++)So[48+Do]=So[96+Do]=String(Do);for(Do=1;Do<=24;Do++)So[Do+111]="F"+Do;for(Do=65;Do<=90;Do++)So[Do]=String.fromCharCode(Do+32),Eo[Do]=String.fromCharCode(Do);for(var Ao in So)Eo.hasOwnProperty(Ao)||(Eo[Ao]=So[Ao]);const Lo="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Io(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Lo?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function Ro(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Po(e){return new pt({props:{handleKeyDown:Bo(e)}})}function Bo(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Io(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(No&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Oo&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Eo:So)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[Ro(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[Ro(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=So[n.keyCode])&&r!=o){let o=t[Ro(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}const Fo=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ho(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function zo(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}const qo=(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let o=Vo(r);if(!o)return!1;let i=o.nodeAfter;if(Jo(e,o,t))return!0;if(0==r.parent.content.size&&(Ho(i,"start")||Ye.isSelectable(i))){let n=Le(e.doc,r.before(),r.after(),h.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ho(i,"start")?Je.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Ye.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))};function Vo(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const jo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function $o(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const _o=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=$o(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Je.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0};var Uo;const Wo=(e,t)=>(t&&t(e.tr.setSelection(new tt(e.doc))),!0);function Jo(e,t,n){let r,o,i=t.nodeBefore,s=t.nodeAfter;if(i.type.spec.isolating||s.type.spec.isolating)return!1;if(function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Ae(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let l=t.parent.canReplace(t.index(),t.index()+1);if(l&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&o.matchType(r[0]||s.type).validEnd){if(n){let o=t.pos+s.nodeSize,l=a.empty;for(let e=r.length-1;e>=0;e--)l=a.from(r[e].create(null,l));l=a.from(i.copy(l));let c=e.tr.step(new Me(t.pos-1,o,t.pos,o,new h(l,1,0),r.length,!0)),u=o+2*r.length;Ae(c.doc,u)&&c.join(u),n(c.scrollIntoView())}return!0}let c=Je.findFrom(t,1),u=c&&c.$from.blockRange(c.$to),d=u&&Ne(u);if(null!=d&&d>=t.depth)return n&&n(e.tr.lift(u,d).scrollIntoView()),!0;if(l&&Ho(s,"start",!0)&&Ho(i,"end")){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let l=s,c=1;for(;!l.isTextblock;l=l.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,l.content)){if(n){let r=a.empty;for(let e=o.length-1;e>=0;e--)r=a.from(o[e].copy(r));n(e.tr.step(new Me(t.pos-o.length,t.pos+s.nodeSize,t.pos+c,t.pos+s.nodeSize-c,new h(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Ko(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Ze.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Go=Ko(-1),Xo=Ko(1);function Zo(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Qo(e,t=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,(e=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o=!1,i=n.tr;for(let t=0;!o&&t<s.length;t++){let{$from:r,$to:i}=s[t];o=n.doc.rangeHasMark(r.pos,i.pos,e)}for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(o)i.removeMark(r.pos,a.pos,e);else{let n=r.pos,o=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,u=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<o&&(n+=c,o-=u),i.addMark(n,o,e.create(t))}}r(i.scrollIntoView())}return!0}}function Yo(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let ei=Yo(Fo,((e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!r)return!1;let o=zo(r);if(!o){let n=r.blockRange(),o=n&&Ne(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&Jo(e,o,t))return!0;if(0==r.parent.content.size&&(Ho(i,"end")||Ye.isSelectable(i))){let n=Le(e.doc,r.before(),r.after(),h.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ho(i,"end")?Je.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):Ye.create(r.doc,o.pos-i.nodeSize)),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=zo(r)}let s=i&&i.nodeBefore;return!(!s||!Ye.isSelectable(s)||(t&&t(e.tr.setSelection(Ye.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))})),ti=Yo(Fo,qo,((e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Vo(r)}let s=i&&i.nodeAfter;return!(!s||!Ye.isSelectable(s)||(t&&t(e.tr.setSelection(Ye.create(e.doc,i.pos)).scrollIntoView()),0))}));const ni={Enter:Yo(jo,((e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof tt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=$o(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Ze.create(s.doc,n+1)),t(s.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(De(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ne(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Ye&&e.selection.node.isBlock)return!(!n.parentOffset||!De(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(t){let o=r.parentOffset==r.parent.content.size,i=e.tr;(e.selection instanceof Ze||e.selection instanceof tt)&&i.deleteSelection();let s=0==n.depth?null:$o(n.node(-1).contentMatchAt(n.indexAfter(-1))),a=Uo?[Uo]:o&&s?[{type:s}]:void 0,l=De(i.doc,i.mapping.map(n.pos),1,a);if(a||l||!De(i.doc,i.mapping.map(n.pos),1,s?[{type:s}]:void 0)||(s&&(a=[{type:s}]),l=!0),l&&(i.split(i.mapping.map(n.pos),1,a),!o&&!n.parentOffset&&n.parent.type!=s)){let e=i.mapping.map(n.before()),t=i.doc.resolve(e);s&&n.node(-1).canReplaceWith(t.index(),t.index()+1,s)&&i.setNodeMarkup(i.mapping.map(n.before()),s)}t(i.scrollIntoView())}return!0})),"Mod-Enter":_o,Backspace:ei,"Mod-Backspace":ei,"Shift-Backspace":ei,Delete:ti,"Mod-Delete":ti,"Mod-a":Wo},ri={"Ctrl-h":ni.Backspace,"Alt-Backspace":ni["Mod-Backspace"],"Ctrl-d":ni.Delete,"Ctrl-Alt-Backspace":ni["Mod-Delete"],"Alt-Delete":ni["Mod-Delete"],"Alt-d":ni["Mod-Delete"],"Ctrl-a":Go,"Ctrl-e":Xo};for(let e in ni)ri[e]=ni[e];const oi=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?ri:ni;class ii{constructor(e,t,n={}){var r;this.match=e,this.match=e,this.handler="string"==typeof t?(r=t,function(e,t,n,o){let i=r;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let r=(n+=e)-o;r>0&&(i=t[0].slice(e-r,e)+i,n=o)}return e.tr.insertText(i,n,o)}):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1}}const si=500;function ai({rules:e}){let t=new pt({state:{init:()=>null,apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>li(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>{setTimeout((()=>{let{$cursor:r}=n.state.selection;r&&li(n,r.pos,r.pos,"",e,t)}))}}},isInputRules:!0});return t}function li(e,t,n,r,o,i){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t),l=a.parent.textBetween(Math.max(0,a.parentOffset-si),a.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(a.parent.type.spec.code){if(!u.inCode)continue}else if("only"===u.inCode)continue;let d=u.match.exec(l),p=d&&u.handler(s,d,t-(d[0].length-r.length),n);if(p)return u.undoable&&p.setMeta(i,{transform:p,from:t,to:n,text:r}),e.dispatch(p),!0}return!1}const ci=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};new ii(/--$/,"—"),new ii(/\.\.\.$/,"…"),new ii(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new ii(/"$/,"”"),new ii(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new ii(/'$/,"’");var ui=200,di=function(){};di.prototype.append=function(e){return e.length?(e=di.from(e),!this.length&&e||e.length<ui&&this.leafAppend(e)||this.length<ui&&e.leafPrepend(this)||this.appendInner(e)):this},di.prototype.prepend=function(e){return e.length?di.from(e).append(this):this},di.prototype.appendInner=function(e){return new hi(this,e)},di.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?di.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},di.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},di.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},di.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},di.from=function(e){return e instanceof di?e:e&&e.length?new pi(e):di.empty};var pi=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=ui)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=ui)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(di);di.empty=new pi([]);var hi=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(di);const fi=di;class mi{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new gi(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new gi(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new mi(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),u=new gi(e.mapping.maps[n],c,t);(l=a&&a.merge(u))&&(u=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>yi&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,l),i-=l),new mi(s.append(o),i)}remapping(e,t){let n=new me;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new mi(this.items.append(e.map((e=>new gi(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let a=t;this.items.forEach((t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new gi(l,i,c))}else n.push(new gi(l))}),r);let l=[];for(let e=t;e<i;e++)l.push(new gi(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),u=new mi(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new gi(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new mi(fi.from(r.reverse()),o)}}mi.empty=new mi(fi.empty,0);class gi{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new gi(t.getMap().invert(),t,this.selection)}}}class vi{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const yi=20;function bi(e){let t=[];return e.forEach(((e,n,r,o)=>t.push(r,o))),t}function wi(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let ki=!1,xi=null;function Ci(e){let t=e.plugins;if(xi!=t){ki=!1,xi=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ki=!0;break}}return ki}const Ti=new mt("history"),Mi=new mt("closeHistory");function Si(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new pt({key:Ti,state:{init:()=>new vi(mi.empty,mi.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Ti);if(i)return i.historyState;n.getMeta(Mi)&&(e=new vi(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Ti))return s.getMeta(Ti).redo?new vi(e.done.addTransform(n,void 0,r,Ci(t)),e.undone,bi(n.mapping.maps[n.steps.length-1]),e.prevTime,e.prevComposition):new vi(e.done,e.undone.addTransform(n,void 0,r,Ci(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new vi(e.done.rebased(n,o),e.undone.rebased(n,o),wi(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new vi(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),wi(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),a=s?wi(e.prevRanges,n.mapping):bi(n.mapping.maps[n.steps.length-1]);return new vi(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Ci(t)),mi.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Ni:"historyRedo"==n?Oi:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Ei(e,t){return(n,r)=>{let o=Ti.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Ci(t),o=Ti.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new vi(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ti,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Ni=Ei(!1,!0),Oi=Ei(!0,!0);Ei(!1,!1),Ei(!0,!1);var Di=function(e,t){return Di=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Di(e,t)};function Ai(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Di(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Li=function(){return Li=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Li.apply(this,arguments)};function Ii(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Ri(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Pi=function(e,t,n){var r;for(r in n=n||null,e)if(e.hasOwnProperty(r)&&!1===t.call(n,e[r],r,e))break},Bi=function(e,t){var n,r,o,i,s=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o<i;o+=1)for(r in n=arguments[o])s.call(n,r)&&(e[r]=n[r]);return e},Fi=function(e){return"string"==typeof e||e instanceof String},Hi=function(e){return e instanceof Array},zi=function(e,t,n){var r=0,o=e.length;for(n=n||null;r<o&&!1!==t.call(n,e[r],r,e);r+=1);},qi=Hi,Vi=zi,ji=Pi,$i=function(e,t,n){qi(e)?Vi(e,t,n):ji(e,t,n)},_i=Fi,Ui=$i,Wi=function(e,t,n){var r=e.style;_i(t)?r[t]=n:Ui(t,(function(e,t){r[t]=e}))},Ji=Hi,Ki=function(e,t,n){var r,o;if(n=n||0,!Ji(t))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e,n);for(o=t.length,r=n;n>=0&&r<o;r+=1)if(t[r]===e)return r;return-1},Gi=function(e){return void 0===e},Xi=Gi,Zi=function(e){return e&&e.className?Xi(e.className.baseVal)?e.className:e.className.baseVal:""},Qi=Hi,Yi=Gi,es=function(e,t){t=(t=Qi(t)?t.join(" "):t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),Yi(e.className.baseVal)?e.className=t:e.className.baseVal=t},ts=$i,ns=Ki,rs=Zi,is=es,ss=function(e){var t,n=Array.prototype.slice.call(arguments,1),r=e.classList,o=[];r?ts(n,(function(t){e.classList.add(t)})):((t=rs(e))&&(n=[].concat(t.split(/\s+/),n)),ts(n,(function(e){ns(e,o)<0&&o.push(e)})),is(e,o))},as=zi,ls=Ki,cs=Zi,us=es,ds=function(e){var t,n,r=Array.prototype.slice.call(arguments,1),o=e.classList;o?as(r,(function(e){o.remove(e)})):(t=cs(e).split(/\s+/),n=[],as(t,(function(e){ls(e,r)<0&&n.push(e)})),us(e,n))},ps=function(e){return"number"==typeof e||e instanceof Number},hs=function(e){return null===e},fs=Pi,ms=Gi,gs=function(e,t){var n=location.hostname,r="TOAST UI "+e+" for "+n+": Statistics",o=window.localStorage.getItem(r);(ms(window.tui)||!1!==window.tui.usageStatistics)&&(o&&!function(e){return(new Date).getTime()-e>6048e5}(o)||(window.localStorage.setItem(r,(new Date).getTime()),setTimeout((function(){var r,o,i,s;"interactive"!==document.readyState&&"complete"!==document.readyState||(r="https://www.google-analytics.com/collect",o={v:1,t:"event",tid:t,cid:n,dp:n,dh:e,el:e,ec:"use"},i=document.createElement("img"),s="",fs(o,(function(e,t){s+="&"+t+"="+e})),s=s.substring(1),i.src=r+"?"+s,i.style.display="none",document.body.appendChild(i),document.body.removeChild(i))}),1e3)))};/Mac/.test(navigator.platform);var vs=/[\u0020]+/g,ys=/[>(){}[\]+-.!#|]/g,bs=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,ws=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,ks=/[*_~`]/g,xs=/!\[.*\]\(.*\)/g,Cs=/[[\]]/g,Ts=/(?:^|[^\\])\\(?!\\)/g,Ms=new RegExp('[&<>"]',"g");function Ss(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return e}}function Es(e){return Ms.test(e)?e.replace(Ms,Ss):e}function Ns(e,t){return-1!==e.indexOf(t)}var Os=["rel","target","hreflang","type"],Ds={codeblock:/(^ {4}[^\n]+\n*)+/,thematicBreak:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,atxHeading:/^(#{1,6}) +[\s\S]+/,seTextheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,fencedCodeblock:/^((`|~){3,})/};function As(e){if(!e)return null;var t={};return Os.forEach((function(n){Gi(e[n])||(t[n]=e[n])})),t}function Ls(e,t){for(var n="",r=0;r<t;r+=1)n+=e;return n}function Is(e){for(var t=[],n=xs.exec(e);n;)t.push([n.index,n.index+n[0].length]),n=xs.exec(e);return e.replace(Cs,(function(e,n){return t.some((function(e){return n>e[0]&&n<e[1]}))?e:"\\"+e}))}function Rs(e){var t=function(e){return"\\"+e},n=e.replace(vs," ");return ws.test(n)&&(n=n.replace(ws,t)),Ts.test(n)&&(n=n.replace(Ts,(function(e){return e+"\\"}))),n=n.replace(ks,t),bs.test(n)&&(n=n.replace(bs,t)),function(e){var t=!1;return Pi(Ds,(function(n){return n.test(e)&&(t=!0),!t})),t}(n)&&(n=n.replace(ys,t)),n}function Ps(e){return hs(e)||Gi(e)}function Bs(e,t){if(null===e&&e===t)return!0;if("object"!=typeof e||"object"!=typeof t||Ps(e)||Ps(t))return e===t;for(var n in e)if(e[n]!==t[n])return!1;for(var n in t)if(!(n in e))return!1;return!0}function Fs(e){return e[e.length-1]}function Hs(e){return"object"==typeof e&&null!==e}function zs(e,t){var n=Li({},e);return e&&t&&Object.keys(t).forEach((function(e){Hs(n[e])?Array.isArray(t[e])?n[e]=qs(t[e]):n.hasOwnProperty(e)?n[e]=zs(n[e],t[e]):n[e]=Vs(t[e]):n[e]=t[e]})),n}function qs(e){return e.map((function(e){return Hs(e)?Array.isArray(e)?qs(e):Vs(e):e}))}function Vs(e){var t=Object.keys(e);return t.length?t.reduce((function(t,n){return Hs(e[n])?t[n]=Array.isArray(e[n])?qs(e[n]):Vs(e[n]):t[n]=e[n],t}),{}):e}function js(e,t){return void 0===t&&(t={}),Object.keys(t).forEach((function(n){e.hasOwnProperty(n)&&"object"==typeof e[n]?Array.isArray(t[n])?e[n]=t[n]:js(e[n],t[n]):e[n]=t[n]})),e}function $s(e,t){return e>t?[t,e]:[e,t]}var _s=zi,Us=function(e){var t;try{t=Array.prototype.slice.call(e)}catch(n){t=[],_s(e,(function(e){t.push(e)}))}return t};function Ws(e,t){var n=e.nodes.paragraph;return t?n.create(null,Fi(t)?e.text(t):t):n.createAndFill()}function Js(e,t,n){return e.text(t,n)}function Ks(e,t,n){void 0===n&&(n=t);var r=e.doc.content.size,o=r>0?r-1:1;return Ze.create(e.doc,Math.min(t,o),Math.min(n,o))}function Gs(e,t,n){var r=t.pos;return e.replaceWith(r,r,Ws(n)),e.setSelection(Ks(e,r+1))}function Xs(e){for(var t=e.state,n=e.from,r=e.startIndex,o=e.endIndex,i=e.createText,s=t.tr,l=t.doc,c=t.schema,u=r;u<=o;u+=1){var d=l.child(u),p=d.nodeSize,h=d.textContent,f=d.content,m=i(h),g=m?Js(c,m):a.empty,v=s.mapping.map(n),y=v+f.size;s.replaceWith(v,y,g),n+=p}return s}function Zs(e,t,n,r){var o=n.length;e.split(t).delete(t-o,t).insert(e.mapping.map(t),r).setSelection(Ks(e,e.mapping.map(t)-o))}function Qs(e){return e.sourcepos[0][0]}function Ys(e){return e.sourcepos[1][0]}function ea(e){return e.sourcepos[0][1]}function ta(e){return e.sourcepos[1][1]}function na(e){var t=e.type;return"strike"===t||"strong"===t||"emph"===t||"code"===t||"link"===t||"image"===t}function ra(e){return e&&("item"===e.type||"list"===e.type)}function oa(e){return ra(e)&&"ordered"===e.listData.type}function ia(e){return ra(e)&&"ordered"!==e.listData.type}function sa(e){return e&&("tableCell"===e.type||"tableDelimCell"===e.type)}function aa(e,t,n){for(void 0===n&&(n=!0),e=n?e:e.parent;e&&"document"!==e.type;){if(t(e))return e;e=e.parent}return null}function la(e,t){return[e[0],e[1]+t]}function ca(e,t){return[e[0],t]}function ua(e){var t=e.firstChild.literal;switch(e.type){case"emph":return"*"+t+"*";case"strong":return"**"+t+"**";case"strike":return"~~"+t+"~~";case"code":return"`"+t+"`";case"link":case"image":var n=e,r=n.destination,o=n.title;return("link"===e.type?"":"!")+"["+t+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function da(e){switch(e.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}function pa(e){for(var t=[],n=e.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&t.push(o.literal)}return t.join("")}var ha=[],fa={},ma=/\$\$widget\d+\s/;function ga(e){var t=e.search(ma);if(-1!==t){var n=e.substring(t).replace(ma,"").replace("$$","");e=e.substring(0,t),e+=ga(n)}return e}function va(e,t){return"$$"+e+" "+t+"$$"}function ya(e,t){var n=fa[e],r=n.rule,o=n.toDOM,i=ga(t).match(r);return i&&(t=i[0]),o(t)}function ba(e){(ha=e).forEach((function(e,t){fa["widget"+t]=e}))}function wa(e,t,n,r){return e.concat(ka(t,n,r))}function ka(e,t,n){void 0===n&&(n=0);var r=[],o=(ha[n]||{}).rule,i=n+1;if(e=ga(e),o&&o.test(e)){for(var s=void 0;-1!==(s=e.search(o));){var a=e.substring(0,s);a&&(r=wa(r,a,t,i));var l=(e=e.substring(s)).match(o)[0],c="widget"+n;r.push(t.nodes.widget.create({info:c},t.text(va(c,l)))),e=e.substring(l.length)}e&&(r=wa(r,e,t,i))}else e&&(r=n<ha.length-1?wa(r,e,t,i):[t.text(e)]);return r}function xa(e){for(var t,n="",r=e.walker();t=r.next();){var o=t.node;t.entering&&(o!==e&&"text"!==o.type?(n+=ua(o),r.resumeAt(e,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}function Ca(){return{deleteSelection:function(){return Fo},selectAll:function(){return Wo},undo:function(){return Ni},redo:function(){return Oi}}}var Ta=Ki,Ma=Zi,Sa=function(e,t){var n;return e.classList?e.classList.contains(t):(n=Ma(e).split(/\s+/),Ta(t,n)>-1)},Ea=Ki,Na=Us,Oa=Element.prototype,Da=Oa.matches||Oa.webkitMatchesSelector||Oa.mozMatchesSelector||Oa.msMatchesSelector||function(e){var t=this.document||this.ownerDocument;return Ea(this,Na(t.querySelectorAll(e)))>-1},Aa=function(e,t){return Da.call(e,t)},La="[A-Za-z][A-Za-z0-9-]*",Ia="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ra="<("+La+")("+Ia+")*\\s*/?>",Pa="(?:"+Ra+"|</("+La+")\\s*[>])",Ba=new RegExp("^"+Pa,"i"),Fa=/<br\s*\/*>/i,Ha=/<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,za="</p><p>";function qa(e,t,n){var r=parseInt(e.left,10),o=parseInt(e.top,10),i=parseInt(e.width,10)+parseInt(e.paddingLeft,10)+parseInt(e.paddingRight,10),s=parseInt(e.height,10)+parseInt(e.paddingTop,10)+parseInt(e.paddingBottom,10);return t>=r&&t<=r+i&&n>=o&&n<=o+s}var Va="toastui-editor-";function ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],r=0,o=e;r<o.length;r++){var i,s=o[r];(i=Array.isArray(s)?s[0]?s[1]:null:s)&&n.push(""+Va+i)}return n.join(" ")}function $a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.map((function(e){return Va+"md-"+e})).join(" ")}function _a(e){return e&&e.nodeType===Node.ELEMENT_NODE}function Ua(e){e.parentNode&&e.parentNode.removeChild(e)}function Wa(e,t,n){Gi(n)&&(n=!Sa(e,t)),(n?ss:ds)(e,t)}function Ja(e,t){var n=document.createElement("div");Fi(e)?n.innerHTML=e:n.appendChild(e);var r=n.firstChild;return t&&t.appendChild(r),r}function Ka(e){var t=window.getComputedStyle(e);return["margin-left","margin-right"].reduce((function(e,n){return e+parseInt(t.getPropertyValue(n),10)}),0)+e.offsetWidth}function Ga(e,t){var n;for(n=Fi(t)?function(e){return Aa(e,t)}:function(e){return e===t};e&&e!==document;){if(_a(e)&&n(e))return e;e=e.parentNode}return null}function Xa(e,t){for(var n=0,r=0;e&&e!==t&&(n+=e.offsetTop,r+=e.offsetLeft,e.offsetParent!==t.offsetParent);)e=e.offsetParent;return{offsetTop:n,offsetLeft:r}}function Za(e,t){Object.keys(e).forEach((function(n){Ps(e[n])?t.removeAttribute(n):t.setAttribute(n,e[n])}))}function Qa(e){var t=e;return(t=t.replace(/<img class="ProseMirror-separator" alt="">/g,"")).replace(/ class="ProseMirror-trailingBreak"/g,"")}var Ya=new mt("widget"),el=function(){function e(e,t){var n=this;this.popup=null,this.removeWidget=function(){n.popup&&(n.rootEl.removeChild(n.popup),n.popup=null)},this.rootEl=e.dom.parentElement,this.eventEmitter=t,this.eventEmitter.listen("blur",this.removeWidget),this.eventEmitter.listen("loadUI",(function(){n.rootEl=Ga(e.dom.parentElement,"."+ja("defaultUI"))})),this.eventEmitter.listen("removePopupWidget",this.removeWidget)}return e.prototype.update=function(e){var t=Ya.getState(e.state);if(this.removeWidget(),t){var n=t.node,r=t.style,o=e.coordsAtPos(t.pos),i=o.top,s=o.left,a=o.bottom-i,l=this.rootEl.getBoundingClientRect(),c=i-l.top;Wi(n,{opacity:"0"}),this.rootEl.appendChild(n),Wi(n,{position:"absolute",left:s-l.left+5+"px",top:("bottom"===r?c+a-5:c-a)+"px",opacity:"1"}),this.popup=n,e.focus()}},e.prototype.destroy=function(){this.eventEmitter.removeEventHandler("blur",this.removeWidget)},e}();function tl(e,t,n){e.emit("addImageBlobHook",t,(function(n,r){e.emit("command","addImage",{imageUrl:n,altText:r||t.name||"image"})}),n)}function nl(e){var t=Us(e).filter((function(e){return-1!==e.type.indexOf("image")}));if(1===t.length){var n=t[0];if(n)return n.getAsFile()}return null}function rl(e){var t=e.eventEmitter;return new pt({props:{handleDOMEvents:{drop:function(e,n){var r,o=null===(r=n.dataTransfer)||void 0===r?void 0:r.files;return o&&zi(o,(function(e){return-1===e.type.indexOf("image")||(n.preventDefault(),n.stopPropagation(),tl(t,e,n.type),!1)})),!0}}}})}var ol=function(){function e(){}return Object.defineProperty(e.prototype,"type",{get:function(){return"node"},enumerable:!1,configurable:!0}),e.prototype.setContext=function(e){this.context=e},e}();function il(e){var t=document.createElement("span"),n=ya(e.attrs.info,e.textContent);return t.className="tui-widget",t.appendChild(n),{dom:t}}function sl(e){return"widget"===e.type.name}var al=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"widget"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{info:{default:null}},group:"inline",inline:!0,content:"text*",selectable:!1,atom:!0,toDOM:function(){return["span",{class:"tui-widget"},0]},parseDOM:[{tag:"span.tui-widget",getAttrs:function(e){return{info:e.textContent.match(/\$\$(widget\d+)/)[1]}}}]}},enumerable:!1,configurable:!0}),t}(ol),ll=function(){function e(e){this.timer=null,this.el=document.createElement("div"),this.el.className="toastui-editor",this.eventEmitter=e,this.placeholder={text:""}}return e.prototype.createState=function(){return ut.create({schema:this.schema,plugins:this.createPlugins()})},e.prototype.initEvent=function(){var e=this,t=e.eventEmitter,n=e.view,r=e.editorType;n.dom.addEventListener("focus",(function(){return t.emit("focus",r)})),n.dom.addEventListener("blur",(function(){return t.emit("blur",r)}))},e.prototype.emitChangeEvent=function(e){this.eventEmitter.emit("caretChange",this.editorType),e.docChanged&&this.eventEmitter.emit("change",this.editorType)},Object.defineProperty(e.prototype,"defaultPlugins",{get:function(){var e,t,n=this.createInputRules(),r=Ii(Ii([],this.keymaps),[Po(Li({"Shift-Enter":oi.Enter},oi)),Si(),(t=this.placeholder,new pt({props:{decorations:function(e){var n=e.doc;if(t.text&&1===n.childCount&&n.firstChild.isTextblock&&0===n.firstChild.content.size){var r=document.createElement("span");return ss(r,"placeholder"),t.className&&ss(r,t.className),r.textContent=t.text,Xr.create(n,[Jr.widget(1,r)])}return null}}})),(e=this.eventEmitter,new pt({key:Ya,state:{init:function(){return null},apply:function(e){return e.getMeta("widget")}},view:function(t){return new el(t,e)}})),rl(this.context)]);return n?r.concat(n):r},enumerable:!1,configurable:!0}),e.prototype.createInputRules=function(){var e=ha.map((function(e){var t=e.rule;return new ii(t,(function(e,n,r,o){var i=e.schema,s=e.tr,a=e.doc,l=n.input.match(new RegExp(t,"g")),c=a.resolve(r),u=c.parent,d=0;if(sl(u)&&(u=c.node(c.depth-1)),u.forEach((function(e){return sl(e)&&(d+=1)})),l.length>d){var p=Fs(l),h=ka(p,i);return s.replaceWith(o-p.length+1,o,h)}return null}))}));return e.length?ai({rules:e}):null},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.createSchema=function(){return new G({nodes:this.specs.nodes,marks:this.specs.marks})},e.prototype.createKeymaps=function(e){var t=Ca(),n=t.undo,r=t.redo,o=this.specs.keymaps(e),i={"Mod-z":n(),"Shift-Mod-z":r()};return e?o.concat(Po(i)):o},e.prototype.createCommands=function(){return this.specs.commands(this.view)},e.prototype.createPluginProps=function(){var e=this;return this.extraPlugins.map((function(t){return t(e.eventEmitter)}))},e.prototype.focus=function(){var e=this;this.clearTimer(),this.timer=setTimeout((function(){e.view.focus(),e.view.dispatch(e.view.state.tr.scrollIntoView())}))},e.prototype.blur=function(){this.view.dom.blur()},e.prototype.destroy=function(){var e=this;this.clearTimer(),this.view.destroy(),Object.keys(this).forEach((function(t){delete e[t]}))},e.prototype.moveCursorToStart=function(e){var t=this.view.state.tr;this.view.dispatch(t.setSelection(Ks(t,1)).scrollIntoView()),e&&this.focus()},e.prototype.moveCursorToEnd=function(e){var t=this.view.state.tr;this.view.dispatch(t.setSelection(Ks(t,t.doc.content.size-1)).scrollIntoView()),e&&this.focus()},e.prototype.setScrollTop=function(e){this.view.dom.scrollTop=e},e.prototype.getScrollTop=function(){return this.view.dom.scrollTop},e.prototype.setPlaceholder=function(e){this.placeholder.text=e,this.view.dispatch(this.view.state.tr.scrollIntoView())},e.prototype.setHeight=function(e){Wi(this.el,{height:e+"px"})},e.prototype.setMinHeight=function(e){Wi(this.el,{minHeight:e+"px"})},e.prototype.getElement=function(){return this.el},e}(),cl=function(e){return e instanceof Function},ul=["Enter","Shift-Enter","Mod-Enter","Tab","Shift-Tab","Delete","Backspace","Mod-Delete","Mod-Backspace","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Mod-d","Mod-D","Alt-ArrowUp","Alt-ArrowDown"];function dl(e,t,n){return e.focus(),t(n)(e.state,e.dispatch,e)}var pl=function(){function e(e){this.specs=e}return Object.defineProperty(e.prototype,"nodes",{get:function(){return this.specs.filter((function(e){return"node"===e.type})).reduce((function(e,t){var n,r=t.name,o=t.schema;return Li(Li({},e),((n={})[r]=o,n))}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marks",{get:function(){return this.specs.filter((function(e){return"mark"===e.type})).reduce((function(e,t){var n,r=t.name,o=t.schema;return Li(Li({},e),((n={})[r]=o,n))}),{})},enumerable:!1,configurable:!0}),e.prototype.commands=function(e,t){var n=this.specs.filter((function(e){return e.commands})).reduce((function(t,n){var r={},o=n.commands();return cl(o)?r[n.name]=function(t){return dl(e,o,t)}:Object.keys(o).forEach((function(t){r[t]=function(n){return dl(e,o[t],n)}})),Li(Li({},t),r)}),{}),r=Ca();return Object.keys(r).forEach((function(t){n[t]=function(n){return dl(e,r[t],n)}})),t&&Object.keys(t).forEach((function(r){n[r]=function(n){return dl(e,t[r],n)}})),n},e.prototype.keymaps=function(e){return this.specs.filter((function(e){return e.keymaps})).map((function(e){return e.keymaps()})).map((function(t){return e||Object.keys(t).forEach((function(e){Ns(ul,e)||delete t[e]})),Po(t)}))},e.prototype.setContext=function(e){this.specs.forEach((function(t){t.setContext(e)}))},e}();function hl(e){var t=e.from,n=e.to;return e instanceof tt?[t+1,n-1]:[t,n]}function fl(e){return e.index(0)+1}function ml(e,t,n){void 0===n&&(n=1);var r=0;return e.forEach((function(e,o){sl(e)&&o+2<t&&(r+=2*n)})),r}function gl(e,t,n){void 0===n&&(n=t);var r=t===n,o=e.resolve(t),i=fl(o),s=i,a=o.start(1),l=a;if(!r){var c=e.resolve(n===e.content.size?n-1:n);l=c.start(1),s=fl(c),c.pos===e.content.size&&(n=e.content.size-2)}var u=Math.max(t-a+1,1),d=Math.max(n-l+1,1);return[[i,u+ml(e.child(i-1),u,-1)],[s,d+ml(e.child(s-1),d,-1)]]}function vl(e,t){for(var n=[],r=0,o=0;r<t;r+=1){var i=e.child(r);n[r]=o,o+=i.nodeSize}return n}function yl(e,t,n){var r=vl(e,n[0]),o=t[0]-1,i=n[0]-1,s=e.child(o),a=e.child(i),l=r[o],c=r[i];return l+=t[1]+ml(s,t[1]-1),c+=n[1]+ml(a,n[1]-1),[l,Math.min(c,e.content.size)]}function bl(e){var t=e.$from,n=e.$to,r=e.from,o=e.to,i=t.doc;return e instanceof tt&&(t=i.resolve(r+1),n=i.resolve(o-1)),0===t.depth&&(n=t=i.resolve(r-1)),{startFromOffset:t.start(1),endFromOffset:n.start(1),startToOffset:t.end(1),endToOffset:n.end(1),startIndex:t.index(0),endIndex:n.index(0),from:t.pos,to:n.pos}}function wl(e,t){for(var n=1,r=1,o=0,i=0;o<e.childCount;o+=1){var s=e.child(o).nodeSize;if(n=i+1,r=i+s-1,o===t)break;i+=s}return{startOffset:n,endOffset:r}}var kl="heading",xl="link",Cl="code",Tl="meta",Ml="delimiter",Sl="markedText",El={strong:2,emph:1,strike:2};function Nl(e,t,n,r){return{start:e,end:t,spec:{type:n,attrs:r}}}function Ol(e,t,n){var r=e.type,o=la(t,El[r]),i=la(n,-El[r]);return[Nl(o,i,r),Nl(t,o,Ml),Nl(i,n,Ml)]}function Dl(e,t,n,r){return[Nl(e,t,xl),Nl(ca(e,n[1]+1),ca(t,r),xl,{desc:!0}),Nl(ca(t,r+2),la(t,-1),xl,{url:!0})]}function Al(e,t,n,r){var o={start:t,end:n,spec:{attrs:{className:r+"-line-background",codeStart:t[0],codeEnd:n[0]}},lineBackground:!0};return"item"!==e.type&&"blockQuote"!==e.type?[Li(Li({},o),{end:t,spec:{attrs:{className:r+"-line-background start"}}}),Li(Li({},o),{start:[Math.min(t[0]+1,n[0]),t[1]]})]:null}function Ll(e,t){for(var n=[];e;){var r=e.type;"paragraph"!==r&&"codeBlock"!==r||n.push(Nl([Qs(e),ea(e)-1],[Ys(e),ta(e)+1],t)),e=e.next}return n}var Il={heading:function(e,t,n){var r=e.level,o=e.headingType,i=[Nl(t,n,kl,{level:r})];return"atx"===o?i.push(Nl(t,la(t,r),Ml)):i.push(Nl(ca(n,0),n,kl,{seText:!0})),i},strong:Ol,emph:Ol,strike:Ol,link:function(e,t,n){var r=e.lastChild,o=e.extendedAutolink,i=r?ta(r)+1:2;return o?[Nl(t,n,xl,{desc:!0})]:Dl(t,n,t,i)},image:function(e,t,n){var r=e.lastChild,o=r?ta(r)+1:3,i=la(t,1);return Ii([Nl(t,i,Tl)],Dl(t,n,i,o))},code:function(e,t,n){var r=e.tickCount,o=la(t,r),i=la(n,-r);return[Nl(t,n,Cl),Nl(t,o,Cl,{start:!0}),Nl(o,i,Cl,{marked:!0}),Nl(i,n,Cl,{end:!0})]},codeBlock:function(e,t,n,r){var o=e.fenceOffset,i=e.fenceLength,s=e.fenceChar,a=e.info,l=e.infoPadding,c=e.parent,u=o+i,d=[Nl(ca(t,1),n,"codeBlock")];s&&d.push(Nl(t,la(t,u),Ml)),a&&d.push(Nl(la(t,i),la(t,i+l+a.length),Tl)),new RegExp("^(\\s{0,4})("+s+"{"+i+",})").test(r)&&d.push(Nl(ca(n,1),n,Ml));var p=Al(c,t,n,"code-block");return p?d.concat(p):d},blockQuote:function(e,t,n){var r=e.parent&&"blockQuote"!==e.parent.type?[Nl(t,n,"blockQuote")]:[];if(e.firstChild){var o=[];"paragraph"===e.firstChild.type?o=function(e){for(var t=[];e;)t.push(Nl([Qs(e),ea(e)],[Ys(e),ta(e)+1],Sl)),e=e.next;return t}(e.firstChild.firstChild):"list"===e.firstChild.type&&(o=Ll(e.firstChild,Sl)),r=Ii(Ii([],r),o)}return r},item:function(e,t){var n=e.listData,r=n.padding,o=n.task,i=function(e){for(var t=0;e.parent.parent&&"item"===e.parent.parent.type;)e=e.parent.parent,t+=1;return["listItem",Li(Li({},[{odd:!0},{even:!0}][t%2]),{listStyle:!0})]}(e),s=[Nl.apply(void 0,Ii([t,la(t,r)],i))];return o&&(s.push(Nl(la(t,r),la(t,r+3),"taskDelimiter")),s.push(Nl(la(t,r+1),la(t,r+2),Tl))),s.concat(Ll(e.firstChild,Sl))},customBlock:function(e,t,n){var r=e,o=r.offset,i=r.syntaxLength,s=r.info,a=r.parent,l=o+i,c=[Nl(ca(t,1),n,"customBlock")];c.push(Nl(t,la(t,l),Ml)),s&&c.push(Nl(la(t,l),la(t,i+s.length),Tl)),c.push(Nl(ca(n,1),n,Ml));var u=Al(a,t,n,"custom-block");return u?c.concat(u):c}},Rl={thematicBreak:"thematicBreak",table:"table",tableCell:"tableCell",htmlInline:"html"};function Pl(e,t,n,r){var o=e.type;return cl(Il[o])?Il[o](e,t,n,r):Rl[o]?[Nl(t,n,Rl[o])]:null}var Bl={};function Fl(e){var t=e.schema,n=e.toastMark;return new pt({appendTransaction:function(e,r,o){var i=e[0],s=o.tr;if(i.docChanged){var a=[];i.getMeta("editResult").forEach((function(e){var t=e.nodes,r=e.removedNodeRange;if(t.length){a=a.concat(function(e,t){var n=e.doc,r=t[0].sourcepos[0],o=Fs(t).sourcepos[1],i=[r[0],r[1]],s=[o[0],o[1]+1],a=[];return function(e,t,n){var r=[];Bl={};for(var o=t[0]-1;o<n[0];o+=1){var i=e.child(o),s=i.attrs.codeEnd,a=i.attrs.codeStart;if(a&&s&&!Ns(r,a)){r.push(a),s=Math.min(s,e.childCount);for(var l=a-1,c=n[0],u=l;u<c;u+=1)Bl[u]=!0}}}(n,r,o),a.push({start:i,end:s}),a}(s,t));for(var o=0,i=t;o<i.length;o++)for(var l=i[o].walker(),c=l.next();c;){var u=c.node;c.entering&&(a=a.concat(zl(u,n))),c=l.next()}}else if(r)for(var d=s.doc.childCount-1,p=r.line,h=p[0],f=p[1],m=Math.min(h,d),g=Math.min(f,d),v=m;v<=g;v+=1)Bl[v]=!0})),function(e,t,n){var r=e.doc,o=t.nodes.paragraph,i=vl(r,r.childCount);n.forEach((function(n){var s=n.start,a=n.end,l=n.spec,c=n.lineBackground,u=Math.min(s[0],r.childCount)-1,d=Math.min(a[0],r.childCount)-1,p=r.child(u),h=r.child(d),f=i[u],m=i[d];f+=s[1]+ml(p,s[1]-1),m+=a[1]+ml(h,a[1]-1),l?c?function(e,t,n,r,o){void 0===o&&(o={});for(var i=r.endIndex,s=r.from,a=r.to,l=!1,c=r.startIndex;c<=i;c+=1)delete Bl[c],l=Hl(t,c,o);l&&e.setBlockType(s,a,n,o)}(e,r,o,{from:f,to:m,startIndex:u,endIndex:d},l.attrs):e.addMark(f,m,t.mark(l.type,l.attrs)):e.removeMark(f,m)})),function(e,t,n){Object.keys(Bl).forEach((function(r){var o=Number(r),i=Math.min(Number(r)+1,e.doc.childCount-1),s=t[o],a=t[i]-1;o===i&&(a+=2),e.setBlockType(s,a,n)}))}(e,i,o)}(s,t,a)}return s.setMeta("widget",i.getMeta("widget"))}})}function Hl(e,t,n){return Object.keys(n).some((function(r){return n[r]!==e.child(t).attrs[r]}))}function zl(e,t){var n=t.getLineTexts(),r=[Qs(e),ea(e)],o=[Ys(e),ta(e)+1],i=Pl(e,r,o,n[o[0]-1]);return null!=i?i:[]}var ql=["taskList","orderedList","bulletList","table","strong","emph","strike","heading","thematicBreak","blockQuote","code","codeBlock","indent","outdent"];var Vl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),t}(ol),jl=function(){function e(){}return Object.defineProperty(e.prototype,"type",{get:function(){return"mark"},enumerable:!1,configurable:!0}),e.prototype.setContext=function(e){this.context=e},e}();function $l(e,t){return _l(e,t-1)}function _l(e,t){return e.child(t).textContent}var Ul=/^\s*> ?/,Wl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("block-quote")},0]}}},enumerable:!1,configurable:!0}),t.prototype.createBlockQuoteText=function(e,t){return t?e.replace(Ul,"").trim():"> "+e.trim()},t.prototype.extendBlockQuote=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.tr,s=t.schema,a=bl(r),l=a.endFromOffset,c=a.endToOffset,u=a.endIndex,d=a.to,p=_l(o,u);if(Ul.test(p)&&d>l&&r.empty){if(p.replace(Ul,"").trim()){var h=p.slice(d-l).trim();Zs(i,c,h,Js(s,e.createBlockQuoteText(h)))}else i.deleteRange(l,c).split(i.mapping.map(c));return n(i),!0}return!1}},t.prototype.commands=function(){var e=this;return function(){return function(t,n){var r=t.selection,o=t.doc,i=bl(r),s=i.startFromOffset,a=i.endToOffset,l=i.startIndex,c=i.endIndex,u=Ul.test(_l(o,l)),d=Xs({state:t,startIndex:l,endIndex:c,from:s,createText:function(t){return e.createBlockQuoteText(t,u)}});return n(d.setSelection(Ks(d,d.mapping.map(a)))),!0}}},t.prototype.keymaps=function(){var e=this.commands()();return{"alt-q":e,"alt-Q":e,Enter:this.extendBlockQuote()}},t}(jl),Jl=/(^\s*)([-*+] |[\d]+\. )/,Kl=/(^\s*)([\d])+\.( \[[ xX]])? /,Gl=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Xl=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Zl=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,Ql=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Yl=/(^\s*)([-*+])( \[[ xX]]) /;function ec(e){return Kl.test(e)?"ordered":"bullet"}function tc(e){for(var t=0;e&&"document"!==e.type;)"list"===e.type&&(t+=1),e=e.parent;return t}function nc(e,t,n,r){for(var o=e.getLineTexts().length,i=[],s=t;r?s<o:s>1;){s=r?s+1:s-1;var a=e.findFirstNodeAtLine(s),l=tc(a);if(l===n)i.push({line:s,depth:n,mdNode:a});else if(l<n)break}return i}function rc(e,t,n,r){void 0===r&&(r=0);var o=Number.MAX_VALUE,i=0,s=t.map((function(t,s){var a=t.line;o=Math.min(a-1,o),i=Math.max(a-1,i);var l=$l(e,a);return l="bullet"===n?function(e){if(!Jl.test(e))return"* "+e;var t=ec(e);return"bullet"===t&&Xl.test(e)?e=e.replace(Yl,"$1$2 "):"ordered"===t&&(e=e.replace(Kl,"$1* ")),e}(l):function(e,t){if(!Jl.test(e))return t+". "+e;var n=ec(e);if("bullet"===n||"ordered"===n&&Xl.test(e))e=e.replace(Xl,"$1"+t+". ");else if("ordered"===n){var r=Gl.exec(e)[3];Number(r)!==t&&(e=e.replace(Kl,"$1"+t+". "))}return e}(l,s+1+r),{text:l,line:a}}));return{changedResults:s,firstIndex:o,lastIndex:i}}function oc(e,t){var n,r,o,i,s,a,l,c=(r=(n=t).toastMark,o=n.mdNode,a=nc(r,i=n.line,s=tc(o),!1).reverse(),l=nc(r,i,s,!0),a.concat([{line:i,depth:s,mdNode:o}]).concat(l));return rc(t.doc,c,e)}var ic={bullet:function(e){return oc("bullet",e)},ordered:function(e){return oc("ordered",e)},task:function(e){var t=e.mdNode,n=e.doc,r=e.line,o=$l(n,r);return t.listData.task?o=o.replace(Ql,"$1$2"):ra(t)&&(o=o.replace(Jl,"$1$2[ ] ")),{changedResults:[{text:o,line:r}]}}},sc={bullet:function(e){var t=e.doc,n=e.line;return{changedResults:[{text:"* "+$l(t,n),line:n}]}},ordered:function(e){for(var t=e.toastMark,n=e.doc,r=e.line,o=e.startLine,i=$l(n,r),s=1,a=o,l=0,c=o-1;c>0;c-=1){var u=t.findFirstNodeAtLine(c),d=$l(n,c)&&!!aa(u,(function(e){return ra(e)})),p=Gl.exec($l(n,c));if(!p&&!d)break;if(p||!d){var h=p,f=h[1],m=h[3];if(!f){s=Number(m),a=c;break}}else l+=1}return{changedResults:[{text:s+r-a-l+". "+i,line:r}]}},task:function(e){var t=e.doc,n=e.line;return{changedResults:[{text:"* [ ] "+$l(t,n),line:n}]}}},ac={bullet:function(e){var t=e.line,n=$l(e.doc,t),r=Zl.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(e){var t=e.toastMark,n=e.line,r=e.mdNode,o=e.doc,i=tc(r),s=$l(o,n),a=Gl.exec(s),l=a[1],c=a[3],u=a[4],d=Number(c)+1,p=""+l+d+u,h=nc(t,n,i,!0).filter((function(e){var t=Gl.exec($l(o,e.line));return t&&t[1].length===l.length&&!!aa(e.mdNode,(function(e){return oa(e)}))}));return Li({listSyntax:p},rc(o,h,"ordered",d))}};function lc(e,t,n,r,o){for(var i=[],s=$l(e,n),a=Gl.exec(s);a;){var l=a[1],c=a[4],u=a[5],d=l.length;if(d===o)i.push(Js(t,""+l+r+c+u)),r+=1,n+=1;else if(d>o){var p=lc(e,t,n,1,d);n=p.line,i=i.concat(p.nodes)}if(d<o||n>e.childCount)break;s=$l(e,n),a=Gl.exec(s)}return{nodes:i,line:n}}var cc=/(^\s{1,4})(.*)/;function uc(e,t,n){return e<t||Jl.test(n)||Ul.test(n)}function dc(e,t,n){var r=n.$from;0===r.depth&&(r=e.resolve(r.pos-1));var o=r.node(1),i=r.start(1),s=o.content.size;return o.rangeHasMark(0,s,t.marks.table)&&r.pos-i!==s&&r.pos!==i}function pc(e,t){var n=t.from,r=t.to;if("indent"===t.type)n+=4,r+=4*(t.lineLen+1);else{var o=t.spaceLenList;n-=o[0];for(var i=0;i<o.length;i+=1)r-=o[i]}return Ks(e,n,r)}var hc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"inline*",attrs:{className:{default:null},codeStart:{default:null},codeEnd:{default:null}},selectable:!1,group:"block",parseDOM:[{tag:"div"}],toDOM:function(e){var t=e.attrs;return t.className?["div",{class:$a(t.className)},0]:["div",0]}}},enumerable:!1,configurable:!0}),t.prototype.reorderList=function(e,t){for(var n=this.context,r=n.view,o=n.toastMark,i=n.schema,s=r.state,a=s.tr,l=s.selection,c=s.doc,u=o.findFirstNodeAtLine(e),d=u;u&&!ia(u)&&"document"!==u.parent.type;)if(oa(u=u.parent)){d=u;break}d&&(e=d.sourcepos[0][0]);var p=Gl.exec($l(c,e)),h=p[1],f=p[3],m=h.length,g=lc(c,i,e,Number(f),m),v=g.line,y=g.nodes;t=Math.max(t,v-1);for(var b=wl(c,e-1).startOffset,w=e-1;w<=t-1;w+=1){var k=c.child(w),x=k.nodeSize,C=k.content,T=a.mapping.map(b),M=T+C.size;a.replaceWith(T,M,y[w-e+1]),b+=x}var S=Ks(a,l.from,l.to);r.dispatch(a.setSelection(S))},t.prototype.indent=function(e){var t=this;return void 0===e&&(e=!1),function(){return function(n,r){var o=n.schema,i=n.selection,s=n.doc,a=bl(i),l=a.from,c=a.to,u=a.startFromOffset,d=a.startIndex,p=a.endIndex;if(e&&dc(s,o,i))return!1;var h=_l(s,d);if(e&&uc(l,c,h)||!e&&Jl.test(h)){var f=Xs({state:n,from:u,startIndex:d,endIndex:p,createText:function(e){return"    "+e}}),m={type:"indent",from:l,to:c,lineLen:p-d};r(f.setSelection(pc(f,m))),Gl.test(h)&&t.reorderList(d+1,p+1)}else e&&r(n.tr.insert(c,Js(o,"    ")));return!0}}},t.prototype.outdent=function(e){var t=this;return void 0===e&&(e=!1),function(){return function(n,r){var o=n.selection,i=n.doc,s=n.schema,a=bl(o),l=a.from,c=a.to,u=a.startFromOffset,d=a.startIndex,p=a.endIndex;if(e&&dc(i,s,o))return!1;var h=_l(i,d);if(e&&uc(l,c,h)||!e&&Jl.test(h)){var f=[],m=Xs({state:n,from:u,startIndex:d,endIndex:p,createText:function(e){var t=cc.exec(e);return f.push(t?t[1].length:0),e.replace(cc,"$2")}}),g={type:"outdent",from:l,to:c,spaceLenList:f};r(m.setSelection(pc(m,g))),Gl.test(h)&&t.reorderList(d+1,p+1)}else if(e){var v=h.slice(0,c-u),y=v.replace(/\s{1,4}$/,""),b=c-(v.length-y.length);r(n.tr.delete(b,c))}return!0}}},t.prototype.deleteLines=function(){var e=this;return function(t,n){var r=e.context.view,o=bl(t.selection),i=o.startFromOffset,s=o.endToOffset;return Yo((function(){return n(t.tr.deleteRange(i,s)),!0}),qo)(t,n,r)}},t.prototype.moveDown=function(){return function(e,t){var n=e.doc,r=e.tr,o=e.selection,i=e.schema,s=bl(o),a=s.startFromOffset,l=s.endToOffset,c=s.endIndex;if(c<n.content.childCount-1){var u=n.child(c+1),d=u.nodeSize,p=u.textContent;return r.delete(l,l+d).split(a).insert(r.mapping.map(a)-2,Js(i,p)),t(r),!0}return!1}},t.prototype.moveUp=function(){return function(e,t){var n=e.tr,r=e.doc,o=e.selection,i=e.schema,s=bl(o),a=s.startFromOffset,l=s.endToOffset,c=s.startIndex;if(c>0){var u=r.child(c-1),d=u.nodeSize,p=u.textContent;return n.delete(a-d,a).split(n.mapping.map(l)).insert(n.mapping.map(l),Js(i,p)),t(n),!0}return!1}},t.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},t.prototype.keymaps=function(){return{Tab:this.indent(!0)(),"Shift-Tab":this.outdent(!0)(),"Mod-d":this.deleteLines(),"Mod-D":this.deleteLines(),"Alt-ArrowUp":this.moveUp(),"Alt-ArrowDown":this.moveDown()}},t}(ol),fc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),t}(ol),mc=/^#{1,6}\s/,gc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(e){var t=e.attrs,n="heading|heading"+t.level;return t.seText&&(n+="|delimiter|setext"),["span",{class:$a.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.createHeadingText=function(e,t,n){for(var r=t.replace(n,"").trim(),o="";e>0;)o+="#",e-=1;return o+" "+r},t.prototype.commands=function(){var e=this;return function(t){return function(n,r){var o=t.level,i=bl(n.selection),s=i.startFromOffset,a=i.endToOffset,l=Xs({state:n,from:s,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(t){var n=t.match(mc),r=n?n[0]:"";return e.createHeadingText(o,t,r)}});return r(l.setSelection(Ks(l,l.mapping.map(a)))),!0}}},t}(jl),vc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("code-block")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){var n=e.selection,r=e.schema,o=e.tr,i=bl(n),s=i.startFromOffset,a=i.endToOffset,l=Js(r,"```");return o.insert(s,l).split(s+3),o.split(o.mapping.map(a)).insert(o.mapping.map(a),l),t(o.setSelection(Ks(o,o.mapping.map(a)-5))),!0}}},t.prototype.keepIndentation=function(){var e=this;return function(t,n){var r,o=t.selection,i=t.tr,s=t.doc,a=t.schema,l=e.context.toastMark,c=bl(o),u=c.startFromOffset,d=c.endToOffset,p=c.endIndex,h=c.from,f=c.to,m=_l(s,p);if(h===f&&m.trim()){var g=m.match(/^\s+/);if((r=l.findFirstNodeAtLine(p+1))&&"codeBlock"===r.type&&g){var v=g[0],y=m.slice(f-u);return Zs(i,d,y,Js(a,v+y)),n(i),!0}}return!1}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-p":e,"Shift-Mod-P":e,Enter:this.keepIndentation()}},t}(jl),yc=/\||\s/g;function bc(e,t){for(var n="|",r=0;r<e;r+=1)n+=t?" --- |":"  |";return n}var wc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("table")},0]}}},enumerable:!1,configurable:!0}),t.prototype.extendTable=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.tr,s=t.schema;if(!r.empty)return!1;var a=bl(r),l=a.endFromOffset,c=a.endToOffset,u=a.endIndex,d=a.to,p=_l(o,u),h=[u+1,d-l+1],f=aa(e.context.toastMark.findNodeAtPosition(h),(function(e){return sa(e)&&("tableDelimRow"===e.parent.type||"tableBody"===e.parent.parent.type)}));if(f){var m=!p.replace(yc,"").trim(),g=bc(f.parent.parent.parent.columns.length);return m?i.deleteRange(l,c).split(i.mapping.map(c)):i.split(c).insert(i.mapping.map(c),Js(s,g)).setSelection(Ks(i,i.mapping.map(c)-2)),n(i),!0}return!1}},t.prototype.moveTableCell=function(e){var t=this;return function(n,r){var o=n.selection,i=n.tr,s=bl(o),a=s.endFromOffset,l=[s.endIndex+1,s.to-a],c=aa(t.context.toastMark.findNodeAtPosition(l),(function(e){return sa(e)}));if(c){var u=c.parent,d=function(e){return e?{type:"next",parentType:"tableHead",childType:"firstChild"}:{type:"prev",parentType:"tableBody",childType:"lastChild"}}(e),p=d.type,h=d.parentType,f=d.childType,m=ta(c);if(c[p])m=ta(c[p])-1;else{var g=u[p]||u.parent.type!==h?u[p]:u.parent[p][f];"next"===p?m+=(g?ta(g[f]):0)+2:"prev"===p&&(m=g?-4:0)}return r(i.setSelection(Ks(i,a+m))),!0}return!1}},t.prototype.addTable=function(){return function(e){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=e,a=s.columnCount,l=s.rowCount,c=bl(r).endToOffset,u=function(e){return[bc(e),bc(e,!0)]}(a),d=function(e,t){for(var n=[],r=0;r<t;r+=1)n.push(bc(e));return n}(a,l-1);return Ii(Ii([],u),d).forEach((function(e){o.split(o.mapping.map(c)).insert(o.mapping.map(c),Js(i,e))})),n(o.setSelection(Ks(o,c+4))),!0}}},t.prototype.commands=function(){return{addTable:this.addTable()}},t.prototype.keymaps=function(){return{Enter:this.extendTable(),Tab:this.moveTableCell(!0),"Shift-Tab":this.moveTableCell(!1)}},t}(jl),kc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("thematic-break")},0]}}},enumerable:!1,configurable:!0}),t.prototype.hr=function(){return function(){return function(e,t){var n=e.selection,r=e.schema,o=e.tr,i=bl(n),s=i.from,a=i.to,l=i.endToOffset,c=Js(r,"***");return o.split(s).replaceWith(o.mapping.map(s),o.mapping.map(a),c).split(o.mapping.map(a)).setSelection(Ks(o,o.mapping.map(l))),t(o),!0}}},t.prototype.commands=function(){return{hr:this.hr()}},t.prototype.keymaps=function(){var e=this.hr()();return{"Mod-l":e,"Mod-L":e}},t}(jl);function xc(e,t){var n=e.type;return t<=e.sourcepos[0][0]&&("codeBlock"===n||"heading"===n||n.match("table"))}var Cc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{odd:{default:!1},even:{default:!1},listStyle:{default:!1}},toDOM:function(e){var t=e.attrs,n=t.odd,r=t.even,o="list-item";return t.listStyle&&(o+="|list-item-style"),n&&(o+="|list-item-odd"),r&&(o+="|list-item-even"),["span",{class:$a.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.extendList=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.schema,s=t.tr,a=e.context.toastMark,l=bl(r),c=l.to,u=l.startFromOffset,d=l.endFromOffset,p=l.endIndex,h=l.endToOffset,f=_l(o,p);if(!Jl.test(f)||r.from===u||!r.empty)return!1;if(f.replace(Xl,"").trim()){var m=ec(f),g=a.findFirstNodeAtLine(p+1),v=f.slice(c-d),y={toastMark:a,mdNode:g,doc:o,line:p+1},b=ac[m](y),w=b.listSyntax,k=b.changedResults;if(null==k?void 0:k.length){s.split(c),k.unshift({text:w+v,line:p+1}),e.changeToListPerLine(s,k,{from:c,startLine:k[0].line,endLine:Fs(k).line});var x=s.mapping.map(h)-v.length;s.setSelection(Ks(s,x))}else Zs(s,h,v,Js(i,w+v))}else s.deleteRange(d,h).split(s.mapping.map(h));return n(s),!0}},t.prototype.toList=function(e){var t=this;return function(){return function(n,r){for(var o=n.doc,i=n.tr,s=n.selection,a=t.context.toastMark,l=bl(s),c=l.startIndex+1,u=l.endIndex+1,d=l.endToOffset,p=[],h=c;h<=u;h+=1){var f=a.findFirstNodeAtLine(h);if(f&&xc(f,h))break;if(-1===p.indexOf(h)){var m={toastMark:a,mdNode:f,doc:o,line:h,startLine:c},g=(ra(f)?ic[e](m):sc[e](m)).changedResults,v=t.changeToListPerLine(i,g,{from:wl(o,g[0].line-1).startOffset,startLine:g[0].line,endLine:Fs(g).line,indexDiff:1});d=Math.max(v,d),g&&(p=p.concat(g.map((function(e){return e.line}))))}}return r(i.setSelection(Ks(i,i.mapping.map(d)))),!0}}},t.prototype.changeToListPerLine=function(e,t,n){for(var r=n.from,o=n.startLine,i=n.endLine,s=n.indexDiff,a=void 0===s?0:s,l=0,c=function(n){var o=e.doc.child(n),i=o.nodeSize,s=o.content,c=e.mapping.map(r),d=c+s.size,p=t.filter((function(e){return e.line-a===n}))[0];p&&(e.replaceWith(c,d,Js(u.context.schema,p.text)),l=Math.max(l,r+s.size)),r+=i},u=this,d=o-a;d<=i-a;d+=1)c(d);return l},t.prototype.toggleTask=function(){var e=this;return function(t,n){for(var r=t.selection,o=t.tr,i=t.doc,s=t.schema,a=e.context.toastMark,l=bl(r),c=l.startIndex,u=l.endIndex,d=null,p=c;p<=u;p+=1){var h=a.findFirstNodeAtLine(p+1);if(ra(h)&&h.listData.task){var f=h.listData,m=f.checked,g=f.padding,v=m?" ":"x",y=h.sourcepos[0],b=wl(i,y[0]-1).startOffset;b+=y[1]+g,d=o.replaceWith(b,b+1,s.text(v))}}return!!d&&(n(d),!0)}},t.prototype.commands=function(){return{bulletList:this.toList("bullet"),orderedList:this.toList("ordered"),taskList:this.toList("task")}},t.prototype.keymaps=function(){var e=this.toList("bullet")(),t=this.toList("ordered")(),n=this.toList("task")(),r=this.toggleTask();return{"Mod-u":e,"Mod-U":e,"Mod-o":t,"Mod-O":t,"alt-t":n,"alt-T":n,"Shift-Ctrl-x":r,"Shift-Ctrl-X":r,Enter:this.extendList()}},t}(jl);function Tc(e,t){return function(){return function(n,r){var o=n.tr,i=n.selection,s=cl(e)?e:function(t){return e.test(t)},a=t.length,l=o.doc,c=hl(i),u=c[0],d=c[1],p=Math.max(u-a,1),h=Math.min(d+a,l.content.size-1),f=i.content(),m=f.content.textBetween(0,f.content.size,"\n"),g=l.textBetween(p,u,"\n"),v=l.textBetween(d,h,"\n");if(m=""+g+m+v,g&&v&&s(m))o.delete(h-a,h).delete(p,p+a);else{o.insertText(t,d).insertText(t,u);var y=i.empty?Ks(o,u+a):Ks(o,u+a,d+a);o.setSelection(y)}return r(o),!0}}}var Mc=/^(\*{2}|_{2}).*([\s\S]*)\1$/m,Sc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("strong")},0]}}},enumerable:!1,configurable:!0}),t.prototype.bold=function(){return Tc(Mc,"**")},t.prototype.commands=function(){return{bold:this.bold()}},t.prototype.keymaps=function(){var e=this.bold()();return{"Mod-b":e,"Mod-B":e}},t}(jl),Ec=/^(~{2}).*([\s\S]*)\1$/m,Nc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("strike")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return Tc(Ec,"~~")},t.prototype.keymaps=function(){var e=this.commands()();return{"Mod-s":e,"Mod-S":e}},t}(jl),Oc=/^(\*|_).*([\s\S]*)\1$/m,Dc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("emph")},0]}}},enumerable:!1,configurable:!0}),t.prototype.italic=function(){return Tc(Oc,"*")},t.prototype.commands=function(){return{italic:this.italic()}},t.prototype.keymaps=function(){var e=this.italic()();return{"Mod-i":e,"Mod-I":e}},t}(jl),Ac=/^(`).*([\s\S]*)\1$/m,Lc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{start:{default:!1},end:{default:!1},marked:{default:!1}},toDOM:function(e){var t=e.attrs,n="code";return t.start&&(n+="|delimiter|start"),t.end&&(n+="|delimiter|end"),t.marked&&(n+="|marked-text"),["span",{class:$a.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return Tc(Ac,"`")},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-c":e,"Shift-Mod-C":e}},t}(jl),Ic=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(e){var t=e.attrs,n="link";return t.url&&(n+="|link-url|marked-text"),t.desc&&(n+="|link-desc|marked-text"),["span",{class:$a.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.addLinkOrImage=function(e){return function(t){return function(n,r){var o=n.selection,i=n.tr,s=n.schema,a=hl(o),l=a[0],c=a[1],u=t,d=u.linkText,p=u.altText,h=u.linkUrl,f=u.imageUrl,m=d,g=h,v="";return"image"===e&&(m=p,g=f,v="!"),v+="["+(m=Is(m))+"]("+g+")",r(i.replaceWith(l,c,Js(s,v))),!0}}},t.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},t}(jl),Rc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),t}(jl),Pc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("delimiter")},0]}}},enumerable:!1,configurable:!0}),t}(jl),Bc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("meta")},0]}}},enumerable:!1,configurable:!0}),t}(jl),Fc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("marked-text")},0]}}},enumerable:!1,configurable:!0}),t}(jl),Hc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("table-cell")},0]}}},enumerable:!1,configurable:!0}),t}(jl),zc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("html")},0]}}},enumerable:!1,configurable:!0}),t}(jl),qc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:$a("custom-block")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){var r=t.selection,o=t.schema,i=t.tr,s=bl(r),a=s.startFromOffset,l=s.endToOffset;if(!(null==e?void 0:e.info))return!1;var c="$$"+e.info,u=Js(o,c),d=Js(o,"$$");return i.insert(a,u).split(a+c.length),i.split(i.mapping.map(l)).insert(i.mapping.map(l),d),n(i.setSelection(Ks(i,i.mapping.map(l)-4))),!0}}},t}(jl),Vc=/x|backspace/i,jc=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;function $c(e){var t=e.schema,n=e.toastMark;return new pt({props:{handleDOMEvents:{keyup:function(e,r){var o,i=e.state,s=i.doc,a=i.tr,l=i.selection;if(l.empty&&Vc.test(r.key)){var c=bl(l),u=c.startIndex,d=c.startFromOffset,p=[u+1,c.from-d+1],h=aa(n.findNodeAtPosition(p),(function(e){var t;return"paragraph"===e.type&&"item"===(null===(t=e.parent)||void 0===t?void 0:t.type)}));if(null===(o=null==h?void 0:h.firstChild)||void 0===o?void 0:o.literal){var f=h.firstChild,m=f.literal.match(jc);if(m){var g=f.sourcepos[0],v=m[1],y=m[2],b=m[3],w=v.length+b.length,k=wl(s,g[0]-1).startOffset,x=g[1]+k;if(y){var C=w?w+1:0;a.replaceWith(x,C+x,t.text(y)),e.dispatch(a)}else w||(a.insertText(" ",x),e.dispatch(a))}}}return!1}}}})}var _c="cut",Uc=/\r\n|\n|\r/,Wc=function(e){function t(t,n){var r=e.call(this,t)||this,o=n.toastMark,i=n.useCommandShortcut,s=void 0===i||i,a=n.mdPlugins,l=void 0===a?[]:a;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=o,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(s),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Li(Li({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",(function(e){return r.toggleActive(!0,e)})),r.eventEmitter.listen("changePreviewTabPreview",(function(){return r.toggleActive(!1)})),r.initEvent(),r}return Ai(t,e),t.prototype.toggleActive=function(e,t){Wa(this.el,"active",e),e?t||this.focus():this.blur()},t.prototype.createClipboard=function(){var e=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=ja("pseudo-clipboard"),this.clipboard.addEventListener("paste",(function(t){var n=t.clipboardData||window.clipboardData,r=n&&n.items;if(r){var o=Us(r).some((function(e){return"string"===e.kind&&"text/rtf"===e.type}));if(!o){var i=nl(r);i&&(t.preventDefault(),tl(e.eventEmitter,i,t.type))}}})),this.clipboard.addEventListener("input",(function(t){var n=t.target.value;e.replaceSelection(n),t.preventDefault(),t.target.value=""})),this.el.insertBefore(this.clipboard,this.view.dom)},t.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},t.prototype.createSpecs=function(){return new pl([new Vl,new hc,new al,new fc,new gc,new Wl,new vc,new qc,new wc,new Hc,new kc,new Cc,new Sc,new Nc,new Dc,new Lc,new Ic,new Pc,new Rc,new Fc,new Bc,new zc])},t.prototype.createPlugins=function(){return Ii([Fl(this.context),(e=this.context,t=e.toastMark,n=e.eventEmitter,new pt({view:function(){return{update:function(e,r){var o=e.state,i=o.doc,s=o.selection;if(!(r&&r.doc.eq(i)&&r.selection.eq(s))){var a=s.from,l=o.doc.resolve(a).start(),c=a-l;a===l&&(c+=1);var u=[o.doc.content.findIndex(a).index+1,c],d=t.findNodeAtPosition(u),p=function(e){var t={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}},n=!0;return function(e,t,n){for(void 0===n&&(n=!0),e=n?e:e.parent;e&&"document"!==e.type;)t(e),e=e.parent}(e,(function(e){var r=function(e){var t=e.type;return ra(e)?e.listData.task?"taskList":"ordered"===e.listData.type?"orderedList":"bulletList":-1!==t.indexOf("table")?"table":Ns(ql,t)?t:null}(e);r&&("bulletList"===r||"orderedList"===r?n&&(t[r]={active:!0},t.indent.disabled=!1,t.outdent.disabled=!1,n=!1):t[r]={active:!0})})),t}(d);n.emit("changeToolbarState",{cursorPos:u,mdNode:d,toolbarState:p}),n.emit("setFocusedNode",d)}}}}})),$c(this.context)],this.createPluginProps()).concat(this.defaultPlugins);var e,t,n},t.prototype.createView=function(){var e=this;return new wo(this.el,{state:this.createState(),dispatchTransaction:function(t){e.updateMarkdown(t);var n=e.view.state.applyTransaction(t).state;e.view.updateState(n),e.emitChangeEvent(t)},handleKeyDown:function(t,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&e.clipboard.focus(),e.eventEmitter.emit("keydown",e.editorType,n),!1},handleDOMEvents:{copy:function(t,n){return e.captureCopy(n)},cut:function(t,n){return e.captureCopy(n,_c)},scroll:function(){return e.eventEmitter.emit("scroll","editor"),!0},keyup:function(t,n){return e.eventEmitter.emit("keyup",e.editorType,n),!1}},nodeViews:{widget:il}})},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.captureCopy=function(e,t){e.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return e.clipboardData?e.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),t===_c&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",_c)),!0},t.prototype.updateMarkdown=function(e){var t=this;e.docChanged&&e.steps.forEach((function(n,r){if(n.slice&&!(n instanceof Me)){var o=e.docs[r],i=[n.from,n.to],s=gl(o,i[0],i[1]),a=s[0],l=s[1],c=t.getChanged(n.slice);a[0]===l[0]&&a[1]===l[1]&&""===c&&(c="\n");var u=t.toastMark.editMarkdown(a,l,c);t.eventEmitter.emit("updatePreview",u),e.setMeta("editResult",u).scrollIntoView()}}))},t.prototype.getChanged=function(e){var t="",n=e.content.size;return e.content.nodesBetween(0,n,(function(e,r){e.isText?t+=e.text.slice(Math.max(0,r)-r,n-r):e.isBlock&&r>0&&(t+="\n")})),t},t.prototype.setSelection=function(e,t){void 0===t&&(t=e);var n=this.view.state.tr,r=yl(n.doc,e,t),o=r[0],i=r[1];this.view.dispatch(n.setSelection(Ks(n,o,i)).scrollIntoView())},t.prototype.replaceSelection=function(e,t,n){var r,o=this.view.state,i=o.tr,s=o.schema,l=o.doc,c=e.split(Uc).map((function(e){return Ws(s,ka(e,s))})),u=new h(a.from(c),1,1);if(this.focus(),t&&n){var d=yl(l,t,n),p=d[0],f=d[1];r=i.replaceRange(p,f,u)}else r=i.replaceSelection(u);this.view.dispatch(r.scrollIntoView())},t.prototype.deleteSelection=function(e,t){var n,r=this.view.state,o=r.tr,i=r.doc;if(e&&t){var s=yl(i,e,t),a=s[0],l=s[1];n=o.deleteRange(a,l)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},t.prototype.getSelectedText=function(e,t){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;if(e&&t){var a=yl(r,e,t);i=a[0],s=a[1]}return r.textBetween(i,s,"\n")},t.prototype.getSelection=function(){var e=this.view.state.selection,t=e.from,n=e.to;return gl(this.view.state.tr.doc,t,n)},t.prototype.setMarkdown=function(e,t){void 0===t&&(t=!0);var n=e.split(Uc),r=this.view.state,o=r.tr,i=r.doc,s=r.schema,a=n.map((function(e){return Ws(s,ka(e,s))}));this.view.dispatch(o.replaceWith(0,i.content.size,a)),t&&this.moveCursorToEnd(!0)},t.prototype.addWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=r.doc,s=r.selection,a=n?yl(i,n,n)[0]:s.to;this.view.dispatch(o.setMeta("widget",{pos:a,node:e,style:t}))},t.prototype.replaceWithWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=r.schema,s=yl(r.doc,e,t),a=ka(n,i);this.view.dispatch(o.replaceWith(s[0],s[1],a))},t.prototype.getRangeInfoOfNode=function(e){var t=this.view.state,n=t.doc,r=t.selection,o=e||gl(n,r.from)[0],i=this.toastMark.findNodeAtPosition(o);return"text"===i.type&&"paragraph"!==i.parent.type&&(i=i.parent),i.sourcepos[1][1]+=1,{range:i.sourcepos,type:i.type}},t.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map((function(e){return ga(e)})).join("\n")},t.prototype.getToastMark=function(){return this.toastMark},t}(ll),Jc="_feEventKey",Kc=function(e,t){var n,r=e[Jc];return r||(r=e[Jc]={}),(n=r[t])||(n=r[t]=[]),n},Gc=Fi,Xc=$i,Zc=Kc;function Qc(e,t,n){var r,o=Zc(e,t);n?(Xc(o,(function(o,i){return n!==o.handler||(Yc(e,t,o.wrappedHandler),r=i,!1)})),o.splice(r,1)):(Xc(o,(function(n){Yc(e,t,n.wrappedHandler)})),o.splice(0,o.length))}function Yc(e,t,n){"removeEventListener"in e?e.removeEventListener(t,n):"detachEvent"in e&&e.detachEvent("on"+t,n)}var eu=function(e,t,n){Gc(t)?Xc(t.split(/\s+/g),(function(t){Qc(e,t,n)})):Xc(t,(function(t,n){Qc(e,n,t)}))},tu=Fi,nu=$i,ru=Kc;function ou(e,t,n,r){function o(t){n.call(r||e,t||window.event)}"addEventListener"in e?e.addEventListener(t,o):"attachEvent"in e&&e.attachEvent("on"+t,o),function(e,t,n,r){var o=ru(e,t),i=!1;nu(o,(function(e){return e.handler!==n||(i=!0,!1)})),i||o.push({handler:n,wrappedHandler:r})}(e,t,n,o)}var iu=function(e,t,n,r){tu(t)?nu(t.split(/\s+/g),(function(t){ou(e,t,n,r)})):nu(t,(function(t,r){ou(e,r,t,n)}))},su=function(e,t){return su=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},su(e,t)};function au(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}su(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var lu=function(){return lu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lu.apply(this,arguments)};function cu(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var uu="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},du={};function pu(e,t,n){var r,o,i,s,a,l="";for("string"!=typeof t&&(n=t,t=pu.defaultChars),void 0===n&&(n=!0),a=function(e){var t,n,r=du[e];if(r)return r;for(r=du[e]=[],t=0;t<128;t++)n=String.fromCharCode(t),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2));for(t=0;t<e.length;t++)r[e.charCodeAt(t)]=e[t];return r}(t),r=0,o=e.length;r<o;r++)if(i=e.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(e.slice(r+1,r+3)))l+=e.slice(r,r+3),r+=2;else if(i<128)l+=a[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(s=e.charCodeAt(r+1))>=56320&&s<=57343){l+=encodeURIComponent(e[r]+e[r+1]),r++;continue}l+="%EF%BF%BD"}else l+=encodeURIComponent(e[r]);return l}pu.defaultChars=";/?:@&=+$,-_.!~*'()#",pu.componentChars="-_.!~*'()";var hu=pu,fu={},mu={},gu={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅",in:"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺",int:"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"},vu={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},yu={},bu=uu&&uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yu,"__esModule",{value:!0});var wu=bu({0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}),ku=String.fromCodePoint||function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+String.fromCharCode(e)};yu.default=function(e){return e>=55296&&e<=57343||e>1114111?"�":(e in wu.default&&(e=wu.default[e]),ku(e))};var xu=uu&&uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mu,"__esModule",{value:!0}),mu.decodeHTML=mu.decodeHTMLStrict=mu.decodeXML=void 0;var Cu=xu(gu),Tu=xu({Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"}),Mu=xu(vu),Su=xu(yu),Eu=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function Nu(e){var t=Du(e);return function(e){return String(e).replace(Eu,t)}}mu.decodeXML=Nu(Mu.default),mu.decodeHTMLStrict=Nu(Cu.default);var Ou=function(e,t){return e<t?1:-1};function Du(e){return function(t){if("#"===t.charAt(1)){var n=t.charAt(2);return"X"===n||"x"===n?Su.default(parseInt(t.substr(3),16)):Su.default(parseInt(t.substr(2),10))}return e[t.slice(1,-1)]||t}}mu.decodeHTML=function(){for(var e=Object.keys(Tu.default).sort(Ou),t=Object.keys(Cu.default).sort(Ou),n=0,r=0;n<t.length;n++)e[r]===t[n]?(t[n]+=";?",r++):t[n]+=";";var o=new RegExp("&(?:"+t.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=Du(Cu.default);function s(e){return";"!==e.substr(-1)&&(e+=";"),i(e)}return function(e){return String(e).replace(o,s)}}();var Au={},Lu=uu&&uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Au,"__esModule",{value:!0}),Au.escapeUTF8=Au.escape=Au.encodeNonAsciiHTML=Au.encodeHTML=Au.encodeXML=void 0;var Iu=zu(Lu(vu).default),Ru=qu(Iu);Au.encodeXML=Uu(Iu);var Pu,Bu,Fu=zu(Lu(gu).default),Hu=qu(Fu);function zu(e){return Object.keys(e).sort().reduce((function(t,n){return t[e[n]]="&"+n+";",t}),{})}function qu(e){for(var t=[],n=[],r=0,o=Object.keys(e);r<o.length;r++){var i=o[r];1===i.length?t.push("\\"+i):n.push(i)}t.sort();for(var s=0;s<t.length-1;s++){for(var a=s;a<t.length-1&&t[a].charCodeAt(1)+1===t[a+1].charCodeAt(1);)a+=1;var l=1+a-s;l<3||t.splice(s,l,t[s]+"-"+t[a])}return n.unshift("["+t.join("")+"]"),new RegExp(n.join("|"),"g")}Au.encodeHTML=(Pu=Fu,Bu=Hu,function(e){return e.replace(Bu,(function(e){return Pu[e]})).replace(Vu,$u)}),Au.encodeNonAsciiHTML=Uu(Fu);var Vu=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,ju=null!=String.prototype.codePointAt?function(e){return e.codePointAt(0)}:function(e){return 1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536};function $u(e){return"&#x"+(e.length>1?ju(e):e.charCodeAt(0)).toString(16).toUpperCase()+";"}var _u=new RegExp(Ru.source+"|"+Vu.source,"g");function Uu(e){return function(t){return t.replace(_u,(function(t){return e[t]||$u(t)}))}}Au.escape=function(e){return e.replace(_u,$u)},Au.escapeUTF8=function(e){return e.replace(Ru,$u)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeXMLStrict=e.decodeHTML5Strict=e.decodeHTML4Strict=e.decodeHTML5=e.decodeHTML4=e.decodeHTMLStrict=e.decodeHTML=e.decodeXML=e.encodeHTML5=e.encodeHTML4=e.escapeUTF8=e.escape=e.encodeNonAsciiHTML=e.encodeHTML=e.encodeXML=e.encode=e.decodeStrict=e.decode=void 0;var t=mu,n=Au;e.decode=function(e,n){return(!n||n<=0?t.decodeXML:t.decodeHTML)(e)},e.decodeStrict=function(e,n){return(!n||n<=0?t.decodeXML:t.decodeHTMLStrict)(e)},e.encode=function(e,t){return(!t||t<=0?n.encodeXML:n.encodeHTML)(e)};var r=Au;Object.defineProperty(e,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(e,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(e,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(e,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(e,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(e,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(e,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=mu;Object.defineProperty(e,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(e,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(fu);var Wu="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",Ju=/[\\&]/,Ku="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",Gu=new RegExp("\\\\"+Ku+"|"+Wu,"gi"),Xu=new RegExp('[&<>"]',"g"),Zu=function(e){return 92===e.charCodeAt(0)?e.charAt(1):fu.decodeHTML(e)};function Qu(e){return Ju.test(e)?e.replace(Gu,Zu):e}function Yu(e){try{return hu(e)}catch(t){return e}}function ed(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return e}}function td(e){return Xu.test(e)?e.replace(Xu,ed):e}function nd(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n.join("")}function rd(e){return!e||!/[^ \t]+/.test(e)}var od=function(){function e(e){this.current=e,this.root=e,this.entering=!0}return e.prototype.next=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=id(e);return t&&n?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e.next?(this.current=e.parent,this.entering=!1):(this.current=e.next,this.entering=!0),{entering:t,node:e}},e.prototype.resumeAt=function(e,t){this.current=e,this.entering=!0===t},e}();function id(e){switch(e.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var sd=1,ad={};function ld(e){delete ad[e]}var cd=function(){function e(e,t){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===e?-1:sd++,this.type=e,this.sourcepos=t,ad[this.id]=this}return e.prototype.isContainer=function(){return id(this)},e.prototype.unlink=function(){this.prev?this.prev.next=this.next:this.parent&&(this.parent.firstChild=this.next),this.next?this.next.prev=this.prev:this.parent&&(this.parent.lastChild=this.prev),this.parent=null,this.next=null,this.prev=null},e.prototype.replaceWith=function(e){this.insertBefore(e),this.unlink()},e.prototype.insertAfter=function(e){e.unlink(),e.next=this.next,e.next&&(e.next.prev=e),e.prev=this,this.next=e,this.parent&&(e.parent=this.parent,e.next||(e.parent.lastChild=e))},e.prototype.insertBefore=function(e){e.unlink(),e.prev=this.prev,e.prev&&(e.prev.next=e),e.next=this,this.prev=e,e.parent=this.parent,e.prev||(e.parent.firstChild=e)},e.prototype.appendChild=function(e){e.unlink(),e.parent=this,this.lastChild?(this.lastChild.next=e,e.prev=this.lastChild,this.lastChild=e):(this.firstChild=e,this.lastChild=e)},e.prototype.prependChild=function(e){e.unlink(),e.parent=this,this.firstChild?(this.firstChild.prev=e,e.next=this.firstChild,this.firstChild=e):(this.firstChild=e,this.lastChild=e)},e.prototype.walker=function(){return new od(this)},e}(),ud=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=t,r}return au(t,e),t}(cd),dd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.listData=null,t}return au(t,e),t}(ud),pd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.level=0,t.headingType="atx",t}return au(t,e),t}(ud),hd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isFenced=!1,t.fenceChar=null,t.fenceLength=0,t.fenceOffset=-1,t.info=null,t.infoPadding=0,t}return au(t,e),t}(ud),fd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.columns=[],t}return au(t,e),t}(ud),md=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.startIdx=0,t.endIdx=0,t.paddingLeft=0,t.paddingRight=0,t.ignored=!1,t}return au(t,e),t}(ud),gd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.title="",t.dest="",t.label="",t}return au(t,e),t}(ud),vd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.syntaxLength=0,t.offset=-1,t.info="",t}return au(t,e),t}(ud),yd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.htmlBlockType=-1,t}return au(t,e),t}(ud),bd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.destination=null,t.title=null,t.extendedAutolink=!1,t}return au(t,e),t}(cd),wd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.tickCount=0,t}return au(t,e),t}(cd),kd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.info="",t}return au(t,e),t}(cd);function xd(e,t){switch(e){case"heading":return new pd(e,t);case"list":case"item":return new dd(e,t);case"link":case"image":return new bd(e,t);case"codeBlock":return new hd(e,t);case"htmlBlock":return new yd(e,t);case"table":return new fd(e,t);case"tableCell":return new md(e,t);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new ud(e,t);case"code":return new wd(e,t);case"refDef":return new gd(e,t);case"customBlock":return new vd(e,t);case"customInline":return new kd(e,t);default:return new cd(e,t)}}function Cd(e){return"codeBlock"===e.type}function Td(e){return"list"===e.type}function Md(e){return"refDef"===e.type}function Sd(e){return"customBlock"===e.type}function Ed(e,t){var n=xd("text",t);return n.literal=e,n}var Nd,Od="[A-Za-z][A-Za-z0-9-]*",Dd="<"+Od+"(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Ad="</"+Od+"\\s*[>]",Ld=new RegExp("^(?:"+Dd+"|"+Ad+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)Nd=function(e){try{return String.fromCodePoint(e)}catch(e){if(e instanceof RangeError)return String.fromCharCode(65533);throw e}};else{var Id=String.fromCharCode,Rd=Math.floor;Nd=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r,o=[],i=-1,s=e.length;if(!s)return"";for(var a="";++i<s;){var l=Number(e[i]);if(!isFinite(l)||l<0||l>1114111||Rd(l)!==l)return String.fromCharCode(65533);l<=65535?o.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,o.push(n,r)),(i+1===s||o.length>16384)&&(a+=Id.apply(void 0,o),o.length=0)}return a}}var Pd=Nd;function Bd(e){var t=/\)+$/.exec(e);if(t){for(var n=0,r=0,o=e;r<o.length;r++){var i=o[r];"("===i?n<0?n=1:n+=1:")"===i&&(n-=1)}if(n<0){var s=Math.min(-n,t[0].length);return e.substring(0,e.length-s)}}return e}function Fd(e){return e.replace(/&[A-Za-z0-9]+;$/,"")}function Hd(e){return cu(cu([],function(e){for(var t,n=new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]","g"),r=[];t=n.exec(e);){var o=Fd(Bd(t[0])),i="www"===t[1]?"http://":"";r.push({text:o,range:[t.index,t.index+o.length-1],url:""+i+o})}return r}(e)),function(e){for(var t,n=new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+","g"),r=[];t=n.exec(e);){var o=t[0];/[_-]+$/.test(o)||r.push({text:o,range:[t.index,t.index+o.length-1],url:"mailto:"+o})}return r}(e)).sort((function(e,t){return e.range[0]-t.range[0]}))}function zd(e){return e[e.length-1]}function qd(e){return e.slice(1,e.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function Vd(e,t){Object.keys(e).forEach((function(n){t(n,e[n])}))}function jd(e){return!Object.keys(e).length}var $d=39,_d=34,Ud=36,Wd="\\\\"+Ku,Jd=new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),Kd=new RegExp('^(?:"('+Wd+'|[^"\\x00])*"|\'('+Wd+"|[^'\\x00])*'|\\(("+Wd+"|[^()\\x00])*\\))"),Gd=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,Xd=new RegExp("^"+Ku),Zd=new RegExp("^"+Wu,"i"),Qd=/`+/,Yd=/^`+/,ep=/\.\.\./g,tp=/--+/g,np=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,rp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,op=/^ *(?:\n *)?/,ip=/^[ \t\n\x0b\x0c\x0d]/,sp=/^\s/,ap=/ *$/,lp=/^ */,cp=/^ *(?:\n|$)/,up=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,dp=/^[^\n`\[\]\\!<&*_'"~$]+/m,pp=function(){function e(e){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=e}return e.prototype.sourcepos=function(e,t){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,e+n];return"number"==typeof t?[o,[r,t+n]]:o},e.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},e.prototype.match=function(e){var t=e.exec(this.subject.slice(this.pos));return null===t?null:(this.pos+=t.index+t[0].length,t[0])},e.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},e.prototype.spnl=function(){return this.match(op),!0},e.prototype.parseBackticks=function(e){var t=this.pos+1,n=this.match(Yd);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match(Qd));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),s=this.sourcepos(t,this.pos),a=i.split("\n");if(a.length>1){var l=zd(a);this.lineIdx+=a.length-1,this.linePosOffset=-(this.pos-l.length-n.length),s[1]=this.sourcepos(this.pos),i=a.join(" ")}var c=xd("code",s);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?c.literal=i.slice(1,i.length-1):c.literal=i,c.tickCount=n.length,e.appendChild(c),!0}return this.pos=o,e.appendChild(Ed(n,this.sourcepos(t,this.pos-1))),!0},e.prototype.parseBackslash=function(e){var t,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,t=xd("linebreak",this.sourcepos(this.pos-1,this.pos)),e.appendChild(t),this.nextLine()):Xd.test(n.charAt(this.pos))?(e.appendChild(Ed(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):e.appendChild(Ed("\\",this.sourcepos(r,r))),!0},e.prototype.parseAutolink=function(e){var t,n,r,o=this.pos+1;return(t=this.match(np))?(n=t.slice(1,t.length-1),(r=xd("link",this.sourcepos(o,this.pos))).destination=Yu("mailto:"+n),r.title="",r.appendChild(Ed(n,this.sourcepos(o+1,this.pos-1))),e.appendChild(r),!0):!!(t=this.match(rp))&&(n=t.slice(1,t.length-1),(r=xd("link",this.sourcepos(o,this.pos))).destination=Yu(n),r.title="",r.appendChild(Ed(n,this.sourcepos(o+1,this.pos-1))),e.appendChild(r),!0)},e.prototype.parseHtmlTag=function(e){var t=this.pos+1,n=this.match(Ld);if(null===n)return!1;var r=xd("htmlInline",this.sourcepos(t,this.pos));return r.literal=n,e.appendChild(r),!0},e.prototype.scanDelims=function(e){var t=0,n=this.pos;if(e===$d||e===_d)t++,this.pos++;else for(;this.peek()===e;)t++,this.pos++;if(0===t||t<2&&(126===e||e===Ud))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":Pd(i);var s,a,l=sp.test(r),c=Jd.test(r),u=sp.test(o),d=Jd.test(o),p=!l&&(!c||u||d),h=!u&&(!d||l||c);return 95===e?(s=p&&(!h||d),a=h&&(!p||c)):e===$d||e===_d?(s=p&&!h,a=h):e===Ud?(s=!l,a=!u):(s=p,a=h),this.pos=n,{numdelims:t,canOpen:s,canClose:a}},e.prototype.handleDelim=function(e,t){var n=this.scanDelims(e);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=Ed(e===$d?"’":e===_d?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return t.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||e!==$d&&e!==_d)&&(this.delimiters={cc:e,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},e.prototype.removeDelimiter=function(e){null!==e.previous&&(e.previous.next=e.next),null===e.next?this.delimiters=e.previous:e.next.previous=e.previous},e.prototype.removeDelimitersBetween=function(e,t){e.next!==t&&(e.next=t,t.previous=e)},e.prototype.processEmphasis=function(e){var t,n,r,o,i,s,a,l=!1,c=((t={})[95]=[e,e,e],t[42]=[e,e,e],t[39]=[e],t[34]=[e],t[126]=[e],t[36]=[e],t);for(r=this.delimiters;null!==r&&r.previous!==e;)r=r.previous;for(;null!==r;){var u=r.cc,d=95===u||42===u;if(r.canClose){for(n=r.previous,a=!1;null!==n&&n!==e&&n!==c[u][d?r.origdelims%3:0];){if(l=d&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!l){a=!0;break}n=n.previous}if(o=r,d||126===u||u===Ud)if(a){if(n){var p=r.numdelims>=2&&n.numdelims>=2?2:1,h=d?0:1;i=n.node,s=r.node;var f=d?1===p?"emph":"strong":"strike";u===Ud&&(f="customInline");var m=xd(f),g=i.sourcepos[1],v=s.sourcepos[0];m.sourcepos=[[g[0],g[1]-p+1],[v[0],v[1]+p-1]],i.sourcepos[1][1]-=p,s.sourcepos[0][1]+=p,i.literal=i.literal.slice(p),s.literal=s.literal.slice(p),n.numdelims-=p,r.numdelims-=p;for(var y=i.next,b=void 0;y&&y!==s;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===Ud){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length<=x.length?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=h&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=h){0===r.numdelims&&s.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===$d?(r.node.literal="’",a&&(n.node.literal="‘"),r=r.next):u===_d&&(r.node.literal="”",a&&(n.node.literal="“"),r=r.next);a||(c[u][d?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==e;)this.removeDelimiter(this.delimiters)},e.prototype.parseLinkTitle=function(){var e=this.match(Kd);return null===e?null:Qu(e.substr(1,e.length-2))},e.prototype.parseLinkDestination=function(){var e=this.match(Gd);if(null===e){if(60===this.peek())return null;for(var t=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&Xd.test(this.subject.charAt(this.pos+1)))this.pos+=1,-1!==this.peek()&&(this.pos+=1);else if(40===r)this.pos+=1,n+=1;else if(41===r){if(n<1)break;this.pos+=1,n-=1}else{if(null!==ip.exec(Pd(r)))break;this.pos+=1}return this.pos===t&&41!==r||0!==n?null:Yu(Qu(e=this.subject.substr(t,this.pos-t)))}return Yu(Qu(e.substr(1,e.length-2)))},e.prototype.parseLinkLabel=function(){var e=this.match(up);return null===e||e.length>1001?0:e.length},e.prototype.parseOpenBracket=function(e){var t=this.pos;this.pos+=1;var n=Ed("[",this.sourcepos(this.pos,this.pos));return e.appendChild(n),this.addBracket(n,t,!1),!0},e.prototype.parseBang=function(e){var t=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=Ed("![",this.sourcepos(this.pos-1,this.pos));e.appendChild(n),this.addBracket(n,t+1,!0)}else n=Ed("!",this.sourcepos(this.pos,this.pos)),e.appendChild(n);return!0},e.prototype.parseCloseBracket=function(e){var t=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return e.appendChild(Ed("]",this.sourcepos(o,o))),!0;if(!i.active)return e.appendChild(Ed("]",this.sourcepos(o,o))),this.removeBracket(),!0;var s=i.image,a=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(t=this.parseLinkDestination())&&this.spnl()&&(ip.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=a);var l="";if(!r){var c=this.pos,u=this.parseLinkLabel();if(u>2?l=this.subject.slice(c,c+u):i.bracketAfter||(l=this.subject.slice(i.index,o)),0===u&&(this.pos=a),l){l=qd(l);var d=this.refMap[l];d&&(t=d.destination,n=d.title,r=!0)}}if(r){var p=xd(s?"image":"link");p.destination=t,p.title=n||"",p.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var h=i.node.next,f=void 0;h;)f=h.next,h.unlink(),p.appendChild(h),h=f;if(e.appendChild(p),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!s)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[e.id]={node:e,refLabel:l}),!0}return this.removeBracket(),this.pos=o,e.appendChild(Ed("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[e.id]={node:e,refLabel:l}),!0},e.prototype.addBracket=function(e,t,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:e,startpos:this.sourcepos(t+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:t,image:n,active:!0}},e.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},e.prototype.parseEntity=function(e){var t,n=this.pos+1;return!!(t=this.match(Zd))&&(e.appendChild(Ed(fu.decodeHTML(t),this.sourcepos(n,this.pos))),!0)},e.prototype.parseString=function(e){var t,n=this.pos+1;if(t=this.match(dp)){if(this.options.smart){var r=t.replace(ep,"…").replace(tp,(function(e){var t=0,n=0;return e.length%3==0?n=e.length/3:e.length%2==0?t=e.length/2:e.length%3==2?(t=1,n=(e.length-2)/3):(t=2,n=(e.length-4)/3),nd("—",n)+nd("–",t)}));e.appendChild(Ed(r,this.sourcepos(n,this.pos)))}else{var o=Ed(t,this.sourcepos(n,this.pos));e.appendChild(o)}return!0}return!1},e.prototype.parseNewline=function(e){this.pos+=1;var t=e.lastChild;if(t&&"text"===t.type&&" "===t.literal[t.literal.length-1]){var n=" "===t.literal[t.literal.length-2],r=t.literal.length;t.literal=t.literal.replace(ap,"");var o=r-t.literal.length;t.sourcepos[1][1]-=o,e.appendChild(xd(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else e.appendChild(xd("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(lp),!0},e.prototype.parseReference=function(e,t){if(!this.options.referenceDefinition)return 0;this.subject=e.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var s=this.parseLinkDestination();if(null===s)return this.pos=r,0;var a=this.pos;this.spnl(),this.pos!==a&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=a);var l=!0;if(null===this.match(cp)&&(""===n?l=!1:(n="",this.pos=a,l=null!==this.match(cp))),!l)return this.pos=r,0;var c=qd(i);if(""===c)return this.pos=r,0;var u=this.getReferenceDefSourcepos(e);e.sourcepos[0][0]=u[1][0]+1;var d=xd("refDef",u);return d.title=n,d.dest=s,d.label=c,e.insertBefore(d),t[c]?this.refDefCandidateMap[d.id]=d:t[c]=rh(d),this.pos-r},e.prototype.mergeTextNodes=function(e){for(var t,n=[];t=e.next();){var r=t.entering,o=t.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],s=n[n.length-1];i.sourcepos&&s.sourcepos&&(i.sourcepos[1]=s.sourcepos[1]),i.next=s.next,i.next&&(i.next.prev=i);for(var a=1;a<n.length;a+=1)i.literal+=n[a].literal,n[a].unlink();n=[]}}},e.prototype.getReferenceDefSourcepos=function(e){for(var t=e.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<t.length;i+=1){var s=t[i];if(ip.test(s))break;if(/\:/.test(s)&&0===r){if(n)break;var a=s.indexOf(":")===s.length-1?i+1:i;o={line:a,ch:t[a].length},n=!0}var l=s.match(/'|"/g);if(l&&(r+=l.length),2===r){o={line:i,ch:s.length};break}}return[[e.sourcepos[0][0],e.sourcepos[0][1]],[e.sourcepos[0][0]+o.line,o.ch]]},e.prototype.parseInline=function(e){var t,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(e);break;case 92:n=this.parseBackslash(e);break;case 96:n=this.parseBackticks(e);break;case 42:case 95:case 126:case Ud:n=this.handleDelim(r,e);break;case $d:case _d:n=!!(null===(t=this.options)||void 0===t?void 0:t.smart)&&this.handleDelim(r,e);break;case 91:n=this.parseOpenBracket(e);break;case 33:n=this.parseBang(e);break;case 93:n=this.parseCloseBracket(e);break;case 60:n=this.parseAutolink(e)||this.parseHtmlTag(e);break;case 38:e.disabledEntityParse||(n=this.parseEntity(e));break;default:n=this.parseString(e)}return n||(this.pos+=1,e.appendChild(Ed(Pd(r),this.sourcepos(this.pos,this.pos+1)))),!0},e.prototype.parse=function(e){for(this.subject=e.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=e.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=e.sourcepos[0][0],function(e){return"heading"===e.type}(e)&&(this.lineOffsets[0]+=e.level+1);this.parseInline(e););e.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(e.walker());var t=this.options,n=t.extendedAutolinks,r=t.customParser;if(n&&function(e,t){var n;"boolean"==typeof t&&(t=Hd);for(var r=function(){var e=n.entering,r=n.node;if(e&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=t(o);if(!i||!i.length)return"continue";for(var s=0,a=r.sourcepos[0],l=a[0],c=a[1],u=function(e,t){return[[l,c+e],[l,c+t]]},d=[],p=0,h=i;p<h.length;p++){var f=h[p],m=f.range,g=f.url,v=f.text;m[0]>s&&d.push(Ed(o.substring(s,m[0]),u(s,m[0]-1)));var y=xd("link",u.apply(void 0,m));y.appendChild(Ed(v,u.apply(void 0,m))),y.destination=g,y.extendedAutolink=!0,d.push(y),s=m[1]+1}s<o.length&&d.push(Ed(o.substring(s),u(s,o.length-1)));for(var b=0,w=d;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=e.next();)r()}(e.walker(),n),r&&e.firstChild)for(var o,i=e.firstChild.walker();o=i.next();){var s=o.node,a=o.entering;r[s.type]&&r[s.type](s,{entering:a,options:this.options})}},e}(),hp=/^\[([ \txX])\][ \t]+/,fp=/[^ \t\f\v\r\n]/,mp=/^(?:`{3,}|~{3,})(?= *$)/;function gp(e){for(var t=e;t;){if(t.lastLineBlank)return!0;var n=t.type;if(t.lastLineChecked||"list"!==n&&"item"!==n){t.lastLineChecked=!0;break}t.lastLineChecked=!0,t=t.lastChild}return!1}function vp(e,t){return t<e.length?e.charCodeAt(t):-1}function yp(e){return!fp.test(e)}function bp(e){return 32===e||9===e}var wp=/^\$\$$/,kp={continue:function(e,t){var n=e.currentLine,r=n.match(wp);if(r)return e.lastLineLength=r[0].length,e.finalize(t,e.lineNumber),2;for(var o=t.offset;o>0&&bp(vp(n,e.offset));)e.advanceOffset(1,!0),o--;return 0},finalize:function(e,t){if(null!==t.stringContent){var n=t.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),s=o.match(/^(\s*)(.*)/);t.info=Qu(s[2].trim()),t.literal=i,t.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},xp={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},Cp={continue:function(){return 0},finalize:function(e,t){for(var n=t.firstChild;n;){if(gp(n)&&n.next){t.listData.tight=!1;break}for(var r=n.firstChild;r;){if(gp(r)&&(n.next||r.next)){t.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(e){return"item"===e},acceptsLines:!1},Tp={continue:function(e,t){var n=e.currentLine,r=e.indent;if(t.isFenced){var o=r<=3&&n.charAt(e.nextNonspace)===t.fenceChar&&n.slice(e.nextNonspace).match(mp);if(o&&o[0].length>=t.fenceLength)return e.lastLineLength=e.offset+r+o[0].length,e.finalize(t,e.lineNumber),2;for(var i=t.fenceOffset;i>0&&bp(vp(n,e.offset));)e.advanceOffset(1,!0),i--}else if(r>=4)e.advanceOffset(4,!0);else{if(!e.blank)return 1;e.advanceNextNonspace()}return 0},finalize:function(e,t){var n;if(null!==t.stringContent){if(t.isFenced){var r=t.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),s=r.slice(o+1),a=i.match(/^(\s*)(.*)/);t.infoPadding=a[1].length,t.info=Qu(a[2].trim()),t.literal=s}else t.literal=null===(n=t.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");t.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},Mp={document:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"item"!==e},acceptsLines:!1},list:Cp,blockQuote:{continue:function(e){var t=e.currentLine;return e.indented||62!==vp(t,e.nextNonspace)?1:(e.advanceNextNonspace(),e.advanceOffset(1,!1),bp(vp(t,e.offset))&&e.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(e){return"item"!==e},acceptsLines:!1},item:{continue:function(e,t){if(e.blank){if(null===t.firstChild)return 1;e.advanceNextNonspace()}else{if(!(e.indent>=t.listData.markerOffset+t.listData.padding))return 1;e.advanceOffset(t.listData.markerOffset+t.listData.padding,!0)}return 0},finalize:function(e,t){if(t.firstChild&&"paragraph"===t.firstChild.type){var n=t.firstChild,r=n.stringContent.match(hp);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,t.listData.task=!0,t.listData.checked=/[xX]/.test(r[1])}}},canContain:function(e){return"item"!==e},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:Tp,htmlBlock:{continue:function(e,t){return!e.blank||6!==t.htmlBlockType&&7!==t.htmlBlockType?0:1},finalize:function(e,t){var n;t.literal=(null===(n=t.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,t.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(e){return e.blank?1:0},finalize:function(e,t){if(null!==t.stringContent){for(var n,r=!1;91===vp(t.stringContent,0)&&(n=e.inlineParser.parseReference(t,e.refMap));)t.stringContent=t.stringContent.slice(n),r=!0;r&&yp(t.stringContent)&&t.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"tableHead"===e||"tableBody"===e},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"tableRow"===e},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableRow"===e||"tableDelimRow"===e},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableCell"===e},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableDelimCell"===e},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:xp,customBlock:kp,frontMatter:xp};function Sp(e){for(var t=0,n=0,r=[],o=0;o<e.length;o+=1)if("|"===e[o]&&"\\"!==e[o-1]){var i=e.substring(t,o);0===t&&rd(i)?n=o+1:r.push(i),t=o+1}return t<e.length&&(rd(i=e.substring(t,e.length))||r.push(i)),[n,r]}function Ep(e,t,n,r){for(var o=[],i=0,s=t;i<s.length;i++){var a=s[i],l=a.match(/^[ \t]+/),c=l?l[0].length:0,u=void 0,d=void 0;if(c===a.length)c=0,u=0,d="";else{var p=a.match(/[ \t]+$/);u=p?p[0].length:0,d=a.slice(c,a.length-u)}var h=r+c,f=xd(e,[[n,r],[n,r+a.length-1]]);f.stringContent=d.replace(/\\\|/g,"|"),f.startIdx=o.length,f.endIdx=o.length,f.lineOffsets=[h-1],f.paddingLeft=c,f.paddingRight=u,o.push(f),r+=a.length+1}return o}function Np(e){var t=null,n=e.stringContent,r=n[0];return":"===n[n.length-1]?t=":"===r?"center":"right":":"===r&&(t="left"),{align:t}}var Op=/^(\$\$)(\s*[a-zA-Z])+/,Dp=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,Ap=/^`{3,}(?!.*`)|^~{3,}/,Lp=[/./,/^<(?:script|pre|style)(?:\s|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Z]/,/^<!\[CDATA\[/,/^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,new RegExp("^(?:"+Dd+"|"+Ad+")\\s*$","i")],Ip=/^(?:=+|-+)[ \t]*$/,Rp=/^#{1,6}(?:[ \t]+|$)/,Pp=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,Bp=/^[*+-]/,Fp=/^(\d{1,9})([.)])/;function Hp(e,t){return e.options.disallowDeepHeading&&("blockQuote"===t.type||"item"===t.type)}var zp=[function(e){return e.indented||62!==vp(e.currentLine,e.nextNonspace)?0:(e.advanceNextNonspace(),e.advanceOffset(1,!1),bp(vp(e.currentLine,e.offset))&&e.advanceOffset(1,!0),e.closeUnmatchedBlocks(),e.addChild("blockQuote",e.nextNonspace),1)},function(e,t){var n;if(!e.indented&&!Hp(e,t)&&(n=e.currentLine.slice(e.nextNonspace).match(Rp))){e.advanceNextNonspace(),e.advanceOffset(n[0].length,!1),e.closeUnmatchedBlocks();var r=e.addChild("heading",e.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=e.currentLine.slice(e.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),e.advanceOffset(e.currentLine.length-e.offset),2}return 0},function(e){var t;if(!e.indented&&(t=e.currentLine.slice(e.nextNonspace).match(Ap))){var n=t[0].length;e.closeUnmatchedBlocks();var r=e.addChild("codeBlock",e.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=t[0][0],r.fenceOffset=e.indent,e.advanceNextNonspace(),e.advanceOffset(n,!1),2}return 0},function(e,t){if(!e.indented&&60===vp(e.currentLine,e.nextNonspace)){var n=e.currentLine.slice(e.nextNonspace),r=e.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(Lp[o]);if(i){if(7===o){if("paragraph"===t.type)return 0;if(r.length>0&&new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return e.closeUnmatchedBlocks(),e.addChild("htmlBlock",e.offset).htmlBlockType=o,2}}}return 0},function(e,t){var n;if(null!==t.stringContent&&!e.indented&&"paragraph"===t.type&&!Hp(e,t.parent)&&(n=e.currentLine.slice(e.nextNonspace).match(Ip))){e.closeUnmatchedBlocks();for(var r=void 0;91===vp(t.stringContent,0)&&(r=e.inlineParser.parseReference(t,e.refMap));)t.stringContent=t.stringContent.slice(r);if(t.stringContent.length>0){var o=xd("heading",t.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=t.stringContent,t.insertAfter(o),t.unlink(),e.tip=o,e.advanceOffset(e.currentLine.length-e.offset,!1),2}return 0}return 0},function(e){return!e.indented&&Pp.test(e.currentLine.slice(e.nextNonspace))?(e.closeUnmatchedBlocks(),e.addChild("thematicBreak",e.nextNonspace),e.advanceOffset(e.currentLine.length-e.offset,!1),2):0},function(e,t){var n,r,o,i=t;return e.indented&&"list"!==t.type||!(n=function(e,t){var n,r,o=e.currentLine.slice(e.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:e.indent,task:!1,checked:!1};if(e.indent>=4)return null;if(n=o.match(Bp))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(Fp))||"paragraph"===t.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=vp(e.currentLine,e.nextNonspace+n[0].length))&&9!==r&&32!==r)return null;if("paragraph"===t.type&&!e.currentLine.slice(e.nextNonspace+n[0].length).match(fp))return null;e.advanceNextNonspace(),e.advanceOffset(n[0].length,!0);var s=e.column,a=e.offset;do{e.advanceOffset(1,!0),r=vp(e.currentLine,e.offset)}while(e.column-s<5&&bp(r));var l=-1===vp(e.currentLine,e.offset),c=e.column-s;return c>=5||c<1||l?(i.padding=n[0].length+1,e.column=s,e.offset=a,bp(vp(e.currentLine,e.offset))&&e.advanceOffset(1,!0)):i.padding=n[0].length+c,i}(e,i))?0:(e.closeUnmatchedBlocks(),"list"===e.tip.type&&(o=n,(r=i.listData).type===o.type&&r.delimiter===o.delimiter&&r.bulletChar===o.bulletChar)||((i=e.addChild("list",e.nextNonspace)).listData=n),(i=e.addChild("item",e.nextNonspace)).listData=n,1)},function(e){return e.indented&&"paragraph"!==e.tip.type&&!e.blank?(e.advanceOffset(4,!0),e.closeUnmatchedBlocks(),e.addChild("codeBlock",e.offset),2):0},function(e,t){var n=t.stringContent;if("paragraph"===t.type&&!e.indented&&!e.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),s=e.currentLine.slice(e.nextNonspace),a=Sp(i),l=a[0],c=a[1],u=Sp(s),d=u[0],p=u[1],h=/^[ \t]*:?-+:?[ \t]*$/;if(!c.length||!p.length||p.some((function(e){return!h.test(e)}))||1===p.length&&0!==s.indexOf("|"))return 0;var f=t.lineOffsets,m=e.lineNumber-1,g=zd(f)+1,v=xd("table",[[m,g],[e.lineNumber,e.offset]]);if(v.columns=p.map((function(){return{align:null}})),t.insertAfter(v),1===f.length)t.unlink();else{t.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;e.lastLineLength=f[f.length-2]+y,e.finalize(t,m-1)}e.advanceOffset(e.currentLine.length-e.offset,!1);var b=xd("tableHead",[[m,g],[e.lineNumber,e.offset]]);v.appendChild(b);var w=xd("tableRow",[[m,g],[m,g+i.length-1]]),k=xd("tableDelimRow",[[e.lineNumber,e.nextNonspace+1],[e.lineNumber,e.offset]]);b.appendChild(w),b.appendChild(k),Ep("tableCell",c,m,g+l).forEach((function(e){w.appendChild(e)}));var x=Ep("tableDelimCell",p,e.lineNumber,e.nextNonspace+1+d);return x.forEach((function(e){k.appendChild(e)})),v.columns=x.map(Np),e.tip=v,2}return 0},function(e,t){if("table"!==t.type&&"tableBody"!==t.type||!e.blank&&-1===e.currentLine.indexOf("|"))return 0;if(e.advanceOffset(e.currentLine.length-e.offset,!1),e.blank){var n=t;return"tableBody"===t.type&&(n=t.parent,e.finalize(t,e.lineNumber-1)),e.finalize(n,e.lineNumber-1),0}var r=t;"table"===t.type&&((r=e.addChild("tableBody",e.nextNonspace)).stringContent=null);var o=xd("tableRow",[[e.lineNumber,e.nextNonspace+1],[e.lineNumber,e.currentLine.length]]);r.appendChild(o);var i=r.parent,s=Sp(e.currentLine.slice(e.nextNonspace)),a=s[0];return Ep("tableCell",s[1],e.lineNumber,e.nextNonspace+1+a).forEach((function(e,t){t>=i.columns.length&&(e.ignored=!0),o.appendChild(e)})),2},function(e){var t;if(!e.indented&&!Dp.test(e.currentLine)&&(t=e.currentLine.match(Op))){var n=t[1].length;e.closeUnmatchedBlocks();var r=e.addChild("customBlock",e.nextNonspace);return r.syntaxLength=n,r.offset=e.indent,e.advanceNextNonspace(),e.advanceOffset(n,!1),2}return 0}],qp=/^(-{3}|\+{3}|;{3})$/,Vp=function(e,t){var n=e.currentLine,r=e.lineNumber,o=e.indented;return 1===r&&!o&&"document"===t.type&&qp.test(n)?(e.closeUnmatchedBlocks(),e.addChild("frontMatter",e.nextNonspace).stringContent=n,e.advanceNextNonspace(),e.advanceOffset(n.length,!1),2):0},jp={continue:function(e,t){var n=e.currentLine,r=n.match(qp);return"frontMatter"===t.type&&r?(t.stringContent+=n,e.lastLineLength=r[0].length,e.finalize(t,e.lineNumber),2):0},finalize:function(e,t){null!==t.stringContent&&(t.literal=t.stringContent,t.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},$p=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],_p=/^[#`~*+_=<>0-9-;$]/,Up=/\r\n|\n|\r/;function Wp(){return xd("document",[[1,1],[0,0]])}var Jp={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},Kp=function(){function e(e){this.options=lu(lu({},Jp),e),this.doc=Wp(),this.tip=this.doc,this.oldtip=this.doc,this.lineNumber=0,this.offset=0,this.column=0,this.nextNonspace=0,this.nextNonspaceColumn=0,this.indent=0,this.currentLine="",this.indented=!1,this.blank=!1,this.partiallyConsumedTab=!1,this.allClosed=!0,this.lastMatchedContainer=this.doc,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.lastLineLength=0,this.lines=[],this.options.frontMatter&&(Mp.frontMatter=jp,zp.unshift(Vp)),this.inlineParser=new pp(this.options)}return e.prototype.advanceOffset=function(e,t){void 0===t&&(t=!1);for(var n,r,o,i=this.currentLine;e>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,t?(this.partiallyConsumedTab=n>e,r=n>e?e:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,e-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,e-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,e-=1)},e.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},e.prototype.findNextNonspace=function(){for(var e,t=this.currentLine,n=this.offset,r=this.column;""!==(e=t.charAt(n));)if(" "===e)n++,r++;else{if("\t"!==e)break;n++,r+=4-r%4}this.blank="\n"===e||"\r"===e||""===e,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},e.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var e=4-this.column%4;this.tip.stringContent+=nd(" ",e)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},e.prototype.addChild=function(e,t){for(;!Mp[this.tip.type].canContain(e);)this.finalize(this.tip,this.lineNumber-1);var n=t+1,r=xd(e,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},e.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var e=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=e}this.allClosed=!0}},e.prototype.finalize=function(e,t){var n=e.parent;e.open=!1,e.sourcepos[1]=[t,this.lastLineLength],Mp[e.type].finalize(this,e),this.tip=n},e.prototype.processInlines=function(e){var t,n=this.options.customParser,r=e.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;t=r.next();){var o=t.node,i=t.entering,s=o.type;n&&n[s]&&n[s](o,{entering:i,options:this.options}),i||"paragraph"!==s&&"heading"!==s&&("tableCell"!==s||o.ignored)||this.inlineParser.parse(o)}},e.prototype.incorporateLine=function(e){var t=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==e.indexOf("\0")&&(e=e.replace(/\0/g,"�")),this.currentLine=e;for(var n,r=!0;(n=t.lastChild)&&n.open;){switch(t=n,this.findNextNonspace(),Mp[t.type].continue(this,t)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=e.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){t=t.parent;break}}this.allClosed=t===this.oldtip,this.lastMatchedContainer=t;for(var o="paragraph"!==t.type&&Mp[t.type].acceptsLines,i=zp.length;!o;){if(this.findNextNonspace(),"table"!==t.type&&"tableBody"!==t.type&&"paragraph"!==t.type&&!this.indented&&!_p.test(e.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var s=0;s<i;){var a=zp[s](this,t);if(1===a){t=this.tip;break}if(2===a){t=this.tip,o=!0;break}s++}if(s===i){this.advanceNextNonspace();break}}if(this.allClosed||this.blank||"paragraph"!==this.tip.type){this.closeUnmatchedBlocks(),this.blank&&t.lastChild&&(t.lastChild.lastLineBlank=!0);for(var l=t.type,c=this.blank&&!("blockQuote"===l||Cd(t)&&t.isFenced||"item"===l&&!t.firstChild&&t.sourcepos[0][0]===this.lineNumber),u=t;u;)u.lastLineBlank=c,u=u.parent;Mp[l].acceptsLines?(this.addLine(),"htmlBlock"===t.type&&t.htmlBlockType>=1&&t.htmlBlockType<=5&&$p[t.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=e.length,this.finalize(t,this.lineNumber))):this.offset<e.length&&!this.blank&&(t=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=e.length},e.prototype.parse=function(e,t){this.doc=Wp(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=e.split(Up),r=n.length;this.lines=t||n,this.options.referenceDefinition&&this.clearRefMaps(),10===e.charCodeAt(e.length-1)&&(r-=1);for(var o=0;o<r;o++)this.incorporateLine(n[o]);for(;this.tip;)this.finalize(this.tip,r);return this.processInlines(this.doc),this.doc},e.prototype.partialParseStart=function(e,t){this.doc=Wp(),this.tip=this.doc,this.lineNumber=e-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=t.length,r=0;r<n;r++)this.incorporateLine(t[r]);return this.doc},e.prototype.partialParseExtends=function(e){for(var t=0;t<e.length;t++)this.incorporateLine(e[t])},e.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},e.prototype.setRefMaps=function(e,t,n){this.refMap=e,this.refLinkCandidateMap=t,this.refDefCandidateMap=n},e.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(e){var t;t=e,Object.keys(t).forEach((function(e){delete t[e]}))}))},e}();function Gp(e,t){return e[0]<t[0]?1:e[0]>t[0]?-1:e[1]<t[1]?1:e[1]>t[1]?-1:0}function Xp(e,t){var n=e[0];return 1===Gp(e[1],t)?1:-1===Gp(n,t)?-1:0}function Zp(e,t){for(var n=0,r=t;n<r.length;n++){var o=r[n];e.insertBefore(o)}}function Qp(e,t){var n=e[0];return e[1][0]<t?1:n[0]>t?-1:0}function Yp(e,t){for(var n=e.firstChild;n;){var r=Qp(n.sourcepos,t);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return e.lastChild}function eh(e){return function(e){return ad[e]}(e)||null}function th(e,t,n){if(void 0===n&&(n=null),t)for(var r=t.walker();t&&t!==n;){e(t);var o=r.next();if(!o)break;t=o.node}}var nh=/\r\n|\n|\r/;function rh(e){return{id:e.id,title:e.title,sourcepos:e.sourcepos,unlinked:!1,destination:e.dest}}var oh=function(){function e(e,t){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==t?void 0:t.referenceDefinition),this.parser=new Kp(t),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},e=e||"",this.lineTexts=e.split(nh),this.root=this.parser.parse(e,this.lineTexts)}return e.prototype.updateLineTexts=function(e,t,n){var r,o=e[0],i=e[1],s=t[0],a=t[1],l=n.split(nh),c=l.length,u=this.lineTexts[o-1],d=this.lineTexts[s-1];l[0]=u.slice(0,i-1)+l[0],l[c-1]=l[c-1]+d.slice(a-1);var p=s-o+1;return(r=this.lineTexts).splice.apply(r,cu([o-1,p],l)),c-p},e.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var e=this.lineTexts,t=e.length-1;""===e[t];)t-=1;e.length-2>t&&(t+=1),this.root.sourcepos[1]=[t+1,e[t].length]},e.prototype.replaceRangeNodes=function(e,t,n){e?(Zp(e,n),function(e,t){if(e.parent===t.parent&&e!==t){for(var n=e.next;n&&n!==t;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var s=i[o];n[s]&&(ld(n[s].id),n[s]=null)}n=r}e.next=t.next,t.next?t.next.prev=e:e.parent.lastChild=e}}(e,t),[e.id,t.id].forEach((function(e){return ld(e)})),e.unlink()):t?(Zp(t,n),ld(t.id),t.unlink()):function(e,t){for(var n=t.length-1;n>=0;n-=1)e.prependChild(t[n])}(this.root,n)},e.prototype.getNodeRange=function(e,t){var n=Yp(this.root,e[0]),r=Yp(this.root,t[0]);return r&&r.next&&t[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},e.prototype.trigger=function(e,t){this.eventHandlerMap[e].forEach((function(e){e(t)}))},e.prototype.extendEndLine=function(e){for(;""===this.lineTexts[e];)e+=1;return e},e.prototype.parseRange=function(e,t,n,r){var o;e&&e.prev&&(Td(e.prev)&&function(e){var t=e.match(/^[ \t]+/);if(t&&(t[0].length>=2||/\t/.test(t[0])))return!0;var n=t?e.slice(t.length):e;return Bp.test(n)||Fp.test(n)}(this.lineTexts[n-1])||"table"===e.prev.type&&!yp(o=this.lineTexts[n-1])&&-1!==o.indexOf("|"))&&(n=(e=e.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),s=this.parser.partialParseStart(n,i),a=t?t.next:this.root.firstChild,l=s.lastChild,c=l&&Cd(l)&&l.open,u=l&&Sd(l)&&l.open,d=l&&Td(l);(c||u)&&a||d&&a&&("list"===a.type||a.sourcepos[0][1]>=2);){var p=this.extendEndLine(a.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,p)),e||(e=t),t=a,r=p,a=a.next}return this.parser.partialParseFinish(),{newNodes:function(e){for(var t=[],n=e.firstChild;n;)t.push(n),n=n.next;return t}(s),extStartNode:e,extEndNode:t}},e.prototype.getRemovedNodeRange=function(e,t){return!e||e&&Md(e)||t&&Md(t)?null:{id:[e.id,t.id],line:[e.sourcepos[0][0]-1,t.sourcepos[1][0]-1]}},e.prototype.markDeletedRefMap=function(e,t){var n=this;if(!jd(this.refMap)){var r=function(e){if(Md(e)){var t=n.refMap[e.label];t&&e.id===t.id&&(t.unlinked=!0)}};e&&th(r,e.parent,t),t&&th(r,t)}},e.prototype.replaceWithNewRefDefState=function(e){var t=this;if(!jd(this.refMap)){var n=function(e){if(Md(e)){var n=e.label,r=t.refMap[n];r&&!r.unlinked||(t.refMap[n]=rh(e))}};e.forEach((function(e){th(n,e)}))}},e.prototype.replaceWithRefDefCandidate=function(){var e=this;jd(this.refDefCandidateMap)||Vd(this.refDefCandidateMap,(function(t,n){var r=n.label,o=n.sourcepos,i=e.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(e.refMap[r]=rh(n))}))},e.prototype.getRangeWithRefDef=function(e,t,n,r,o){if(this.referenceDefinition&&!jd(this.refMap)){var i=Yp(this.root,e-1),s=Yp(this.root,t+1);i&&Md(i)&&i!==n&&i!==r&&(e=(n=i).sourcepos[0][0]),s&&Md(s)&&s!==n&&s!==r&&(r=s,t=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,e,t]},e.prototype.parse=function(e,t,n){void 0===n&&(n=0);var r=this.getNodeRange(e,t),o=r[0],i=r[1],s=o?Math.min(o.sourcepos[0][0],e[0]):e[0],a=this.extendEndLine((i?Math.max(i.sourcepos[1][0],t[0]):t[0])+n),l=this.parseRange.apply(this,this.getRangeWithRefDef(s,a,o,i,n)),c=l.newNodes,u=l.extStartNode,d=l.extEndNode,p=this.getRemovedNodeRange(u,d),h=d?d.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,d),this.replaceRangeNodes(u,d,c),this.replaceWithNewRefDefState(c)):this.replaceRangeNodes(u,d,c),{nodes:c,removedNodeRange:p,nextNode:h}},e.prototype.parseRefLink=function(){var e=this,t=[];return jd(this.refMap)||Vd(this.refMap,(function(n,r){r.unlinked&&delete e.refMap[n],Vd(e.refLinkCandidateMap,(function(r,o){var i=o.node;o.refLabel===n&&t.push(e.parse(i.sourcepos[0],i.sourcepos[1]))}))})),t},e.prototype.removeUnlinkedCandidate=function(){jd(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(e){Vd(e,(function(t){(function(e){var t=eh(e);if(!t)return!0;for(;t&&"document"!==t.type;){if(!t.parent&&!t.prev&&!t.next)return!0;t=t.parent}return!1})(t)&&delete e[t]}))}))},e.prototype.editMarkdown=function(e,t,n){var r=this.updateLineTexts(e,t,n),o=this.parse(e,t,r),i=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=lu({},e);return t.forEach((function(e){delete r[e]})),r}(o,"nextNode");!function(e,t){if(e&&e.parent&&0!==t){var n,r=e.parent.walker();for(r.resumeAt(e,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=t,o.sourcepos[1][0]+=t)}}}(o.nextNode,r),this.updateRootNodeState();var s=[i];return this.referenceDefinition&&(this.removeUnlinkedCandidate(),this.replaceWithRefDefCandidate(),s=s.concat(this.parseRefLink())),this.trigger("change",s),s},e.prototype.getLineTexts=function(){return this.lineTexts},e.prototype.getRootNode=function(){return this.root},e.prototype.findNodeAtPosition=function(e){var t=function(e,t){for(var n=e,r=null;n;){var o=Xp(n.sourcepos,t);if(0===o){if(!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)return r;if(!n.next)return r;n=n.next}}return n}(this.root,e);return t&&t!==this.root?t:null},e.prototype.findFirstNodeAtLine=function(e){return function(e,t){for(var n=e.firstChild,r=null;n;){var o=Qp(n.sourcepos,t);if(0===o){if(n.sourcepos[0][0]===t||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(e){for(;e.parent&&"document"!==e.parent.type&&e.parent.sourcepos[0][0]===e.sourcepos[0][0];)e=e.parent;return e}(function(e){for(;e.lastChild;)e=e.lastChild;return e}(r)):null}(this.root,e)},e.prototype.on=function(e,t){this.eventHandlerMap[e].push(t)},e.prototype.off=function(e,t){var n=this.eventHandlerMap[e],r=n.indexOf(t);n.splice(r,1)},e.prototype.findNodeById=function(e){return eh(e)},e.prototype.removeAllNode=function(){ad={}},e}(),ih=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function sh(e){return ih.test(e)?e.replace(ih,(function(e,t){return"&lt;"+t})):e}var ah={heading:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"h"+e.level,outerNewLine:!0}},text:function(e){return{type:"text",content:e.literal}},softbreak:function(e,t){return{type:"html",content:t.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"em"}},strong:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(e,t){var n,r=t.entering,o=null===(n=e.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(e,t){var n=t.entering,r=e.listData,o=r.type,i=r.start,s="bullet"===o?"ul":"ol",a={};return"ol"===s&&null!==i&&1!==i&&(a.start=i.toString()),{type:n?"openTag":"closeTag",tagName:s,attributes:a,outerNewLine:!0}},item:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(e,t){return{type:"html",content:t.options.tagFilter?sh(e.literal):e.literal}},htmlBlock:function(e,t){var n=t.options,r=n.tagFilter?sh(e.literal):e.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(e){return[{type:"openTag",tagName:"code"},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(e){var t=e.info,n=t?t.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+td(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(e,t){if(t.entering){var n=e,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:lu({href:td(o)},r&&{title:td(r)})}}return{type:"closeTag",tagName:"a"}},image:function(e,t){var n=t.getChildrenText,r=t.skipChildren,o=e,i=o.title,s=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:lu({src:td(s),alt:n(e)},i&&{title:td(i)})}},customBlock:function(e,t,n){var r=e.info.trim().toLowerCase(),o=n[r];if(o)try{return o(e,t)}catch(e){console.warn("[@toast-ui/editor] - The error occurred when "+r+" block node was parsed in markdown renderer: "+e)}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:e.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(e){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:e.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(e,t,n){var r=e,o=r.info,i=r.firstChild,s=o.trim().toLowerCase(),a=n[s],l=t.entering;if(a)try{return a(e,t)}catch(e){console.warn("[@toast-ui/editor] - The error occurred when "+s+" inline node was parsed in markdown renderer: "+e)}return l?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+o+(i?" ":"")}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},lh={strike:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"del"}},item:function(e,t){var n=t.entering,r=e.listData,o=r.checked,i=r.task;if(n){var s={type:"openTag",tagName:"li",outerNewLine:!0};return i?[s,{type:"openTag",tagName:"input",selfClose:!0,attributes:lu(lu({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(e,t){if(t.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(e.lastChild)for(var r=e.parent.parent.columns.length,o=e.lastChild.endIdx+1;o<r;o+=1)n.push({type:"openTag",tagName:"td",outerNewLine:!0},{type:"closeTag",tagName:"td",outerNewLine:!0});return n.push({type:"closeTag",tagName:"tr",outerNewLine:!0}),n},tableCell:function(e,t){var n=t.entering;if(e.ignored)return{type:"text",content:""};var r=e.parent.parent,o="tableHead"===r.type?"th":"td",i=r.parent.columns[e.startIdx],s=(null==i?void 0:i.align)?{align:i.align}:null;return n?lu({type:"openTag",tagName:o,outerNewLine:!0},s&&{attributes:s}):{type:"closeTag",tagName:o,outerNewLine:!0}}},ch={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function uh(e){for(var t=[],n=e.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&t.push(o.literal)}return t.join("")}var dh=function(){function e(e){this.buffer=[],this.options=lu(lu({},ch),e),this.convertors=this.createConvertors(),delete this.options.convertors}return e.prototype.createConvertors=function(){var e=lu({},ah);if(this.options.gfm&&(e=lu(lu({},e),lh)),this.options.convertors){var t=this.options.convertors,n=Object.keys(t),r=lu(lu({},ah),lh);n.forEach((function(n){var o=e[n],i=t[n],s=-1===Object.keys(r).indexOf(n)?n.toLowerCase():n;e[s]=o?function(e,t,n){return t.origin=function(){return o(e,t,n)},i(e,t)}:i}))}return e},e.prototype.getConvertors=function(){return this.convertors},e.prototype.getOptions=function(){return this.options},e.prototype.render=function(e){var t=this;this.buffer=[];for(var n=e.walker(),r=null,o=function(){var e=r.node,o=r.entering,s=i.convertors[e.type];if(!s)return"continue";var a=!1,l={entering:o,leaf:!id(e),options:i.options,getChildrenText:uh,skipChildren:function(){a=!0}},c=Sd(e)||function(e){return"customInline"===e.type}(e)?s(e,l,i.convertors):s(e,l);c&&((Array.isArray(c)?c:[c]).forEach((function(n,r){"openTag"===n.type&&t.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(e.id)),t.renderHTMLNode(n)})),a&&(n.resumeAt(e,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},e.prototype.renderHTMLNode=function(e){switch(e.type){case"openTag":case"closeTag":this.renderElementNode(e);break;case"text":this.renderTextNode(e);break;case"html":this.renderRawHtmlNode(e)}},e.prototype.generateOpenTagString=function(e){var t=this,n=e.tagName,r=e.classNames,o=e.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach((function(e){var n=o[e];t.buffer.push(" "+e+'="'+n+'"')})),e.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},e.prototype.generateCloseTagString=function(e){var t=e.tagName;this.buffer.push("</"+t+">")},e.prototype.addNewLine=function(){this.buffer.length&&"\n"!==zd(zd(this.buffer))&&this.buffer.push("\n")},e.prototype.addOuterNewLine=function(e){e.outerNewLine&&this.addNewLine()},e.prototype.addInnerNewLine=function(e){e.innerNewLine&&this.addNewLine()},e.prototype.renderTextNode=function(e){this.buffer.push(td(e.content))},e.prototype.renderRawHtmlNode=function(e){this.addOuterNewLine(e),this.buffer.push(e.content),this.addOuterNewLine(e)},e.prototype.renderElementNode=function(e){"openTag"===e.type?(this.addOuterNewLine(e),this.generateOpenTagString(e),e.selfClose?this.addOuterNewLine(e):this.addInnerNewLine(e)):(this.addInnerNewLine(e),this.generateCloseTagString(e),this.addOuterNewLine(e))},e}(),ph=Object.hasOwnProperty,hh=Object.setPrototypeOf,fh=Object.isFrozen,mh=Object.getPrototypeOf,gh=Object.getOwnPropertyDescriptor,vh=Object.freeze,yh=Object.seal,bh=Object.create,wh="undefined"!=typeof Reflect&&Reflect,kh=wh.apply,xh=wh.construct;kh||(kh=function(e,t,n){return e.apply(t,n)}),vh||(vh=function(e){return e}),yh||(yh=function(e){return e}),xh||(xh=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Ch,Th=Rh(Array.prototype.forEach),Mh=Rh(Array.prototype.pop),Sh=Rh(Array.prototype.push),Eh=Rh(String.prototype.toLowerCase),Nh=Rh(String.prototype.match),Oh=Rh(String.prototype.replace),Dh=Rh(String.prototype.indexOf),Ah=Rh(String.prototype.trim),Lh=Rh(RegExp.prototype.test),Ih=(Ch=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return xh(Ch,t)});function Rh(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return kh(e,t,r)}}function Ph(e,t){hh&&hh(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=Eh(r);o!==r&&(fh(t)||(t[n]=o),r=o)}e[r]=!0}return e}function Bh(e){var t=bh(null),n=void 0;for(n in e)kh(ph,e,[n])&&(t[n]=e[n]);return t}function Fh(e,t){for(;null!==e;){var n=gh(e,t);if(n){if(n.get)return Rh(n.get);if("function"==typeof n.value)return Rh(n.value)}e=mh(e)}return function(e){return console.warn("fallback value for",e),null}}var Hh=vh(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zh=vh(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),qh=vh(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Vh=vh(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),jh=vh(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),$h=vh(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_h=vh(["#text"]),Uh=vh(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Wh=vh(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Jh=vh(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kh=vh(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gh=yh(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Xh=yh(/<%[\s\S]*|[\s\S]*%>/gm),Zh=yh(/^data-[\-\w.\u00B7-\uFFFF]/),Qh=yh(/^aria-[\-\w]+$/),Yh=yh(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ef=yh(/^(?:\w+script|data):/i),tf=yh(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function rf(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var of=function(){return"undefined"==typeof window?null:window},sf=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:of(),n=function(t){return e(t)};if(n.version="2.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,i=t.DocumentFragment,s=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,d=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,p=t.Text,h=t.Comment,f=t.DOMParser,m=t.trustedTypes,g=l.prototype,v=Fh(g,"cloneNode"),y=Fh(g,"nextSibling"),b=Fh(g,"childNodes"),w=Fh(g,"parentNode");if("function"==typeof s){var k=o.createElement("template");k.content&&k.content.ownerDocument&&(o=k.content.ownerDocument)}var x=function(e,t){if("object"!==(void 0===e?"undefined":nf(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,r),C=x&&te?x.createHTML(""):"",T=o,M=T.implementation,S=T.createNodeIterator,E=T.createDocumentFragment,N=T.getElementsByTagName,O=r.importNode,D={};try{D=Bh(o).documentMode?o.documentMode:{}}catch(e){}var A={};n.isSupported="function"==typeof w&&M&&void 0!==M.createHTMLDocument&&9!==D;var L=Gh,I=Xh,R=Zh,P=Qh,B=ef,F=tf,H=Yh,z=null,q=Ph({},[].concat(rf(Hh),rf(zh),rf(qh),rf(jh),rf(_h))),V=null,j=Ph({},[].concat(rf(Uh),rf(Wh),rf(Jh),rf(Kh))),$=null,_=null,U=!0,W=!0,J=!1,K=!1,G=!1,X=!1,Z=!1,Q=!1,Y=!1,ee=!0,te=!1,ne=!0,re=!0,oe=!1,ie={},se=null,ae=Ph({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),le=null,ce=Ph({},["audio","video","img","source","image","track"]),ue=null,de=Ph({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml",me=fe,ge=!1,ve=void 0,ye=["application/xhtml+xml","text/html"],be=void 0,we=null,ke=o.createElement("form"),xe=function(e){we&&we===e||(e&&"object"===(void 0===e?"undefined":nf(e))||(e={}),e=Bh(e),z="ALLOWED_TAGS"in e?Ph({},e.ALLOWED_TAGS):q,V="ALLOWED_ATTR"in e?Ph({},e.ALLOWED_ATTR):j,ue="ADD_URI_SAFE_ATTR"in e?Ph(Bh(de),e.ADD_URI_SAFE_ATTR):de,le="ADD_DATA_URI_TAGS"in e?Ph(Bh(ce),e.ADD_DATA_URI_TAGS):ce,se="FORBID_CONTENTS"in e?Ph({},e.FORBID_CONTENTS):ae,$="FORBID_TAGS"in e?Ph({},e.FORBID_TAGS):{},_="FORBID_ATTR"in e?Ph({},e.FORBID_ATTR):{},ie="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,K=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,Q=e.RETURN_DOM||!1,Y=e.RETURN_DOM_FRAGMENT||!1,ee=!1!==e.RETURN_DOM_IMPORT,te=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,re=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,H=e.ALLOWED_URI_REGEXP||H,me=e.NAMESPACE||fe,ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===ve?function(e){return e}:Eh,K&&(W=!1),Y&&(Q=!0),ie&&(z=Ph({},[].concat(rf(_h))),V=[],!0===ie.html&&(Ph(z,Hh),Ph(V,Uh)),!0===ie.svg&&(Ph(z,zh),Ph(V,Wh),Ph(V,Kh)),!0===ie.svgFilters&&(Ph(z,qh),Ph(V,Wh),Ph(V,Kh)),!0===ie.mathMl&&(Ph(z,jh),Ph(V,Jh),Ph(V,Kh))),e.ADD_TAGS&&(z===q&&(z=Bh(z)),Ph(z,e.ADD_TAGS)),e.ADD_ATTR&&(V===j&&(V=Bh(V)),Ph(V,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&Ph(ue,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(se===ae&&(se=Bh(se)),Ph(se,e.FORBID_CONTENTS)),re&&(z["#text"]=!0),G&&Ph(z,["html","head","body"]),z.table&&(Ph(z,["tbody"]),delete $.tbody),vh&&vh(e),we=e)},Ce=Ph({},["mi","mo","mn","ms","mtext"]),Te=Ph({},["foreignobject","desc","title","annotation-xml"]),Me=Ph({},zh);Ph(Me,qh),Ph(Me,Vh);var Se=Ph({},jh);Ph(Se,$h);var Ee=function(e){Sh(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=C}catch(t){e.remove()}}},Ne=function(e,t){try{Sh(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Sh(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!V[e])if(Q||Y)try{Ee(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Oe=function(e){var t=void 0,n=void 0;if(Z)e="<remove></remove>"+e;else{var r=Nh(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=x?x.createHTML(e):e;if(me===fe)try{t=(new f).parseFromString(i,ve)}catch(e){}if(!t||!t.documentElement){t=M.createDocument(me,"template",null);try{t.documentElement.innerHTML=ge?"":i}catch(e){}}var s=t.body||t.documentElement;return e&&n&&s.insertBefore(o.createTextNode(n),s.childNodes[0]||null),me===fe?N.call(t,G?"html":"body")[0]:G?t.documentElement:s},De=function(e){return S.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ae=function(e){return"object"===(void 0===a?"undefined":nf(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":nf(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,r){A[e]&&Th(A[e],(function(e){e.call(n,t,r,we)}))},Ie=function(e){var t,r=void 0;if(Le("beforeSanitizeElements",e,null),!((t=e)instanceof p||t instanceof h||"string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof d&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore))return Ee(e),!0;if(Nh(e.nodeName,/[\u0080-\uFFFF]/))return Ee(e),!0;var o=be(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:o,allowedTags:z}),!Ae(e.firstElementChild)&&(!Ae(e.content)||!Ae(e.content.firstElementChild))&&Lh(/<[/\w]/g,e.innerHTML)&&Lh(/<[/\w]/g,e.textContent))return Ee(e),!0;if("select"===o&&Lh(/<template/i,e.innerHTML))return Ee(e),!0;if(!z[o]||$[o]){if(re&&!se[o]){var i=w(e)||e.parentNode,s=b(e)||e.childNodes;if(s&&i)for(var a=s.length-1;a>=0;--a)i.insertBefore(v(s[a],!0),y(e))}return Ee(e),!0}return e instanceof l&&!function(e){var t=w(e);t&&t.tagName||(t={namespaceURI:fe,tagName:"template"});var n=Eh(e.tagName),r=Eh(t.tagName);if(e.namespaceURI===he)return t.namespaceURI===fe?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===r||Ce[r]):Boolean(Me[n]);if(e.namespaceURI===pe)return t.namespaceURI===fe?"math"===n:t.namespaceURI===he?"math"===n&&Te[r]:Boolean(Se[n]);if(e.namespaceURI===fe){if(t.namespaceURI===he&&!Te[r])return!1;if(t.namespaceURI===pe&&!Ce[r])return!1;var o=Ph({},["title","style","font","a","script"]);return!Se[n]&&(o[n]||!Me[n])}return!1}(e)?(Ee(e),!0):"noscript"!==o&&"noembed"!==o||!Lh(/<\/no(script|embed)/i,e.innerHTML)?(K&&3===e.nodeType&&(r=e.textContent,r=Oh(r,L," "),r=Oh(r,I," "),e.textContent!==r&&(Sh(n.removed,{element:e.cloneNode()}),e.textContent=r)),Le("afterSanitizeElements",e,null),!1):(Ee(e),!0)},Re=function(e,t,n){if(ne&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;if(W&&!_[t]&&Lh(R,t));else if(U&&Lh(P,t));else{if(!V[t]||_[t])return!1;if(ue[t]);else if(Lh(H,Oh(n,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Dh(n,"data:")||!le[e])if(J&&!Lh(B,Oh(n,F,"")));else if(n)return!1}return!0},Pe=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;Le("beforeSanitizeAttributes",e,null);var s=e.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V};for(i=s.length;i--;){var l=t=s[i],c=l.name,u=l.namespaceURI;if(r=Ah(t.value),o=be(c),a.attrName=o,a.attrValue=r,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),r=a.attrValue,!a.forceKeepAttr&&(Ne(c,e),a.keepAttr))if(Lh(/\/>/i,r))Ne(c,e);else{K&&(r=Oh(r,L," "),r=Oh(r,I," "));var d=be(e.nodeName);if(Re(d,o,r))try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),Mh(n.removed)}catch(e){}}}Le("afterSanitizeAttributes",e,null)}},Be=function e(t){var n=void 0,r=De(t);for(Le("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Le("uponSanitizeShadowNode",n,null),Ie(n)||(n.content instanceof i&&e(n.content),Pe(n));Le("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var s=void 0,l=void 0,c=void 0,u=void 0,d=void 0;if((ge=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ae(e)){if("function"!=typeof e.toString)throw Ih("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ih("dirty is not a string, aborting")}if(!n.isSupported){if("object"===nf(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Ae(e))return t.toStaticHTML(e.outerHTML)}return e}if(X||xe(o),n.removed=[],"string"==typeof e&&(oe=!1),oe);else if(e instanceof a)1===(l=(s=Oe("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?s=l:s.appendChild(l);else{if(!Q&&!K&&!G&&-1===e.indexOf("<"))return x&&te?x.createHTML(e):e;if(!(s=Oe(e)))return Q?null:C}s&&Z&&Ee(s.firstChild);for(var p=De(oe?e:s);c=p.nextNode();)3===c.nodeType&&c===u||Ie(c)||(c.content instanceof i&&Be(c.content),Pe(c),u=c);if(u=null,oe)return e;if(Q){if(Y)for(d=E.call(s.ownerDocument);s.firstChild;)d.appendChild(s.firstChild);else d=s;return ee&&(d=O.call(r,d,!0)),d}var h=G?s.outerHTML:s.innerHTML;return K&&(h=Oh(h,L," "),h=Oh(h,I," ")),x&&te?x.createHTML(h):h},n.setConfig=function(e){xe(e),X=!0},n.clearConfig=function(){we=null,X=!1},n.isValidAttribute=function(e,t,n){we||xe({});var r=be(e),o=be(t);return Re(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(A[e]=A[e]||[],Sh(A[e],t))},n.removeHook=function(e){A[e]&&Mh(A[e])},n.removeHooks=function(e){A[e]&&(A[e]=[])},n.removeAllHooks=function(){A={}},n}(),af=["iframe","embed"],lf=[];function cf(e){Ns(af,e)&&lf.push(e.toLowerCase())}function uf(e,t){return sf.sanitize(e,Li({ADD_TAGS:lf,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},t))}function df(e,t){return e.literal.replace(new RegExp("(<\\s*"+t+"[^>]*>)|(</"+t+"\\s*[>])","ig"),"").trim()}function pf(e){var t=(e=e.match(Ba)[0]).match(new RegExp(Ia,"g"));return t?t.reduce((function(e,t){var n=t.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(e[r]=o.join("=").replace(/'|"/g,"").trim()),e}),{}):{}}function hf(e){return Us(e.attributes).reduce((function(e,t){return e[t.nodeName]=t.nodeValue,e}),{})}function ff(e,t,n,r){var o=r.getToDOMNode(t)(e),i=n(o.outerHTML),s=document.createElement("div");return s.innerHTML=i,{dom:o=s.firstChild,htmlAttrs:hf(o)}}var mf={htmlBlock:function(e,t,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:e,getAttrs:function(e){return{htmlAttrs:hf(e),childrenHTML:e.innerHTML}}}],toDOM:function(r){var o=ff(r,e,t,n),i=o.dom,s=o.htmlAttrs;return s.class=s.class?s.class+" html-block":"html-block",Ii([e,s],Us(i.childNodes))}}},htmlInline:function(e,t,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:e,getAttrs:function(e){return{htmlAttrs:hf(e)}}}],toDOM:function(r){var o=ff(r,e,t,n).htmlAttrs;return[e,o,0]}}}},gf=/^\s*<\s*\//,vf={paragraph:function(e,t){var n=t.entering,r=t.origin;return t.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(e){return{type:"html",content:e.prev&&"htmlInline"===e.prev.type&&/<br ?\/?>/.test(e.prev.literal)?"\n":"<br>\n"}},item:function(e,t){if(t.entering){var n={},r=[];return e.listData.task&&(n["data-task"]="",r.push("task-list-item"),e.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(e){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(e.tickCount)}},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(e){var t=e,n=t.fenceLength,r=t.info,o=r?r.split(/\s+/):[],i=[],s={};if(n>3&&(s["data-backticks"]=n),o.length>0&&o[0].length>0){var a=o[0];i.push("lang-"+a),s["data-language"]=a}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:s},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(e,t){var n=t.origin,r=t.entering,o=t.skipChildren,i=e.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:ya(i,xa(e)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function yf(e,t){var n=Li({},vf);return e&&(n.link=function(t,n){var r=n.entering,o=(0,n.origin)();return r&&(o.attributes=Li(Li({},o.attributes),e)),o}),t&&Object.keys(t).forEach((function(e){var r=n[e],o=t[e];r&&cl(o)?n[e]=function(e,t){var n=Li({},t);return n.origin=function(){return r(e,t)},o(e,n)}:Ns(["htmlBlock","htmlInline"],e)&&!cl(o)?n[e]=function(e,t){var n=e.literal.match(Ba);if(n){var r=n[0],i=n[1],s=n[3],a=(i||s).toLowerCase(),l=o[a],c=df(e,a);if(l){var u=Li({},e);return u.attrs=pf(r),u.childrenHTML=c,u.type=a,t.entering=!gf.test(e.literal),l(u,t)}}return t.origin()}:n[e]=o})),n}var bf=["list","item","blockQuote"],wf=["UL","OL","BLOCKQUOTE"];function kf(e,t){var n,r=e.child(t);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function xf(e,t,n){var r=Qs(t)-1,o=Ys(t)-1,i=n[r].getBoundingClientRect(),s=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:s<=0?n[r].clientHeight:s+Cf(e,n,Math.min(o+1,e.childCount-1)),rect:i}}function Cf(e,t,n){for(var r=e.childCount-1,o=0;n<=r&&kf(e,n);)o+=t[n].clientHeight,n+=1;return o}function Tf(e,t){for(var n=0;e&&e!==t&&(Ns(wf,e.tagName)||(n+=e.offsetTop),e.offsetParent!==t.offsetParent);)e=e.parentElement;return n}function Mf(e,t,n){return e&&t>n+e.offsetTop?Mf(e.nextElementSibling,t,n)||e:null}function Sf(e,t){for(var n=e.querySelector('[data-nodeid="'+t.id+'"]');!n||na(t);)t=t.parent,n=e.querySelector('[data-nodeid="'+t.id+'"]');return function(e){for(var t=e.mdNode,n=e.el;(Ns(bf,t.type)||"table"===t.type)&&t.firstChild;)t=t.firstChild,n=n.firstElementChild;return{mdNode:t,el:n}}({mdNode:t,el:n})}var Ef={};function Nf(e){e&&(delete Ef[Number(e.getAttribute("data-nodeid"))],Us(e.children).forEach((function(e){Nf(e)})))}var Of=ja("md-preview-highlight"),Df=function(){function e(e,t){var n=document.createElement("div");this.el=n,this.eventEmitter=e,this.isViewer=!!t.isViewer,this.el.className=ja("md-preview");var r=t.linkAttributes,o=t.customHTMLRenderer,i=t.sanitizer,s=t.highlight,a=void 0!==s&&s;this.renderer=new dh({gfm:!0,nodeId:!0,convertors:yf(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(a),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return e.prototype.initContentSection=function(){this.previewContent=Ja('<div class="'+ja("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},e.prototype.toggleActive=function(e){Wa(this.el,"active",e)},e.prototype.initEvent=function(e){var t=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(e&&(this.eventEmitter.listen("changeToolbarState",(function(e){var n=e.mdNode,r=e.cursorPos;t.updateCursorNode(n,r)})),this.eventEmitter.listen("blur",(function(){t.removeHighlight()}))),iu(this.el,"scroll",(function(e){t.eventEmitter.emit("scroll","preview",function(e,t){for(var n=t,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=Mf(o,e,Tf(n,t))}var i=n||r;return i===t?null:i}(e.target.scrollTop,t.previewContent))})),this.eventEmitter.listen("changePreviewTabPreview",(function(){return t.toggleActive(!0)})),this.eventEmitter.listen("changePreviewTabWrite",(function(){return t.toggleActive(!1)})))},e.prototype.removeHighlight=function(){if(this.cursorNodeId){var e=this.getElementByNodeId(this.cursorNodeId);e&&ds(e,Of)}},e.prototype.updateCursorNode=function(e,t){e&&("tableRow"===(e=aa(e,(function(e){return!function(e){switch(e.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(e)}))).type?e=function(e,t){for(var n=e.firstChild;n&&n.next&&!(ea(n.next)>t+1);)n=n.next;return n}(e,t[1]):"tableBody"===e.type&&(e=null));var n=e?e.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&ds(r,Of),o&&ss(o,Of),this.cursorNodeId=n}},e.prototype.getElementByNodeId=function(e){return e?this.previewContent.querySelector('[data-nodeid="'+e+'"]'):null},e.prototype.update=function(e){var t=this;e.forEach((function(e){return t.replaceRangeNodes(e)})),this.eventEmitter.emit("afterPreviewRender",this)},e.prototype.replaceRangeNodes=function(e){var t=this,n=e.nodes,r=e.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map((function(e){return t.renderer.render(e)})).join("")));if(r){var s=r.id,a=s[0],l=s[1],c=this.getElementByNodeId(a),u=this.getElementByNodeId(l);if(c){c.insertAdjacentHTML("beforebegin",i);for(var d=c;d&&d!==u;){var p=d.nextElementSibling;Ua(d),Nf(d),d=p}(null==d?void 0:d.parentNode)&&(Ua(d),Nf(d))}}else o.insertAdjacentHTML("afterbegin",i)},e.prototype.getRenderer=function(){return this.renderer},e.prototype.destroy=function(){eu(this.el,"scroll"),this.el=null},e.prototype.getElement=function(){return this.el},e.prototype.getHTML=function(){return Qa(this.previewContent.innerHTML)},e.prototype.setHTML=function(e){this.previewContent.innerHTML=e},e.prototype.setHeight=function(e){Wi(this.el,{height:e+"px"})},e.prototype.setMinHeight=function(e){Wi(this.el,{minHeight:e+"px"})},e}();function Af(e,t){for(var n=e.depth;n;){var r=e.node(n);if(t(r,n))return{node:r,depth:n,offset:n>0?e.before(n):0};n-=1}return null}function Lf(e){return!!Af(e,(function(e){var t=e.type;return"listItem"===t.name||"bulletList"===t.name||"orderedList"===t.name}))}function If(e){return!!Af(e,(function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name}))}function Rf(e){return Af(e,(function(e){return"listItem"===e.type.name}))}function Pf(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({},t&&{rawHTML:t})}}}function Bf(e){return Object.keys(e).reduce((function(t,n){return"rawHTML"!==n&&e[n]&&(t[n="className"===n?"class":n]=e[n]),t}),{})}function Ff(e){return{tag:e,getAttrs:function(e){return["rawHTML","colspan","rowspan","extended"].reduce((function(t,n){var r="rawHTML"===n?"data-raw-html":n,o=e.getAttribute(r);return o&&(t[n]=Ns(["rawHTML","extended"],n)?o:Number(o)),t}),{})}}}function Hf(e){var t=e.htmlAttrs,n=e.classNames;return Li(Li({},t),{class:n?n.join(" "):null})}function zf(e,t,n,r){var o=t.$from,i=t.$to,s=t.depth,l=t,c=!1;if(s>=2&&o.node(s-1).type.compatibleContent(n)&&0===t.startIndex&&o.index(s-1)){var u=e.doc.resolve(t.start-2);l=new O(u,u,s),t.endIndex<t.parent.childCount&&(t=new O(o,e.doc.resolve(i.end(s)),s)),c=!0}var d=function(e,t,n,r){var o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(i){var s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}return null}(e,n),i=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(s){for(var a=(s.length?s[s.length-1]:t).contentMatch,l=r;a&&l<o;l+=1)a=a.matchType(n.child(l).type);if(a&&a.validEnd)return s}return null}(t,n);if(o&&i){var s=o.map((function(e){return{type:e}})),a=i.map((function(e){return{type:e,attrs:r}}));return s.concat({type:n}).concat(a)}return null}(l,t,n,r);return d?function(e,t,n,r,o){for(var i=t.start,s=t.end,l=t.startIndex,c=t.endIndex,u=t.parent,d=a.empty,p=n.length-1;p>=0;p-=1)d=a.from(n[p].type.create(n[p].attrs,d));e.step(new Me(i-(r?2:0),s,i,s,new h(d,0,0),n.length,!0));var f=0;for(p=0;p<n.length;p+=1)if(n[p].type===o){f=p+1;break}for(var m=n.length-f,g=i+n.length-(r?2:0),v=(p=l,c);p<v;p+=1)!(p===l)&&De(e.doc,g,m)&&(e.split(g,m),g+=2*m),g+=u.child(p).nodeSize;return e}(e,t,d,c,n):e}function qf(e,t){for(var n=e.resolve(t);"paragraph"!==n.node().type.name;)t-=2,n=e.resolve(t);return Rf(n)}function Vf(e){return function(t,n){var r=t.selection,o=t.tr,i=r.$from,s=r.$to,a=i.blockRange(s);if(a){var l=Lf(i)?function(e,t,n){var r=t.$from,o=t.$to,i=Rf(r),s=Rf(o);if(i&&s)for(;s;){var a=s.offset,l=s.node,c=s.depth;l.attrs.task&&e.setNodeMarkup(a,null,{task:!1,checked:!1});var u=e.doc.resolve(a);if(u.parent.type!==n){var d=u.before(c-1);e.setNodeMarkup(d,n)}if(a===i.offset)break;s=qf(e.doc,a)}return e}(o,a,e):zf(o,a,e);return n(l),!0}return!1}}function jf(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from,s=n.$to,a=i.blockRange(s);if(a){var l=Lf(i)?function(e,t){var n=t.$from,r=t.$to,o=Rf(n),i=Rf(r);if(o&&i)for(;i;){var s=i.offset,a={task:!i.node.attrs.task,checked:!1};if(e.setNodeMarkup(s,null,a),s===o.offset)break;i=qf(e.doc,s)}return e}(r,a):zf(r,a,o.nodes.bulletList,{task:!0});return t(l),!0}return!1}}function $f(){return{indent:function(){return function(e,t){var n,r=e.selection,o=e.schema,i=r.$from,s=r.$to;return!(!i.blockRange(s)||!Lf(i))&&(n=o.nodes.listItem,function(e,t){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,l=i.blockRange(s,(function(e){var t=e.childCount,r=e.firstChild;return!!t&&r.type===n}));if(l&&l.startIndex>0){var c=l.parent,u=c.child(l.startIndex-1);if(u.type!==n)return!1;var d=u.lastChild&&u.lastChild.type===c.type,p=d?a.from(n.create()):null,f=new h(a.from(n.create(null,a.from(c.type.create(null,p)))),d?3:1,0),m=l.start,g=l.end;return r.step(new Me(m-(d?3:1),g,m,g,f,1,!0)),t(r),!0}return!1})(e,t)}},outdent:function(){return function(e,t){var n,r=e.selection,o=e.schema,i=r.$from,s=r.$to;return!(!i.blockRange(s)||!Lf(i))&&(n=o.nodes.listItem,function(e,t){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,l=i.blockRange(s,(function(e){var t=e.childCount,r=e.firstChild;return!!t&&r.type===n}));if(l){var c=i.node(l.depth-1).type===n?function(e,t,n){var r=t.$from,o=t.$to,i=t.end,s=t.depth,l=t.parent,c=o.end(s);return i<c&&(e.step(new Me(i-1,c,i,c,new h(a.from(n.create(null,l.copy())),1,0),1,!0)),t=new O(e.doc.resolve(r.pos),e.doc.resolve(c),s)),e.lift(t,Ne(t)),e}(r,l,n):function(e,t){for(var n=t.parent,r=t.end,o=t.endIndex-1,i=t.startIndex;o>i;o-=1)r-=n.child(o).nodeSize,e.delete(r-1,r+1);var s=e.doc.resolve(t.start),l=s.nodeAfter,c=0===t.startIndex,u=t.endIndex===n.childCount,d=s.node(-1),p=s.index(-1),f=d.canReplace(p+(c?0:1),p+1,null==l?void 0:l.content.append(u?a.empty:a.from(n)));if(l&&f){var m=s.pos,g=m+l.nodeSize;e.step(new Me(m-(c?1:0),g+(u?1:0),m+1,g-1,new h((c?a.empty:a.from(n.copy(a.empty))).append(u?a.empty:a.from(n.copy(a.empty))),c?0:1,u?0:1),c?0:1))}return e}(r,l);return t(c),!0}return!1})(e,t)}}}}var _f=new Map,Uf=function(){function e(e,t,n,r){this.table=e,this.tableRows=t,this.tableStartPos=n,this.rowInfo=r}return e.create=function(t){var n=Af(t,(function(e){return"table"===e.type.name}));if(n){var r=n.node,o=n.depth,i=n.offset,s=_f.get(r);if((null==s?void 0:s.tableStartPos)===i+1)return s;var a=[],l=t.start(o),c=r.child(0),u=r.child(1),d=Wf(c,l),p=Wf(u,l+c.nodeSize);c.forEach((function(e){return a.push(e)})),u.forEach((function(e){return a.push(e)}));var h=new e(r,a,l,d.concat(p));return _f.set(r,h),h}return null},Object.defineProperty(e.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),e.prototype.getCellInfo=function(e,t){return this.rowInfo[e][t]},e.prototype.posAt=function(e,t){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===e){for(var i=t;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},e.prototype.getNodeAndPos=function(e,t){var n=this.rowInfo[e][t];return{node:this.table.nodeAt(n.offset-this.tableStartOffset),pos:n.offset}},e.prototype.extendedRowspan=function(e,t){return!1},e.prototype.extendedColspan=function(e,t){return!1},e.prototype.getRowspanCount=function(e,t){return 0},e.prototype.getColspanCount=function(e,t){return 0},e.prototype.decreaseColspanCount=function(e,t){return 0},e.prototype.decreaseRowspanCount=function(e,t){return 0},e.prototype.getColspanStartInfo=function(e,t){return null},e.prototype.getRowspanStartInfo=function(e,t){return null},e.prototype.getCellStartOffset=function(e,t){var n=this.rowInfo[e][t].offset;return this.extendedRowspan(e,t)?this.posAt(e,t):n},e.prototype.getCellEndOffset=function(e,t){var n=this.rowInfo[e][t],r=n.offset,o=n.nodeSize;return this.extendedRowspan(e,t)?this.posAt(e,t):r+o},e.prototype.getCellIndex=function(e){for(var t=0;t<this.totalRowCount;t+=1)for(var n=this.rowInfo[t],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>e.pos)return[t,r];return[0,0]},e.prototype.getRectOffsets=function(e,t){var n,r,o;void 0===t&&(t=e),e.pos>t.pos&&(e=(n=[t,e])[0],t=n[1]);var i=this.getCellIndex(e),s=i[0],a=i[1],l=this.getCellIndex(t),c=l[0],u=l[1];return s=(r=$s(s,c))[0],c=r[1],a=(o=$s(a,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:s,startColIdx:a,endRowIdx:c,endColIdx:u})},e.prototype.getSpannedOffsets=function(e){return e},e}(),Wf=function(e,t){var n=[];return e.forEach((function(e,r){var o={rowspanMap:{},colspanMap:{},length:0};e.forEach((function(e,n){for(var i=e.nodeSize,s=0;o[s];)s+=1;o[s]={offset:t+r+n+2,nodeSize:i},o.length+=1})),n.push(o)})),n};function Jf(e,t){return js(Uf.prototype,e),Wf=t,Uf}var Kf=function(e){function t(t,n){void 0===n&&(n=t);var r=this,o=t.node(0),i=Uf.create(t),s=i.getRectOffsets(t,n),a=function(e,t,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,s=n.endColIdx,a=[],l=r;l<=i;l+=1)for(var c=o;c<=s;c+=1){var u=t.getCellInfo(l,c),d=u.offset,p=u.nodeSize;a.push(new Ke(e.resolve(d+1),e.resolve(d+p-1)))}return a}(o,i,s);return(r=e.call(this,a[0].$from,a[0].$to,a)||this).startCell=t,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return Ai(t,e),t.prototype.map=function(e,n){var r=this.startCell.pos,o=this.endCell.pos,i=e.resolve(n.map(r)),s=e.resolve(n.map(o)),a=Uf.create(i);if(this.offsetMap.totalColumnCount>a.totalColumnCount||this.offsetMap.totalRowCount>a.totalRowCount){var l={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[s.parent.type.name],c=s.end(s.depth-l),u=Math.min(c-4,s.pos);return Ze.create(e,u)}return new t(i,s)},t.prototype.eq=function(e){return e instanceof t&&e.startCell.pos===this.startCell.pos&&e.endCell.pos===this.endCell.pos},t.prototype.content=function(){for(var e=this.startCell.node(-2),t=this.startCell.start(-2),n=e.child(1).firstChild,r=e.child(0).type.create(),o=e.child(1).type.create(),i=Uf.create(this.startCell),s=i.getRectOffsets(this.startCell,this.endCell),l=s.startRowIdx,c=s.startColIdx,u=s.endRowIdx,d=s.endColIdx,p=!1,f=l;f<=u;f+=1){for(var m=[],g=c;g<=d;g+=1){var v=i.getCellInfo(f,g).offset,y=e.nodeAt(v-t);y&&(p="tableHeadCell"===y.type.name,i.extendedRowspan(f,g)||i.extendedColspan(f,g)?m.push(y.type.create({extended:!0})):m.push(y.copy(y.content)))}var b=n.copy(a.from(m)),w=p?r:o;w.content=w.content.append(a.from(b))}return new h(function(e,t){var n=[];return e.childCount&&n.push(e),t.childCount&&n.push(t),a.from(n)}(r,o),1,1)},t.prototype.toJSON=function(){return JSON.stringify(this)},t}(Je);function Gf(e,t,n,r){for(var o=n.nodes,i=o.tableRow,s=o.tableBodyCell,a=o.paragraph,l=[],c=0;c<e;c+=1){for(var u=[],d=0;d<t;d+=1){var p=r&&r[c*t+d],h=a.create(null,p?n.text(p):[]);u.push(s.create(null,h))}l.push(i.create(null,u))}return l}function Xf(e,t,n,r){void 0===r&&(r=null);for(var o=n.nodes,i=o.tableHeadCell,s=o.tableBodyCell,a=o.paragraph,l=0===t?i:s,c=[],u=0;u<e;u+=1)c.push(l.create(r,a.create()));return c}function Zf(e,t){for(;e&&e!==t;){if("TD"===e.nodeName||"TH"===e.nodeName)return e;e=e.parentNode}return null}function Qf(e){return Af(e,(function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name}))}function Yf(e){if(e instanceof Ze){var t=e.$anchor,n=Qf(t);if(n){var r=t.node(0).resolve(t.before(n.depth));return{anchor:r,head:r}}}var o=e;return{anchor:o.startCell,head:o.endCell}}function em(e){var t;if(e.size){var n=e.content,r=e.openStart,o=e.openEnd;if(1!==n.childCount)return null;for(;1===n.childCount&&(r>0&&o>0||"table"===(null===(t=n.firstChild)||void 0===t?void 0:t.type.name));)r-=1,o-=1,n=n.firstChild.content;if("tableHead"===n.firstChild.type.name||"tableBody"===n.firstChild.type.name)return n}return null}function tm(e){var t=e.startRowIdx,n=e.startColIdx;return{rowCount:e.endRowIdx-t+1,columnCount:e.endColIdx-n+1}}function nm(e,t){return Li(Li({},e.attrs),t)}var rm=new mt("cellSelection"),om=function(){function e(e){this.view=e,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return e.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},e.prototype.handleMousedown=function(e){var t=Zf(e.target,this.view.dom);if(2!==e.button){if(t){var n=this.getCellPos(e);n&&(this.startCellPos=n),this.bindEvent()}}else e.preventDefault()},e.prototype.handleMousemove=function(e){var t,n=rm.getState(this.view.state),r=this.getCellPos(e),o=this.startCellPos;n?t=this.view.state.doc.resolve(n):o!==r&&(t=o),t&&o&&r&&this.setCellSelection(o,r)},e.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==rm.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(rm,-1))},e.prototype.bindEvent=function(){var e=this.view.dom;e.addEventListener("mousemove",this.handlers.mousemove),e.addEventListener("mouseup",this.handlers.mouseup)},e.prototype.unbindEvent=function(){var e=this.view.dom;e.removeEventListener("mousemove",this.handlers.mousemove),e.removeEventListener("mouseup",this.handlers.mouseup)},e.prototype.getCellPos=function(e){var t=e.clientX,n=e.clientY,r=this.view.posAtCoords({left:t,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),s=Qf(i);if(s){var a=i.before(s.depth);return o.resolve(a)}}return null},e.prototype.setCellSelection=function(e,t){var n=this.view.state,r=n.selection,o=n.tr,i=null===rm.getState(this.view.state),s=new Kf(e,t);if(i||!r.eq(s)){var a=o.setSelection(s);i&&a.setMeta(rm,t.pos),this.view.dispatch(a)}},e.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},e}(),im=ja("cell-selected");function sm(e){var t=e.selection,n=e.doc;if(t instanceof Kf){var r=[];return t.ranges.forEach((function(e){var t=e.$from,n=e.$to;r.push(Jr.node(t.pos-1,n.pos+1,{class:im}))})),Xr.create(n,r)}return null}var am=function(){function e(){this.keys=[],this.values=[]}return e.prototype.getKeyIndex=function(e){return Ki(e,this.keys)},e.prototype.get=function(e){return this.values[this.getKeyIndex(e)]},e.prototype.set=function(e,t){var n=this.getKeyIndex(e);return n>-1?this.values[n]=t:(this.keys.push(e),this.values.push(t)),this},e.prototype.has=function(e){return this.getKeyIndex(e)>-1},e.prototype.delete=function(e){var t=this.getKeyIndex(e);return t>-1&&(this.keys.splice(t,1),this.values.splice(t,1),!0)},e.prototype.forEach=function(e,t){var n=this;void 0===t&&(t=this),this.values.forEach((function(r,o){r&&n.keys[o]&&e.call(t,r,n.keys[o],n)}))},e.prototype.clear=function(){this.keys=[],this.values=[]},e}(),lm="en-US",cm=function(){function e(){this.code=lm,this.langs=new am}return e.prototype.setCode=function(e){this.code=e||lm},e.prototype.setLanguage=function(e,t){var n=this;(e=[].concat(e)).forEach((function(e){if(n.langs.has(e)){var r=n.langs.get(e);n.langs.set(e,Bi(r,t))}else n.langs.set(e,t)}))},e.prototype.get=function(e,t){t||(t=this.code);var n=this.langs.get(t);n||(n=this.langs.get(lm));var r=n[e];if(!r)throw new Error('There is no text key "'+e+'" in '+t);return r},e}(),um=new cm,dm=[[{action:"Add row to up",command:"addRowToUp",disableInThead:!0,className:"add-row-up"},{action:"Add row to down",command:"addRowToDown",disableInThead:!0,className:"add-row-down"},{action:"Remove row",command:"removeRow",disableInThead:!0,className:"remove-row"}],[{action:"Add column to left",command:"addColumnToLeft",className:"add-column-left"},{action:"Add column to right",command:"addColumnToRight",className:"add-column-right"},{action:"Remove column",command:"removeColumn",className:"remove-column"}],[{action:"Align column to left",command:"alignColumn",payload:{align:"left"},className:"align-column-left"},{action:"Align column to center",command:"alignColumn",payload:{align:"center"},className:"align-column-center"},{action:"Align column to right",command:"alignColumn",payload:{align:"right"},className:"align-column-right"}],[{action:"Remove table",command:"removeTable",className:"remove-table"}]];function pm(e,t){return dm.map((function(n){return n.map((function(n){var r=n.action,o=n.command,i=n.payload,s=n.disableInThead,a=n.className;return{label:um.get(r),onClick:function(){e.emit("command",o,i)},disabled:t&&!!s,className:a}}))})).concat()}var hm=["image","link","customBlock","frontMatter"],fm=["strong","strike","emph","code"],mm=["bulletList","orderedList","taskList"];function gm(e,t,n){var r=e.$from,o=e.$to,i=e.from,s=e.to,a={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}};return t.nodesBetween(i,s,(function(e,t,i){var s=function(e,t){var n=e.type.name;return"listItem"===n?e.attrs.task?"taskList":t.type.name:-1!==n.indexOf("table")?"table":n}(e,i);Ns(hm,s)||(Ns(mm,s)?(function(e,t){t[e]={active:!0},mm.filter((function(t){return t!==e})).forEach((function(e){t[e]&&delete t[e]}))}(s,a),a.indent.disabled=!1,a.outdent.disabled=!1):"paragraph"===s||"text"===s?function(e,t,n,r){fm.forEach((function(o){var i=n.marks[o],s=e.marksAcross(t)||[];i.isInSet(s)&&(r[o]={active:!0})}))}(r,o,n,a):a[s]={active:!0})})),a}function vm(e){return new pt({view:function(){return{update:function(t){var n=t.state,r=n.selection,o=n.doc,i=n.schema;e.emit("changeToolbarState",{toolbarState:gm(r,o,i)})}}}})}var ym=function(){function e(e,t,n,r){var o=this;this.openEditor=function(){if(o.innerEditorView)throw new Error("The editor is already opened.");o.dom.draggable=!1,o.wrapper.style.display="none",o.innerViewContainer.style.display="block",o.innerEditorView=new wo(o.innerViewContainer,{state:ut.create({doc:o.node,plugins:[Po({"Mod-z":function(){return Ni(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return Oi(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(e,t){return t(e.tr.insertText("\t")),!0},Enter:jo,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),Si()]}),dispatchTransaction:function(e){return o.dispatchInner(e)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=e,this.editorView=t,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=ja("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=ja("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return e.prototype.renderToolArea=function(){var e=this,t=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");t.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",(function(){return e.openEditor()})),t.appendChild(n),t.appendChild(r),this.wrapper.appendChild(t)},e.prototype.renderCustomBlock=function(){var e=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(e){for(var t=e(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);t&&this.wrapper.appendChild(t),this.renderToolArea()}},e.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=ja("custom-block-editor"),this.innerViewContainer.style.display="none"},e.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},e.prototype.saveAndFinishEditing=function(){var e=this.editorView.state.selection.to,t=this.editorView.state;this.editorView.dispatch(t.tr.setSelection(Ks(t.tr,e))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},e.prototype.cancelEditing=function(){var e=function(e){let t=Ti.getState(e);return t?t.done.eventCount:0}(this.innerEditorView.state);for(this.canceled=!0;e--;)Ni(this.innerEditorView.state,this.innerEditorView.dispatch),Ni(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var t=this.editorView.state.selection.to,n=this.editorView.state;this.editorView.dispatch(n.tr.setSelection(Ze.create(n.doc,t))),this.editorView.focus(),this.closeEditor()},e.prototype.dispatchInner=function(e){var t=this.innerEditorView.state.applyTransaction(e),n=t.state,r=t.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&cl(this.getPos)){for(var o=this.editorView.state.tr,i=fe.offset(this.getPos()+1),s=0;s<r.length;s+=1)for(var a=r[s].steps,l=0;l<a.length;l+=1)o.step(a[l].map(i));o.docChanged&&this.editorView.dispatch(o)}},e.prototype.update=function(e){return!!e.sameMarkup(this.node)&&(this.node=e,this.innerEditorView||this.renderCustomBlock(),!0)},e.prototype.stopEvent=function(e){return!!this.innerEditorView&&!!e.target&&this.innerEditorView.dom.contains(e.target)},e.prototype.ignoreMutation=function(){return!0},e.prototype.destroy=function(){this.dom.removeEventListener("dblclick",this.openEditor),this.closeEditor()},e}(),bm="image-link",wm=function(){function e(e,t,n,r){var o,i=this;this.handleMousedown=function(e){e.preventDefault();var t=e.target,n=e.offsetX,r=e.offsetY;if(i.imageLink&&cl(i.getPos)&&Sa(t,bm)){var o=getComputedStyle(t,":before");if(e.stopPropagation(),qa(o,n,r)){var s=i.view.state.tr,a=i.getPos();s.setSelection(Ks(s,a,a+1)),i.view.dispatch(s),i.eventEmitter.emit("openPopup","link",i.imageLink.attrs)}}},this.node=e,this.view=t,this.getPos=n,this.eventEmitter=r,this.imageLink=null!==(o=e.marks.filter((function(e){return"link"===e.type.name}))[0])&&void 0!==o?o:null,this.dom=this.createElement(),this.bindEvent()}return e.prototype.createElement=function(){var e=this.createImageElement(this.node);if(this.imageLink){var t=document.createElement("span");return t.className=bm,t.appendChild(e),t}return e},e.prototype.createImageElement=function(e){var t=document.createElement("img"),n=e.attrs,r=n.imageUrl,o=n.altText,i=Hf(e.attrs);return t.src=r,o&&(t.alt=o),Za(i,t),t},e.prototype.bindEvent=function(){this.imageLink&&this.dom.addEventListener("mousedown",this.handleMousedown)},e.prototype.stopEvent=function(){return!0},e.prototype.destroy=function(){this.imageLink&&this.dom.removeEventListener("mousedown",this.handleMousedown)},e}(),km=function(){function e(e,t,n,r){var o=this;this.contentDOM=null,this.input=null,this.timer=null,this.handleMousedown=function(e){var t=e.target;if("none"!==getComputedStyle(t,":after").backgroundImage&&cl(o.getPos)){var n=o.view.coordsAtPos(o.getPos()),r=n.top,i=n.right;o.createLanguageEditor({top:r,right:i})}},this.handleKeydown=function(e){"Enter"===e.key&&o.input&&(e.preventDefault(),o.changeLanguage())},this.node=e,this.view=t,this.getPos=n,this.eventEmitter=r,this.createElement(),this.bindDOMEvent(),this.bindEvent()}return e.prototype.createElement=function(){var e=this.node.attrs.language,t=document.createElement("div");t.setAttribute("data-language",e||"text"),t.className="toastui-editor-ww-code-block";var n=this.createCodeBlockElement(),r=n.firstChild;t.appendChild(n),this.dom=t,this.contentDOM=r},e.prototype.createCodeBlockElement=function(){var e=document.createElement("pre"),t=document.createElement("code"),n=this.node.attrs.language,r=Hf(this.node.attrs);return n&&t.setAttribute("data-language",n),Za(r,e),e.appendChild(t),e},e.prototype.createLanguageEditor=function(e){var t=this,n=e.top,r=e.right,o=document.createElement("span");o.className="toastui-editor-ww-code-block-language";var i=document.createElement("input");i.type="text",i.value=this.node.attrs.language,o.appendChild(i),this.view.dom.parentElement.appendChild(o);var s=o.clientWidth;Wi(o,{top:n+10+"px",left:r-s-10+"px",width:s+"px"}),this.input=i,this.input.addEventListener("blur",(function(){return t.changeLanguage()})),this.input.addEventListener("keydown",this.handleKeydown),this.clearTimer(),this.timer=setTimeout((function(){t.input.focus()}))},e.prototype.bindDOMEvent=function(){this.dom&&this.dom.addEventListener("click",this.handleMousedown)},e.prototype.bindEvent=function(){var e=this;this.eventEmitter.listen("scroll",(function(){e.input&&e.reset()}))},e.prototype.changeLanguage=function(){if(this.input&&cl(this.getPos)){var e=this.input.value;this.reset();var t=this.getPos(),n=this.view.state.tr;n.setNodeMarkup(t,null,{language:e}),this.view.dispatch(n)}},e.prototype.reset=function(){var e;if(null===(e=this.input)||void 0===e?void 0:e.parentElement){var t=this.input.parentElement;this.input=null,Ua(t)}},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.stopEvent=function(){return!0},e.prototype.update=function(e){return!!e.sameMarkup(this.node)&&(this.node=e,!0)},e.prototype.destroy=function(){this.reset(),this.clearTimer(),this.dom&&this.dom.removeEventListener("click",this.handleMousedown)},e}(),xm=/MsoListParagraph/,Cm=/style=(.|\n)*mso-/,Tm=/mso-list:(.*)/,Mm=/O:P/,Sm=/^(n|u|l)/,Em="p.MsoListParagraph";function Nm(e){for(var t=[],n=document.createTreeWalker(e,1,null,!1);n.nextNode();){var r=n.currentNode;if(_a(r)){var o=r,i=o.outerHTML,s=o.textContent,a=Cm.test(i),l=Tm.test(i);a&&!l&&s?t.push([r,!0]):(Mm.test(r.nodeName)||a&&!s||l)&&t.push([r,!1])}}return t.forEach((function(e){var t=e[0];e[1]?function(e){for(var t=[];e.firstChild;)t.push(e.firstChild),e.parentNode&&e.parentNode.insertBefore(e.firstChild,e);Ua(e)}(t):Ua(t)})),e.innerHTML.trim()}function Om(e){var t=e[0].unordered?"ul":"ol",n=document.createElement(t);return e.forEach((function(e){var t=e.children,r=e.contents,o=document.createElement("li");o.innerHTML=r,n.appendChild(o),t.length&&n.appendChild(Om(t))})),n}function Dm(e){return Om(function(e){var t=[];return e.forEach((function(e,n){var r=t[n-1],o=function(e,t){var n=e.getAttribute("style");if(n){var r=n.match(Tm)[1].trim().split(" ")[1];return{id:t,level:parseInt(r.replace("level",""),10),prev:null,parent:null,children:[],unordered:Sm.test(e.textContent||""),contents:Nm(e)}}return null}(e,n);o&&(r&&function(e,t){if(t.level<e.level)t.children.push(e),e.parent=t;else{for(;t&&t.level!==e.level;)t=t.parent;t&&(e.prev=t,e.parent=t.parent,e.parent&&e.parent.children.push(e))}}(o,r),t.push(o))})),t}(e).filter((function(e){return!e.parent})))}var Am="\x3c!--StartFragment--\x3e";function Lm(e){return function(e){return Cm.test(e)}(e=function(e){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e="<tr>"+e+"</tr>"),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e="<table>"+e+"</table>"),e}(e=function(e){var t=e.indexOf(Am),n=e.lastIndexOf("\x3c!--EndFragment--\x3e");return t>-1&&n>-1&&(e=e.slice(t+20,n)),e.replace(/<br[^>]*>/g,za)}(e)))&&(e=function(e){var t=document.createElement("div");t.innerHTML=e;var n,r,o=[],i=(n=Em,(r=Us(t.querySelectorAll(n))).length?r:[]);return i.forEach((function(e){var n,r,i=function(e){for(;e&&!_a(e);)e=e.nextSibling;return!e||!xm.test(e.className)}(e.nextSibling);if(o.push(e),i){var s=Dm(o),a=e.nextSibling;a?(n=s,(r=a).parentNode&&r.parentNode.insertBefore(n,r)):function(e,t){(t=Hi(t)?Us(t):[t]).forEach((function(t){e.appendChild(t)}))}(t,s),o=[]}Ua(e)})),(i.length?"<p></p>":"")+t.innerHTML}(e)),e}function Im(e,t,n){for(var r=[],o=e.childCount,i=0;i<o;i+=1)if(!e.child(i).attrs.extended){var s=i<o?n.create(e.child(i).attrs,e.child(i).content):n.createAndFill();r.push(s)}return r}function Rm(e,t,n){var r=n.nodes,o=r.tableRow,i=Im(e,0,r.tableHeadCell);return o.create(null,i)}function Pm(e,t,n){var r=n.nodes,o=r.tableRow,i=Im(e,0,r.tableBodyCell);return o.create(null,i)}function Bm(e){var t=[],n=[];return"tableHead"===e.firstChild.type.name&&e.firstChild.forEach((function(e){return t.push(e)})),"tableBody"===e.lastChild.type.name&&e.lastChild.forEach((function(e){return n.push(e)})),Ii(Ii([],t),n)}function Fm(e,t,n){var r=Rm(e,0,n);return n.nodes.tableHead.create(null,r)}function Hm(e,t,n){var r=e.map((function(e){return Pm(e,0,n)}));if(!e.length){var o=function(e,t){for(var n=t.nodes,r=n.tableRow,o=n.tableBodyCell,i=[],s=0;s<e;s+=1){var a=o.createAndFill();i.push(a)}return r.create({dummyRowForPasting:!0},i)}(t,n);r.push(o)}return n.nodes.tableBody.create(null,r)}var zm=4;function qm(e){return e*zm}var Vm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),t}(ol),jm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"inline*",group:"block",attrs:Li({},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"p"}],toDOM:function(e){return["p",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(ol),$m=/\s{1,4}$/,_m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),t.prototype.addSpaces=function(){return function(e,t){var n=e.selection,r=e.tr,o=n.$from,i=n.$to;return!(!o.blockRange(i)||Lf(o)||If(o)||(t(r.insertText("    ",o.pos,i.pos)),0))}},t.prototype.removeSpaces=function(){return function(e,t){var n=e.selection,r=e.tr,o=n.$from,i=n.$to,s=n.from;if(o.blockRange(i)&&!Lf(o)&&!If(o)){var a=o.nodeBefore;if(a&&a.isText){var l=a.text,c=l.replace($m,""),u=l.length-c.length;return t(r.delete(s-u,s)),!0}}return!1}},t.prototype.keymaps=function(){return{Tab:this.addSpaces(),"Shift-Tab":this.removeSpaces()}},t}(ol),Um=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"levels",{get:function(){return[1,2,3,4,5,6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=this.levels.map((function(e){return{tag:"h"+e,getAttrs:function(t){var n=t.getAttribute("data-raw-html");return Li({level:e},n&&{rawHTML:n})}}}));return{attrs:Li({level:{default:1},headingType:{default:"atx"},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"inline*",group:"block",defining:!0,parseDOM:e,toDOM:function(e){var t=e.attrs;return["h"+t.level,Hf(t),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){return Zo(t.schema.nodes[e.level?"heading":"paragraph"],e)(t,n)}}},t}(ol),Wm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:Li({language:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),code:!0,defining:!0,marks:"",parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(e){var t=e.getAttribute("data-raw-html"),n=e.firstElementChild;return Li({language:(null==n?void 0:n.getAttribute("data-language"))||null},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"pre",["code",Li({"data-language":t.language},Hf(t)),0]]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Zo(e.schema.nodes.codeBlock)(e,t)}}},t.prototype.moveCursor=function(e){var t=this;return function(n,r){var o,i=n.tr,s=n.doc,a=n.schema,l=n.selection.$from;if(t.context.view.endOfTextblock(e)&&"codeBlock"===l.node().type.name){var c=l.parent.textContent.split("\n"),u="up"===e?l.start():l.end(),d="up"===e?[u,c[0].length+u]:[u-Fs(c).length,u],p=s.resolve("up"===e?l.before():l.after()),h="up"===e?p.nodeBefore:p.nodeAfter;if((o=l.pos)>=d[0]&&o<=d[1]&&!h){var f=Gs(i,p,a);if(f)return r(f),!0}}return!1}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-p":e,"Shift-Mod-P":e,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},t}(ol),Jm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Pf("ul")],toDOM:function(e){return["ul",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.changeList=function(){return function(e,t){return Vf(e.schema.nodes.bulletList)(e,t)}},t.prototype.commands=function(){return{bulletList:this.changeList,taskList:jf}},t.prototype.keymaps=function(){var e=this.changeList(),t=$f(),n=t.indent,r=t.outdent;return{"Mod-u":e,"Mod-U":e,Tab:n(),"Shift-Tab":r()}},t}(ol),Km=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Li({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(e){var t=e.getAttribute("start"),n=e.getAttribute("data-raw-html");return Li({order:e.hasAttribute("start")?Number(t):1},n&&{rawHTML:n})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"ol",Li({start:1===t.order?null:t.order},Hf(t)),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Vf(e.schema.nodes.orderedList)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()(),t=$f(),n=t.indent,r=t.outdent;return{"Mod-o":e,"Mod-O":e,Tab:n(),"Shift-Tab":r()}},t}(ol),Gm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"paragraph block*",selectable:!1,attrs:{task:{default:!1},checked:{default:!1},rawHTML:{default:null}},defining:!0,parseDOM:[{tag:"li",getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({task:e.hasAttribute("data-task"),checked:e.hasAttribute("data-task-checked")},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs,n=t.task,r=t.checked;if(!n)return[t.rawHTML||"li",0];var o=["task-list-item"];return r&&o.push("checked"),[t.rawHTML||"li",Li({class:o.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),t.prototype.liftToPrevListItem=function(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from,s=n.empty,a=o.nodes.listItem,l=i.parent,c=i.node(-1);if(s&&!l.childCount&&c.type===a){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),t(r),!0;if(i.node(-3).type===a)return r.delete(i.start(-2)-1,i.end(-1)),t(r),!0}return!1}},t.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(e,t){return(n=e.schema.nodes.listItem,function(e,t){var r=e.tr,o=e.selection,i=o.$from,s=o.$to;if(i.depth<2||!i.sameParent(s))return!1;var l=i.node(-1);if(l.type!==n)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==n||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,u=a.empty,d=i.depth-(c?1:2);d>=i.depth-3;d-=1)u=a.from(i.node(d).copy(u));return u=u.append(a.from(n.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new h(u,c?3:2,2)),r.setSelection(Je.near(r.doc.resolve(i.pos+(c?3:2)))),t(r),!0}var p=s.pos===i.end()?l.contentMatchAt(0).defaultType:null,f=p&&[null,{type:p}];return r.delete(i.pos,s.pos),!!De(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),t(r),!0)})(e,t);var n}}},t}(ol),Xm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[Pf("blockquote")],toDOM:function(e){return["blockquote",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&function(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(Oe).concat({type:t,attrs:n}).concat(i.map(Oe)):null}(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(e.schema.nodes.blockQuote)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Alt-q":e,"Alt-Q":e}},t}(ol),Zm={left:function(e,t){var n=e[0],r=e[1],o=t.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var s=t.getCellInfo(n,r);return s.offset+s.nodeSize-2}return null},right:function(e,t){var n=e[0],r=e[1],o=t.totalRowCount,i=t.totalColumnCount,s=r===i-1;if(n!==o-1||!s){var a=r+1,l=t.getColspanStartInfo(n,r);return(null==l?void 0:l.count)>1&&(a+=l.count-1),(s||a===i)&&(n+=1,a=0),t.getCellInfo(n,a).offset+2}return null},up:function(e,t){var n=e[0],r=e[1];if(n>0){var o=t.getCellInfo(n-1,r);return o.offset+o.nodeSize-2}return null},down:function(e,t){var n=e[0],r=e[1];if(n<t.totalRowCount-1){var o=n+1,i=t.getRowspanStartInfo(n,r);return(null==i?void 0:i.count)>1&&(o+=i.count-1),t.getCellInfo(o,r).offset+2}return null}};function Qm(e,t,n){var r=n[0],o=n[1],i=t.getRowspanStartInfo(r,o),s="up"===e&&0===r,a="down"===e&&((null==i?void 0:i.count)>1?r+i.count-1:r)===t.totalRowCount-1;return s||a}function Ym(e,t,n,r){void 0===r&&(r=!1);var o=e.doc.resolve(t.tableEndOffset);return r||!o.nodeAfter?Gs(e,o,n):e.setSelection(Je.near(o,1))}function eg(e,t,n,r){var o=(0,Zm[e])(n,r);if(o){var i="right"===e||"down"===e?1:-1;return t.setSelection(Je.near(t.doc.resolve(o),i))}return null}function tg(e,t,n){var r=e.getCellInfo(t,0).offset,o=e.getCellInfo(t,n-1);return{from:r,to:o.offset+o.nodeSize}}var ng=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Pf("table")],toDOM:function(e){return["table",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.addTable=function(){return function(e){return void 0===e&&(e={rowCount:2,columnCount:1,data:[]}),function(t,n){var r=e.rowCount,o=e.columnCount,i=e.data,s=t.schema,a=t.selection,l=t.tr,c=a.from,u=a.to,d=a.$from;if(c===u&&!If(d)){var p=s.nodes,h=p.tableHead,f=p.tableBody,m=null==i?void 0:i.slice(0,o),g=null==i?void 0:i.slice(o,i.length),v=function(e,t,n){for(var r=t.nodes,o=r.tableRow,i=r.tableHeadCell,s=r.paragraph,a=[],l=0;l<e;l+=1){var c=n&&n[l],u=s.create(null,c?t.text(c):[]);a.push(i.create(null,u))}return[o.create(null,a)]}(o,s,m),y=Gf(r-1,o,s,g),b=s.nodes.table.create(null,[h.create(null,v),f.create(null,y)]);return n(l.replaceSelectionWith(b)),!0}return!1}}},t.prototype.removeTable=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Uf.create(n.$anchor);if(o){var i=o.tableStartOffset,s=o.tableEndOffset,a=i-1,l=Ks(r.delete(a,s),a);return t(r.setSelection(l)),!0}return!1}}},t.prototype.addColumn=function(e){return function(){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=Yf(r),a=s.anchor,l=s.head;if(a&&l){for(var c=Uf.create(a),u=c.getRectOffsets(a,l),d="left"===e?u.startColIdx:u.endColIdx+1,p=tm(u).columnCount,h=c.totalRowCount,f=0;f<h;f+=1){var m=Xf(p,f,i);o.insert(o.mapping.map(c.posAt(f,d)),m)}return n(o),!0}return!1}}},t.prototype.removeColumn=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Yf(n),i=o.anchor,s=o.head;if(i&&s){var a=Uf.create(i),l=a.getRectOffsets(i,s),c=a.totalColumnCount,u=a.totalRowCount;if(tm(l).columnCount===c)return!1;for(var d=l.startColIdx,p=l.endColIdx,h=r.mapping.maps.length,f=0;f<u;f+=1)for(var m=p;m>=d;m-=1){var g=a.getCellInfo(f,m),v=g.offset,y=g.nodeSize,b=r.mapping.slice(h).map(v),w=b+y;r.delete(b,w)}return t(r),!0}return!1}}},t.prototype.addRow=function(e){return function(){return function(t,n){var r=t.selection,o=t.schema,i=t.tr,s=Yf(r),a=s.anchor,l=s.head;if(a&&l){var c=Uf.create(a),u=c.totalColumnCount,d=c.getRectOffsets(a,l),p=tm(d).rowCount,h=function(e,t,n){var r,o,i;return"up"===e?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=t.totalColumnCount-1,i=t.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(e,c,d),f=h.targetRowIdx,m=h.insertColIdx,g=h.nodeSize;if(0!==f){for(var v=[],y=i.mapping.map(c.posAt(f,m))+g,b=[],w=0;w<u;w+=1)b=b.concat(Xf(1,f,o));for(var k=0;k<p;k+=1)v.push(o.nodes.tableRow.create(null,b));return n(i.insert(y,v)),!0}}return!1}}},t.prototype.removeRow=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Yf(n),i=o.anchor,s=o.head;if(i&&s){var a=Uf.create(i),l=a.totalRowCount,c=a.totalColumnCount,u=a.getRectOffsets(i,s),d=tm(u).rowCount,p=u.startRowIdx,h=u.endRowIdx;if(d===l-1||0===p)return!1;for(var f=h;f>=p;f-=1){var m=tg(a,f,c),g=m.from,v=m.to;r.delete(g-1,v+1)}return t(r),!0}return!1}}},t.prototype.alignColumn=function(){return function(e){return void 0===e&&(e={align:"center"}),function(t,n){var r=e.align,o=t.selection,i=t.tr,s=Yf(o),a=s.anchor,l=s.head;if(a&&l){for(var c=Uf.create(a),u=c.totalRowCount,d=c.getRectOffsets(a,l),p=d.startColIdx,h=d.endColIdx,f=0;f<u;f+=1)for(var m=p;m<=h;m+=1)if(!c.extendedRowspan(f,m)&&!c.extendedColspan(f,m)){var g=c.getNodeAndPos(f,m),v=g.node,y=g.pos,b=nm(v,{align:r});i.setNodeMarkup(y,null,b)}return n(i),!0}return!1}}},t.prototype.moveToCell=function(e){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=Yf(r),a=s.anchor,l=s.head;if(a&&l){var c,u=Uf.create(a),d=u.getCellIndex(a);if(c=Qm(e,u,d)?Ym(o,u,i):eg(e,o,d,u))return n(c),!0}return!1}},t.prototype.moveInCell=function(e){var t=this;return function(n,r){var o=n.selection,i=n.tr,s=n.doc,a=n.schema,l=o.$from;if(!t.context.view.endOfTextblock(e))return!1;var c=Af(l,(function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name}));if(c){var u=Af(l,(function(e){return"paragraph"===e.type.name})),d=c.depth;if(u&&function(e,t,n,r){var o=t[0],i=t[1],s=o+3,a=i>=s,l=a?o+1:i,c=function(e,t,n,r,o){var i=t[2];if("left"===e||"up"===e){if(o&&!function(e,t,n){var r=n[0],o=n[1],i=t.resolve(e.before(r-1));return o===r&&!i.nodeBefore}(n,r,[t[0],t[1]]))return!1;var s=n.before(i);if(r.resolve(s).nodeBefore)return!1}return!0}(e,[i,s,l],n,r,a),u=function(e,t,n,r,o){if("right"===e||"down"===e){if(o&&!function(e){for(var t,n,r=e.depth;r&&"tableBodyCell"!==(n=e.node(r)).type.name;){if("listItem"===n.type.name){var o=e.node(r-1).lastChild===n,i="paragraph"!==(null===(t=n.lastChild)||void 0===t?void 0:t.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(t);if(r.resolve(i).nodeAfter)return!1}return!0}(e,l,n,r,a);return c&&u}(e,[d,u.depth],l,s)){var p=Yf(o).anchor,h=Uf.create(p),f=h.getCellIndex(p),m=void 0;if(function(e,t,n){var r=n[0],o=n[1];if("up"===e||"down"===e)return!1;var i=t.tableStartOffset,s=t.tableEndOffset,a=t.getCellInfo(r,o),l=a.offset,c=a.nodeSize;return("left"===e?i:s)===("left"===e?l-2:l+c+3)}(e,h,f)?m=function(e,t,n){var r=e.doc.resolve(t.before(n-3));return e.setSelection(new Ye(r))}(i,l,d):Qm(e,h,f)?"up"===e?m=function(e,t,n){var r=e.doc.resolve(t.tableStartOffset-1);return r.nodeBefore?e.setSelection(Je.near(r,-1)):Gs(e,r,n)}(i,h,a):"down"===e&&(m=Ym(i,h,a)):m=eg(e,i,f,h),m)return r(m),!0}}return!1}},t.prototype.deleteCells=function(){return function(e,t){var n=e.schema,r=e.selection,o=e.tr,i=Yf(r),s=i.anchor,a=i.head;if(s&&a&&!(r instanceof Ze)){for(var l=Uf.create(s),c=l.getRectOffsets(s,a),u=c.startRowIdx,d=c.startColIdx,p=c.endRowIdx,h=c.endColIdx,f=u;f<=p;f+=1)for(var m=d;m<=h;m+=1)if(!l.extendedRowspan(f,m)&&!l.extendedColspan(f,m)){var g=l.getNodeAndPos(f,m),v=g.node,y=g.pos,b=Xf(1,f,n,v.attrs);o.replaceWith(o.mapping.map(y),o.mapping.map(y+v.nodeSize),b)}return t(o),!0}return!1}},t.prototype.exitTable=function(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from;if(Af(i,(function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name}))&&Af(i,(function(e){return"paragraph"===e.type.name}))){var s=Yf(n).anchor;return t(Ym(r,Uf.create(s),o,!0)),!0}return!1}},t.prototype.commands=function(){return{addTable:this.addTable(),removeTable:this.removeTable(),addColumnToLeft:this.addColumn("left"),addColumnToRight:this.addColumn("right"),removeColumn:this.removeColumn(),addRowToUp:this.addRow("up"),addRowToDown:this.addRow("down"),removeRow:this.removeRow(),alignColumn:this.alignColumn()}},t.prototype.keymaps=function(){var e=this.deleteCells();return{Tab:this.moveToCell("right"),"Shift-Tab":this.moveToCell("left"),ArrowUp:this.moveInCell("up"),ArrowDown:this.moveInCell("down"),ArrowLeft:this.moveInCell("left"),ArrowRight:this.moveInCell("right"),Backspace:e,"Mod-Backspace":e,Delete:e,"Mod-Delete":e,"Mod-Enter":this.exitTable()}},t}(ol),rg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableHead"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableRow{1}",attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Pf("thead")],toDOM:function(e){return["thead",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(ol),og=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableBody"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableRow+",attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tbody",getAttrs:function(e){var t=e.querySelectorAll("tr")[0].children.length,n=e.getAttribute("data-raw-html");return!!t&&Li({},n&&{rawHTML:n})}}],toDOM:function(e){return["tbody",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(ol),ig=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableRow"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"(tableHeadCell | tableBodyCell)*",attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tr",getAttrs:function(e){var t=e.children.length,n=e.getAttribute("data-raw-html");return!!t&&Li({},n&&{rawHTML:n})}}],toDOM:function(e){return["tr",Hf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(ol),sg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableHeadCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"paragraph+",attrs:Li({align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},extended:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),isolating:!0,parseDOM:[Ff("th")],toDOM:function(e){var t=e.attrs,n=Bf(t);return["th",Li(Li({},n),Hf(t)),0]}}},enumerable:!1,configurable:!0}),t}(ol),ag=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableBodyCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"(paragraph | bulletList | orderedList)+",attrs:{align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},rowspan:{default:null},extended:{default:null}},isolating:!0,parseDOM:[Ff("td")],toDOM:function(e){return["td",Bf(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(ol),lg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"image"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{inline:!0,attrs:Li({imageUrl:{default:""},altText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"img[src]",getAttrs:function(e){var t=uf(e,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=t.getAttribute("src")||"",r=t.getAttribute("data-raw-html"),o=t.getAttribute("alt");return Li({imageUrl:n,altText:o},r&&{rawHTML:r})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"img",Li(Li({src:Es(t.imageUrl)},t.altText&&{alt:t.altText}),Hf(t))]}}},enumerable:!1,configurable:!0}),t.prototype.addImage=function(){return function(e){return function(t,n){var r=t.schema,o=t.tr,i=e,s=i.imageUrl,a=i.altText;if(!s)return!1;var l=r.nodes.image.createAndFill(Li({imageUrl:s},a&&{altText:a}));return n(o.replaceSelectionWith(l).scrollIntoView()),!0}}},t.prototype.commands=function(){return{addImage:this.addImage()}},t}(ol),cg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"block",parseDOM:[{tag:"hr"}],selectable:!1,toDOM:function(e){var t=e.attrs;return["div",Hf(t),[t.rawHTML||"hr"]]}}},enumerable:!1,configurable:!0}),t.prototype.hr=function(){var e=this;return function(){return function(t,n){var r,o=t.selection,i=o.$from;if(i===o.$to){var s=t.doc,a=t.schema.nodes,l=a.thematicBreak,c=a.paragraph,u=[l.create()],d=i.node(1),p=s.child(s.childCount-1)===d,h=s.resolve(i.after(1)),f=(null===(r=i.nodeAfter)||void 0===r?void 0:r.type.name)===e.name;return(p||f)&&u.push(c.create()),n(t.tr.insert(h.pos,u).scrollIntoView()),!0}return!1}}},t.prototype.commands=function(){return{hr:this.hr()}},t.prototype.keymaps=function(){var e=this.hr()();return{"Mod-l":e,"Mod-L":e}},t}(ol),ug=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["b","strong"].map((function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({},t&&{rawHTML:t})}}}));return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"strong",Hf(t)]}}},enumerable:!1,configurable:!0}),t.prototype.bold=function(){return function(){return function(e,t){return Qo(e.schema.marks.strong)(e,t)}}},t.prototype.commands=function(){return{bold:this.bold()}},t.prototype.keymaps=function(){var e=this.bold()();return{"Mod-b":e,"Mod-B":e}},t}(jl),dg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["i","em"].map((function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({},t&&{rawHTML:t})}}}));return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"em",Hf(t)]}}},enumerable:!1,configurable:!0}),t.prototype.italic=function(){return function(){return function(e,t){return Qo(e.schema.marks.emph)(e,t)}}},t.prototype.commands=function(){return{italic:this.italic()}},t.prototype.keymaps=function(){var e=this.italic()();return{"Mod-i":e,"Mod-I":e}},t}(jl),pg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["s","del"].map((function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({},t&&{rawHTML:t})}}}));return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"del",Hf(t)]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Qo(e.schema.marks.strike)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Mod-s":e,"Mod-S":e}},t}(jl),hg=function(e){function t(t){var n=e.call(this)||this;return n.linkAttributes=t,n}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=this;return{attrs:Li({linkUrl:{default:""},title:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(e){var t=uf(e,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=t.getAttribute("href")||"",r=t.getAttribute("title")||"",o=t.getAttribute("data-raw-html");return Li({linkUrl:n,title:r},o&&{rawHTML:o})}}],toDOM:function(t){var n=t.attrs;return[n.rawHTML||"a",Li(Li({href:Es(n.linkUrl)},e.linkAttributes),Hf(n))]}}},enumerable:!1,configurable:!0}),t.prototype.addLink=function(){return function(e){return function(t,n){var r=e,o=r.linkUrl,i=r.linkText,s=void 0===i?"":i,a=t.schema,l=t.tr,c=t.selection,u=c.empty,d=c.from,p=c.to;if(d&&p&&o){var h={linkUrl:o},f=a.mark("link",h);if(u&&s){var m=Js(a,s,f);l.replaceRangeWith(d,p,m)}else l.addMark(d,p,f);return n(l.scrollIntoView()),!0}return!1}}},t.prototype.toggleLink=function(){return function(e){return function(t,n){return Qo(t.schema.marks.link,e)(t,n)}}},t.prototype.commands=function(){return{addLink:this.addLink(),toggleLink:this.toggleLink()}},t}(jl),fg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:Li({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"code",getAttrs:function(e){var t=e.getAttribute("data-raw-html");return Li({},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"code",Hf(t)]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Qo(e.schema.marks.code)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-c":e,"Shift-Mod-C":e}},t}(jl),mg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:{info:{default:null}},atom:!0,code:!0,defining:!0,parseDOM:[{tag:"div[data-custom-info]",getAttrs:function(e){return{info:e.getAttribute("data-custom-info")}}}],toDOM:function(e){return["div",{"data-custom-info":e.attrs.info||null},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){return!!(null==e?void 0:e.info)&&Zo(t.schema.nodes.customBlock,e)(t,n)}}},t}(ol),gg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"frontMatter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-front-matter]"}],toDOM:function(){return["div",{"data-front-matter":"true"},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t,n){var r=e.selection.$from;return!(!n.endOfTextblock("down")||"frontMatter"!==r.node().type.name)&&_o(e,t)}}},t.prototype.keymaps=function(){return{Enter:this.commands()()}},t}(ol),vg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"htmlComment"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-html-comment]"}],toDOM:function(){return["div",{"data-html-comment":"true"},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t,n){var r=e.selection.$from;return!(!n.endOfTextblock("down")||"htmlComment"!==r.node().type.name)&&_o(e,t)}}},t.prototype.keymaps=function(){return{Enter:this.commands()()}},t}(ol),yg=ja("contents"),bg=function(e){function t(t,n){var r=e.call(this,t)||this,o=n.toDOMAdaptor,i=n.htmlSchemaMap,s=void 0===i?{}:i,a=n.linkAttributes,l=void 0===a?{}:a,c=n.useCommandShortcut,u=void 0===c||c,d=n.wwPlugins,p=void 0===d?[]:d,h=n.wwNodeViews,f=void 0===h?{}:h;return r.editorType="wysiwyg",r.el.classList.add("ww-mode"),r.toDOMAdaptor=o,r.linkAttributes=l,r.extraPlugins=p,r.pluginNodeViews=f,r.specs=r.createSpecs(),r.schema=r.createSchema(s),r.context=r.createContext(),r.keymaps=r.createKeymaps(u),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Li(Li({},r.context),{view:r.view})),r.initEvent(),r}return Ai(t,e),t.prototype.createSpecs=function(){return e=this.linkAttributes,new pl([new Vm,new jm,new _m,new Um,new Wm,new Jm,new Km,new Gm,new Xm,new ng,new rg,new og,new ig,new sg,new ag,new lg,new cg,new ug,new dg,new pg,new hg(e),new fg,new mg,new gg,new al,new vg]);var e},t.prototype.createContext=function(){return{schema:this.schema,eventEmitter:this.eventEmitter}},t.prototype.createSchema=function(e){return new G({nodes:Li(Li({},this.specs.nodes),e.nodes),marks:Li(Li({},this.specs.marks),e.marks)})},t.prototype.createPlugins=function(){return Ii([new pt({key:rm,state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(rm);if(n)return-1===n?null:n;if(hs(t)||!e.docChanged)return t;var r=e.mapping.mapResult(t),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:sm,createSelectionBetween:function(e){var t=e.state;return hs(rm.getState(t))?null:t.selection}},view:function(e){return new om(e)}}),(e=this.eventEmitter,new pt({props:{handleDOMEvents:{contextmenu:function(t,n){var r=Zf(n.target,t.dom);if(r){n.preventDefault();var o=n,i=o.clientX,s=o.clientY,a=t.dom.parentNode.getBoundingClientRect(),l=a.left,c=a.top,u="TH"===r.nodeName;return e.emit("contextmenu",{pos:{left:i-l+10+"px",top:s-c+30+"px"},menuGroups:pm(e,u),tableCell:r}),!0}return!1}}}})),new pt({props:{handleDOMEvents:{mousedown:function(e,t){var n=t,r=n.clientX,o=n.clientY,i=e.posAtCoords({left:r,top:o});if(i){var s=e.state,a=s.doc,l=s.tr,c=a.resolve(i.pos),u=Rf(c),d=t.target,p=getComputedStyle(d,":before"),h=t,f=h.offsetX,m=h.offsetY;if(!u||!qa(p,f,m))return!1;t.preventDefault();var g=c.before(u.depth),v=u.node.attrs;return l.setNodeMarkup(g,null,Li(Li({},v),{checked:!v.checked})),e.dispatch(l),!0}return!1}}}}),vm(this.eventEmitter)],this.createPluginProps()).concat(this.defaultPlugins);var e},t.prototype.createPluginNodeViews=function(){var e=this.eventEmitter,t=this.pluginNodeViews,n={};return t&&Object.keys(t).forEach((function(r){n[r]=function(n,o,i){return t[r](n,o,i,e)}})),n},t.prototype.createView=function(){var e=this,t=this.toDOMAdaptor,n=this.eventEmitter;return new wo(this.el,{state:this.createState(),attributes:{class:yg},nodeViews:Li({customBlock:function(e,n,r){return new ym(e,n,r,t)},image:function(e,t,r){return new wm(e,t,r,n)},codeBlock:function(e,t,r){return new km(e,t,r,n)},widget:il},this.createPluginNodeViews()),dispatchTransaction:function(t){var n=e.view.state.applyTransaction(t).state;e.view.updateState(n),e.emitChangeEvent(t.scrollIntoView()),e.eventEmitter.emit("setFocusedNode",n.selection.$from.node(1))},transformPastedHTML:Lm,transformPasted:function(t){return function(e,t,n){var r=[],o=e.content,i=e.openStart,s=e.openEnd;return o.forEach((function(e){if("table"===e.type.name){var o=em(new h(a.from(e),0,0));if(o){var i=Bm(o),s="tableBody"===o.firstChild.type.name,l=function(e,t,n,r){var o=function(e){return e.reduce((function(e,t){return e.childCount>t.childCount?e:t})).childCount}(e);if(n&&r)return t.nodes.table.create(null,[Hm(e,o,t)]);var i=e[0],s=e.slice(1),a=[Fm(i,0,t)];return s.length&&a.push(Hm(s,o,t)),t.nodes.table.create(null,a)}(i,t,s,n);r.push(l)}}else r.push(e)})),new h(a.from(r),i,s)}(t,e.schema,If(e.view.state.selection.$from))},handlePaste:function(e,t,n){return function(e,t){var n=e.state,r=n.selection,o=n.schema,i=n.tr,s=Yf(r),a=s.anchor,l=s.head;if(a&&l){var c=em(t);if(!c)return!1;var u=Uf.create(a),d=u.getRectOffsets(a,l),p=function(e,t,n){var r=[],o=Bm(e),i=(o[0].childCount,o.length),s=0===t.startRowIdx,a=o.slice(0,i);if(s){var l=a.shift();if(l){var c=Rm(l,0,n).content;r.push(c)}}return a.forEach((function(e){if(!e.attrs.dummyRowForPasting){var t=Pm(e,0,n).content;r.push(t)}})),r}(c,d,o),f=function(e,t,n){for(var r=t.startRowIdx,o=t.startColIdx,i=n.length,s=0,a=function(e){var t=n[e].childCount;n[e].forEach((function(e){var n=e.attrs.colspan;n>1&&(t+=n-1)})),s=Math.max(s,t)},l=0;l<i;l+=1)a(l);var c=r+i-1,u=o+s-1;return{startRowIdx:r,startColIdx:o,endRowIdx:c,endColIdx:u,addedRowCount:Math.max(c+1-e.totalRowCount,0),addedColumnCount:Math.max(u+1-e.totalColumnCount,0)}}(u,d,p),m=[];return function(e,t){var n=tm(e.getSpannedOffsets(t)),r=n.rowCount,o=n.columnCount,i=tm(t),s=i.rowCount,a=i.columnCount;return r===s&&o===a}(u,f)&&(function(e,t){for(var n=e.startRowIdx,r=e.startColIdx,o=e.endRowIdx,i=e.endColIdx,s=e.addedRowCount,a=e.addedColumnCount,l=n;l<=o-s;l+=1)t.push({rowIdx:l,startColIdx:r,endColIdx:i-a})}(f,m),f.addedColumnCount&&function(e,t,n,r,o){for(var i=r.startRowIdx,s=r.startColIdx,a=r.endRowIdx,l=r.endColIdx,c=r.addedRowCount,u=r.addedColumnCount,d=n.totalRowCount,p=0,h=0;h<d;h+=1){var f=n.getCellInfo(h,l-u),m=f.offset,g=f.nodeSize,v=e.mapping.map(m+g),y=Xf(u,h,t);if(e.insert(v,y),h>=i&&h<=a-c){var b=n.getCellInfo(h,l-u),w=e.mapping.map(b.offset),k=v+qm(u);o[p]={rowIdx:h,startColIdx:s,endColIdx:l,dummyOffsets:[w,k]},p+=1}}}(i,o,u,f,m),f.addedRowCount&&function(e,t,n,r,o){var i=r.addedRowCount,s=r.addedColumnCount,a=r.startColIdx,l=r.endColIdx,c=e.mapping.maps.length,u=n.tableEndOffset-2,d=Gf(i,n.totalColumnCount+s,t),p=u;e.insert(e.mapping.slice(c).map(p),d);for(var h=0;h<i;h+=1){var f=p+qm(a)+1,m=p+qm(l+1)+1,g=p+qm(n.totalColumnCount+s)+2;o.push({rowIdx:h+n.totalRowCount,startColIdx:a,endColIdx:l,dummyOffsets:[f,m]}),p=g}}(i,o,u,f,m),function(e,t,n,r){var o=e.mapping.maps.length;n.forEach((function(n,i){var s=n.rowIdx,a=n.startColIdx,l=n.endColIdx,c=n.dummyOffsets,u=e.mapping.slice(o),d=new h(t[i],0,0),p=c?c[0]:r.getCellStartOffset(s,a),f=c?c[1]:r.getCellEndOffset(s,l);e.replace(u.map(p),u.map(f),d)}))}(i,p,m,u),e.dispatch(i),function(e,t,n){var r=e.state,o=r.tr,i=r.doc,s=Uf.create(i.resolve(n)),a=t[0],l=a.rowIdx,c=a.startColIdx,u=Fs(t),d=u.rowIdx,p=u.endColIdx,h=s.getCellInfo(l,c).offset,f=s.getCellInfo(d,p).offset;e.dispatch(o.setSelection(new Kf(i.resolve(h),i.resolve(f))))}(e,m,u.getCellInfo(0,0).offset)),!0}return!1}(e,n)},handleKeyDown:function(t,n){return e.eventEmitter.emit("keydown",e.editorType,n),!1},handleDOMEvents:{paste:function(t,n){var r=n.clipboardData||window.clipboardData,o=null==r?void 0:r.items;if(o){var i=Us(o).some((function(e){return"string"===e.kind&&"text/rtf"===e.type}));if(!i){var s=nl(o);s&&(n.preventDefault(),tl(e.eventEmitter,s,n.type))}}return!1},keyup:function(t,n){return e.eventEmitter.emit("keyup",e.editorType,n),!1},scroll:function(){return e.eventEmitter.emit("scroll","editor"),!0}}})},t.prototype.createCommands=function(){return this.specs.commands(this.view,$f())},t.prototype.getHTML=function(){return Qa(this.view.dom.innerHTML)},t.prototype.getModel=function(){return this.view.state.doc},t.prototype.getSelection=function(){var e=this.view.state.selection;return[e.from,e.to]},t.prototype.getSchema=function(){return this.view.state.schema},t.prototype.replaceSelection=function(e,t,n){var r=this.view.state,o=r.schema,i=r.tr,s=e.split("\n").map((function(e){return Ws(o,ka(e,o))})),l=new h(a.from(s),1,1),c=ps(t)&&ps(n)?i.replaceRange(t,n,l):i.replaceSelection(l);this.view.dispatch(c),this.focus()},t.prototype.deleteSelection=function(e,t){var n=this.view.state.tr,r=ps(e)&&ps(t)?n.deleteRange(e,t):n.deleteSelection();this.view.dispatch(r.scrollIntoView())},t.prototype.getSelectedText=function(e,t){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;return ps(e)&&ps(t)&&(i=e,s=t),r.textBetween(i,s,"\n")},t.prototype.setModel=function(e,t){void 0===t&&(t=!1);var n=this.view.state,r=n.tr,o=n.doc;this.view.dispatch(r.replaceWith(0,o.content.size,e)),t&&this.moveCursorToEnd(!0)},t.prototype.setSelection=function(e,t){void 0===t&&(t=e);var n=this.view.state.tr,r=Ks(n,e,t);this.view.dispatch(n.setSelection(r).scrollIntoView())},t.prototype.addWidget=function(e,t,n){var r=this.view,o=r.dispatch,i=r.state;o(i.tr.setMeta("widget",{pos:null!=n?n:i.selection.to,node:e,style:t}))},t.prototype.replaceWithWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=ka(n,r.schema);this.view.dispatch(o.replaceWith(e,t,i))},t.prototype.getRangeInfoOfNode=function(e){var t=this.view.state,n=t.doc,r=t.selection,o=e?n.resolve(e):r.$from,i=o.marks(),s=o.node(),a=o.start(),l=o.end(),c=s.type.name;if(i.length||"paragraph"===c){var u=i[i.length-1];c=u?u.type.name:"text",s.forEach((function(e,t){var n=e.isText,r=e.nodeSize,i=e.marks,s=o.pos-a;n&&t<=s&&t+r>=s&&function(e){return!e.length||Ns(e,u)}(i)&&(l=(a+=t)+r)}))}return{range:[a,l],type:c}},t}(ll),wg=Gi,kg=hs,xg=function(e){return!(t=e,wg(t)||kg(t)||!1===e);var t},Cg=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],Tg=function(){function e(){var e=this;this.events=new am,this.eventTypes=Cg.reduce((function(e,t){return Li(Li({},e),{type:t})}),{}),this.hold=!1,Cg.forEach((function(t){e.addEventType(t)}))}return e.prototype.listen=function(e,t){var n=this.getTypeInfo(e),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(t.namespace=n.namespace),r.push(t),this.events.set(n.type,r)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this.getTypeInfo(e),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach((function(e){var n=e.apply(void 0,t);Gi(n)||i.push(n)})),i},e.prototype.emitReduce=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(e);return!this.hold&&o&&o.forEach((function(e){var r=e.apply(void 0,Ii([t],n));!xg(r)||(t=r)})),t},e.prototype.getTypeInfo=function(e){var t=e.split(".");return{type:t[0],namespace:t[1]}},e.prototype.hasEventType=function(e){return!Gi(this.eventTypes[this.getTypeInfo(e).type])},e.prototype.addEventType=function(e){if(this.hasEventType(e))throw new Error("There is already have event type "+e);this.eventTypes[e]=e},e.prototype.removeEventHandler=function(e,t){var n=this,r=this.getTypeInfo(e),o=r.type,i=r.namespace;o&&t?this.removeEventHandlerWithHandler(o,t):o&&!i?this.events.delete(o):!o&&i?this.events.forEach((function(e,t){n.removeEventHandlerWithTypeInfo(t,i)})):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},e.prototype.removeEventHandlerWithHandler=function(e,t){var n=this.events.get(e);if(n){var r=n.indexOf(t);n.indexOf(t)>=0&&n.splice(r,1)}},e.prototype.removeEventHandlerWithTypeInfo=function(e,t){var n=[],r=this.events.get(e);r&&(r.map((function(e){return e.namespace!==t&&n.push(e),null})),this.events.set(e,n))},e.prototype.getEvents=function(){return this.events},e.prototype.holdEventInvoke=function(e){this.hold=!0,e(),this.hold=!1},e}(),Mg=function(){function e(e,t,n,r){this.eventEmitter=e,this.mdCommands=t,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return e.prototype.initEvent=function(){var e=this;this.eventEmitter.listen("command",(function(t,n){e.exec(t,n)}))},e.prototype.addCommand=function(e,t,n){"markdown"===e?this.mdCommands[t]=n:this.wwCommands[t]=n},e.prototype.deleteCommand=function(e,t){"markdown"===e?delete this.mdCommands[t]:delete this.wwCommands[t]},e.prototype.exec=function(e,t){"markdown"===this.getEditorType()?this.mdCommands[e](t):this.wwCommands[e](t)},e}();function Sg(e){return"\n"===e[e.length-1]?e.slice(0,e.length-1):e}function Eg(e,t){var n=e.schema,r=t.literal.match(Ba);if(r){var o=r[1],i=r[3],s=(o||i).toLowerCase();return"htmlInline"===t.type&&!(!n.marks[s]&&!n.nodes[s])}return!1}function Ng(e){return Ns(["text","strong","emph","strike","image","link","code"],e.type)}function Og(e){return"softbreak"===(null==e?void 0:e.type)}function Dg(e){var t=e.type,n=e.literal,r="htmlInline"===t&&n.match(Ba);if(r){var o=r[1],i=r[3],s=o||i;if(s)return Ns(["ul","ol","li"],s.toLowerCase())}return!1}function Ag(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=document.createElement("div");r.innerHTML=uf(e);var o=r.firstChild;return t.map((function(e){return o.getAttribute(e)||""}))}var Lg={"b, strong":function(e,t,n){var r=e.schema.marks.strong;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},"i, em":function(e,t,n){var r=e.schema.marks.emph;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},"s, del":function(e,t,n){var r=e.schema.marks.strike;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},code:function(e,t,n){var r=e.schema.marks.code;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},a:function(e,t,n){var r=t.literal,o=e.schema.marks.link;if(n){var i=Ag(r,"href")[0];e.openMark(o.create({linkUrl:i,rawHTML:n}))}else e.closeMark(o)},img:function(e,t,n){var r=t.literal;if(n){var o=Ag(r,"src","alt"),i=o[0],s=o[1],a=e.schema.nodes.image;e.addNode(a,Li({rawHTML:n,imageUrl:i},s&&{altText:s}))}},hr:function(e,t,n){e.addNode(e.schema.nodes.thematicBreak,{rawHTML:n})},br:function(e,t){var n=e.schema.nodes.paragraph,r=t.parent,o=t.prev,i=t.next;"paragraph"===(null==r?void 0:r.type)?(Og(o)&&e.openNode(n),Og(i)?e.closeNode():i&&(e.closeNode(),e.openNode(n))):"tableCell"===(null==r?void 0:r.type)&&(o&&(Ng(o)||Eg(e,o))&&e.closeNode(),i&&(Ng(i)||Eg(e,i))&&e.openNode(n))},pre:function(e,t,n){var r,o,i=document.createElement("div");i.innerHTML=t.literal;var s=null===(o=null===(r=i.firstChild)||void 0===r?void 0:r.firstChild)||void 0===o?void 0:o.textContent;e.openNode(e.schema.nodes.codeBlock,{rawHTML:n}),e.addText(Sg(s)),e.closeNode()},"ul, ol":function(e,t,n){if("tableCell"===t.parent.type){var r=e.schema.nodes,o=r.bulletList,i=r.orderedList,s=r.paragraph,a="ul"===n?o:i;n?(t.prev&&!Dg(t.prev)&&e.closeNode(),e.openNode(a,{rawHTML:n})):(e.closeNode(),t.next&&!Dg(t.next)&&e.openNode(s))}},li:function(e,t,n){var r;if("tableCell"===(null===(r=t.parent)||void 0===r?void 0:r.type)){var o=e.schema.nodes,i=o.listItem,s=o.paragraph;if(n){var a=function(e){var t=e.literal;return{task:/data-task/.test(t),checked:/data-task-checked/.test(t)}}(t);t.prev&&!Dg(t.prev)&&e.closeNode(),e.openNode(i,Li({rawHTML:n},a)),t.next&&!Dg(t.next)&&e.openNode(s)}else t.prev&&!Dg(t.prev)&&e.closeNode(),e.closeNode()}}},Ig=function(e){var t={};return Object.keys(e).forEach((function(n){n.split(", ").forEach((function(r){var o=r.toLowerCase();t[o]=e[n]}))})),t}(Lg);function Rg(e){return"htmlInline"===e.type&&Fa.test(e.literal)}function Pg(e){Us(e.childNodes).forEach((function(e){if(_a(e)){var t=e.nodeName.toLowerCase();e.setAttribute("data-raw-html",t),e.childNodes&&Pg(e)}}))}var Bg={text:function(e,t){e.addText(t.literal||"")},paragraph:function(e,t,n,r){var o;if(n.entering){var i=e.schema.nodes.paragraph;"paragraph"===(null===(o=t.prev)||void 0===o?void 0:o.type)&&(e.openNode(i,r),e.closeNode()),e.openNode(i,r)}else e.closeNode()},heading:function(e,t,n,r){if(n.entering){var o=t,i=o.level,s=o.headingType;e.openNode(e.schema.nodes.heading,Li({level:i,headingType:s},r))}else e.closeNode()},codeBlock:function(e,t,n){var r=e.schema.nodes.codeBlock,o=t,i=o.info,s=o.literal;e.openNode(r,Li({language:i},n)),e.addText(Sg(s||"")),e.closeNode()},list:function(e,t,n,r){if(n.entering){var o=e.schema.nodes,i=o.bulletList,s=o.orderedList,a=t.listData,l=a.type,c=a.start;"bullet"===l?e.openNode(i,r):e.openNode(s,Li({order:c},r))}else e.closeNode()},item:function(e,t,n,r){var o=n.entering,i=e.schema.nodes.listItem,s=t.listData,a=s.task,l=s.checked;if(o){var c=Li(Li(Li({},a&&{task:a}),l&&{checked:l}),r);e.openNode(i,c)}else e.closeNode()},blockQuote:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.blockQuote,r):e.closeNode()},image:function(e,t,n,r){var o=n.entering,i=n.skipChildren,s=e.schema.nodes.image,a=t,l=a.destination,c=a.firstChild;o&&i&&i(),e.addNode(s,Li(Li({imageUrl:l},c&&{altText:c.literal}),r))},thematicBreak:function(e,t,n,r){e.addNode(e.schema.nodes.thematicBreak,r)},strong:function(e,t,n,r){var o=n.entering,i=e.schema.marks.strong;o?e.openMark(i.create(r)):e.closeMark(i)},emph:function(e,t,n,r){var o=n.entering,i=e.schema.marks.emph;o?e.openMark(i.create(r)):e.closeMark(i)},link:function(e,t,n,r){var o=n.entering,i=e.schema.marks.link,s=t,a=s.destination,l=s.title;if(o){var c=Li({linkUrl:a,title:l},r);e.openMark(i.create(c))}else e.closeMark(i)},softbreak:function(e,t){if("paragraph"===t.parent.type){var n=t.prev,r=t.next;n&&!Rg(n)&&e.closeNode(),r&&!Rg(r)&&e.openNode(e.schema.nodes.paragraph)}},table:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.table,r):e.closeNode()},tableHead:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableHead,r):e.closeNode()},tableBody:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableBody,r):e.closeNode()},tableRow:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableRow,r):e.closeNode()},tableCell:function(e,t,n){var r=n.entering;if(!t.ignored){var o=function(t){return t&&(Ng(t)||Eg(e,t))};if(r){var i=e.schema.nodes,s=i.tableHeadCell,a=i.tableBodyCell,l=i.paragraph,c=t.parent.parent,u="tableHead"===c.type?s:a,d=(c.parent.columns[t.startIdx]||{}).align,p=Li({},t.attrs);d&&(p.align=d),e.openNode(u,p),o(t.firstChild)&&e.openNode(l)}else o(t.lastChild)&&e.closeNode(),e.closeNode()}},strike:function(e,t,n,r){var o=n.entering,i=e.schema.marks.strike;o?e.openMark(i.create(r)):e.closeMark(i)},code:function(e,t,n,r){var o=e.schema.marks.code;e.openMark(o.create(r)),e.addText(Sg(t.literal||"")),e.closeMark(o)},customBlock:function(e,t){var n=e.schema.nodes,r=n.customBlock,o=n.paragraph,i=t,s=i.info,a=i.literal;e.openNode(r,{info:s}),e.addText(Sg(a||"")),e.closeNode(),t.next||(e.openNode(o),e.closeNode())},frontMatter:function(e,t){e.openNode(e.schema.nodes.frontMatter),e.addText(t.literal),e.closeNode()},htmlInline:function(e,t){var n=t.literal,r=n.match(Ba),o=r[1],i=r[3],s=(o||i).toLowerCase(),a=e.schema.marks[s],l=uf(n);if(null==a?void 0:a.spec.attrs.htmlInline)if(o){var c=pf(l);e.openMark(a.create({htmlAttrs:c}))}else e.closeMark(a);else{var u=Ig[s];u&&u(e,t,o)}},htmlBlock:function(e,t){var n=t.literal,r=document.createElement("div");if(Ha.test(n))e.openNode(e.schema.nodes.htmlComment),e.addText(t.literal),e.closeNode();else{var o=n.match(Ba),i=o[1],s=o[3],a=(i||s).toLowerCase(),l=e.schema.nodes[a],c=uf(n);if(null==l?void 0:l.spec.attrs.htmlBlock){var u=pf(c),d=df(t,a);e.addNode(l,{htmlAttrs:u,childrenHTML:d})}else r.innerHTML=c,Pg(r),e.convertByDOMParser(r)}},customInline:function(e,t,n){var r=n.entering,o=n.skipChildren,i=t,s=i.info,a=i.firstChild,l=e.schema;if(-1!==s.indexOf("widget")&&r){var c=xa(t);o(),e.addNode(l.nodes.widget,{info:s},[l.text(va(s,c))])}else{var u="$$";r&&(u+=a?s+" ":s),e.addText(u)}}},Fg=function(){function e(e,t){this.schema=e,this.convertors=t,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=d.none}return e.prototype.top=function(){return Fs(this.stack)},e.prototype.push=function(e){this.stack.length&&this.top().content.push(e)},e.prototype.addText=function(e){if(e){var t=this.top().content,n=Fs(t),r=this.schema.text(e,this.marks),o=n&&(s=r,!!((i=n).isText&&s.isText&&d.sameSet(i.marks,s.marks))&&i.withText(i.text+s.text));o?t[t.length-1]=o:t.push(r)}var i,s},e.prototype.openMark=function(e){this.marks=e.addToSet(this.marks)},e.prototype.closeMark=function(e){this.marks=e.removeFromSet(this.marks)},e.prototype.addNode=function(e,t,n){var r=e.createAndFill(t,n,this.marks);return r?(this.push(r),r):null},e.prototype.openNode=function(e,t){this.stack.push({type:e,attrs:t,content:[]})},e.prototype.closeNode=function(){this.marks.length&&(this.marks=d.none);var e=this.stack.pop(),t=e.type,n=e.attrs,r=e.content;return this.addNode(t,n,r)},e.prototype.convertByDOMParser=function(e){var t=this;Z.fromSchema(this.schema).parse(e).content.forEach((function(e){return t.push(e)}))},e.prototype.closeUnmatchedHTMLInline=function(e,t){var n;if(!t&&"htmlInline"!==e.type)for(var r=this.stack.length-1;r>=0;r-=1){var o=this.stack[r];if(!(null===(n=o.attrs)||void 0===n?void 0:n.rawHTML))break;o.content.length?this.closeNode():this.stack.pop()}},e.prototype.convert=function(e,t){for(var n=e.walker(),r=n.next(),o=function(){var e=r.node,o=r.entering,s=i.convertors[e.type],a=!1;if(s){var l={entering:o,leaf:!da(e),getChildrenText:pa,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){a=!0}};if(i.closeUnmatchedHTMLInline(e,o),s(i,e,l),(null==t?void 0:t.node)===e){var c=i.stack.reduce((function(e,t){return e+t.content.reduce((function(e,t){return e+t.nodeSize}),0)}),0)+1;t.setMappedPos(c)}}a&&(n.resumeAt(e,!1),n.next()),r=n.next()},i=this;r;)o()},e.prototype.convertNode=function(e,t){return this.convert(e,t),this.stack.length?this.closeNode():null},e}(),Hg={text:function(e,t){var n,r=t.node,o=null!==(n=r.text)&&void 0!==n?n:"";(r.marks||[]).some((function(e){return"link"===e.type.name}))?e.text(Is(o),!1):e.text(o)},paragraph:function(e,t){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o;if(e.stopNewline)e.convertInline(n);else{var s=0===i,a=!s&&r.child(i-1),l=a&&0===a.childCount,c=i<r.childCount-1&&r.child(i+1),u=c&&"paragraph"===c.type.name,d=0===n.childCount;if(d&&l)e.write("<br>\n");else if(!d||l||s)e.convertInline(n),u?e.write("\n"):e.closeBlock(n);else{if("listItem"===(null==r?void 0:r.type.name)){var p=e.getDelim();e.setDelim(""),e.write("<br>"),e.setDelim(p)}e.write("\n")}}},heading:function(e,t,n){var r=t.node,o=n.delim;"atx"===r.attrs.headingType?(e.write(o+" "),e.convertInline(r),e.closeBlock(r)):(e.convertInline(r),e.ensureNewLine(),e.write(o),e.closeBlock(r))},codeBlock:function(e,t,n){var r=t.node,o=n.delim,i=n.text,s=o,a=s[0],l=s[1];e.write(a),e.ensureNewLine(),e.text(i,!1),e.ensureNewLine(),e.write(l),e.closeBlock(r)},blockQuote:function(e,t,n){var r=t.node,o=t.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&e.flushClose(1),e.wrapBlock(i,null,r,(function(){return e.convertNode(r)}))},bulletList:function(e,t,n){var r=t.node,o=n.delim;e.convertList(r,Ls(" ",4),(function(){return o+" "}))},orderedList:function(e,t){var n=t.node,r=n.attrs.order||1;e.convertList(n,Ls(" ",4),(function(e){return String(r+e)+". "}))},listItem:function(e,t){var n=t.node,r=n.attrs,o=r.task,i=r.checked;o&&e.write("["+(i?"x":" ")+"] "),e.convertNode(n)},image:function(e,t,n){var r=n.attrs;e.write("!["+(null==r?void 0:r.altText)+"]("+(null==r?void 0:r.imageUrl)+")")},thematicBreak:function(e,t,n){var r=t.node,o=n.delim;e.write(o),e.closeBlock(r)},table:function(e,t){var n=t.node;e.convertNode(n),e.closeBlock(n)},tableHead:function(e,t,n){var r=t.node,o=n.delim,i=r.firstChild;e.convertNode(r);var s=null!=o?o:"";!o&&i&&i.forEach((function(e){var t,n,r,o,i,a=(t=e.textContent,n=e.attrs.align,r=t.length,o="",i="","left"===n?(o=":",r-=1):"right"===n?(i=":",r-=1):"center"===n&&(o=":",i=":",r-=2),""+o+Ls("-",Math.max(r,3))+i);s+="| "+a+" "})),e.write(s+"|"),e.ensureNewLine()},tableBody:function(e,t){var n=t.node;e.convertNode(n)},tableRow:function(e,t){var n=t.node;e.convertNode(n),e.write("|"),e.ensureNewLine()},tableHeadCell:function(e,t,n){var r=t.node,o=n.delim,i=void 0===o?"| ":o;e.write(i),e.convertTableCell(r),e.write(" ")},tableBodyCell:function(e,t,n){var r=t.node,o=n.delim,i=void 0===o?"| ":o;e.write(i),e.convertTableCell(r),e.write(" ")},customBlock:function(e,t,n){var r=t.node,o=n.delim,i=n.text,s=o,a=s[0],l=s[1];e.write(a),e.ensureNewLine(),e.text(i,!1),e.ensureNewLine(),e.write(l),e.closeBlock(r)},frontMatter:function(e,t,n){var r=t.node,o=n.text;e.text(o,!1),e.closeBlock(r)},widget:function(e,t,n){var r=n.text;e.write(r)},html:function(e,t,n){var r=t.node,o=n.text;e.write(o),r.attrs.htmlBlock&&e.closeBlock(r)},htmlComment:function(e,t,n){var r=t.node,o=n.text;e.write(o),e.closeBlock(r)}};function zg(e,t){var n=e.text,r=/`+/g,o=0;if(e.isText&&n)for(var i=r.exec(n);i;)o=Math.max(o,i[0].length),i=r.exec(n);for(var s=o>0&&t>0?" `":"`",a=0;a<o;a+=1)s+="`";return o>0&&t<0&&(s+=" "),s}function qg(e){return e?["<"+e+">","</"+e+">"]:null}function Vg(e){return e?"<"+e+">":null}function jg(e){return e?"</"+e+">":null}var $g={heading:function(e){var t=e.node.attrs,n=t.level,r=Ls("#",n);return"setext"===t.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:qg(t.rawHTML)}},codeBlock:function(e){var t=e.node,n=t.attrs,r=t.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:qg(n.rawHTML),text:r}},blockQuote:function(e){return{delim:"> ",rawHTML:qg(e.node.attrs.rawHTML)}},bulletList:function(e,t){var n=e.node,r=t.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:qg(o)}},orderedList:function(e,t){var n=e.node,r=t.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:qg(o)}},listItem:function(e,t){var n=e.node,r=t.inTable,o=n.attrs,i=o.task,s=o.checked,a=n.attrs.rawHTML;return r&&(a=a||"li"),{rawHTML:a?["<"+a+(i?' class="task-list-item'+(s?" checked":"")+'"':"")+(i?" data-task"+(s?" data-task-checked":""):"")+">","</"+a+">"]:null}},table:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},tableHead:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},tableBody:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},tableRow:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},tableHeadCell:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},tableBodyCell:function(e){return{rawHTML:qg(e.node.attrs.rawHTML)}},image:function(e){var t=e.node.attrs,n=t.rawHTML,r=t.altText,o=t.imageUrl.replace(/&amp;/g,"&"),i=r?' alt="'+Es(r)+'"':"";return{rawHTML:n?"<"+n+' src="'+Es(o)+'"'+i+">":null,attrs:{altText:Is(r||""),imageUrl:o}}},thematicBreak:function(e){return{delim:"***",rawHTML:Vg(e.node.attrs.rawHTML)}},customBlock:function(e){var t=e.node,n=t.attrs,r=t.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(e){return{text:e.node.textContent}},widget:function(e){return{text:e.node.textContent}},strong:function(e,t){var n=e.node,r=t.entering,o=n.attrs.rawHTML;return{delim:"**",rawHTML:r?Vg(o):jg(o)}},emph:function(e,t){var n=e.node,r=t.entering,o=n.attrs.rawHTML;return{delim:"*",rawHTML:r?Vg(o):jg(o)}},strike:function(e,t){var n=e.node,r=t.entering,o=n.attrs.rawHTML;return{delim:"~~",rawHTML:r?Vg(o):jg(o)}},link:function(e,t){var n,r,o=e.node,i=t.entering,s=o.attrs,a=s.title,l=s.rawHTML,c=s.linkUrl.replace(/&amp;/g,"&"),u=a?' title="'+Es(a)+'"':"";return i?{delim:"[",rawHTML:l?"<"+l+' href="'+Es(c)+'"'+u+">":null}:{delim:"]("+c+(a?" "+(n=Is(a),(r=-1===n.indexOf('"')?'""':-1===n.indexOf("'")?"''":"()")[0]+n+r[1]):"")+")",rawHTML:jg(l)}},code:function(e,t){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o,s=t.entering;return{delim:s?zg(r.child(i),-1):zg(r.child(i-1),1),rawHTML:s?Vg(n.attrs.rawHTML):jg(n.attrs.rawHTML)}},htmlComment:function(e){return{text:e.node.textContent}},html:function(e,t){var n=e.node,r=t.entering,o=n.type.name,i=n.attrs.htmlAttrs,s="<"+o,a="</"+o+">";return Object.keys(i).forEach((function(e){s+=" "+e+'="'+i[e].replace(/"/g,"'")+'"'})),s+=">",n.attrs.htmlInline?{rawHTML:r?s:a}:{text:""+s+n.attrs.childrenHTML+a}}},_g={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Ug(e){Object.keys(e).forEach((function(t){var n=$g[t],r=e[t];$g[t]=n?function(e,t){return t.origin=function(){return n(e,t)},r(e,t)}:r,delete e[t]}));var t=function(e){var t={};return Object.keys(Hg).forEach((function(n){t[n]=function(t,r){if(Hg[n]){var o=e[n],i=o?o(r,{inTable:t.inTable}):{};!function(e,t){var n=t.state,r=t.nodeInfo,o=t.params,i=o.rawHTML;i?Ki(e,["heading","codeBlock"])>-1?function(e,t,n){var r=n[0],o=n[1];e.write(r),e.convertInline(t),e.write(o)}(n,r.node,i):Ki(e,["image","thematicBreak"])>-1?n.write(i):function(e,t,n){var r=t.node,o=t.parent,i=n[0],s=n[1];e.stopNewline=!0,e.write(i),e.convertNode(r),e.write(s),"doc"===(null==o?void 0:o.type.name)&&(e.closeBlock(r),e.stopNewline=!1)}(n,r,i):Hg[e](n,r,o)}(n,{state:t,nodeInfo:r,params:i})}}})),t}($g),n=function(e){var t={};return Object.keys(_g).forEach((function(n){t[n]=function(t,r){var o=_g[n],i=e[n],s=i&&t&&!Gi(r)?i(t,{entering:r}):{};return Li(Li({},s),o)}})),t}($g);return{nodeTypeConvertors:t,markTypeConvertors:n}}var Wg=function(){function e(e){var t=e.nodeTypeConvertors,n=e.markTypeConvertors;this.nodeTypeConvertors=t,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return e.prototype.getMarkConvertor=function(e){var t=e.attrs.htmlInline?"html":e.type.name;return this.markTypeConvertors[t]},e.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},e.prototype.markText=function(e,t,n,r){var o=this.getMarkConvertor(e);if(o){var i=o({node:e,parent:n,index:r},t),s=i.delim;return i.rawHTML||s}return""},e.prototype.setDelim=function(e){this.delim=e},e.prototype.getDelim=function(){return this.delim},e.prototype.flushClose=function(e){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),e||(e=2),e>1){var t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(var r=1;r<e;r+=1)this.result+=t+"\n"}this.closed=!1}},e.prototype.wrapBlock=function(e,t,n,r){var o=this.getDelim();this.write(t||e),this.setDelim(this.getDelim()+e),r(),this.setDelim(o),this.closeBlock(n)},e.prototype.ensureNewLine=function(){this.isInBlank()||(this.result+="\n")},e.prototype.write=function(e){void 0===e&&(e=""),this.flushClose(),this.delim&&this.isInBlank()&&(this.result+=this.delim),e&&(this.result+=e)},e.prototype.closeBlock=function(e){this.closed=e},e.prototype.text=function(e,t){void 0===t&&(t=!0);for(var n=e.split("\n"),r=0;r<n.length;r+=1)this.write(),this.result+=t?Rs(n[r]):n[r],r!==n.length-1&&(this.result+="\n")},e.prototype.convertBlock=function(e,t,n){var r=e.type.name,o=this.nodeTypeConvertors[r],i={node:e,parent:t,index:n};e.attrs.htmlBlock?this.nodeTypeConvertors.html(this,i):o&&o(this,i)},e.prototype.convertInline=function(e){var t=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[],l=r;r="";var c=o&&o.isText&&a.some((function(e){var n=t.getMarkConvertor(e),r=n&&n();return r&&r.removedEnclosingWhitespace}));if(c&&o&&o.text){var u=/^(\s*)(.*?)(\s*)$/m.exec(o.text),d=u[1],p=u[2],h=u[3];l+=d,r=h,(d||h)&&((o=p?o.withText(p):null)||(a=n))}for(var f=a.length&&Fs(a),m=f&&t.getMarkConvertor(f),g=m&&m(),v=g&&!1===g.escape,y=a.length-(v?1:0),b=0;b<y&&(p=a[b],!g||g.mixable);b+=1)for(var w=0;w<n.length;w+=1){var k=n[w];if(g&&!g.mixable)break;if(p.eq(k)){b>w?a=a.slice(0,w).concat(p).concat(a.slice(w,b)).concat(a.slice(b+1,y)):w>b&&(a=a.slice(0,b).concat(a.slice(b+1,w)).concat(p).concat(a.slice(w,y)));break}}for(var x=0;x<Math.min(n.length,y)&&a[x].eq(n[x]);)x+=1;for(;x<n.length;){var C=n.pop();C&&t.text(t.markText(C,!1,e,s),!1)}if(l&&t.text(l),o){for(;n.length<y;)p=a[n.length],n.push(p),t.text(t.markText(p,!0,e,s),!1);v&&o.isText?t.text(t.markText(f,!0,e,s)+o.text+t.markText(f,!1,e,s+1),!1):t.convertBlock(o,e,s)}};e.forEach(o),o(null,0,e.childCount)},e.prototype.convertList=function(e,t,n){var r,o=this;this.closed&&this.closed.type===e.type?this.flushClose(3):this.tightList&&this.flushClose(1);var i=null===(r=e.attrs.tight)||void 0===r||r,s=this.tightList;this.tightList=i,e.forEach((function(r,s,a){a&&i&&o.flushClose(1),o.wrapBlock(t,n(a),e,(function(){return o.convertBlock(r,e,a)}))})),this.tightList=s},e.prototype.convertTableCell=function(e){var t=this;this.stopNewline=!0,this.inTable=!0,e.forEach((function(n,r,o){Ns(["bulletList","orderedList"],n.type.name)?(t.convertBlock(n,e,o),t.closed=!1):(t.convertInline(n),o<e.childCount-1&&"paragraph"===e.child(o+1).type.name&&t.write("<br>"))})),this.stopNewline=!1,this.inTable=!1},e.prototype.convertNode=function(e,t){var n=this;return e.forEach((function(r,o,i){if(n.convertBlock(r,e,i),(null==t?void 0:t.node)===r){var s=n.result.split("\n");t.setMappedPos([s.length,Fs(s).length+1])}})),this.result},e}(),Jg=function(){function e(e,t,n,r){var o=this;this.setMappedPos=function(e){o.mappedPosWhenConverting=e},this.schema=e,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(e){var t=Object.keys(e),n=Li({},Bg),r=new dh({gfm:!0,nodeId:!0,convertors:e}).getConvertors();return t.forEach((function(t){var o=Bg[t];o&&!Ns(["htmlBlock","htmlInline"],t)&&(n[t]=function(n,i,s){s.origin=function(){return r[t](i,s,r)};var a,l=e[t](i,s);if(l){var c=Array.isArray(l)?l[0]:l;a={htmlAttrs:c.attributes,classNames:c.classNames}}o(n,i,s,a)})})),n}(n),this.toMdConvertors=Ug(t||{}),this.eventEmitter.listen("setFocusedNode",(function(e){return o.focusedNode=e}))}return e.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},e.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},e.prototype.toWysiwygModel=function(e){return new Fg(this.schema,this.toWwConvertors).convertNode(e,this.getInfoForPosSync())},e.prototype.toMarkdownText=function(e){var t=new Wg(this.toMdConvertors).convertNode(e,this.getInfoForPosSync());return this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",t)},e}();function Kg(e){var t=e.plugins,n=e.eventEmitter,r=e.usageStatistics,o=e.instance;return n.listen("mixinTableOffsetMapPrototype",Jf),(null!=t?t:[]).reduce((function(e,t){var i=function(e){var t=e.plugin,n={eventEmitter:e.eventEmitter,usageStatistics:e.usageStatistics,instance:e.instance,pmState:{Plugin:pt,PluginKey:mt,Selection:Je,TextSelection:Ze},pmView:{Decoration:Jr,DecorationSet:Xr},pmModel:{Fragment:a},pmRules:{InputRule:ii,inputRules:ai,undoInputRule:ci},pmKeymap:{keymap:Po},i18n:um};if(Hi(t)){var r=t[0],o=t[1];return r(n,void 0===o?{}:o)}return t(n)}({plugin:t,eventEmitter:n,usageStatistics:r,instance:o});if(!i)throw new Error("The return value of the executed plugin is empty.");var s=i.markdownParsers,l=i.toHTMLRenderers,c=i.toMarkdownRenderers,u=i.markdownPlugins,d=i.wysiwygPlugins,p=i.wysiwygNodeViews,h=i.markdownCommands,f=i.wysiwygCommands,m=i.toolbarItems;return l&&(e.toHTMLRenderers=zs(e.toHTMLRenderers,l)),c&&(e.toMarkdownRenderers=zs(e.toMarkdownRenderers,c)),u&&(e.mdPlugins=e.mdPlugins.concat(u)),d&&(e.wwPlugins=e.wwPlugins.concat(d)),p&&(e.wwNodeViews=Li(Li({},e.wwNodeViews),p)),h&&(e.mdCommands=Li(Li({},e.mdCommands),h)),f&&(e.wwCommands=Li(Li({},e.wwCommands),f)),m&&(e.toolbarItems=e.toolbarItems.concat(m)),s&&(e.markdownParsers=Li(Li({},e.markdownParsers),s)),e}),{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Gg=function(){function e(e){var t=this;this.options=Bi({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},e),this.eventEmitter=new Tg;var n,r=As(this.options.linkAttributes),o=Kg({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this})||{},i=o.toHTMLRenderers,s=o.markdownParsers,a=this.options,l=a.customHTMLRenderer,c=a.extendedAutolinks,u=a.referenceDefinition,d=a.frontMatter,p=a.customHTMLSanitizer,h={linkAttributes:r,customHTMLRenderer:Li(Li({},i),l),extendedAutolinks:c,referenceDefinition:u,frontMatter:d,sanitizer:p||uf};n=h.customHTMLRenderer,["htmlBlock","htmlInline"].forEach((function(e){n[e]&&Object.keys(n[e]).forEach((function(e){return cf(e)}))})),this.options.events&&Pi(this.options.events,(function(e,n){t.on(n,e)}));var f=this.options,m=f.el,g=f.initialValue,v=f.theme,y=m.innerHTML;"light"!==v&&m.classList.add(ja(v)),m.innerHTML="",this.toastMark=new oh("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:c,referenceDefinition:u,disallowDeepHeading:!0,frontMatter:d,customParser:s}),this.preview=new Df(this.eventEmitter,Li(Li({},h),{isViewer:!0})),iu(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),g?this.setMarkdown(g):y&&this.preview.setHTML(y),m.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return e.prototype.toggleTask=function(e){var t=e.target,n=getComputedStyle(t,":before");!t.hasAttribute("data-task-disabled")&&t.hasAttribute("data-task")&&qa(n,e.offsetX,e.offsetY)&&(Wa(t,"checked"),this.eventEmitter.emit("change",{source:"viewer",date:e}))},e.prototype.setMarkdown=function(e){var t=this.toastMark.getLineTexts(),n=[t.length,Fs(t).length+1],r=this.toastMark.editMarkdown([1,1],n,e||"");this.eventEmitter.emit("updatePreview",r)},e.prototype.on=function(e,t){this.eventEmitter.listen(e,t)},e.prototype.off=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.addHook=function(e,t){this.eventEmitter.removeEventHandler(e),this.eventEmitter.listen(e,t)},e.prototype.destroy=function(){eu(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},e.prototype.isViewer=function(){return!0},e.prototype.isMarkdownMode=function(){return!1},e.prototype.isWysiwygMode=function(){return!1},e}();function Xg(e){return e instanceof A}function Zg(e){return Ns(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],e)}var Qg={openTag:function(e,t){var n=e,r=n.tagName,o=n.classNames,i=n.attributes,s=document.createElement(r),a={};o&&(s.className=o.join(" ")),i&&(a=Li(Li({},a),i)),Za(a,s),t.push(s)},closeTag:function(e,t){if(t.length>1){var n=t.pop();Fs(t).appendChild(n)}},html:function(e,t){Fs(t).insertAdjacentHTML("beforeend",e.content)},text:function(e,t){var n=document.createTextNode(e.content);Fs(t).appendChild(n)}},Yg=function(){function e(e,t){var n=yf(e,t),r=Li(Li({},t.htmlBlock),t.htmlInline);this.customConvertorKeys=Object.keys(t).concat(Object.keys(r)),this.renderer=new dh({gfm:!0,convertors:Li(Li({},n),r)}),this.convertors=this.renderer.getConvertors()}return e.prototype.generateTokens=function(e){var t=function(e){var t=e.attrs,n=e.type.name,r={type:n,wysiwygNode:!0,literal:!Zg(n)&&Xg(e)?e.textContent:null},o={heading:{level:t.level},link:{destination:t.linkUrl,title:t.title},image:{destination:t.imageUrl},codeBlock:{info:t.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:t.order}},listItem:{type:"item",listData:{task:t.task,checked:t.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:t.align},tableBodyCell:{type:"tableCell",cellType:"body",align:t.align},customBlock:{info:t.info}}[n],i=Li(Li({},r),o),s=e.attrs,a=s.htmlAttrs,l=s.childrenHTML;return a?Li(Li({},i),{attrs:a,childrenHTML:l}):i}(e),n={entering:!0,leaf:!!Xg(e)&&e.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Xg(e)?e.textContent:""},skipChildren:function(){return!1}},r=this.convertors[e.type.name],o=r(t,n,this.convertors),i=Hi(o)?o:[o];return(Zg(e.type.name)||e.attrs.htmlInline)&&(n.entering=!1,i.push({type:"text",content:Xg(e)?e.textContent:""}),i=i.concat(r(t,n,this.convertors))),i},e.prototype.toDOMNode=function(e){var t=this.generateTokens(e),n=[];return t.forEach((function(e){return Qg[e.type](e,n)})),n[0]},e.prototype.getToDOMNode=function(e){return Ns(this.customConvertorKeys,e)?this.toDOMNode.bind(this):null},e}(),ev=null,tv=null;function nv(e,t){var n=t.syncScrollTop,r=t.releaseEventBlock;tv&&clearTimeout(tv),n(e),tv=setTimeout((function(){r()}),15)}var rv=function(){function e(e,t,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0,this.timer=null;var r=t.previewContent,o=t.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=e,this.editorView=e.view,this.toastMark=e.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return e.prototype.addScrollSyncEvent=function(){var e=this;this.eventEmitter.listen("afterPreviewRender",(function(){e.clearTimer(),e.timer=setTimeout((function(){e.syncPreviewScrollTop(!0)}),200)})),this.eventEmitter.listen("scroll",(function(t,n){e.active&&("editor"===t&&"editor"!==e.blockedScroll?e.syncPreviewScrollTop():"preview"===t&&"preview"!==e.blockedScroll&&e.syncEditorScrollTop(n))})),this.eventEmitter.listen("toggleScrollSync",(function(t){e.active=t}))},e.prototype.getMdNodeAtPos=function(e,t){var n=e.content.findIndex(t.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},e.prototype.getScrollTopByCaretPos=function(){var e=this.mdEditor.getSelection(),t=this.toastMark.findFirstNodeAtLine(e[0][0]),n=this.previewEl.clientHeight,r=Sf(this.previewRoot,t).el,o=(Tf(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().top<n?null:o},e.prototype.syncPreviewScrollTop=function(e){void 0===e&&(e=!1);var t,n=this,r=n.editorView,o=n.previewEl,i=n.previewRoot,s=r.dom.getBoundingClientRect(),a=s.left,l=s.top,c=r.posAtCoords({left:a,top:l}),u=r.state.doc,d=this.getMdNodeAtPos(u,c);if(d&&("htmlBlock"!==(t=d.type)&&"htmlInline"!==t)){var p=o.scrollTop,h=r.dom,f=h.scrollTop,m=h.scrollHeight,g=h.clientHeight,v=h.children,y=m-f<=g+18,b=y?o.scrollHeight:0;if(f&&!y){if(e){var w=this.getScrollTopByCaretPos();if(!w)return;b=w}else{var k=Sf(this.previewRoot,d),x=k.el,C=xf(u,k.mdNode,v),T=C.height,M=C.rect;b=(Tf(x,i)||x.offsetTop)+x.clientHeight*(l>M.top?Math.min((l-M.top)/T,1):0)}b=this.getResolvedScrollTop("editor",f,b,p),this.latestEditorScrollTop=f}b!==p&&this.run("editor",b,p)}},e.prototype.syncEditorScrollTop=function(e){var t=this,n=t.toastMark,r=t.editorView,o=t.previewRoot,i=t.previewEl,s=r.dom,a=r.state,l=i.scrollTop,c=i.clientHeight,u=i.scrollHeight-l<=c,d=s.scrollTop,p=u?s.scrollHeight:0;if(l&&e&&!u){if(e=function(e,t){for(;!e.getAttribute("data-nodeid")&&e.parentElement!==t;)e=e.parentElement;return e}(e,o),!e.getAttribute("data-nodeid"))return;var h=s.children,f=Number(e.getAttribute("data-nodeid")),m=Sf(this.previewRoot,n.findNodeById(f)),g=m.mdNode,v=m.el;p=h[Qs(g)-1].offsetTop;var y=xf(a.doc,g,h).height,b=function(e,t,n){var r,o=Ef[r=n]&&Ef[r].height,i=function(e){return Ef[e]&&Ef[e].offsetTop}(n),s=o||e.clientHeight,a=i||Tf(e,t)||e.offsetTop;return o||function(e,t){Ef[e]=Ef[e]||{},Ef[e].height=t}(n,s),i||function(e,t){Ef[e]=Ef[e]||{},Ef[e].offsetTop=t}(n,a),{nodeHeight:s,offsetTop:a}}(v,o,f),w=b.nodeHeight;p+=function(e,t,n,r){return Math.min((e-t)/n,1)*r}(l,b.offsetTop,w,y),p=this.getResolvedScrollTop("preview",l,p,d),this.latestPreviewScrollTop=l}p!==d&&this.run("preview",p,d)},e.prototype.getResolvedScrollTop=function(e,t,n,r){var o="editor"===e?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o<t?Math.max(n,r):Math.min(n,r)},e.prototype.run=function(e,t,n){var r,o=this;"editor"===e?(r=this.previewEl,this.blockedScroll="preview"):(r=this.editorView.dom,this.blockedScroll="editor"),function(e,t,n){var r=t-e,o=Date.now(),i=function(){var s,a=(Date.now()-o)/100;ev&&clearTimeout(ev),a<1?(s=e+r*Math.cos((1-a)*Math.PI/2),nv(Math.ceil(s),n),ev=setTimeout(i,1)):(nv(t,n),ev=null)};i()}(n,t,{syncScrollTop:function(e){return r.scrollTop=e},releaseEventBlock:function(){return o.blockedScroll=null}})},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.destroy=function(){this.clearTimer(),this.eventEmitter.removeEventHandler("scroll"),this.eventEmitter.removeEventHandler("afterPreviewRender")},e}(),ov={getPopupInitialValues:function(e,t){return"link"===t.popupName?{linkText:e.getSelectedText()}:{}}},iv=function(){function e(e){var t=this;this.initialHTML=e.el.innerHTML,e.el.innerHTML="",this.options=Bi({previewStyle:"tab",previewHighlight:!0,initialEditType:"markdown",height:"300px",minHeight:"200px",language:"en-US",useCommandShortcut:!0,usageStatistics:!0,toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","image","link"],["code","codeblock"],["scrollSync"]],hideModeSwitch:!1,linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,customMarkdownRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,widgetRules:[],theme:"light",autofocus:!0},e);var n=this.options,r=n.customHTMLRenderer,o=n.extendedAutolinks,i=n.referenceDefinition,s=n.frontMatter,a=n.customMarkdownRenderer,l=n.useCommandShortcut,c=n.initialEditType,u=n.widgetRules,d=n.customHTMLSanitizer;this.mode=c||"markdown",this.mdPreviewStyle=this.options.previewStyle,this.i18n=um,this.i18n.setCode(this.options.language),this.eventEmitter=new Tg,ba(u);var p=As(this.options.linkAttributes);this.pluginInfo=Kg({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this});var h,f=this.pluginInfo,m=f.toHTMLRenderers,g=f.toMarkdownRenderers,v=f.mdPlugins,y=f.wwPlugins,b=f.wwNodeViews,w=f.mdCommands,k=f.wwCommands,x=f.markdownParsers,C={linkAttributes:p,customHTMLRenderer:zs(m,r),extendedAutolinks:o,referenceDefinition:i,frontMatter:s,sanitizer:d||uf},T=new Yg(p,C.customHTMLRenderer),M=function(e,t,n){var r={nodes:{},marks:{}};return["htmlBlock","htmlInline"].forEach((function(o){e[o]&&Object.keys(e[o]).forEach((function(e){var i="htmlBlock"===o?"nodes":"marks";cf(e),r[i][e]=mf[o](e,t,n)}))})),r}(C.customHTMLRenderer,C.sanitizer,T);this.toastMark=new oh("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:o,referenceDefinition:i,disallowDeepHeading:!0,frontMatter:s,customParser:x}),this.mdEditor=new Wc(this.eventEmitter,{toastMark:this.toastMark,useCommandShortcut:l,mdPlugins:v}),this.preview=new Df(this.eventEmitter,Li(Li({},C),{isViewer:!1,highlight:this.options.previewHighlight})),this.wwEditor=new bg(this.eventEmitter,{toDOMAdaptor:T,useCommandShortcut:l,htmlSchemaMap:M,linkAttributes:p,wwPlugins:y,wwNodeViews:b}),this.convertor=new Jg(this.wwEditor.getSchema(),Li(Li({},g),a),yf(p,C.customHTMLRenderer),this.eventEmitter),this.setMinHeight(this.options.minHeight),this.setHeight(this.options.height),this.setMarkdown(this.options.initialValue,!1),this.options.placeholder&&this.setPlaceholder(this.options.placeholder),this.options.initialValue||this.setHTML(this.initialHTML,!1),this.commandManager=new Mg(this.eventEmitter,this.mdEditor.commands,this.wwEditor.commands,(function(){return t.mode})),this.options.usageStatistics&&gs("editor","UA-129966929-1"),this.scrollSync=new rv(this.mdEditor,this.preview,this.eventEmitter),this.addInitEvent(),this.addInitCommand(w,k),(h=this).eventEmitter.listen("query",(function(e,t){return ov[e](h,t)})),this.options.hooks&&Pi(this.options.hooks,(function(e,n){return t.addHook(n,e)})),this.options.events&&Pi(this.options.events,(function(e,n){return t.on(n,e)})),this.eventEmitter.emit("load",this),this.moveCursorToStart(this.options.autofocus)}return e.prototype.addInitEvent=function(){var e=this;this.on("needChangeMode",this.changeMode.bind(this)),this.on("loadUI",(function(){if("auto"!==e.height){var t=Math.min(parseInt(e.minHeight,10),parseInt(e.height,10)-75)+"px";e.setMinHeight(t)}})),this.eventEmitter.listen("addImageBlobHook",(function(e,t){var n=new FileReader;n.onload=function(e){var n=e.target;return t(n.result)},n.readAsDataURL(e)}))},e.prototype.addInitCommand=function(e,t){var n=this,r=function(e,t){Object.keys(t).forEach((function(r){n.addCommand(e,r,t[r])}))};this.addCommand("markdown","toggleScrollSync",(function(e){return n.eventEmitter.emit("toggleScrollSync",e.active),!0})),r("markdown",e),r("wysiwyg",t)},e.prototype.getCurrentModeEditor=function(){return this.isMarkdownMode()?this.mdEditor:this.wwEditor},e.factory=function(t){return t.viewer?new Gg(t):new e(t)},e.setLanguage=function(e,t){um.setLanguage(e,t)},e.prototype.changePreviewStyle=function(e){this.mdPreviewStyle!==e&&(this.mdPreviewStyle=e,this.eventEmitter.emit("changePreviewStyle",e))},e.prototype.exec=function(e,t){this.commandManager.exec(e,t)},e.prototype.addCommand=function(e,t,n){var r=this;this.commandManager.addCommand(e,t,(function(t){void 0===t&&(t={});var o=("markdown"===e?r.mdEditor:r.wwEditor).view;n(t,o.state,o.dispatch,o)}))},e.prototype.on=function(e,t){this.eventEmitter.listen(e,t)},e.prototype.off=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.addHook=function(e,t){this.eventEmitter.removeEventHandler(e),this.eventEmitter.listen(e,t)},e.prototype.removeHook=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.focus=function(){this.getCurrentModeEditor().focus()},e.prototype.blur=function(){this.getCurrentModeEditor().blur()},e.prototype.moveCursorToEnd=function(e){void 0===e&&(e=!0),this.getCurrentModeEditor().moveCursorToEnd(e)},e.prototype.moveCursorToStart=function(e){void 0===e&&(e=!0),this.getCurrentModeEditor().moveCursorToStart(e)},e.prototype.setMarkdown=function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=!0),this.mdEditor.setMarkdown(e,t),this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r,t)}},e.prototype.setHTML=function(e,t){void 0===e&&(e=""),void 0===t&&(t=!0);var n=document.createElement("div");n.innerHTML=function(e){var t=e.replace(/<p><br\s*\/*><\/p>/gi,"<p></p>"),n=new RegExp(Pa,"ig"),r=t.match(n);return null==r||r.forEach((function(e,n){if(Fa.test(e)){var o=za;if(n){var i=r[n-1].match(Ra);if(i&&!/br/i.test(i[1])){var s=i[1];o="</"+s+"><"+s+">"}}t=t.replace(Fa,o)}})),t}(e);var r=Z.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),t):this.wwEditor.setModel(r,t)},e.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},e.prototype.getHTML=function(){var e=this;this.eventEmitter.holdEventInvoke((function(){if(e.isMarkdownMode()){var t=e.toastMark.getRootNode(),n=e.convertor.toWysiwygModel(t);e.wwEditor.setModel(n)}}));var t=Qa(this.wwEditor.view.dom.innerHTML);if(this.placeholder){var n=new RegExp('<span class="placeholder[^>]+>'+this.placeholder+"</span>","i");return t.replace(n,"")}return t},e.prototype.insertText=function(e){this.getCurrentModeEditor().replaceSelection(e)},e.prototype.setSelection=function(e,t){this.getCurrentModeEditor().setSelection(e,t)},e.prototype.replaceSelection=function(e,t,n){this.getCurrentModeEditor().replaceSelection(e,t,n)},e.prototype.deleteSelection=function(e,t){this.getCurrentModeEditor().deleteSelection(e,t)},e.prototype.getSelectedText=function(e,t){return this.getCurrentModeEditor().getSelectedText(e,t)},e.prototype.getRangeInfoOfNode=function(e){return this.getCurrentModeEditor().getRangeInfoOfNode(e)},e.prototype.addWidget=function(e,t,n){this.getCurrentModeEditor().addWidget(e,t,n)},e.prototype.replaceWithWidget=function(e,t,n){this.getCurrentModeEditor().replaceWithWidget(e,t,n)},e.prototype.setHeight=function(e){var t=this.options.el;Fi(e)&&("auto"===e?ss(t,"auto-height"):ds(t,"auto-height"),this.setMinHeight(this.getMinHeight())),Wi(t,{height:e}),this.height=e},e.prototype.getHeight=function(){return this.height},e.prototype.setMinHeight=function(e){if(e!==this.minHeight){var t=this.height||this.options.height;"auto"!==t&&this.options.el.querySelector("."+ja("main"))&&(e=Math.min(parseInt(e,10),parseInt(t,10)-75)+"px");var n=parseInt(e,10);this.minHeight=e,this.wwEditor.setMinHeight(n),this.mdEditor.setMinHeight(n),this.preview.setMinHeight(n)}},e.prototype.getMinHeight=function(){return this.minHeight},e.prototype.isMarkdownMode=function(){return"markdown"===this.mode},e.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},e.prototype.isViewer=function(){return!1},e.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},e.prototype.changeMode=function(e,t){if(this.mode!==e){if(this.mode=e,this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r)}else r=this.wwEditor.getModel(),this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),!t);if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",e),!t){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&ps(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},e.prototype.destroy=function(){var e=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach((function(t,n){return e.off(n)}))},e.prototype.hide=function(){this.eventEmitter.emit("hide")},e.prototype.show=function(){this.eventEmitter.emit("show")},e.prototype.setScrollTop=function(e){this.getCurrentModeEditor().setScrollTop(e)},e.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},e.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},e.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},e.prototype.setPlaceholder=function(e){this.placeholder=e,this.mdEditor.setPlaceholder(e),this.wwEditor.setPlaceholder(e)},e.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},e.prototype.convertPosToMatchEditorMode=function(e,t,n){var r,o;void 0===t&&(t=e),void 0===n&&(n=this.mode);var i=this.mdEditor.view.state.doc,s=Array.isArray(e),a=Array.isArray(t),l=e,c=t;if(s!==a)throw new Error("Types of arguments must be same");return"markdown"!==n||s||a?"wysiwyg"===n&&s&&a&&(l=(o=yl(i,e,t))[0],c=o[1]):(l=(r=gl(i,e,t))[0],c=r[1]),[l,c]},e}(),sv=function(){function e(e){this.current=e,this.root=e,this.entering=!0}return e.prototype.walk=function(){var e=this.entering,t=this.current;return t?(e?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:t.next?(this.current=t.next,this.entering=!0):(this.current=t.parent,this.entering=!1),{vnode:t,entering:e}):null},e}(),av=function(){function e(e,t,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=e,this.props=t,this.children=n,this.props.children=n,t.ref&&(this.ref=t.ref,delete t.ref),t.key&&(this.key=t.key,delete t.key)}return e.prototype.walker=function(){return new sv(this)},e.removalNodes=[],e}();function lv(e,t){var n,r,o=e;"boolean"==typeof(r=e)||r instanceof Boolean||null==e?o=null:(Fi(e)||ps(e))&&(n=String(e),o=new av("TEXT_NODE",{nodeValue:n},[])),o&&t.push(o)}var cv=function(e){for(var t,n,r=arguments,o=1,i="",s="",a=[0],l=function(e){1===o&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(e?r[e]:i):3===o&&(e||i)?(a[1]=e?r[e]:i,o=2):2===o&&"..."===i&&e?a[2]=js(a[2]||{},r[e]):2===o&&i&&!e?(a[2]=a[2]||{})[i]=!0:o>=5&&(5===o?((a[2]=a[2]||{})[n]=e?i?i+r[e]:r[e]:i,o=6):(e||i)&&(a[2][n]+=e?i+r[e]:i)),i=""},c=0;c<e.length;c++){c&&(1===o&&l(),l(c));for(let r=0;r<e[c].length;r++)t=e[c][r],1===o?"<"===t?(l(),a=[a,"",null],o=3):i+=t:4===o?"--"===i&&">"===t?(o=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(l(),o=1):o&&("="===t?(o=5,n=i,i=""):"/"===t&&(o<5||">"===e[c][r+1])?(l(),3===o&&(a=a[0]),o=a,(a=a[0]).push(this.apply(null,o.slice(1))),o=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(l(),o=2):i+=t),3===o&&"!--"===i&&(o=4,a=a[0])}return l(),a.length>2?a.slice(1):a[1]}.bind((function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=[];return n.forEach((function(e){Array.isArray(e)?e.forEach((function(e){lv(e,o)})):lv(e,o)})),new av(e,t||{},o)})),uv=function(e){return e===Object(e)};function dv(e){var t;return"TEXT_NODE"===e.type?t=document.createTextNode(e.props.nodeValue):fv(t=document.createElement(e.type),{},e.props),t}function pv(e,t){e.node?t.removeChild(e.node):pv(e.firstChild,t)}var hv=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function fv(e,t,n,r){Object.keys(n).forEach((function(o){if(!r||r(o))if(/^on/.test(o)){var i=o.slice(2).toLowerCase();e.addEventListener(i,n[o])}else"nodeValue"===o?e[o]=n[o]:"style"===o&&uv(n[o])?function(e,t,n){t&&Object.keys(t).forEach((function(t){e.style[t]=""})),Object.keys(n).forEach((function(t){var r=n[t];e.style[t]=ps(r)&&!hv.test(t)?r+"px":r}))}(e,t[o],n[o]):"children"!==o&&(!1===n[o]?e.removeAttribute(o):e.setAttribute(o,n[o]))}))}function mv(e){if(av.removalNodes.forEach((function(e){return vv(e)})),e)for(var t=void 0,n=e.walker();t=n.walk();)if(e=t.vnode,t.entering)vv(e);else if(cl(e.type)){var r=e.component;if(!e.old&&r.mounted&&r.mounted(),e.old&&r.updated){var o=r.prevProps||{};r.updated(o)}}}function gv(e){for(var t=e.parent;!t.node;)t=t.parent;return t.node}function vv(e){if(e&&e.parent){if(e.node){var t=gv(e);"A"===e.effect?t.appendChild(e.node):"U"===e.effect&&(i=e.node,s=e.old.props,a=e.props,Object.keys(s).forEach((function(e){if(/^on/.test(e)){if(!a[e]||s[e]!==a[e]){var t=e.slice(2).toLowerCase();i.removeEventListener(t,s[e])}}else"children"===e||a[e]||function(e){return(null==e?void 0:e.nodeType)===Node.TEXT_NODE}(i)||i.removeAttribute(e)})),fv(i,s,a,(function(e){return!Bs(s[e],a[e])})))}if("D"===e.effect)for(var n=void 0,r=e.walker();n=r.walk();)if(e=n.vnode,!n.entering)if(cl(e.type)){var o=e.component;o.beforeDestroy&&o.beforeDestroy()}else pv(e,t=gv(e));e.ref&&(e.component?e.ref(e.component):e.node&&e.ref(e.node))}var i,s,a}function yv(e,t){var n=t.props,r=t.component;return r?(r.prevProps=r.props,r.props=t.props,r):new e(n)}function bv(e){for(var t=e;e&&!e.skip;){if(cl(e.type)){var n=yv(e.type,e);n.vnode=e,e.component=n,e.props.children=e.children=[n.render()],wv(e)}else e.node||(e.node=dv(e)),wv(e);if(e.firstChild)e=e.firstChild;else{for(;e&&e.parent&&!e.next&&(e=e.parent)!==t;);e=e.next}}}function wv(e){var t=e.children,n=e.old?e.old.firstChild:null,r=null;t.forEach((function(t,o){var i=function(e,t){return e&&t&&t.type===e.type&&(!t.key||t.key===e.key)}(n,t);i&&(t.old=n,t.parent=e,t.node=n.node,t.component=n.component,t.effect="U"),t&&!i&&(t.old=null,t.parent=e,t.node=null,t.effect="A"),n&&!i&&(av.removalNodes.push(n),n.effect="D"),n&&(n=n.next),0===o?e.firstChild=t:t&&(r.next=t),r=t}));var o=Fs(t);if(!t.length)for(;n;)av.removalNodes.push(n),n.effect="D",n=n.next;for(;n&&o;)n&&o.old!==n&&(av.removalNodes.push(n),n.effect="D",n=n.next)}var kv,xv=function(){function e(e){this.props=e,this.state={},this.refs={}}return e.prototype.setState=function(e){var t,n=Li(Li({},this.state),e);Bs(this.state,n)||(this.state=n,(t=this.vnode).effect="U",t.old=t,t.next&&(t.next.skip=!0),av.removalNodes=[],bv(t),mv(t),t.next&&(t.next.skip=!1))},e}(),Cv=function(e){function t(t){var n=e.call(this,t)||this;return n.state={hide:!1},n}return Ai(t,e),t.prototype.show=function(){this.setState({hide:!1})},t.prototype.hide=function(){this.setState({hide:!0})},t.prototype.render=function(){var e=this.props,t=e.editorType,n=e.eventEmitter;return cv(kv||(kv=Ri(['\n      <div class="','" style="display: ','">\n        <div\n          class="tab-item','"\n          onClick=',"\n        >\n          ",'\n        </div>\n        <div\n          class="tab-item','"\n          onClick=',"\n        >\n          ","\n        </div>\n      </div>\n    "],['\n      <div class="','" style="display: ','">\n        <div\n          class="tab-item','"\n          onClick=',"\n        >\n          ",'\n        </div>\n        <div\n          class="tab-item','"\n          onClick=',"\n        >\n          ","\n        </div>\n      </div>\n    "])),ja("mode-switch"),this.state.hide?"none":"block","markdown"===t?" active":"",(function(){n.emit("needChangeMode","markdown")}),um.get("Markdown"),"wysiwyg"===t?" active":"",(function(){n.emit("needChangeMode","wysiwyg")}),um.get("WYSIWYG"))},t}(xv),Tv=function(e,t){var n,r,o,i,s=!0,a=function(t){e.apply(null,t),n=null};function l(){if(i=Array.prototype.slice.call(arguments),s)return a(i),void(s=!1);o=Number(new Date),n=n||o,r(i),o-n>=t&&a(i)}return r=function(e,t){var n,r;return t=t||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout((function(){e.apply(null,r)}),t)}}(a,t=t||0),l.reset=function(){s=!0,n=null},l},Mv=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,r){return e[0]===t&&(n=r,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];e.call(t,o[1],o[0])}},t}()}(),Sv="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,Ev=void 0!==n.g&&n.g.Math===Math?n.g:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),Nv="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(Ev):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)},Ov=["top","right","bottom","left","width","height","size","weight"],Dv="undefined"!=typeof MutationObserver,Av=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&a()}function s(){Nv(i)}function a(){var e=Date.now();if(n){if(e-o<2)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=e}return a}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){Sv&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Dv?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){Sv&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;Ov.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Lv=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},Iv=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||Ev},Rv=zv(0,0,0,0);function Pv(e){return parseFloat(e)||0}function Bv(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+Pv(e["border-"+n+"-width"])}),0)}var Fv="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof Iv(e).SVGGraphicsElement}:function(e){return e instanceof Iv(e).SVGElement&&"function"==typeof e.getBBox};function Hv(e){return Sv?Fv(e)?function(e){var t=e.getBBox();return zv(0,0,t.width,t.height)}(e):function(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Rv;var r=Iv(e).getComputedStyle(e),o=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],i=e["padding-"+o];t[o]=Pv(i)}return t}(r),i=o.left+o.right,s=o.top+o.bottom,a=Pv(r.width),l=Pv(r.height);if("border-box"===r.boxSizing&&(Math.round(a+i)!==t&&(a-=Bv(r,"left","right")+i),Math.round(l+s)!==n&&(l-=Bv(r,"top","bottom")+s)),!function(e){return e===Iv(e).document.documentElement}(e)){var c=Math.round(a+i)-t,u=Math.round(l+s)-n;1!==Math.abs(c)&&(a-=c),1!==Math.abs(u)&&(l-=u)}return zv(o.left,o.top,a,l)}(e):Rv}function zv(e,t,n,r){return{x:e,y:t,width:n,height:r}}var qv=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=zv(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=Hv(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),Vv=function(e,t){var n,r,o,i,s,a,l,c=(r=(n=t).x,o=n.y,i=n.width,s=n.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),Lv(l,{x:r,y:o,width:i,height:s,top:o,right:r+i,bottom:s+o,left:r}),l);Lv(this,{target:e,contentRect:c})},jv=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new Mv,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Iv(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new qv(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Iv(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new Vv(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),$v="undefined"!=typeof WeakMap?new WeakMap:new Mv,_v=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Av.getInstance(),r=new jv(t,n,this);$v.set(this,r)};["observe","unobserve","disconnect"].forEach((function(e){_v.prototype[e]=function(){var t;return(t=$v.get(this))[e].apply(t,arguments)}}));var Uv,Wv,Jv,Kv,Gv,Xv,Zv,Qv,Yv,ey,ty,ny,ry,oy,iy,sy,ay=void 0!==Ev.ResizeObserver?Ev.ResizeObserver:_v,ly=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),t.prototype.execCommand=function(e){var t=Ga(e.target,"li");this.props.execCommand("heading",{level:Number(t.getAttribute("data-level"))})},t.prototype.render=function(){var e=this;return cv(Wv||(Wv=Ri(["\n      <ul\n        onClick=",'\n        aria-role="menu"\n        aria-label="','"\n      >\n        ','\n        <li data-type="Paragraph" aria-role="menuitem">\n          <div>',"</div>\n        </li>\n      </ul>\n    "],["\n      <ul\n        onClick=",'\n        aria-role="menu"\n        aria-label="','"\n      >\n        ','\n        <li data-type="Paragraph" aria-role="menuitem">\n          <div>',"</div>\n        </li>\n      </ul>\n    "])),(function(t){return e.execCommand(t)}),um.get("Headings"),[1,2,3,4,5,6].map((function(e){return cv(Uv||(Uv=Ri(['\n              <li data-level="','" data-type="Heading" aria-role="menuitem">\n                <',">"," ","</$>\n              </li>\n            "],['\n              <li data-level="','" data-type="Heading" aria-role="menuitem">\n                <',">"," ","</$>\n              </li>\n            "])),e,"h"+e,um.get("Heading"),e)})),um.get("Paragraph"))},t}(xv),cy=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),t.prototype.toggleTab=function(e,t){this.props.onClick(e,t)},t.prototype.render=function(){var e=this;return cv(Kv||(Kv=Ri(['\n      <div class="','" aria-role="tabpanel">\n        ',"\n      </div>\n    "],['\n      <div class="','" aria-role="tabpanel">\n        ',"\n      </div>\n    "])),ja("tabs"),this.props.tabs.map((function(t){var n=t.name,r=t.text,o=e.props.activeTab===n;return cv(Jv||(Jv=Ri(['\n            <div\n              class="tab-item','"\n              onClick=','\n              aria-role="tab"\n              aria-label="','"\n              aria-selected="','"\n              tabindex="','"\n            >\n              ',"\n            </div>\n          "],['\n            <div\n              class="tab-item','"\n              onClick=','\n              aria-role="tab"\n              aria-label="','"\n              aria-selected="','"\n              tabindex="','"\n            >\n              ',"\n            </div>\n          "])),o?" active":"",(function(t){return e.toggleTab(t,n)}),um.get(r),o?"true":"false",o?"0":"-1",um.get(r))})))},t}(xv),uy=function(e){function t(t){var n=e.call(this,t)||this;return n.initialize=function(e){void 0===e&&(e="file");var t=n.refs.url;t.value="",n.refs.altText.value="",n.refs.file.value="",ds(t,"wrong"),n.setState({activeTab:e,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(e,t){t!==n.state.activeTab&&n.initialize(t)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(e){var t=e.target.files;(null==t?void 0:t.length)&&n.setState({file:t[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return Ai(t,e),t.prototype.emitAddImageBlob=function(){var e=this,t=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null==t?void 0:t.length){r="";var o=t.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,(function(t,r){return e.props.execCommand("addImage",{imageUrl:t,altText:r||n.value})}),"ui")}this.setState({fileNameElClassName:r})},t.prototype.emitAddImage=function(){var e=this.refs.url,t=this.refs.altText,n=e.value,r=t.value||"image";ds(e,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):ss(e,"wrong")},t.prototype.preventSelectStart=function(e){e.preventDefault()},t.prototype.updated=function(){this.props.show||this.initialize()},t.prototype.render=function(){var e=this,t=this.state,n=t.activeTab,r=t.file,o=t.fileNameElClassName;return cv(Gv||(Gv=Ri(['\n      <div aria-label="','">\n        <'," tabs="," activeTab="," onClick=",' />\n        <div style="display:','">\n          <label for="toastuiImageUrlInput">','</label>\n          <input\n            id="toastuiImageUrlInput"\n            type="text"\n            ref=','\n          />\n        </div>\n        <div style="display:',';position: relative;">\n          <label for="toastuiImageFileInput">','</label>\n          <span\n            class="',"",'"\n            onClick=',"\n            onSelectstart=","\n          >\n            ",'\n          </span>\n          <button\n            type="button"\n            class="','"\n            onClick=',"\n          >\n            ",'\n          </button>\n          <input\n            id="toastuiImageFileInput"\n            type="file"\n            accept="image/*"\n            onChange=',"\n            ref=",'\n          />\n        </div>\n        <label for="toastuiAltTextInput">','</label>\n        <input\n          id="toastuiAltTextInput"\n          type="text"\n          ref=','\n        />\n        <div class="','">\n          <button type="button" class="','" onClick=',">\n            ",'\n          </button>\n          <button type="button" class="','" onClick=',">\n            ","\n          </button>\n        </div>\n      </div>\n    "],['\n      <div aria-label="','">\n        <'," tabs="," activeTab="," onClick=",' />\n        <div style="display:','">\n          <label for="toastuiImageUrlInput">','</label>\n          <input\n            id="toastuiImageUrlInput"\n            type="text"\n            ref=','\n          />\n        </div>\n        <div style="display:',';position: relative;">\n          <label for="toastuiImageFileInput">','</label>\n          <span\n            class="',"",'"\n            onClick=',"\n            onSelectstart=","\n          >\n            ",'\n          </span>\n          <button\n            type="button"\n            class="','"\n            onClick=',"\n          >\n            ",'\n          </button>\n          <input\n            id="toastuiImageFileInput"\n            type="file"\n            accept="image/*"\n            onChange=',"\n            ref=",'\n          />\n        </div>\n        <label for="toastuiAltTextInput">','</label>\n        <input\n          id="toastuiAltTextInput"\n          type="text"\n          ref=','\n        />\n        <div class="','">\n          <button type="button" class="','" onClick=',">\n            ",'\n          </button>\n          <button type="button" class="','" onClick=',">\n            ","\n          </button>\n        </div>\n      </div>\n    "])),um.get("Insert image"),cy,this.tabs,n,this.toggleTab,"url"===n?"block":"none",um.get("Image URL"),(function(t){return e.refs.url=t}),"file"===n?"block":"none",um.get("Select image file"),ja("file-name"),r?" has-file":o,this.showFileSelectBox,this.preventSelectStart,r?r.name:um.get("No file"),ja("file-select-button"),this.showFileSelectBox,um.get("Choose a file"),this.changeFile,(function(t){return e.refs.file=t}),um.get("Description"),(function(t){return e.refs.altText=t}),ja("button-container"),ja("close-button"),this.props.hidePopup,um.get("Cancel"),ja("ok-button"),this.execCommand,um.get("OK"))},t}(xv),dy=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.execCommand=function(){var e=t.refs.url,n=t.refs.text;ds(e,"wrong"),ds(n,"wrong"),e.value.length<1?ss(e,"wrong"):Gi(t.props.initialValues.linkUrl)&&n.value.length<1?ss(n,"wrong"):t.props.execCommand("addLink",{linkUrl:e.value,linkText:n.value})},t}return Ai(t,e),t.prototype.initialize=function(){var e=this.props.initialValues,t=e.linkUrl,n=e.linkText,r=this.refs.url,o=this.refs.text;ds(r,"wrong"),ds(o,"wrong","disabled"),o.removeAttribute("disabled"),t&&(ss(o,"disabled"),o.setAttribute("disabled","disabled")),r.value=t||"",o.value=n||""},t.prototype.mounted=function(){this.initialize()},t.prototype.updated=function(e){!e.show&&this.props.show&&this.initialize()},t.prototype.render=function(){var e=this;return cv(Xv||(Xv=Ri(['\n      <div aria-label="','">\n        <label for="toastuiLinkUrlInput">','</label>\n        <input\n          id="toastuiLinkUrlInput"\n          type="text"\n          ref=','\n        />\n        <label for="toastuiLinkTextInput">','</label>\n        <input\n          id="toastuiLinkTextInput"\n          type="text"\n          ref=','\n        />\n        <div class="','">\n          <button type="button" class="','" onClick=',">\n            ",'\n          </button>\n          <button type="button" class="','" onClick=',">\n            ","\n          </button>\n        </div>\n      </div>\n    "],['\n      <div aria-label="','">\n        <label for="toastuiLinkUrlInput">','</label>\n        <input\n          id="toastuiLinkUrlInput"\n          type="text"\n          ref=','\n        />\n        <label for="toastuiLinkTextInput">','</label>\n        <input\n          id="toastuiLinkTextInput"\n          type="text"\n          ref=','\n        />\n        <div class="','">\n          <button type="button" class="','" onClick=',">\n            ",'\n          </button>\n          <button type="button" class="','" onClick=',">\n            ","\n          </button>\n        </div>\n      </div>\n    "])),um.get("Insert link"),um.get("URL"),(function(t){return e.refs.url=t}),um.get("Link text"),(function(t){return e.refs.text=t}),ja("button-container"),ja("close-button"),this.props.hidePopup,um.get("Cancel"),ja("ok-button"),this.execCommand,um.get("OK"))},t}(xv),py=function(e){function t(t){var n=e.call(this,t)||this;return n.extendSelectionRange=function(e){var t=e.pageX,r=e.pageY,o=t-n.offsetRect.left,i=r-n.offsetRect.top,s=n.getSelectionRangeByOffset(o,i);n.setState(Li({},s))},n.execCommand=function(){n.props.execCommand("addTable",{rowCount:n.state.rowIdx+1,columnCount:n.state.colIdx+1})},n.state={rowIdx:-1,colIdx:-1},n}return Ai(t,e),t.prototype.getDescription=function(){return-1===this.state.colIdx?"":this.state.colIdx+1+" x "+(this.state.rowIdx+1)},t.prototype.getBoundByRange=function(e,t){return{width:20*(e+1),height:20*(t+1)}},t.prototype.getRangeByOffset=function(e,t){return{colIdx:Math.floor(e/20),rowIdx:Math.floor(t/20)}},t.prototype.getTableRange=function(){var e=this.state,t=e.colIdx,n=e.rowIdx,r=Math.max(t,5),o=Math.max(n,5);return t>=5&&r<9&&(r+=1),n>=5&&o<14&&(o+=1),{colIdx:r+1,rowIdx:o+1}},t.prototype.getSelectionAreaBound=function(){var e=this.getBoundByRange(this.state.colIdx,this.state.rowIdx),t=e.width,n=e.height;return t||n?{width:t-1,height:n-1,display:"block"}:{display:"none"}},t.prototype.getSelectionRangeByOffset=function(e,t){var n=this.getRangeByOffset(e,t);return n.rowIdx=Math.min(Math.max(n.rowIdx,1),14),n.colIdx=Math.min(Math.max(n.colIdx,1),9),n},t.prototype.updated=function(){if(this.props.show){if(-1===this.state.colIdx&&-1===this.state.rowIdx){var e=this.refs.tableEl.getBoundingClientRect(),t=e.left,n=e.top;this.offsetRect={left:window.pageXOffset+t,top:window.pageYOffset+n}}}else this.setState({colIdx:-1,rowIdx:-1})},t.prototype.createTableArea=function(e){for(var t=e.colIdx,n=e.rowIdx,r=[],o=0;o<n;o+=1){for(var i=[],s=0;s<t;s+=1){var a=ja("table-cell")+(o>0?"":" header");i.push(cv(Zv||(Zv=Ri(['<div class="','"></div>'],['<div class="','"></div>'])),a))}r.push(cv(Qv||(Qv=Ri(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),ja("table-row"),i))}return cv(Yv||(Yv=Ri(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),ja("table"),r)},t.prototype.render=function(){var e=this,t=this.getTableRange(),n=this.getSelectionAreaBound();return cv(ey||(ey=Ri(['\n      <div aria-label="','">\n        <div\n          class="','"\n          ref=',"\n          onMousemove=","\n          onClick=","\n        >\n          ",'\n          <div class="','" style=','></div>\n        </div>\n        <p class="','">',"</p>\n      </div>\n    "],['\n      <div aria-label="','">\n        <div\n          class="','"\n          ref=',"\n          onMousemove=","\n          onClick=","\n        >\n          ",'\n          <div class="','" style=','></div>\n        </div>\n        <p class="','">',"</p>\n      </div>\n    "])),um.get("Insert table"),ja("table-selection"),(function(t){return e.refs.tableEl=t}),this.extendSelectionRange,this.execCommand,this.createTableArea(t),ja("table-selection-layer"),n,ja("table-description"),this.getDescription())},t}(xv),hy=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),t.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},t.prototype.updated=function(e){this.refs.el.replaceChild(this.props.body,e.body)},t.prototype.render=function(){var e=this;return cv(ty||(ty=Ri(["<div ref=","></div>"],["<div ref=","></div>"])),(function(t){return e.refs.el=t}))},t}(xv);function fy(e){return Fi(e)?function(e){var t;switch(e){case"heading":t={name:"heading",className:"heading",tooltip:um.get("Headings"),state:"heading"};break;case"bold":t={name:"bold",className:"bold",command:"bold",tooltip:um.get("Bold"),state:"strong"};break;case"italic":t={name:"italic",className:"italic",command:"italic",tooltip:um.get("Italic"),state:"emph"};break;case"strike":t={name:"strike",className:"strike",command:"strike",tooltip:um.get("Strike"),state:"strike"};break;case"hr":t={name:"hr",className:"hrline",command:"hr",tooltip:um.get("Line"),state:"thematicBreak"};break;case"quote":t={name:"quote",className:"quote",command:"blockQuote",tooltip:um.get("Blockquote"),state:"blockQuote"};break;case"ul":t={name:"ul",className:"bullet-list",command:"bulletList",tooltip:um.get("Unordered list"),state:"bulletList"};break;case"ol":t={name:"ol",className:"ordered-list",command:"orderedList",tooltip:um.get("Ordered list"),state:"orderedList"};break;case"task":t={name:"task",className:"task-list",command:"taskList",tooltip:um.get("Task"),state:"taskList"};break;case"table":t={name:"table",className:"table",tooltip:um.get("Insert table"),state:"table"};break;case"image":t={name:"image",className:"image",tooltip:um.get("Insert image")};break;case"link":t={name:"link",className:"link",tooltip:um.get("Insert link")};break;case"code":t={name:"code",className:"code",command:"code",tooltip:um.get("Code"),state:"code"};break;case"codeblock":t={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:um.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":t={name:"indent",className:"indent",command:"indent",tooltip:um.get("Indent"),state:"indent"};break;case"outdent":t={name:"outdent",className:"outdent",command:"outdent",tooltip:um.get("Outdent"),state:"outdent"};break;case"scrollSync":t=function(){var e=document.createElement("label"),t=document.createElement("input"),n=document.createElement("span");e.className="scroll-sync active",t.type="checkbox",t.checked=!0,n.className="switch";return e.appendChild(t),e.appendChild(n),{name:"scrollSync",el:e,onMounted:function(n){return t.addEventListener("change",(function(t){var r=t.target.checked;r?ss(e,"active"):ds(e,"active"),n("toggleScrollSync",{active:r})}))}}}();break;case"more":t={name:"more",className:"more",tooltip:um.get("More")}}return"scrollSync"!==t.name&&(t.className+=" "+ja("toolbar-icons")),t}(e):e}function my(e,t){var n=t.el,r=t.pos,o=t.popup,i=t.initialValues;switch(e){case"heading":return{render:function(e){return cv(ny||(ny=Ri(["<"," ..."," />"],["<"," ..."," />"])),ly,e)},className:ja("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(e){return cv(ry||(ry=Ri(["<"," ..."," />"],["<"," ..."," />"])),dy,e)},className:ja("popup-add-link"),fromEl:n,pos:r,initialValues:i};case"image":return{render:function(e){return cv(oy||(oy=Ri(["<"," ..."," />"],["<"," ..."," />"])),uy,e)},className:ja("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(e){return cv(iy||(iy=Ri(["<"," ..."," />"],["<"," ..."," />"])),py,e)},className:ja("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return o?Li({render:function(e){return cv(sy||(sy=Ri(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),hy,e,o.body)},fromEl:n,pos:r},o):null;default:return null}}function gy(e){e.hidden=e.length===e.filter((function(e){return e.hidden})).length}var vy,yy,by=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handleMousedown=function(e){Ga(e.target,"."+ja("popup"))||Ga(e.target,t.props.info.fromEl)||t.props.hidePopup()},t}return Ai(t,e),t.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},t.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},t.prototype.updated=function(e){var t=this.props,n=t.show,r=t.info;if(n&&r.pos&&e.show!==n){var o=Li({},r.pos),i=this.refs.el.offsetWidth,s=Ga(this.refs.el,"."+ja("toolbar")).offsetWidth;o.left+i>=s&&(o.left=s-i-20),Bs(this.state.popupPos,o)||this.setState({popupPos:o})}},t.prototype.render=function(){var e=this,t=this.props,n=t.info,r=t.show,o=t.hidePopup,i=t.eventEmitter,s=t.execCommand,a=n||{},l=a.className,c=void 0===l?"":l,u=a.style,d=a.render,p=a.initialValues,h=void 0===p?{}:p,f=Li(Li({display:r?"block":"none"},u),this.state.popupPos);return cv(vy||(vy=Ri(['\n      <div\n        class="'," ",'"\n        style=',"\n        ref=",'\n        aria-role="dialog"\n      >\n        <div class="','">\n          ',"\n        </div>\n      </div>\n    "],['\n      <div\n        class="'," ",'"\n        style=',"\n        ref=",'\n        aria-role="dialog"\n      >\n        <div class="','">\n          ',"\n        </div>\n      </div>\n    "])),ja("popup"),c,f,(function(t){return e.refs.el=t}),ja("popup-body"),d&&d({eventEmitter:i,show:r,hidePopup:o,execCommand:s,initialValues:h}))},t}(xv);function wy(e){return function(t){function n(e){var n=t.call(this,e)||this;return n.showTooltip=function(e){var t=n.props.item.tooltip;if(!n.props.disabled&&t){var r=n.getBound(e),o=r.left+6+"px",i=r.top+6+"px";Wi(n.props.tooltipRef.current,{display:"block",left:o,top:i}),n.props.tooltipRef.current.querySelector(".text").textContent=t}},n.hideTooltip=function(){Wi(n.props.tooltipRef.current,"display","none")},n.state={active:!1,disabled:e.disabled},n.addEvent(),n}return Ai(n,t),n.prototype.addEvent=function(){var e=this,t=this.props,n=t.item,r=t.eventEmitter;n.state&&r.listen("changeToolbarState",(function(t){var r,o=null!==(r=t.toolbarState[n.state])&&void 0!==r?r:{},i=o.active,s=o.disabled;e.setState({active:!!i,disabled:null!=s?s:e.props.disabled})}))},n.prototype.getBound=function(e){var t=Xa(e,Ga(e,"."+ja("toolbar"))),n=t.offsetLeft,r=t.offsetTop;return{left:n,top:e.offsetHeight+r}},n.prototype.render=function(){return cv(yy||(yy=Ri(["\n        <","\n          ...","\n          active=","\n          showTooltip=","\n          hideTooltip=","\n          getBound=","\n          disabled=","\n        />\n      "],["\n        <","\n          ...","\n          active=","\n          showTooltip=","\n          hideTooltip=","\n          getBound=","\n          disabled=","\n        />\n      "])),e,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound,this.state.disabled||this.props.disabled)},n}(xv)}var ky,xy,Cy,Ty,My,Sy,Ey,Ny,Oy,Dy,Ay,Ly,Iy,Ry,Py=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.showTooltip=function(){t.props.showTooltip(t.refs.el)},t.execCommand=function(){var e=t.props,n=e.item,r=e.execCommand,o=e.setPopupInfo,i=e.getBound,s=e.eventEmitter,a=n.command,l=n.name,c=n.popup;if(a)r(a);else{var u=c?"customPopupBody":l,d=s.emit("query","getPopupInitialValues",{popupName:u})[0],p=my(u,{el:t.refs.el,pos:i(t.refs.el),popup:c,initialValues:d});p&&o(p)}},t}return Ai(t,e),t.prototype.mounted=function(){this.setItemWidth()},t.prototype.updated=function(e){e.item.name!==this.props.item.name&&this.setItemWidth()},t.prototype.setItemWidth=function(){var e=this.props,t=e.setItemWidth,n=e.item;t&&t(n.name,Ka(this.refs.el)+(n.hidden?80:0))},t.prototype.render=function(){var e=this,t=this.props,n=t.hideTooltip,r=t.disabled,o=t.item,i=t.active,s=Li({display:o.hidden?"none":null},o.style),a=(o.className||"")+(i?" active":"");return cv(ky||(ky=Ri(["\n      <button\n        ref=",'\n        type="button"\n        style=',"\n        class=","\n        onClick=","\n        onMouseover=","\n        onMouseout=","\n        disabled=","\n        aria-label=","\n      >\n        ","\n      </button>\n    "],["\n      <button\n        ref=",'\n        type="button"\n        style=',"\n        class=","\n        onClick=","\n        onMouseover=","\n        onMouseout=","\n        disabled=","\n        aria-label=","\n      >\n        ","\n      </button>\n    "])),(function(t){return e.refs.el=t}),s,a,this.execCommand,this.showTooltip,n,!!r,o.text||o.tooltip||"",o.text||"")},t}(xv),By=wy(Py),Fy=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.showTooltip=function(){t.props.showTooltip(t.refs.el)},t.showPopup=function(){var e=my("customPopupBody",{el:t.refs.el,pos:t.props.getBound(t.refs.el),popup:t.props.item.popup});e&&t.props.setPopupInfo(e)},t}return Ai(t,e),t.prototype.mounted=function(){var e=this.props,t=e.setItemWidth,n=e.item;this.refs.el.appendChild(n.el),t&&t(n.name,Ka(this.refs.el)),n.onMounted&&n.onMounted(this.props.execCommand)},t.prototype.updated=function(e){var t,n=this.props,r=n.item,o=n.active,i=n.disabled;e.active===o&&e.disabled===i||null===(t=r.onUpdated)||void 0===t||t.call(r,{active:o,disabled:i})},t.prototype.render=function(){var e=this,t=this.props,n=t.disabled,r={display:t.item.hidden?"none":"inline-block"},o=function(e){return n?null:e};return cv(xy||(xy=Ri(["\n      <div\n        ref=","\n        style=","\n        class=","\n        onClick=","\n        onMouseover=","\n        onMouseout=","\n      ></div>\n    "],["\n      <div\n        ref=","\n        style=","\n        class=","\n        onClick=","\n        onMouseover=","\n        onMouseout=","\n      ></div>\n    "])),(function(t){return e.refs.el=t}),r,ja("toolbar-item-wrapper"),o(this.showPopup),o(this.showTooltip),o(this.props.hideTooltip))},t}(xv),Hy=wy(Fy),zy=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ai(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.group,r=t.hiddenDivider,o=n.hidden?{display:"none"}:null,i=r?{display:"none"}:null;return cv(Ty||(Ty=Ri(['\n      <div class="','" style=',">\n        ",'\n        <div class="','" style=',"></div>\n      </div>\n    "],['\n      <div class="','" style=',">\n        ",'\n        <div class="','" style=',"></div>\n      </div>\n    "])),ja("toolbar-group"),o,n.map((function(t){var n=t.el?Hy:By;return cv(Cy||(Cy=Ri(["<"," key="," ..."," item="," />"],["<"," key="," ..."," item="," />"])),n,t.name,e.props,t)})),ja("toolbar-divider"),i)},t}(xv),qy=function(e){function t(t){var n=e.call(this,t)||this;return n.handleClickDocument=function(e){var t=e.target;Ga(t,"."+ja("dropdown-toolbar"))||Ga(t,".more")||n.setState({showDropdown:!1,dropdownPos:null})},n.showTooltip=function(){n.props.showTooltip(n.refs.el)},n.state={showDropdown:!1,dropdownPos:null},n}return Ai(t,e),t.prototype.getBound=function(){var e=this.props.getBound(this.refs.el);return e.top+=4,Li(Li({},e),{left:null,right:10})},t.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},t.prototype.updated=function(){this.state.showDropdown&&!this.state.dropdownPos&&this.setState({dropdownPos:this.getBound()})},t.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},t.prototype.render=function(){var e=this,t=this.state,n=t.showDropdown,r=t.dropdownPos,o=this.props,i=o.disabled,s=o.item,a=o.items,l=o.hideTooltip,c=a.filter((function(e){return!e.hidden})),u=c.length?null:{display:"none"},d=n?null:{display:"none"};return cv(Sy||(Sy=Ri(['\n      <div class="','" style=',">\n        <button\n          ref=",'\n          type="button"\n          class=',"\n          onClick=","\n          onMouseover=","\n          onMouseout=","\n          disabled=",'\n        ></button>\n        <div\n          class="','"\n          style=',"\n          ref=","\n        >\n          ","\n        </div>\n      </div>\n    "],['\n      <div class="','" style=',">\n        <button\n          ref=",'\n          type="button"\n          class=',"\n          onClick=","\n          onMouseover=","\n          onMouseout=","\n          disabled=",'\n        ></button>\n        <div\n          class="','"\n          style=',"\n          ref=","\n        >\n          ","\n        </div>\n      </div>\n    "])),ja("toolbar-group"),u,(function(t){return e.refs.el=t}),s.className,(function(){return e.setState({showDropdown:!0})}),this.showTooltip,l,i,ja("dropdown-toolbar"),Li(Li({},d),r),(function(t){return e.refs.dropdownEl=t}),c.length?c.map((function(t,n){var r;return cv(My||(My=Ri(["\n                  <","\n                    group=","\n                    hiddenDivider=","\n                    ...","\n                  />\n                "],["\n                  <","\n                    group=","\n                    hiddenDivider=","\n                    ...","\n                  />\n                "])),zy,t,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),e.props)})):null)},t}(xv),Vy=wy(qy),jy=function(e){function t(t){var n,r,o=e.call(this,t)||this;return o.toggleTab=function(e,t){var n=o.props.eventEmitter;if(o.state.activeTab!==t){var r="write"===t?"changePreviewTabWrite":"changePreviewTabPreview";n.emit(r),o.setState({activeTab:t})}},o.setItemWidth=function(e,t){o.itemWidthMap[e]=t},o.setPopupInfo=function(e){o.setState({showPopup:!0,popupInfo:e})},o.openPopup=function(e,t){void 0===t&&(t={});var n=o.refs.el.querySelector("."+ja("toolbar-group")+" ."+e);if(n){var r=Xa(n,Ga(n,"."+ja("toolbar"))),i=r.offsetLeft,s=r.offsetTop,a=my(e,{el:n,pos:{left:i,top:n.offsetHeight+s},initialValues:t});a&&o.setPopupInfo(a)}},o.hidePopup=function(){o.state.showPopup&&o.setState({showPopup:!1})},o.execCommand=function(e,t){o.props.eventEmitter.emit("command",e,t),o.hidePopup()},o.tabs=[{name:"write",text:"Write"},{name:"preview",text:"Preview"}],o.itemWidthMap={},o.initialItems=(n=t.toolbarItems||[],r=o.hiddenScrollSync(),n.reduce((function(e,t){e.push(t.map((function(e){return function(e){return e.hidden="scrollSync"===e.name&&r,e}(fy(e))})));var n=e[(e.length||1)-1];return n&&gy(n),e}),[])),o.state={items:o.initialItems,dropdownItems:[],showPopup:!1,popupInfo:{},activeTab:"write"},o.tooltipRef={current:null},o.resizeObserver=new ay((function(){return o.handleResize()})),o.addEvent(),o}return Ai(t,e),t.prototype.insertToolbarItem=function(e,t){var n=e.groupIndex,r=e.itemIndex,o=this.initialItems[n];t=fy(t),o?o.splice(r,0,t):this.initialItems.push([t]),this.setState(this.classifyToolbarItems())},t.prototype.removeToolbarItem=function(e){var t=this;zi(this.initialItems,(function(n){var r=!1;return zi(n,(function(o,i){return o.name!==e||(r=!0,n.splice(i,1),t.setState(t.classifyToolbarItems()),!1)})),!r}))},t.prototype.addEvent=function(){var e=this,t=this.props.eventEmitter;this.handleResize=Tv((function(){e.setState({items:e.initialItems,dropdownItems:[]}),e.setState(e.classifyToolbarItems())}),200),t.listen("openPopup",this.openPopup)},t.prototype.appendTooltipToRoot=function(){var e='<div class="'+ja("tooltip")+'" style="display:none">\n        <div class="arrow"></div>\n        <span class="text"></span>\n      </div>';this.tooltipRef.current=Ja(e,this.refs.el)},t.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},t.prototype.movePrevItemToDropdownToolbar=function(e,t,n,r){var o=function(e){var t=e.pop();t&&r.push(t)};if(e>1)o(n);else{var i=Fs(t);i&&o(i)}},t.prototype.classifyToolbarItems=function(){var e=this,t=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+ja("toolbar-divider")),o=r?Ka(r):0,i=[],s=[],a=!1;return this.initialItems.forEach((function(r,l){var c=[],u=[];r.forEach((function(r,o){r.hidden||((t+=e.itemWidthMap[r.name])>n-50?(a||(e.movePrevItemToDropdownToolbar(o,i,c,u),a=!0),u.push(r)):c.push(r))})),c.length&&(gy(c),i.push(c)),u.length&&(gy(u),s.push(u)),l<e.state.items.length-1&&(t+=o)})),{items:i,dropdownItems:s}},t.prototype.mounted=function(){"tab"===this.props.previewStyle&&this.props.eventEmitter.emit("changePreviewTabWrite",!0),this.setState(this.classifyToolbarItems()),this.appendTooltipToRoot(),this.resizeObserver.observe(this.refs.el)},t.prototype.updated=function(e){var t,n,r=this.props,o=r.editorType,i=r.previewStyle,s=r.eventEmitter,a=i!==e.previewStyle,l=o!==e.editorType;if(a||l){t=this.initialItems,n=this.hiddenScrollSync(),t.forEach((function(e){e.forEach((function(e){return e.hidden="scrollSync"===e.name&&n})),gy(e)}));var c=this.classifyToolbarItems();(a||"tab"===i&&"markdown"===o)&&(s.emit("changePreviewTabWrite"),c.activeTab="write"),this.setState(c)}},t.prototype.beforeDestroy=function(){window.removeEventListener("resize",this.handleResize),this.resizeObserver.disconnect(),Ua(this.tooltipRef.current)},t.prototype.render=function(){var e=this,t=this.props,n=t.previewStyle,r=t.eventEmitter,o=t.editorType,i=this.state,s=i.popupInfo,a=i.showPopup,l=i.activeTab,c=i.items,u=i.dropdownItems,d={eventEmitter:r,tooltipRef:this.tooltipRef,disabled:"markdown"===o&&"tab"===n&&"preview"===l,execCommand:this.execCommand,setPopupInfo:this.setPopupInfo},p="tab"===n?{borderTopLeftRadius:0}:null;return cv(Ny||(Ny=Ri(['\n      <div class="','">\n        <div\n          class="','"\n          style="display: ','"\n        >\n          <'," tabs="," activeTab="," onClick=",' />\n        </div>\n        <div\n          class="','"\n          ref=',"\n          style=","\n        >\n          ","\n          <","\n            item=","\n            items=","\n            ...","\n          />\n        </div>\n        <","\n          info=","\n          show=","\n          eventEmitter=","\n          hidePopup=","\n          execCommand=","\n        />\n      </div>\n    "],['\n      <div class="','">\n        <div\n          class="','"\n          style="display: ','"\n        >\n          <'," tabs="," activeTab="," onClick=",' />\n        </div>\n        <div\n          class="','"\n          ref=',"\n          style=","\n        >\n          ","\n          <","\n            item=","\n            items=","\n            ...","\n          />\n        </div>\n        <","\n          info=","\n          show=","\n          eventEmitter=","\n          hidePopup=","\n          execCommand=","\n        />\n      </div>\n    "])),ja("toolbar"),ja("md-tab-container"),"wysiwyg"===o||"vertical"===n?"none":"block",cy,this.tabs,l,this.toggleTab,ja("defaultUI-toolbar"),(function(t){return e.refs.el=t}),p,c.map((function(t,n){var r;return cv(Ey||(Ey=Ri(["\n              <","\n                group=","\n                hiddenDivider=","\n                setItemWidth=","\n                ...","\n              />\n            "],["\n              <","\n                group=","\n                hiddenDivider=","\n                setItemWidth=","\n                ...","\n              />\n            "])),zy,t,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),e.setItemWidth,d)})),Vy,fy("more"),u,d,by,s,a,r,this.hidePopup,this.execCommand)},t}(xv),$y=function(e){function t(t){var n=e.call(this,t)||this;return n.handleClickDocument=function(e){Ga(e.target,"."+ja("context-menu"))||n.setState({pos:null})},n.state={pos:null,menuGroups:[]},n.addEvent(),n}return Ai(t,e),t.prototype.addEvent=function(){var e=this;this.props.eventEmitter.listen("contextmenu",(function(t){var n=t.pos,r=t.menuGroups;e.setState({pos:n,menuGroups:r})}))},t.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},t.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},t.prototype.getMenuGroupElements=function(){var e=this,t=this.state,n=t.pos,r=t.menuGroups;return n?r.reduce((function(t,n){var r=[];return n.forEach((function(t){var n=t.label,o=t.className,i=void 0!==o&&o,s=t.disabled,a=t.onClick;r.push(cv(Oy||(Oy=Ri(["\n                <li\n                  onClick=",'\n                  class="menu-item','"\n                  aria-role="menuitem"\n                >\n                  <span class="','">',"</span>\n                </li>\n              "],["\n                <li\n                  onClick=",'\n                  class="menu-item','"\n                  aria-role="menuitem"\n                >\n                  <span class="','">',"</span>\n                </li>\n              "])),(function(){s||(a(),e.setState({pos:null}))}),s?" disabled":"",i,n))})),t.push(cv(Dy||(Dy=Ri(['<ul class="menu-group">\n              ',"\n            </ul>"],['<ul class="menu-group">\n              ',"\n            </ul>"])),r)),t}),[]):[]},t.prototype.render=function(){var e=Li({display:this.state.pos?"block":"none"},this.state.pos);return cv(Ay||(Ay=Ri(['<div class="','" style=',' aria-role="menu">\n      ',"\n    </div>"],['<div class="','" style=',' aria-role="menu">\n      ',"\n    </div>"])),ja("context-menu"),e,this.getMenuGroupElements())},t}(xv),_y=function(e){function t(t){var n=e.call(this,t)||this;n.changeMode=function(e){e!==n.state.editorType&&n.setState({editorType:e})},n.changePreviewStyle=function(e){e!==n.state.previewStyle&&n.setState({previewStyle:e})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=t.editorType,o=t.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return Ai(t,e),t.prototype.mounted=function(){var e=this.props.slots,t=e.wwEditor,n=e.mdEditor,r=e.mdPreview;this.refs.wwContainer.appendChild(t),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},t.prototype.insertToolbarItem=function(e,t){this.toolbar.insertToolbarItem(e,t)},t.prototype.removeToolbarItem=function(e){this.toolbar.removeToolbarItem(e)},t.prototype.render=function(){var e=this,t=this.props,n=t.eventEmitter,r=t.hideModeSwitch,o=t.toolbarItems,i=t.theme,s=this.state,a=s.hide,l=s.previewStyle,c=s.editorType,u=a?" hidden":"",d=ja("markdown"===c?"md-mode":"ww-mode"),p=ja("md")+"-"+l+"-style",h=ja(["light"!==i,i+" "]);return cv(Iy||(Iy=Ri(['\n      <div\n        class="',"","",'"\n        ref=',"\n      >\n        <","\n          ref=","\n          eventEmitter=","\n          previewStyle=","\n          toolbarItems=","\n          editorType=",'\n        />\n        <div\n          class="'," ",'"\n          ref=','\n        >\n          <div class="','">\n            <div\n              class="'," ",'"\n              ref=','\n            >\n              <div class="','"></div>\n            </div>\n            <div\n              class="','"\n              ref=',"\n            />\n          </div>\n        </div>\n        ","\n        <"," eventEmitter="," />\n      </div>\n    "],['\n      <div\n        class="',"","",'"\n        ref=',"\n      >\n        <","\n          ref=","\n          eventEmitter=","\n          previewStyle=","\n          toolbarItems=","\n          editorType=",'\n        />\n        <div\n          class="'," ",'"\n          ref=','\n        >\n          <div class="','">\n            <div\n              class="'," ",'"\n              ref=','\n            >\n              <div class="','"></div>\n            </div>\n            <div\n              class="','"\n              ref=',"\n            />\n          </div>\n        </div>\n        ","\n        <"," eventEmitter="," />\n      </div>\n    "])),h,ja("defaultUI"),u,(function(t){return e.refs.el=t}),jy,(function(t){return e.toolbar=t}),n,l,o,c,ja("main"),d,(function(t){return e.refs.editorSection=t}),ja("main-container"),ja("md-container"),p,(function(t){return e.refs.mdContainer=t}),ja("md-splitter"),ja("ww-container"),(function(t){return e.refs.wwContainer=t}),!r&&cv(Ly||(Ly=Ri(["<"," eventEmitter="," editorType="," />"],["<"," eventEmitter="," editorType="," />"])),Cv,n,c),$y,n)},t.prototype.addEvent=function(){var e=this.props.eventEmitter;e.listen("hide",this.hide),e.listen("show",this.show),e.listen("changeMode",this.changeMode),e.listen("changePreviewStyle",this.changePreviewStyle)},t}(xv),Uy=function(e){function t(t){var n,r,o,i,s,a=e.call(this,t)||this,l=(o=a.options.el,i=cv(Ry||(Ry=Ri(["\n        <","\n          ref=","\n          eventEmitter=","\n          slots=","\n          hideModeSwitch=","\n          toolbarItems=","\n          previewStyle=","\n          editorType=","\n          theme=","\n        />\n      "],["\n        <","\n          ref=","\n          eventEmitter=","\n          slots=","\n          hideModeSwitch=","\n          toolbarItems=","\n          previewStyle=","\n          editorType=","\n          theme=","\n        />\n      "])),_y,(function(e){return r=e}),a.eventEmitter,a.getEditorElements(),a.options.hideModeSwitch,a.options.toolbarItems,a.options.previewStyle,a.options.initialEditType,a.options.theme),(s=new av(o.tagName.toLowerCase(),{},[i])).node=o,av.removalNodes=[],bv(s),mv(s),function(){return function(e){e.effect="D",av.removalNodes=[e],mv(),av.removalNodes=[]}(s.firstChild)});return a.setMinHeight(a.options.minHeight),a.setHeight(a.options.height),a.defaultUI={insertToolbarItem:r.insertToolbarItem.bind(r),removeToolbarItem:r.removeToolbarItem.bind(r),destroy:l},null===(n=a.pluginInfo.toolbarItems)||void 0===n||n.forEach((function(e){var t=e.groupIndex,n=e.itemIndex,r=e.item;a.defaultUI.insertToolbarItem({groupIndex:t,itemIndex:n},r)})),a.eventEmitter.emit("loadUI",a),a}return Ai(t,e),t.factory=function(e){return e.viewer?new Gg(e):new t(e)},t.prototype.insertToolbarItem=function(e,t){this.defaultUI.insertToolbarItem(e,t)},t.prototype.removeToolbarItem=function(e){this.defaultUI.removeToolbarItem(e)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.defaultUI.destroy()},t}(iv);iv.setLanguage(["en","en-US"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Write",Preview:"Preview",Headings:"Headings",Paragraph:"Paragraph",Bold:"Bold",Italic:"Italic",Strike:"Strike",Code:"Inline code",Line:"Line",Blockquote:"Blockquote","Unordered list":"Unordered list","Ordered list":"Ordered list",Task:"Task",Indent:"Indent",Outdent:"Outdent","Insert link":"Insert link","Insert CodeBlock":"Insert codeBlock","Insert table":"Insert table","Insert image":"Insert image",Heading:"Heading","Image URL":"Image URL","Select image file":"Select image file","Choose a file":"Choose a file","No file":"No file",Description:"Description",OK:"OK",More:"More",Cancel:"Cancel",File:"File",URL:"URL","Link text":"Link text","Add row to up":"Add row to up","Add row to down":"Add row to down","Add column to left":"Add column to left","Add column to right":"Add column to right","Remove row":"Remove row","Remove column":"Remove column","Align column to left":"Align column to left","Align column to center":"Align column to center","Align column to right":"Align column to right","Remove table":"Remove table","Would you like to paste as table?":"Would you like to paste as table?","Text color":"Text color","Auto scroll enabled":"Auto scroll enabled","Auto scroll disabled":"Auto scroll disabled","Choose language":"Choose language"})},67607:(e,t,n)=>{n.d(t,{A:()=>r.N});var r=n(52811)}}]);

Zerion Mini Shell 1.0