>1}},a.from=function(t){if(t instanceof a)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new a(e)};var c=a;function l(t,e,n){for(var r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;var o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var a=l(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function u(t,e,n,r){for(var o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var s=t.child(--o),a=e.child(--i),c=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var l=0,p=Math.min(s.text.length,a.text.length);lt&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},p.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},p.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},p.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);ot)for(var o=0,i=0;it&&((ie)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new p(n,r)},p.prototype.cutByIndex=function(t,e){return t==e?p.empty:0==t&&e==this.content.length?this:new p(this.content.slice(t,e))},p.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new p(r,o)},p.prototype.addToStart=function(t){return new p([t].concat(this.content),this.size+t.nodeSize)},p.prototype.addToEnd=function(t){return new p(this.content.concat(t),this.size+t.nodeSize)},p.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?h(n+1,o):h(n,r);r=o}},p.prototype.toString=function(){return"<"+this.toStringInner()+">"},p.prototype.toStringInner=function(){return this.content.join(", ")},p.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},p.fromJSON=function(t,e){if(!e)return p.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new p(e.map(t.nodeFromJSON))},p.fromArray=function(t){if(!t.length)return p.empty;for(var e,n=0,r=0;rthis.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},v.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new g("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new g("Inconsistent open depths");return C(t,e,n,0)}function C(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(p.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return N(i,O(t,a.start,a.end,e,r))}var c=t.parent,l=c.content;return N(c,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}return N(i,D(t,e,r))}function T(t,e){if(!e.type.compatibleContent(t.type))throw new g("Cannot join "+e.type.name+" onto "+t.type.name)}function M(t,e,n){var r=t.node(n);return T(r,e.node(n)),r}function S(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function E(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(S(t.nodeAfter,r),i++));for(var a=i;ao&&M(t,e,o+1),s=r.depth>o&&M(n,r,o+1),a=[];return E(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(T(i,s),S(N(i,O(t,e,n,r,o+1)),a)):(i&&S(N(i,D(t,e,o+1)),a),E(e,n,o,a),s&&S(N(s,D(n,r,o+1)),a)),E(r,null,o,a),new p(a)}function D(t,e,n){var r=[];(E(null,t,n,r),t.depth>n)&&S(N(M(t,e,n+1),D(t,e,n+1)),r);return E(e,null,n,r),new p(r)}b.size.get=function(){return this.content.size-this.openStart-this.openEnd},y.prototype.insertAt=function(t,e){var n=k(this.content,t+this.openStart,e,null);return n&&new y(n,this.openStart,this.openEnd)},y.prototype.removeBetween=function(t,e){return new y(w(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},y.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},y.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},y.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},y.fromJSON=function(t,e){if(!e)return y.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new y(p.fromJSON(t,e.content),n,r)},y.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new y(t,n,r)},Object.defineProperties(y.prototype,b),y.empty=new y(p.empty,0,0);var A=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},L={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};A.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},L.parent.get=function(){return this.node(this.depth)},L.doc.get=function(){return this.node(0)},A.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},A.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},A.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},A.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},A.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},A.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},A.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},L.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},L.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},L.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},A.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},A.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new B(this,t,n)},A.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},A.prototype.max=function(t){return t.pos>this.pos?t:this},A.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new A(e,n,o)},A.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},j.isBlock.get=function(){return this.type.isBlock},j.isTextblock.get=function(){return this.type.isTextblock},j.inlineContent.get=function(){return this.type.inlineContent},j.isInline.get=function(){return this.type.isInline},j.isText.get=function(){return this.type.isText},j.isLeaf.get=function(){return this.type.isLeaf},j.isAtom.get=function(){return this.type.isAtom},z.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),q(this.marks,t)},z.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},z.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=p.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var a=r;a=0;n--)e=t[n].type.name+"("+e+")";return e}var V=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},$={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};V.parse=function(t,e){var n=new U(t,e);if(null==n.next)return V.empty;var r=J(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(Y(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];Y(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new V(r.indexOf(t.length-1)>-1),s=0;s>1},V.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},V.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(V.prototype,$),V.empty=new V(!0);var U=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},W={next:{configurable:!0}};function J(t){var e=[];do{e.push(G(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function G(t){var e=[];do{e.push(K(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function K(t){for(var e=function(t){if(t.eat("(")){var e=J(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=X(t,e)}return e}function Z(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function X(t,e){var n=Z(t),r=n;return t.eat(",")&&(r="}"!=t.next?Z(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q(t,e){return e-t}function Y(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i-1},rt.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var ct=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=c.from(t.nodes),this.spec.marks=c.from(t.marks),this.nodes=rt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var o=this.nodes[r],i=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[i]||(n[i]=V.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?lt(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var a in this.marks){var l=this.marks[a],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:lt(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function lt(t,e){for(var n=[],r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}ct.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof rt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},ct.prototype.text=function(t,e){var n=this.nodes.text;return new _(n,n.defaultAttrs,t,v.setFrom(e))},ct.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},ct.prototype.nodeFromJSON=function(t){return z.fromJSON(this,t)},ct.prototype.markFromJSON=function(t){return v.fromJSON(this,t)},ct.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ut=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};ut.prototype.parse=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ut.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!0);return n.addAll(t,null,e.from,e.to),y.maxOpen(n.finish())},ut.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ut.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},mt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},vt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},vt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},gt.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},vt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},vt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},vt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(vt.prototype,gt);var kt=function(t,e){this.nodes=t||{},this.marks=e||{}};function xt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ct(t){return t.document||window.document}kt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=Ct(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},kt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&kt.renderSpec(Ct(n),r(t,e))},kt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var l in c=2,a)if(null!=a[l]){var u=l.indexOf(" ");u>0?s.setAttributeNS(l.slice(0,u),l.slice(u+1),a[l]):s.setAttribute(l,a[l])}for(var p=c;pc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=kt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},kt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new kt(this.nodesFromSchema(t),this.marksFromSchema(t)))},kt.nodesFromSchema=function(t){var e=xt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},kt.marksFromSchema=function(t){return xt(t.marks)};var Tt=n(956),Mt=n.n(Tt),St=n(969),Et=n.n(St),Nt=n(522),Ot=n.n(Nt),Dt=n(204),At=n.n(Dt),Lt=n(462),It=n.n(Lt),Rt=n(758),Pt=n.n(Rt),Bt=n(321),Ft=n.n(Bt),Ht=n(929),zt=n.n(Ht),jt=n(934),_t=n.n(jt),qt=n(391),Vt=n.n(qt),$t=(/Mac/.test(navigator.platform),/[\u0020]+/g),Ut=/[>(){}[\]+-.!#|]/g,Wt=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>||<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,Jt=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,Gt=/[*_~`]/g;function Kt(t,e){return-1!==t.indexOf(e)}var Zt=["rel","target","hreflang","type"],Xt={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 Qt(t){if(!t)return null;var e={};return Zt.forEach((function(n){zt()(t[n])||(e[n]=t[n])})),e}function Yt(t,e){for(var n="",r=0;re?[e,t]:[t,e]}var ue=Math.pow(2,16);function pe(t,e){return t+e*ue}function de(t){return 65535&t}var fe=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},he=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};he.prototype.recover=function(t){var e=0,n=de(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var d=t==(e<0?a:u)?null:pe(s/3,t-a);return new fe(p,e<0?t!=a:t!=u,d)}r+=l-c}return n?t+r:new fe(t+r)},he.prototype.touches=function(t,e){for(var n=0,r=de(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},he.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},me.prototype.invert=function(){var t=new me;return t.appendMappingInverted(this),t},me.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},ge.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(ge.prototype,ye);var we=Object.create(null),ke=function(){};ke.prototype.apply=function(t){return be()},ke.prototype.getMap=function(){return he.empty},ke.prototype.invert=function(t){return be()},ke.prototype.map=function(t){return be()},ke.prototype.merge=function(t){return null},ke.prototype.toJSON=function(){return be()},ke.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=we[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},ke.jsonID=function(t,e){if(t in we)throw new RangeError("Duplicate use of step JSON ID "+t);return we[t]=e,e.prototype.jsonID=t,e};var xe=function(t,e){this.doc=t,this.failed=e};xe.ok=function(t){return new xe(t,null)},xe.fail=function(t){return new xe(null,t)},xe.fromReplace=function(t,e,n,r){try{return xe.ok(t.replace(e,n,r))}catch(t){if(t instanceof g)return xe.fail(t.message);throw t}};var Ce=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Me(t,this.from,this.to)?xe.fail("Structure replace would overwrite content"):xe.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new he([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?y.empty:new y(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?y.empty:new y(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,y.fromJSON(t,n.slice),!!n.structure)},e}(ke);ke.jsonID("replace",Ce);var Te=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Me(t,this.from,this.gapFrom)||Me(t,this.gapTo,this.to)))return xe.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return xe.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?xe.fromReplace(t,this.from,this.to,n):xe.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new he([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||or.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,y.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(ke);function Me(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Se(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ee(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(ni;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),d=r&&r[c]||l;if(d!=l&&(p=p.replaceChild(0,d.type.create(d.attrs))),!l.canReplace(u+1,l.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function De(t,e){var n=t.resolve(e),r=n.index();return Ae(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ae(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Le(t,e,n){for(var r=[],o=0;oe;d--)f||n.index(d)>0?(f=!0,l=p.from(n.node(d).copy(l)),u++):a--;for(var h=p.empty,m=0,v=o,g=!1;v>e;v--)g||r.after(v+1)=0;r--)n=p.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Te(o,i,o,i,new y(n,0,0),e.length,!0))},ge.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new Te(a,c,a+1,c-1,new y(p.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},ge.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Te(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new y(p.from(i),0,0),1,!0))},ge.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=p.empty,i=p.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=p.from(r.node(s).copy(o));var l=n&&n[c];i=p.from(l?l.type.create(l.attrs,i):r.node(s).copy(i))}return this.step(new Ce(t,t,new y(o.append(i),e,e),!0))},ge.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Ce(t-e,t+e,y.empty,!0);return this.step(n)};var Ie=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new y(Le(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return xe.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Re(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(ke);ke.jsonID("addMark",Ie);var Re=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new y(Le(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return xe.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Ie(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(ke);function Pe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}ke.jsonID("removeMark",Re),ge.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),d=Math.min(c+r.nodeSize,e),f=n.addToSet(u),h=0;h=0;f--)this.step(o[f]);return this},ge.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=y.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=y.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Pe(o,i,r)?new Ce(e,n,r):new Be(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},ge.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new y(p.from(n),0,0))},ge.prototype.delete=function(t,e){return this.replace(t,e,y.empty)},ge.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Be=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=p.empty;for(var i=t.depth;i>0;i--)this.placed=p.from(t.node(i).copy(this.placed))},Fe={depth:{configurable:!0}};function He(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(He(t.firstChild.content,e-1,n)))}function ze(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ze(t.lastChild.content,e-1,n)))}function je(t,e){for(var n=0;n1&&(r=r.replaceChild(0,_e(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(p.empty,!0)))),t.copy(r)}function qe(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(p.empty,!0))}return t}function $e(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}Fe.depth.get=function(){return this.frontier.length-1},Be.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new y(i,s,a);return e>-1?new Te(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ce(r.pos,o.pos,c):void 0},Be.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=je(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,l=void 0;if(1==t&&(r?a.matchType(r.type)||(l=a.fillBefore(p.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},Be.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=je(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new y(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},Be.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=je(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new y(He(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new y(He(e,n,1),n,r)},Be.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var s=0;s1||0==l||b.content.size)&&(h=w,d.push(_e(b.mark(m.allowedMarks(b.marks)),1==u?l:0,u==c.childCount?g:-1)))}var k=u==c.childCount;k||(g=-1),this.placed=ze(this.placed,n,p.from(d)),this.frontier[n].match=h,k&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x1&&r==this.$to.end(--n);)++r;return r},Be.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e=0;a--){var c=this.frontier[a],l=c.match,u=qe(t,a,c.type,l,!0);if(!u||u.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},Be.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=ze(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},Be.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=ze(this.placed,this.depth,p.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Be.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(p.empty,!0);t.childCount&&(this.placed=ze(this.placed,this.frontier.length,t))},Object.defineProperties(Be.prototype,Fe),ge.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Pe(r,o,n))return this.step(new Ce(t,e,n));var i=$e(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=n.openStart,f=n.content,h=0;;h++){var m=f.firstChild;if(p.push(m),h==n.openStart)break;f=m.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var v=n.openStart;v>=0;v--){var g=(v+d+1)%(n.openStart+1),b=p[g];if(b)for(var w=0;w=0&&(this.replace(t,e,n),!(this.steps.length>M));S--){var E=i[S];S<0||(t=r.before(E),e=o.after(E))}return this},ge.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Ue=Object.create(null),We=function(t,e,n){this.ranges=n||[new Ge(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Je={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Je.anchor.get=function(){return this.$anchor.pos},Je.head.get=function(){return this.$head.pos},Je.from.get=function(){return this.$from.pos},Je.to.get=function(){return this.$to.pos},Je.$from.get=function(){return this.ranges[0].$from},Je.$to.get=function(){return this.ranges[0].$to},Je.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?en(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):en(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},We.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Ye(t.node(0))},We.atStart=function(t){return en(t,t,0,0,1)||new Ye(t)},We.atEnd=function(t){return en(t,t,t.content.size,t.childCount,-1)||new Ye(t)},We.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ue[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},We.jsonID=function(t,e){if(t in Ue)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ue[t]=e,e.prototype.jsonID=t,e},We.prototype.getBookmark=function(){return Ke.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(We.prototype,Je),We.prototype.visible=!0;var Ge=function(t,e){this.$from=t,this.$to=e},Ke=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=y.empty),t.prototype.replace.call(this,e,n),n==y.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new Ze(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&Xe.isSelectable(a))return Xe.create(t,n-(o<0?a.nodeSize:0))}else{var c=en(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function nn(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return v.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||v.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(We.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(ge);function on(t,e){return e&&t?t.bind(e):t}var sn=function(t,e,n){this.name=t,this.init=on(e.init,n),this.apply=on(e.apply,n)},an=[new sn("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new sn("selection",{init:function(t,e){return t.selection||We.atStart(e.doc)},apply:function(t){return t.selection}}),new sn("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new sn("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],cn=function(t,e){var n=this;this.schema=t,this.fields=an.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new sn(t.key,t.spec.state,t))}))},ln=function(t){this.config=t},un={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};un.schema.get=function(){return this.config.schema},un.plugins.get=function(){return this.config.plugins},ln.prototype.apply=function(t){return this.applyTransaction(t).state},ln.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&pn.splice(e,1)},Object.defineProperties(ln.prototype,un);var pn=[];function dn(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=dn(o,e,{})),n[r]=o}return n}var fn=function(t){this.props={},t.props&&dn(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:mn("plugin")};fn.prototype.getState=function(t){return t[this.key]};var hn=Object.create(null);function mn(t){return t in hn?t+"$"+ ++hn[t]:(hn[t]=0,t+"$")}var vn=function(t){void 0===t&&(t="key"),this.key=mn(t)};vn.prototype.get=function(t){return t.config.pluginsByKey[this.key]},vn.prototype.getState=function(t){return t[this.key]};var gn={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var yn=/Edge\/(\d+)/.exec(navigator.userAgent),bn=/MSIE \d/.test(navigator.userAgent),wn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);gn.mac=/Mac/.test(navigator.platform);var kn=gn.ie=!!(bn||wn||yn);gn.ie_version=bn?document.documentMode||6:wn?+wn[1]:yn?+yn[1]:null,gn.gecko=!kn&&/gecko\/(\d+)/i.test(navigator.userAgent),gn.gecko_version=gn.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var xn=!kn&&/Chrome\/(\d+)/.exec(navigator.userAgent);gn.chrome=!!xn,gn.chrome_version=xn&&+xn[1],gn.safari=!kn&&/Apple Computer/.test(navigator.vendor),gn.ios=gn.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),gn.android=/Android \d/.test(navigator.userAgent),gn.webkit="webkitFontSmoothing"in document.documentElement.style,gn.webkit_version=gn.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Cn=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Tn=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Mn=null,Sn=function(t,e,n){var r=Mn||(Mn=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},En=function(t,e,n,r){return n&&(On(t,e,n,r,-1)||On(t,e,n,r,1))},Nn=/^(img|br|input|textarea|hr)$/i;function On(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Dn(t))){var i=t.parentNode;if(1!=i.nodeType||An(t)||Nn.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Cn(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?Dn(t):0}}}function Dn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function An(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Ln=function(t){var e=t.isCollapsed;return e&&gn.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function In(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Rn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Pn(t,e){return"number"==typeof t?t:t[e]}function Bn(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Fn(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=Tn(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?Rn(i):Bn(s),l=0,u=0;if(e.topc.bottom-Pn(r,"bottom")&&(u=e.bottom-c.bottom+Pn(o,"bottom")),e.leftc.right-Pn(r,"right")&&(l=e.right-c.right+Pn(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var f=s.scrollLeft-p,h=s.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(a)break}}function Hn(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=Tn(t));return e}function zn(t,e){for(var n=0;n=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var f=d.left>e.left?d.left-e.left:d.right=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:_n(n,r)}function qn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Vn(t,e,n){var r=t.childNodes.length;if(r&&n.tope.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=_n(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:l,inside:m?m.posAtStart-m.border:-1}}function Un(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Wn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Jn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=gn.webkit||gn.gecko;if(3==o.nodeType){if(!s||!Wn.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==o.nodeValue.length?(a--,l=1):n<0?a--:c++,Gn(Un(Sn(o,a,c),l),l<0)}var u=Un(Sn(o,i,i),n);if(gn.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(i&&(n<0||i==Dn(o))){var m=o.childNodes[i-1],v=3==m.nodeType?Sn(m,Dn(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return Gn(Un(v,1),!1)}if(i=0)}function Gn(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Kn(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Zn(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var Xn=/[\u0590-\u08ac]/;var Qn=null,Yn=null,tr=!1;function er(t,e,n){return Qn==e&&Yn==n?tr:(Qn=e,Yn=n,tr="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return Zn(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Jn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=Sn(s,0,s.nodeValue.length).getClientRects()}for(var c=0;cl.top&&("up"==n?l.bottomi.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return Xn.test(r.parent.textContent)&&a.modify?Zn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var nr=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},rr={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};nr.prototype.matchesWidget=function(){return!1},nr.prototype.matchesMark=function(){return!1},nr.prototype.matchesNode=function(){return!1},nr.prototype.matchesHack=function(){return!1},rr.beforePosition.get=function(){return!1},nr.prototype.parseRule=function(){return null},nr.prototype.stopEvent=function(){return!1},rr.size.get=function(){for(var t=0,e=0;eCn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},nr.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},nr.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},nr.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},nr.prototype.descAt=function(t){for(var e=0,n=0;e=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},nr.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Cn(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var d=s+1;da&&ie){var b=u;u=p,p=b}var w=document.createRange();w.setEnd(p.node,p.offset),w.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(w)}}},nr.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},rr.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},nr.prototype.markDirty=function(t,e){for(var n=0,r=0;r=n:tn){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},nr.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty0&&(i=Tr(i,0,t,r));for(var a=0;ai;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c=0&&!a&&s.syncToMarks(i==n.node.childCount?v.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(or,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),fr(this.contentDOM,this.children,t),gn.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof Ke)||re+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=Dn(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new sr(this,i,n,o);t.compositionNodes.push(s),this.children=Tr(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!wr(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=gr(this.dom,this.nodeDOM,vr(this.outerDeco,this.node,e),vr(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(nr);function lr(t,e,n,r,o){return br(r,e,t),new cr(null,t,e,n,r,r,r,o,0)}var ur=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(cr),pr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(nr),dr=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(cr);function fr(t,e,n){for(var r=t.firstChild,o=!1,i=0;i0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Cr(t,e){return t.type.side-e.type.side}function Tr(t,e,n,r,o){for(var i=[],s=0,a=0;s=n||u<=e?i.push(c):(ln&&i.push(c.slice(n-l,c.size,r)))}return i}function Mr(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,l=r.resolve(s);if(Ln(n)){for(a=l;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&Xe.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==Dn(t);r||o;){if(t==n)return!0;var i=Cn(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==Dn(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;c=new Xe(s==u?l:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;a=r.resolve(p)}c||(c=Rr(t,a,l,"pointer"==e||t.state.selection.head>1,i=Math.min(o,t.length);r-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=ar.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},xr.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&We.findFrom(s,e)}function Fr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Hr(t,e,n){var r=t.state.selection;if(!(r instanceof Ke)){if(r instanceof Xe&&r.node.isInline)return Fr(t,new Ke(e>0?r.$to:r.$from));var o=Br(t.state,e);return!!o&&Fr(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=Br(t.state,e);return!!(i&&i instanceof Xe)&&Fr(t,i)}if(!(gn.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var l=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM)&&(Xe.isSelectable(c)?Fr(t,new Xe(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!gn.webkit&&Fr(t,new Ke(t.state.doc.resolve(e<0?l:l+c.nodeSize))))}}function zr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function jr(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function _r(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(gn.gecko&&1==n.nodeType&&r0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(jr(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Vr(n))break;for(var c=n.previousSibling;c&&jr(c);)o=n.parentNode,i=Cn(c),c=c.previousSibling;if(c)r=zr(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?$r(t,e,n,r):o&&$r(t,e,o,i)}}function qr(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=zr(n);;)if(r-1)return!1;if(gn.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=Br(t.state,e);if(s&&s instanceof Xe)return Fr(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof Ye?We.near(a,e):We.findFrom(a,e);return!!c&&Fr(t,c)}return!1}function Wr(t,e){if(!(t.state.selection instanceof Ke))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function Jr(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Gr(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||gn.mac&&72==n&&"c"==r?Wr(t,-1)||_r(t):46==n||gn.mac&&68==n&&"c"==r?Wr(t,1)||qr(t):13==n||27==n||(37==n?Hr(t,-1,r)||_r(t):39==n?Hr(t,1,r)||qr(t):38==n?Ur(t,-1,r)||_r(t):40==n?function(t){if(gn.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;Jr(t,o,!0),setTimeout((function(){return Jr(t,o,!1)}),20)}}}(t)||Ur(t,1,r)||qr(t):r==(gn.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Kr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(gn.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||gn.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Zr(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,s=Mr(t,i);if(s&&!t.state.selection.eq(s)){var a=t.state.tr.setSelection(s);"pointer"==i?a.setMeta("pointer",!0):"key"==i&&a.scrollIntoView(),t.dispatch(a)}}else{var c=t.state.doc.resolve(e),l=c.sharedDepth(n);e=c.before(l+1),n=t.state.doc.resolve(n).after(l+1);var u=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Ln(l)||u.push({node:l.focusNode,offset:l.focusOffset})),gn.chrome&&8===t.lastKeyCode)for(var d=s;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){s=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||ut.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Kr,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(gn.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100=a?i-r:0)+(c-a),a=i}else if(c=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&u instanceof Ke&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((gn.ios&&t.lastIOSEnter>Date.now()-225||gn.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,In(13,"Enter"))})))return void(t.lastIOSEnter=0);if(d.sel){var w=Xr(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:u.from,endA:u.to,endB:u.to}}t.domChangeCount++,t.state.selection.fromt.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),gn.ie&&gn.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&" "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((gn.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!T&&x.posb.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Qr(r,!0,!1)n||Qr(s,!0,!1)e.content.size?null:Rr(t,e.resolve(n.anchor),e.resolve(n.head))}function Qr(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Yr(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||kt.fromSchema(t.state.schema),c=ao(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=io[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=c.createElement(u[d]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function to(t,e,n,r,o){var i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||a||!n);if(c){if(t.someProp("transformPastedText",(function(t){e=t(e,a||r)})),a)return new y(p.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?s=l:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/^(\s* ]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=ao().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&io[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return""+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i=0;a-=2){var c=r.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;o=p.from(c.create(n[a+1],o)),i++,s++}return new y(o,i,s)}(function(t,e,n){e=0;r--){var o=n(r);if(o)return o.v}return t}(s.content,o),!1),t.someProp("transformPasted",(function(t){s=t(s)})),s}function eo(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,p.from(t));return t}function no(t,e,n,r,o){if(o=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(p.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}var io={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},so=null;function ao(){return so||(so=document.implementation.createHTMLDocument("title"))}var co={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lo=gn.ie&&gn.ie_version<=11,uo=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};uo.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},uo.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var po=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;et.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new uo,lo&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};po.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},po.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},po.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,co),lo&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},po.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Pr(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(fo)return;fo=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&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.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Er(this.view),this.currentSelection.set(e))}},po.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;ri.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function ko(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function xo(t,e,n,r,o){return wo(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof Xe&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(Xe.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(ko(t,Xe.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&Xe.isSelectable(r))&&(ko(t,new Xe(n),"pointer"),!0)}(t,n))}function Co(t,e,n,r){return wo(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function To(t,e,n,r){return wo(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(ko(t,Ke.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)ko(t,Ke.create(n,s+1,s+1+i.content.size),"pointer");else{if(!Xe.isSelectable(i))continue;ko(t,Xe.create(n,s),"pointer")}return!0}}(t,n)}function Mo(t){return Lo(t)}mo.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!No(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!gn.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Gr(t,e)?e.preventDefault():vo(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,In(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},mo.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},mo.keypress=function(t,e){if(!(No(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||gn.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof Ke&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var So=gn.mac?"metaKey":"ctrlKey";ho.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=Mo(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[So]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(bo(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Eo(t,i,e,n)):("doubleClick"==o?Co:To)(t,i.pos,i.inside,e)?e.preventDefault():vo(t,"pointer"))};var Eo=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[So],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null;var u=t.state.selection;(o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof Xe&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&gn.gecko&&!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((function(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),vo(t,"pointer")};function No(t,e){return!!t.composing||!!(gn.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Eo.prototype.done=function(){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.view.mouseDown=null},Eo.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(bo(t))),this.allowDefault||!e?vo(this.view,"pointer"):xo(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||gn.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||gn.chrome&&!(this.view.state.selection instanceof Ke)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2?(ko(this.view,We.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):vo(this.view,"pointer")}},Eo.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),vo(this.view,"pointer"),0==t.buttons&&this.done()},ho.touchdown=function(t){Mo(t),vo(t,"pointer")},ho.contextmenu=function(t){return Mo(t)};var Oo=gn.android?5e3:-1;function Do(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Lo(t)}),e))}function Ao(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Lo(t,e){if(t.domObserver.forceFlush(),Ao(t),e||t.docView.dirty){var n=Mr(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}mo.compositionstart=mo.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Lo(t,!0),t.markCursor=null;else if(Lo(t),gn.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Do(t,Oo)},mo.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Do(t,20))};var Io=gn.ie&&gn.ie_version<15||gn.ios&&gn.webkit_version<604;function Ro(t,e,n,r){var o=to(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||y.empty)})))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}ho.copy=mo.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Io?null:e.clipboardData,i=Yr(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},mo.paste=function(t,e){var n=Io?null:e.clipboardData;n&&Ro(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ro(t,r.value,null,e):Ro(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Po=function(t,e){this.slice=t,this.move=e},Bo=gn.mac?"altKey":"ctrlKey";for(var Fo in ho.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(bo(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof Xe?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(Xe.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(Xe.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=Yr(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Io?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",Io||e.dataTransfer.setData("text/plain",l),t.dragging=new Po(s,!e[Bo])}},ho.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},mo.dragover=mo.dragenter=function(t,e){return e.preventDefault()},mo.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(bo(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=to(t,e.dataTransfer.getData(Io?"Text":"text/plain"),Io?null:e.dataTransfer.getData("text/html"),!1,o);var s=n&&!e[Bo];if(t.someProp("handleDrop",(function(n){return n(t,e,i||y.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?function(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var l=c.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=c.doc;if(u?c.replaceRangeWith(l,l,i.content.firstChild):c.replaceRange(l,l,i),!c.doc.eq(p)){var d=c.doc.resolve(l);if(u&&Xe.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Xe(d));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Rr(t,d,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},ho.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Er(t)}),20))},ho.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},ho.beforeinput=function(t,e){if(gn.chrome&&gn.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,In(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},mo)ho[Fo]=mo[Fo];function Ho(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var zo=function(t,e){this.spec=e||Uo,this.side=this.spec.side||0,this.toDOM=t};zo.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new qo(i-n,i-n,this)},zo.prototype.valid=function(){return!0},zo.prototype.eq=function(t){return this==t||t instanceof zo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ho(this.spec,t.spec))};var jo=function(t,e){this.spec=e||Uo,this.attrs=t};jo.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new qo(o,i,this)},jo.prototype.valid=function(t,e){return e.from=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;at){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Wo.prototype.map=function(t,e,n){return this==Jo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Uo)},Wo.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;sc+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(l=r-n-(e-t))&&(a[s]+=l,a[s+1]+=l))}},l=0;l=r.content.size){u=!0;continue}var h=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=a[p+2].mapInner(n,y,d+1,t[p]+i+1,s);b!=Jo?(a[p]=f,a[p+1]=h,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var w=Qo(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;is&&l.to=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;ai&&c.type instanceof jo){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;ln&&s.to0;)e++;t.splice(e,0,n)}function ni(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Jo&&e.push(r)})),t.cursorWrapper&&e.push(Wo.create(t.state.doc,[t.cursorWrapper.deco])),Go.from(e)}Go.prototype.forChild=function(t,e){if(e.isLeaf)return Wo.empty;for(var n=[],r=0;rr.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,c,a);!u&&t.selection.eq(r.selection)||(i=!0);var p,d,f,h,m,v,g,y,b,w,k,x="preserve"==l&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Hn(t.dom)}}(this);if(i){this.domObserver.stop();var C=u&&(gn.ie||gn.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(h=r.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(u){var T=gn.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=lr(t.doc,c,a,this.dom,this)),T&&!this.trackWrites&&(C=!0)}C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(p=this,d=p.docView.domFromPos(p.state.selection.anchor,0),f=p.root.getSelection(),En(d.node,d.offset,f.anchorNode,f.anchorOffset)))?Er(this,C):(Lr(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==l)this.dom.scrollTop=0;else if("to selection"==l){var M=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof Xe?Fn(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),M):Fn(this,this.coordsAtPos(t.selection.head,1),M))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,zn(w,0==k?0:k-b))},ri.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},ri.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},pi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),di="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),fi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),hi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),mi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),vi=pi&&(hi||+pi[1]<57)||fi&&hi,gi=0;gi<10;gi++)li[48+gi]=li[96+gi]=String(gi);for(gi=1;gi<=24;gi++)li[gi+111]="F"+gi;for(gi=65;gi<=90;gi++)li[gi]=String.fromCharCode(gi+32),ui[gi]=String.fromCharCode(gi);for(var yi in li)ui.hasOwnProperty(yi)||(ui[yi]=li[yi]);var bi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function wi(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a127)&&(r=li[n.keyCode])&&r!=o){var a=e[ki(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[ki(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}function Ti(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Mi(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Si(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Ei(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){var n=t.node(e);if(t.index(e)+1=0;u--)l=p.from(r[u].create(null,l));l=p.from(i.copy(l));var d=t.tr.step(new Te(e.pos-1,c,e.pos,c,new y(l,1,0),r.length,!0)),f=c+2*r.length;De(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=We.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),v=m&&Ee(m);if(null!=v&&v>=e.depth)return n&&n(t.tr.lift(m,v).scrollIntoView()),!0;if(a&&s.isTextblock&&Mi(i,"end")){for(var g=i,b=[];b.push(g),!g.isTextblock;)g=g.lastChild;if(g.canReplace(g.childCount,g.childCount,s.content)){if(n){for(var w=p.empty,k=b.length-1;k>=0;k--)w=p.from(b[k].copy(w));n(t.tr.step(new Te(e.pos-b.length,e.pos+s.nodeSize,e.pos+1,e.pos+s.nodeSize-1,new y(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Pi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&function(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c0))return!1;var o=Si(r);if(!o){var i=r.blockRange(),s=i&&Ee(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Ri(t,o,e))return!0;if(0==r.parent.content.size&&(Mi(a,"end")||Xe.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Mi(a,"end")?We.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):Xe.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Si(o)}var s=i&&i.nodeBefore;return!(!s||!Xe.isSelectable(s))&&(e&&e(t.tr.setSelection(Xe.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)})),ji=Hi(Ti,Ei,(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset1&&n.after()!=n.end(-1)){var r=n.before();if(Oe(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Ee(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),Li),"Mod-Enter":Ai,Backspace:zi,"Mod-Backspace":zi,Delete:ji,"Mod-Delete":ji,"Mod-a":Ii},qi={"Ctrl-h":_i.Backspace,"Alt-Backspace":_i["Mod-Backspace"],"Ctrl-d":_i.Delete,"Ctrl-Alt-Backspace":_i["Mod-Delete"],"Alt-Delete":_i["Mod-Delete"],"Alt-d":_i["Mod-Delete"]};for(var Vi in _i)qi[Vi]=_i[Vi];var $i=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?qi:_i,Ui=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Wi(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l=e?Gi.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Gi.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Gi.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Gi.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Gi.from=function(t){return t instanceof Gi?t:t&&t.length?new Ki(t):Gi.empty};var Ki=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Ji)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Ji)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Gi);Gi.empty=new Ki([]);var Zi=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return to&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Gi),Xi=Gi,Qi=function(t,e){this.items=t,this.eventCount=e};Qi.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new Yi(t.map));var p,d=t.step.map(r.slice(o));d&&c.maybeStep(d).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new Yi(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Qi(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Qi.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;ces&&(f=m,(d=s).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),s=d.slice(h),i-=m),new Qi(s.append(o),i)},Qi.prototype.remapping=function(t,e){var n=new me;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Qi.prototype.addMaps=function(t){return 0==this.eventCount?this:new Qi(this.items.append(t.map((function(t){return new Yi(t)}))),this.eventCount)},Qi.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new Yi(c,l,u))}else n.push(new Yi(c))}}),r);for(var c=[],l=e;l500&&(p=p.compress(this.items.length-n.length)),p},Qi.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Qi.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new Yi(c.invert(),a,l),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new Qi(Xi.from(r.reverse()),o)},Qi.empty=new Qi(Xi.empty,0);var Yi=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Yi.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Yi(e.getMap().invert(),e,this.selection)}};var ts=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},es=20;function ns(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function rs(t,e){if(!t)return null;for(var n=[],r=0;r=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?rs(t.prevRanges,n.mapping):ns(n.mapping.maps[n.steps.length-1]);return new ts(t.done.addTransform(n,a?e.selection.getBookmark():null,r,cs(e)),Qi.empty,c,n.time)}(n,r,e,t)}},config:t})}function ds(t,e){var n=ls.getState(t);return!(!n||0==n.done.eventCount)&&(e&&is(n,t,e,!1),!0)}function fs(t,e){var n=ls.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&is(n,t,e,!0),!0)}function hs(t,e){var n=t.nodes.paragraph;return e?n.create(null,Pt()(e)?t.text(e):e):n.createAndFill()}function ms(t,e,n){return t.text(e,n)}function vs(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return Ke.create(t.doc,Math.min(e,o),Math.min(n,o))}function gs(t,e,n){var r=e.pos;return t.replaceWith(r,r,hs(n)),t.setSelection(vs(t,r+1))}function ys(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,s=e.tr,a=e.doc,c=e.schema,l=r;l<=o;l+=1){var u=a.child(l),d=u.nodeSize,f=u.textContent,h=u.content,m=i(f),v=m?ms(c,m):p.empty,g=s.mapping.map(n),y=g+h.size;s.replaceWith(g,y,v),n+=d}return s}function bs(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(vs(t,t.mapping.map(e)-o))}function ws(t){return t.sourcepos[0][0]}function ks(t){return t.sourcepos[1][0]}function xs(t){return t.sourcepos[0][1]}function Cs(t){return t.sourcepos[1][1]}function Ts(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Ms(t){return t&&("item"===t.type||"list"===t.type)}function Ss(t){return Ms(t)&&"ordered"===t.listData.type}function Es(t){return Ms(t)&&"ordered"!==t.listData.type}function Ns(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function Os(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function Ds(t,e){return[t[0],t[1]+e]}function As(t,e){return[t[0],e]}function Ls(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function Is(t){switch(t.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 Rs(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var Ps=[],Bs={},Fs=/\$\$widget\d+\s/;function Hs(t){var e=t.search(Fs);if(-1!==e){var n=t.substring(e).replace(Fs,"").replace("$$","");t=t.substring(0,e),t+=Hs(n)}return t}function zs(t,e){return"$$"+t+" "+e+"$$"}function js(t,e){var n=Bs[t],r=n.rule;return(0,n.toDOM)(e=Hs(e).match(r)[0])}function _s(){return Ps}function qs(t){(Ps=t).forEach((function(t,e){Bs["widget"+e]=t}))}function Vs(t,e,n,r){return t.concat($s(e,n,r))}function $s(t,e,n){void 0===n&&(n=0);var r=[],o=(Ps[n]||{}).rule,i=n+1;if(t=Hs(t),o&&o.test(t)){for(var s=void 0;-1!==(s=t.search(o));){var a=t.substring(0,s);a&&(r=Vs(r,a,e,i));var c=(t=t.substring(s)).match(o)[0],l="widget"+n;r.push(e.nodes.widget.create({info:l},e.text(zs(l,c)))),t=t.substring(c.length)}t&&(r=Vs(r,t,e,i))}else t&&(r=np){var d=re(c),f=$s(d,i);return s.replaceWith(o-d.length+1,o,f)}return null}))}));return t.length?function(t){var e=t.rules,n=new fn({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Wi(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&Wi(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:t}):null},t.prototype.createSchema=function(){return new ct({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){return t?this.specs.keymaps():[]},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map((function(e){return e(t.eventEmitter)}))},t.prototype.focus=function(){var t=this;setTimeout((function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())}))},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.view.destroy(),Object.keys(this).forEach((function(e){delete t[e]}))},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(vs(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(vs(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),ca=n(294),la=n.n(ca);function ua(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var pa=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter((function(t){return"node"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter((function(t){return"mark"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter((function(t){return t.commands})).reduce((function(e,n){var r={},i=n.commands();return la()(i)?r[n.name]=function(e){return ua(t,i,e)}:Object.keys(i).forEach((function(e){r[e]=function(n){return ua(t,i[e],n)}})),o(o({},e),r)}),{}),r=Ws();return Object.keys(r).forEach((function(e){n[e]=function(n){return ua(t,r[e],n)}})),e&&Object.keys(e).forEach((function(r){n[r]=function(n){return ua(t,e[r],n)}})),n},t.prototype.keymaps=function(){return this.specs.filter((function(t){return t.keymaps})).map((function(t){return t.keymaps()})).map((function(t){return xi(t)}))},t.prototype.setContext=function(t){this.specs.forEach((function(e){e.setContext(t)}))},t}(),da=n(322),fa=n.n(da),ha=n(714),ma=n.n(ha),va=n(471),ga=n.n(va),ya="[A-Za-z][A-Za-z0-9-]*",ba="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",wa="<("+ya+")("+ba+")*\\s*/?>",ka="(?:"+wa+"|([A-Za-z][A-Za-z0-9-]*)\\s*[>])",xa=new RegExp("^"+ka,"i"),Ca=/ /i,Ta="
";function Ma(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),s=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+s}var Sa="toastui-editor-";function Ea(){for(var t=[],e=0;e ?/,gc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("block-quote")},0]}}},enumerable:!1,configurable:!0}),n.prototype.createBlockQuoteText=function(t,e){return e?t.replace(vc,"").trim():"> "+t.trim()},n.prototype.extendBlockQuote=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,s=e.schema,a=Va(r),c=a.endFromOffset,l=a.endToOffset,u=a.endIndex,p=a.to,d=mc(o,u);if(vc.test(d)&&p>c&&r.empty){if(!d.replace(vc,"").trim())i.deleteRange(c,l).split(i.mapping.map(l));else{var f=d.slice(p-c).trim();bs(i,l,f,ms(s,t.createBlockQuoteText(f)))}return n(i),!0}return!1}},n.prototype.commands=function(){var t=this;return function(){return function(e,n){var r=e.selection,o=e.doc,i=Va(r),s=i.startFromOffset,a=i.endToOffset,c=i.startIndex,l=i.endIndex,u=vc.test(mc(o,c)),p=ys({state:e,startIndex:c,endIndex:l,from:s,createText:function(e){return t.createBlockQuoteText(e,u)}});return n(p.setSelection(vs(p,p.mapping.map(a)))),!0}}},n.prototype.keymaps=function(){var t=this.commands()();return{"alt-q":t,"alt-Q":t,Enter:this.extendBlockQuote()}},n}(fc),yc=/(^\s*)([-*+] |[\d]+\. )/,bc=/(^\s*)([\d])+\.( \[[ xX]])? /,wc=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,kc=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,xc=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,Cc=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Tc=/(^\s*)([-*+])( \[[ xX]]) /;function Mc(t){return bc.test(t)?"ordered":"bullet"}function Sc(t){for(var e=0;t&&"document"!==t.type;)"list"===t.type&&(e+=1),t=t.parent;return e}function Ec(t,e,n,r){for(var o=t.getLineTexts().length,i=[],s=e;r?s1;){s=r?s+1:s-1;var a=t.findFirstNodeAtLine(s),c=Sc(a);if(c===n)i.push({line:s,depth:n,mdNode:a});else if(c0;l-=1){var u=e.findFirstNodeAtLine(l),p=hc(n,l)&&!!Os(u,(function(t){return Ms(t)})),d=wc.exec(hc(n,l));if(!d&&!p)break;if(d||!p){var f=d,h=f[1],m=f[3];if(!h){s=Number(m),a=l;break}}else c+=1}return{changedResults:[{text:s+r-a-c+". "+i,line:r}]}},task:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* [ ] "+hc(e,n),line:n}]}}},Lc={bullet:function(t){var e=t.line,n=hc(t.doc,e),r=xc.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(t){var e=t.toastMark,n=t.line,r=t.mdNode,i=t.doc,s=Sc(r),a=hc(i,n),c=wc.exec(a),l=c[1],u=c[3],p=c[4],d=Number(u)+1,f=""+l+d+p,h=Ec(e,n,s,!0).filter((function(t){var e=wc.exec(hc(i,t.line));return e&&e[1].length===l.length&&!!Os(t.mdNode,(function(t){return Ss(t)}))}));return o({listSyntax:f},Nc(i,h,"ordered",d))}};function Ic(t,e,n,r,o){for(var i=[],s=hc(t,n),a=wc.exec(s);a;){var c=a[1],l=a[4],u=a[5],p=c.length;if(p===o)i.push(ms(e,""+c+r+l+u)),r+=1,n+=1;else if(p>o){var d=Ic(t,e,n,1,p);n=d.line,i=i.concat(d.nodes)}if(pt.childCount)break;s=hc(t,n),a=wc.exec(s)}return{nodes:i,line:n}}var Rc=/(^\s{1,4})(.*)/;function Pc(t,e,n){return t0){var u=r.child(l-1),p=u.nodeSize,d=u.textContent;return n.delete(a-p,a).split(n.mapping.map(c)).insert(n.mapping.map(c),ms(i,d)),e(n),!0}return!1}},n.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},n.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()}},n}(ra),zc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),n}(ra),jc=/^#{1,6}\s/,_c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(t){var e=t.attrs,n="heading|heading"+e.level;return e.seText&&(n+="|delimiter|setext"),["span",{class:Na.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.createHeadingText=function(t,e,n){for(var r=e.replace(n,"").trim(),o="";t>0;)o+="#",t-=1;return o+" "+r},n.prototype.commands=function(){var t=this;return function(e){return function(n,r){var o=e.level,i=Va(n.selection),s=i.startFromOffset,a=i.endToOffset,c=ys({state:n,from:s,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(e){var n=e.match(jc),r=n?n[0]:"";return t.createHeadingText(o,e,r)}});return r(c.setSelection(vs(c,c.mapping.map(a)))),!0}}},n}(fc),qc="```",Vc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("code-block")},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=Va(n),s=i.startFromOffset,a=i.endToOffset,c=ms(r,qc);return o.insert(s,c).split(s+qc.length),o.split(o.mapping.map(a)).insert(o.mapping.map(a),c),e(o.setSelection(vs(o,o.mapping.map(a)-(qc.length+2)))),!0}}},n.prototype.keepIndentation=function(){var t=this;return function(e,n){var r=e.selection,o=e.tr,i=e.doc,s=e.schema,a=t.context.toastMark,c=Va(r),l=c.startFromOffset,u=c.endToOffset,p=c.endIndex,d=c.from,f=c.to,h=mc(i,p);if(d===f&&h.trim()){var m=h.match(/^\s+/);if(function(t){return t&&"codeBlock"===t.type}(a.findFirstNodeAtLine(p+1))&&m){var v=m[0],g=h.slice(f-l);return bs(o,u,g,ms(s,v+g)),n(o),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,Enter:this.keepIndentation()}},n}(fc),$c=/\||\s/g;function Uc(t,e){for(var n="|",r=0;r/g,encoded:"%3E",escaped:"\\>"},{regExp:/ /g,encoded:"%20",escaped:" "}];function sl(t){return il.reduce((function(t,e){var n=e.regExp,r=e.escaped;return t.replace(n,r)}),t)}function al(t){return il.reduce((function(t,e){var n=e.regExp,r=e.encoded;return t.replace(n,r)}),t)}var cl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(t){var e=t.attrs,n="link";return e.url&&(n+="|link-url|marked-text"),e.desc&&(n+="|link-desc|marked-text"),["span",{class:Na.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.addLinkOrImage=function(t){return function(e){return function(n,r){var o=n.selection,i=n.tr,s=n.schema,a=Fa(o),c=a[0],l=a[1],u=e,p=u.linkText,d=u.altText,f=u.linkUrl,h=u.imageUrl,m=p,v=f,g="";return"image"===t&&(m=d,v=h,g="!"),g+="["+(m=sl(m))+"]("+(v=al(v))+")",r(i.replaceWith(c,l,ms(s,g))),!0}}},n.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},n}(fc),ll=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),n}(fc),ul=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("delimiter")},0]}}},enumerable:!1,configurable:!0}),n}(fc),pl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("meta")},0]}}},enumerable:!1,configurable:!0}),n}(fc),dl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("marked-text")},0]}}},enumerable:!1,configurable:!0}),n}(fc),fl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("table-cell")},0]}}},enumerable:!1,configurable:!0}),n}(fc),hl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("html")},0]}}},enumerable:!1,configurable:!0}),n}(fc),ml=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Na("custom-block")},0]}}},enumerable:!1,configurable:!0}),n}(fc),vl=/x|backspace/i,gl=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;var yl="cut",bl=/\r\n|\n|\r/,wl=function(t){function n(e,n){var r=t.call(this,e)||this,i=n.toastMark,s=n.useCommandShortcut,a=void 0===s||s,c=n.mdPlugins,l=void 0===c?[]:c;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=i,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(a),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(o(o({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",(function(){return r.toggleActive(!0)})),r.eventEmitter.listen("changePreviewTabPreview",(function(){return r.toggleActive(!1)})),r.initEvent(),r}return e(n,t),n.prototype.toggleActive=function(t){Aa(this.el,"active",t),t?this.focus():this.blur()},n.prototype.createClipboard=function(){var t=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Ea("pseudo-clipboard"),this.clipboard.addEventListener("paste",(function(e){var n=e.clipboardData||window.clipboardData,r=n&&n.items;if(r){var o=ea(r);o&&(e.preventDefault(),ta(t.eventEmitter,o,e.type))}})),this.clipboard.addEventListener("input",(function(e){var n=e.target.value;t.replaceSelection(n),e.preventDefault(),e.target.value=""})),this.el.insertBefore(this.clipboard,this.view.dom)},n.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},n.prototype.createSpecs=function(){return new pa([new dc,new Hc,new sa,new zc,new _c,new gc,new Vc,new ml,new Wc,new fl,new Jc,new Kc,new Qc,new tl,new nl,new ol,new cl,new ul,new ll,new dl,new pl,new hl])},n.prototype.createPlugins=function(){return this.defaultPlugins.concat(i([ac(this.context),pc(this.context),(t=this.context,e=t.schema,n=t.toastMark,new fn({props:{handleDOMEvents:{keyup:function(t,r){var o,i=t.state,s=i.doc,a=i.tr,c=i.selection;if(c.empty&&vl.test(r.key)){var l=Va(c),u=l.startIndex,p=l.startFromOffset,d=[u+1,l.from-p+1],f=Os(n.findNodeAtPosition(d),(function(t){var e;return"paragraph"===t.type&&"item"===(null===(e=t.parent)||void 0===e?void 0:e.type)}));if(null===(o=null==f?void 0:f.firstChild)||void 0===o?void 0:o.literal){var h=f.firstChild,m=h.literal.match(gl);if(m){var v=h.sourcepos[0],g=m[1],y=m[2],b=m[3],w=g.length+b.length,k=$a(s,v[0]-1).startOffset,x=v[1]+k;if(y){var C=w?w+1:0;a.replaceWith(x,C+x,e.text(y)),t.dispatch(a)}else w||(a.insertText(" ",x),t.dispatch(a))}}}return!1}}}}))],this.createPluginProps()));var t,e,n},n.prototype.createView=function(){var t=this;return new ri(this.el,{state:this.createState(),dispatchTransaction:function(e){t.updateMarkdown(e);var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e)},handleKeyDown:function(e,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&t.clipboard.focus(),t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{copy:function(e,n){return t.captureCopy(n)},cut:function(e,n){return t.captureCopy(n,yl)},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1}},nodeViews:{widget:oa}})},n.prototype.createCommands=function(){return this.specs.commands(this.view)},n.prototype.captureCopy=function(t,e){t.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return t.clipboardData?t.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),e===yl&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",yl)),!0},n.prototype.updateMarkdown=function(t){var e=this;t.docChanged&&t.steps.forEach((function(n,r){if(n.slice&&!(n instanceof Te)){var o=t.docs[r],i=[n.from,n.to],s=ja(o,i[0],i[1]),a=s[0],c=s[1],l=e.getChanged(n.slice);a[0]===c[0]&&a[1]===c[1]&&""===l&&(l="\n");var u=e.toastMark.editMarkdown(a,c,l);e.eventEmitter.emit("updatePreview",u),t.setMeta("editResult",u).scrollIntoView()}}))},n.prototype.getChanged=function(t){var e="",n=t.content.size;return t.content.nodesBetween(0,n,(function(t,r){t.isText?e+=t.text.slice(Math.max(0,r)-r,n-r):t.isBlock&&r>0&&(e+="\n")})),e},n.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=qa(n.doc,t,e),o=r[0],i=r[1];this.view.dispatch(n.setSelection(vs(n,o,i)).scrollIntoView())},n.prototype.replaceSelection=function(t,e,n){var r,o=this.view.state,i=o.tr,s=o.schema,a=o.doc,c=t.split(bl).map((function(t){return hs(s,$s(t,s))})),l=new y(p.from(c),1,1);if(this.focus(),e&&n){var u=qa(a,e,n),d=u[0],f=u[1];r=i.replaceRange(d,f,l)}else r=i.replaceSelection(l);this.view.dispatch(r.scrollIntoView())},n.prototype.deleteSelection=function(t,e){var n,r=this.view.state,o=r.tr,i=r.doc;if(t&&e){var s=qa(i,t,e),a=s[0],c=s[1];n=o.deleteRange(a,c)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},n.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;if(t&&e){var a=qa(r,t,e);i=a[0],s=a[1]}return r.textBetween(i,s,"\n")},n.prototype.getSelection=function(){var t=this.view.state.selection,e=t.from,n=t.to;return ja(this.view.state.tr.doc,e,n)},n.prototype.setMarkdown=function(t,e){void 0===e&&(e=!0);var n=t.split(bl),r=this.view.state,o=r.tr,i=r.doc,s=r.schema,a=n.map((function(t){return hs(s,$s(t,s))}));this.view.dispatch(o.replaceWith(0,i.content.size,a)),e&&this.moveCursorToEnd(!0)},n.prototype.addWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.doc,s=r.selection,a=n?qa(i,n,n)[0]:s.to;this.view.dispatch(o.setMeta("widget",{pos:a,node:t,style:e}))},n.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.schema,s=qa(r.doc,t,e),a=$s(n,i);this.view.dispatch(o.replaceWith(s[0],s[1],a))},n.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t||ja(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}},n.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map((function(t){return Hs(t)})).join("\n")},n.prototype.getToastMark=function(){return this.toastMark},n}(aa),kl=n(349),xl=n.n(kl),Cl=n(348),Tl=n.n(Cl),Ml=function(t,e){return(Ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Sl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Ml(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var El=function(){return(El=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1=56320&&s<=57343){c+=encodeURIComponent(t[r]+t[r+1]),r++;continue}c+="%EF%BF%BD"}else c+=encodeURIComponent(t[r]);return c}Al.defaultChars=";/?:@&=+$,-_.!~*'()#",Al.componentChars="-_.!~*'()";var Ll=Al,Il={},Rl={},Pl={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:""},Bl={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:"ÿ"},Fl={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},Hl={},zl=Ol&&Ol.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hl,"__esModule",{value:!0});var jl=zl({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}),_l=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t)};Hl.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in jl.default&&(t=jl.default[t]),_l(t))};var ql=Ol&&Ol.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.decodeHTML=Rl.decodeHTMLStrict=Rl.decodeXML=void 0;var Vl=ql(Pl),$l=ql(Bl),Ul=ql(Fl),Wl=ql(Hl),Jl=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function Gl(t){var e=Zl(t);return function(t){return String(t).replace(Jl,e)}}Rl.decodeXML=Gl(Ul.default),Rl.decodeHTMLStrict=Gl(Vl.default);var Kl=function(t,e){return t1?cu(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var uu=new RegExp(tu.source+"|"+au.source,"g");function pu(t){return function(e){return e.replace(uu,(function(e){return t[e]||lu(e)}))}}Xl.escape=function(t){return t.replace(uu,lu)},Xl.escapeUTF8=function(t){return t.replace(tu,lu)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=Rl,n=Xl;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=Xl;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=Rl;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(Il);var du="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",fu=/[\\&]/,hu="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",mu=new RegExp("\\\\"+hu+"|"+du,"gi"),vu=new RegExp('[&<>"]',"g"),gu=function(t){return 92===t.charCodeAt(0)?t.charAt(1):Il.decodeHTML(t)};function yu(t){return fu.test(t)?t.replace(mu,gu):t}function bu(t){try{return Ll(t)}catch(e){return t}}function wu(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function ku(t){return vu.test(t)?t.replace(vu,wu):t}function xu(t,e){for(var n=[],r=0;r`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Xu=""+Ku+"\\s*[>]",Qu=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|[A-Za-z][A-Za-z0-9-]*\\s*[>]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i");if(String.fromCodePoint)Gu=function(t){try{return String.fromCodePoint(t)}catch(t){if(t instanceof RangeError)return String.fromCharCode(65533);throw t}};else{var Yu=String.fromCharCode,tp=Math.floor;Gu=function(){for(var t=[],e=0;e1114111||tp(l)!==l)return String.fromCharCode(65533);l<=65535?i.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,i.push(n,r)),(s+1===a||i.length>o)&&(c+=Yu.apply(void 0,i),i.length=0)}return c}}var ep=Gu;function np(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r?@\[\]\\^_`{|}~\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]/),mp=new RegExp('^(?:"('+fp+'|[^"\\x00])*"|\'('+fp+"|[^'\\x00])*'|\\(("+fp+"|[^()\\x00])*\\))"),vp=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,gp=new RegExp("^"+hu),yp=new RegExp("^"+du,"i"),bp=/`+/,wp=/^`+/,kp=/\.\.\./g,xp=/--+/g,Cp=/^<([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])?)*)>/,Tp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Mp=/^ *(?:\n *)?/,Sp=/^[ \t\n\x0b\x0c\x0d]/,Ep=/^\s/,Np=/ *$/,Op=/^ */,Dp=/^ *(?:\n|$)/,Ap=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,Lp=/^[^\n`\[\]\\!<&*_'"~$]+/m,Ip=function(){function t(t){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=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos1){var c=ip(a);this.lineIdx+=a.length-1,this.linePosOffset=-(this.pos-c.length-n.length),s[1]=this.sourcepos(this.pos),i=a.join(" ")}var l=qu("code",s);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?l.literal=i.slice(1,i.length-1):l.literal=i,l.tickCount=n.length,t.appendChild(l),!0}return this.pos=o,t.appendChild(Ju(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=qu("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):gp.test(n.charAt(this.pos))?(t.appendChild(Ju(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(Ju("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Cp))?(n=e.slice(1,e.length-1),(r=qu("link",this.sourcepos(o,this.pos))).destination=bu("mailto:"+n),r.title="",r.appendChild(Ju(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Tp))&&(n=e.slice(1,e.length-1),(r=qu("link",this.sourcepos(o,this.pos))).destination=bu(n),r.title="",r.appendChild(Ju(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(Qu);if(null===n)return!1;var r=qu("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===up||t===pp)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(t===lp||t===dp))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":ep(i);var s,a,c=Ep.test(r),l=hp.test(r),u=Ep.test(o),p=hp.test(o),d=!c&&(!l||u||p),f=!u&&(!p||c||l);return 95===t?(s=d&&(!f||p),a=f&&(!d||l)):t===up||t===pp?(s=d&&!f,a=f):t===dp?(s=!c,a=!u):(s=d,a=f),this.pos=n,{numdelims:e,canOpen:s,canClose:a}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=Ju(t===up?"’":t===pp?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==up&&t!==pp)&&(this.delimiters={cc:t,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},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,s,a,c=!1,l=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,a=!1;null!==n&&n!==t&&n!==l[u][p?r.origdelims%3:0];){if(c=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!c){a=!0;break}n=n.previous}if(o=r,p||u===lp||u===dp)if(a){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,s=r.node;var h=p?1===d?"emph":"strong":"strike";u===dp&&(h="customInline");var m=qu(h),v=i.sourcepos[1],g=s.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,s.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),s.literal=s.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==s;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===dp){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length===x.length+1?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&s.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===up?(r.node.literal="’",a&&(n.node.literal="‘"),r=r.next):u===pp&&(r.node.literal="”",a&&(n.node.literal="“"),r=r.next);a||(l[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(mp);return null===t?null:yu(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(vp);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&gp.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!==Sp.exec(ep(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:bu(yu(t=this.subject.substr(e,this.pos-e)))}return bu(yu(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(Ap);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=Ju("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=Ju("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else{n=Ju("!",this.sourcepos(this.pos,this.pos));t.appendChild(n)}return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(Ju("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(Ju("]",this.sourcepos(o,o))),this.removeBracket(),!0;var s=i.image,a=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(Sp.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 c="";if(!r){var l=this.pos,u=this.parseLinkLabel();if(u>2?c=this.subject.slice(l,l+u):i.bracketAfter||(c=this.subject.slice(i.index,o)),0===u&&(this.pos=a),c){c=sp(c);var p=this.refMap[c];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=qu(s?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),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[t.id]={node:t,refLabel:c}),!0}return this.removeBracket(),this.pos=o,t.appendChild(Ju("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:c}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(yp))&&(t.appendChild(Ju(Il.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(Lp)){if(this.options.smart){var r=e.replace(kp,"…").replace(xp,(function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),xu("—",n)+xu("–",e)}));t.appendChild(Ju(r,this.sourcepos(n,this.pos)))}else{var o=Ju(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(Np,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild(qu(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild(qu("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(Op),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.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 c=!0;if(null===this.match(Dp)&&(""===n?c=!1:(n="",this.pos=a,c=null!==this.match(Dp))),!c)return this.pos=r,0;var l=sp(i);if(""===l)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=qu("refDef",u);return p.title=n,p.dest=s,p.label=l,t.insertBefore(p),e[l]?this.refDefCandidateMap[p.id]=p:e[l]=kd(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.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;as&&p.push(Ju(o.substring(s,m[0]),u(s,m[0]-1)));var y=qu("link",u.apply(void 0,m));y.appendChild(Ju(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),s=m[1]+1}s=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(Rp);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},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:{continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(Bp);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&jp(Hp(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),s=r.slice(o+1),a=i.match(/^(\s*)(.*)/);e.infoPadding=a[1].length,e.info=yu(a[2].trim()),e.literal=s}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===Hp(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&zp(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:qp,customBlock:{continue:function(t,e){var n=t.currentLine,r=n.match(_p);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&jp(Hp(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),s=o.match(/^(\s*)(.*)/);e.info=yu(s[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},frontMatter:qp};function $p(t){for(var e=0,n=0,r=[],o=0;o|$)/i,/^/,/\?>/,/>/,/\]\]>/],cd=/^[#`~*+_=<>0-9-;$]/,ld=/\r\n|\n|\r/;function ud(){return qu("document",[[1,1],[0,0]])}var pd={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},dd=function(){function t(t){this.options=El(El({},pd),t),this.doc=ud(),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&&(Vp.frontMatter=sd,rd.unshift(id)),this.inlineParser=new Ip(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=xu(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!Vp[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=qu(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],Vp[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.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)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),Vp[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&Vp[e.type].acceptsLines,i=rd.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!cd.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var s=0;s=1&&e.htmlBlockType<=5&&ad[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offsete[0]?-1:t[1]e[1]?-1:0}function hd(t,e){var n=t[0];return 1===fd(t[1],e)?1:-1===fd(n,e)?-1:0}function md(t,e){for(var n=0,r=e;ne?-1:0}function gd(t,e){for(var n=t.firstChild;n;){var r=vd(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function yd(t){return function(t){return Eu[t]}(t)||null}function bd(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var wd=/\r\n|\n|\r/;function kd(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var xd=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new dd(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(wd),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,o=t[0],i=t[1],s=e[0],a=e[1],c=n.split(wd),l=c.length,u=this.lineTexts[o-1],p=this.lineTexts[s-1];c[0]=u.slice(0,i-1)+c[0],c[l-1]=c[l-1]+p.slice(a-1);var d=s-o+1;return(r=this.lineTexts).splice.apply(r,Nl([o-1,d],c)),l-d},t.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 t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?(md(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=gd(this.root,t[0]),r=gd(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach((function(t){t(e)}))},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&($u(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return td.test(n)||ed.test(n)}(this.lineTexts[n-1])||function(t){return"table"===t.type}(t.prev)&&(!zp(o=this.lineTexts[n-1])&&-1!==o.indexOf("|")))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),s=this.parser.partialParseStart(n,i),a=e?e.next:this.root.firstChild,c=s.lastChild,l=c&&Vu(c)&&c.open,u=c&&Wu(c)&&c.open,p=c&&$u(c);(l||u)&&a||p&&a&&("list"===a.type||a.sourcepos[0][1]>=2);){var d=this.extendEndLine(a.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=a,r=d,a=a.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(s),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&Uu(t)||e&&Uu(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!cp(this.refMap)){var r=function(t){if(Uu(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&bd(r,t.parent,e),e&&bd(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!cp(this.refMap)){var n=function(t){if(Uu(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=kd(t))}};t.forEach((function(t){bd(n,t)}))}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;cp(this.refDefCandidateMap)||ap(this.refDefCandidateMap,(function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=kd(n))}))},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!cp(this.refMap)){var i=gd(this.root,t-1),s=gd(this.root,e+1);i&&Uu(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),s&&Uu(s)&&s!==n&&s!==r&&(r=s,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],s=o?Math.min(o.sourcepos[0][0],t[0]):t[0],a=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),c=this.parseRange.apply(this,this.getRangeWithRefDef(s,a,o,i,n)),l=c.newNodes,u=c.extStartNode,p=c.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,l),this.replaceWithNewRefDefState(l)):this.replaceRangeNodes(u,p,l),{nodes:l,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return cp(this.refMap)||ap(this.refMap,(function(n,r){r.unlinked&&delete t.refMap[n],ap(t.refLinkCandidateMap,(function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))}))})),e},t.prototype.removeUnlinkedCandidate=function(){cp(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(t){ap(t,(function(e){(function(t){var e=yd(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]}))}))},t.prototype.editMarkdown=function(t,e,n){var r=this.updateLineTexts(t,e,n),o=this.parse(t,e,r),i=function(t){for(var e=[],n=1;n]*>)","ig");function Td(t){return Cd.test(t)?t.replace(Cd,(function(t,e){return"<"+e})):t}var Md={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:" \n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.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(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.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(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?Td(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?Td(t.literal):t.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(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+ku(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:El({href:ku(o)},r&&{title:ku(r)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,r=e.skipChildren,o=t,i=o.title,s=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:El({src:ku(s),alt:n(t)},i&&{title:ku(i)})}},customBlock:function(t,e,n){var r=t.info.trim().toLowerCase(),o=n[r];if(o)try{return o(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+r+" block node was parsed in markdown renderer: "+t)}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.sourcepos,i=r.info,s=i.trim().toLowerCase(),a=n[s],c=e.entering;if(a)try{return a(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+s+" inline node was parsed in markdown renderer: "+t)}var l=o[1][1]-o[0][1]+1===i.length+4?"":i+" ";return c?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+l}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},Sd={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,r=t.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:El(El({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;o0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach((function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')})),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push(""+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==ip(ip(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(ku(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),Dd=n(368),Ad=n.n(Dd),Ld=["iframe","embed"],Id=[];function Rd(t){Kt(Ld,t)&&Id.push(t.toLowerCase())}function Pd(t,e){return Ad().sanitize(t,o({ADD_TAGS:Id,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},e))}function Bd(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]+?>)|("+e+"\\s*[>])","ig"),"").trim()}function Fd(t){var e=(t=t.match(xa)[0]).match(new RegExp(ba,"g"));return e?e.reduce((function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t}),{}):{}}function Hd(t){return Ys()(t.attributes).reduce((function(t,e){return t[e.nodeName]=e.nodeValue,t}),{})}function zd(t,e,n,r){var o=r.getToDOMNode(e)(t),i=n(o.outerHTML),s=document.createElement("div");return s.innerHTML=i,{dom:o=s.firstChild,htmlAttrs:Hd(o)}}var jd={htmlBlock:function(t,e,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:Hd(t),childrenHTML:t.innerHTML}}}],toDOM:function(r){var o=zd(r,t,e,n),s=o.dom,a=o.htmlAttrs;return a.class=a.class?a.class+" html-block":"html-block",i([t,a],Ys()(s.childNodes))}}},htmlInline:function(t,e,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:Hd(t)}}}],toDOM:function(r){var o=zd(r,t,e,n).htmlAttrs;return[t,o,0]}}}};var _d=/^\s*<\s*\//,qd={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/ /.test(t.prev.literal)?"\n":" \n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.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(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.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:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:js(i,Us(t)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function Vd(t,e){var n=o({},qd);return t&&(n.link=function(e,n){var r=n.entering,i=(0,n.origin)();return r&&(i.attributes=o(o({},i.attributes),t)),i}),e&&Object.keys(e).forEach((function(t){var r=n[t],i=e[t];r&&la()(i)?n[t]=function(t,e){var n=o({},e);return n.origin=function(){return r(t,e)},i(t,n)}:Kt(["htmlBlock","htmlInline"],t)&&!la()(i)?n[t]=function(t,e){var n=t.literal.match(xa);if(n){var r=n[0],s=n[1],a=n[3],c=(s||a).toLowerCase(),l=i[c],u=Bd(t,c);if(l){var p=o({},t);return p.attrs=Fd(r),p.childrenHTML=u,p.type=c,e.entering=!_d.test(t.literal),l(p,e)}}return e.origin()}:n[t]=i})),n}var $d=["list","item","blockQuote"],Ud=["UL","OL","BLOCKQUOTE"];function Wd(t,e){var n,r=t.child(e);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function Jd(t,e,n){var r=ws(e)-1,o=ks(e)-1,i=n[r].getBoundingClientRect(),s=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:s<=0?n[r].clientHeight:s+Gd(t,n,Math.min(o+1,t.childCount-1)),rect:i}}function Gd(t,e,n){for(var r=t.childCount-1,o=0;n<=r&&Wd(t,n);)o+=e[n].clientHeight,n+=1;return o}function Kd(t,e){for(var n=0;t&&t!==e&&(Kt(Ud,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function Zd(t,e,n){return t&&e>n+t.offsetTop?Zd(t.nextElementSibling,e,n)||t:null}function Xd(t){for(var e=document.querySelector('[data-nodeid="'+t.id+'"]');!e||Ts(t);)t=t.parent,e=document.querySelector('[data-nodeid="'+t.id+'"]');return function(t){var e=t.mdNode,n=t.el;for(;(Kt($d,e.type)||"table"===e.type)&&e.firstChild;)e=e.firstChild,n=n.firstElementChild;return{mdNode:e,el:n}}({mdNode:t,el:e})}var Qd={};function Yd(t){t&&(delete Qd[Number(t.getAttribute("data-nodeid"))],Ys()(t.children).forEach((function(t){Yd(t)})))}function tf(t,e,n){var r,o=Qd[r=n]&&Qd[r].height,i=function(t){return Qd[t]&&Qd[t].offsetTop}(n),s=o||t.clientHeight,a=i||Kd(t,e)||t.offsetTop;return o||function(t,e){Qd[t]=Qd[t]||{},Qd[t].height=e}(n,s),i||function(t,e){Qd[t]=Qd[t]||{},Qd[t].offsetTop=e}(n,a),{nodeHeight:s,offsetTop:a}}var ef=Ea("md-preview-highlight");var nf=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=Ea("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,s=e.highlight,a=void 0!==s&&s;this.renderer=new Od({gfm:!0,nodeId:!0,convertors:Vd(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(a),this.initContentSection()}return t.prototype.initContentSection=function(){this.previewContent=La('
'),this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){Aa(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),t&&(this.eventEmitter.listen("changeToolbarState",(function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)})),this.eventEmitter.listen("blur",(function(){e.removeHighlight()}))),Tl()(this.el,"scroll",(function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=Zd(o,t,Kd(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))})),this.eventEmitter.listen("changePreviewTabPreview",(function(){return e.toggleActive(!0)})),this.eventEmitter.listen("changePreviewTabWrite",(function(){return e.toggleActive(!1)}))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&It()(t,ef)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=Os(t,(function(t){return!function(t){switch(t.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}}(t)}))).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(xs(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&It()(r,ef),o&&At()(o,ef),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach((function(t){return e.replaceRangeNodes(t)})),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map((function(t){return e.renderer.render(t)})).join("")));if(r){var s=r.id,a=s[0],c=s[1],l=this.getElementByNodeId(a),u=this.getElementByNodeId(c);if(l){l.insertAdjacentHTML("beforebegin",i);for(var p=l;p&&p!==u;){var d=p.nextElementSibling;Da(p),Yd(p),p=d}(null==p?void 0:p.parentNode)&&(Da(p),Yd(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){xl()(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t}();function rf(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r,n))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}function of(t){return!!rf(t,(function(t){var e=t.type;return"listItem"===e.name||"bulletList"===e.name||"orderedList"===e.name}))}function sf(t){return!!rf(t,(function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name}))}function af(t){return rf(t,(function(t){return"listItem"===t.type.name}))}function cf(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}function lf(t){return Object.keys(t).reduce((function(e,n){return"rawHTML"!==n&&t[n]&&(e[n="className"===n?"class":n]=t[n]),e}),{})}function uf(t){return{tag:t,getAttrs:function(t){return["rawHTML","colspan","rowspan","extended"].reduce((function(e,n){var r="rawHTML"===n?"data-raw-html":n,o=t.getAttribute(r);return o&&(e[n]=Kt(["rawHTML","extended"],n)?o:Number(o)),e}),{})}}}function pf(t){var e=t.htmlAttrs,n=t.classNames;return o(o({},e),{class:n?n.join(" "):null})}function df(t,e,n,r){var o=e.$from,i=e.$to,s=e.depth,a=e,c=!1;if(s>=2&&o.node(s-1).type.compatibleContent(n)&&0===e.startIndex&&o.index(s-1)){var l=t.doc.resolve(e.start-2);a=new B(l,l,s),e.endIndex=0;d-=1)u=p.from(n[d].type.create(n[d].attrs,u));t.step(new Te(i-(r?2:0),s,i,s,new y(u,0,0),n.length,!0));var f=0;for(d=0;di;o-=1)r-=n.child(o).nodeSize,t.delete(r-1,r+1);var s=t.doc.resolve(e.start),a=s.nodeAfter,c=0===e.startIndex,l=e.endIndex===n.childCount,u=s.node(-1),d=s.index(-1),f=u.canReplace(d+(c?0:1),d+1,null==a?void 0:a.content.append(l?p.empty:p.from(n)));if(a&&f){var h=s.pos,m=h+a.nodeSize;t.step(new Te(h-(c?1:0),m+(l?1:0),h+1,m-1,new y((c?p.empty:p.from(n.copy(p.empty))).append(l?p.empty:p.from(n.copy(p.empty))),c?0:1,l?0:1),c?0:1))}return t}(r,a)),!0)}}function gf(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!of(o))&&function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s,(function(e){var n=e.childCount,r=e.firstChild;return!!n&&r.type===t}));if(a&&a.startIndex>0){var c=a.parent,l=c.child(a.startIndex-1);if(l.type!==t)return!1;var u=l.lastChild&&l.lastChild.type===c.type,d=u?p.from(t.create()):null,f=new y(p.from(t.create(null,p.from(c.type.create(null,d)))),u?3:1,0),h=a.start,m=a.end;return r.step(new Te(h-(u?3:1),m,h,m,f,1,!0)),n(r),!0}return!1}}(r.nodes.listItem)(t,e)}}}function yf(){return{indent:gf(),outdent:function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!of(o))&&vf(r.nodes.listItem)(t,e)}}}}var bf=new Map,wf=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=rf(e,(function(t){return"table"===t.type.name}));if(n){var r=n.node,o=n.depth,i=n.offset,s=bf.get(r);if((null==s?void 0:s.tableStartPos)===i+1)return s;var a=[],c=e.start(o),l=r.child(0),u=r.child(1),p=kf(l,c),d=kf(u,c+l.nodeSize);l.forEach((function(t){return a.push(t)})),u.forEach((function(t){return a.push(t)}));var f=new t(r,a,c,p.concat(d));return bf.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;it.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),s=i[0],a=i[1],c=this.getCellIndex(e),l=c[0],u=c[1];return s=(r=le(s,l))[0],l=r[1],a=(o=le(a,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:s,startColIdx:a,endRowIdx:l,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),kf=function(t,e){var n=[];return t.forEach((function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach((function(t,n){for(var i=t.nodeSize,s=0;o[s];)s+=1;o[s]={offset:e+r+n+2,nodeSize:i},o.length+=1})),n.push(o)})),n};function xf(t,e){return ce(wf.prototype,t),kf=e,wf}var Cf=function(t){function n(e,n){void 0===n&&(n=e);var r=this,o=e.node(0),i=wf.create(e),s=i.getRectOffsets(e,n),a=function(t,e,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,s=n.endColIdx,a=[],c=r;c<=i;c+=1)for(var l=o;l<=s;l+=1){var u=e.getCellInfo(c,l),p=u.offset,d=u.nodeSize;a.push(new Ge(t.resolve(p+1),t.resolve(p+d-1)))}return a}(o,i,s);return(r=t.call(this,a[0].$from,a[0].$to,a)||this).startCell=e,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return e(n,t),n.prototype.map=function(t,e){var r=this.startCell.pos,o=this.endCell.pos,i=t.resolve(e.map(r)),s=t.resolve(e.map(o)),a=wf.create(i);if(this.offsetMap.totalColumnCount>a.totalColumnCount||this.offsetMap.totalRowCount>a.totalRowCount){var c={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[s.parent.type.name],l=s.end(s.depth-c),u=Math.min(l-4,s.pos);return Ke.create(t,u)}return new n(i,s)},n.prototype.eq=function(t){return t instanceof n&&t.startCell.pos===this.startCell.pos&&t.endCell.pos===this.endCell.pos},n.prototype.content=function(){for(var t=this.startCell.node(-2),e=this.startCell.start(-2),n=t.child(1).firstChild,r=t.child(0).type.create(),o=t.child(1).type.create(),i=wf.create(this.startCell),s=i.getRectOffsets(this.startCell,this.endCell),a=s.startRowIdx,c=s.startColIdx,l=s.endRowIdx,u=s.endColIdx,d=!1,f=a;f<=l;f+=1){for(var h=[],m=c;m<=u;m+=1){var v=i.getCellInfo(f,m).offset,g=t.nodeAt(v-e);g&&(d="tableHeadCell"===g.type.name,i.extendedRowspan(f,m)||i.extendedColspan(f,m)?h.push(g.type.create({extended:!0})):h.push(g.copy(g.content)))}var b=n.copy(p.from(h)),w=d?r:o;w.content=w.content.append(p.from(b))}return new y(function(t,e){var n=[];return t.childCount&&n.push(t),e.childCount&&n.push(e),p.from(n)}(r,o),1,1)},n}(We);function Tf(t,e,n,r){for(var o=n.nodes,i=o.tableRow,s=o.tableBodyCell,a=o.paragraph,c=[],l=0;l0&&o>0||"table"===(null===(e=n.firstChild)||void 0===e?void 0:e.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 Df(t){var e=t.startRowIdx,n=t.startColIdx;return{rowCount:t.endRowIdx-e+1,columnCount:t.endColIdx-n+1}}function Af(t,e){return o(o({},t.attrs),e)}var Lf=new vn("cellSelection"),If=function(){function t(t){this.view=t,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return t.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},t.prototype.handleMousedown=function(t){var e=Sf(t.target,this.view.dom);if(2!==t.button){if(e){var n=this.getCellPos(t);n&&(this.startCellPos=n),this.bindEvent()}}else t.preventDefault()},t.prototype.handleMousemove=function(t){var e,n=Lf.getState(this.view.state),r=this.getCellPos(t),o=this.startCellPos;n?e=this.view.state.doc.resolve(n):o!==r&&(e=o),e&&o&&r&&this.setCellSelection(o,r)},t.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==Lf.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(Lf,-1))},t.prototype.bindEvent=function(){var t=this.view.dom;t.addEventListener("mousemove",this.handlers.mousemove),t.addEventListener("mouseup",this.handlers.mouseup)},t.prototype.unbindEvent=function(){var t=this.view.dom;t.removeEventListener("mousemove",this.handlers.mousemove),t.removeEventListener("mouseup",this.handlers.mouseup)},t.prototype.getCellPos=function(t){var e=t.clientX,n=t.clientY,r=this.view.posAtCoords({left:e,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),s=Ef(i);if(s){var a=i.before(s.depth);return o.resolve(a)}}return null},t.prototype.setCellSelection=function(t,e){var n=this.view.state,r=n.selection,o=n.tr,i=null===Lf.getState(this.view.state),s=new Cf(t,e);if(i||!r.eq(s)){var a=o.setSelection(s);i&&a.setMeta(Lf,e.pos),this.view.dispatch(a)}},t.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},t}(),Rf=Ea("cell-selected");function Pf(t){var e=t.selection,n=t.doc;if(e instanceof Cf){var r=[];return e.ranges.forEach((function(t){var e=t.$from,n=t.$to;r.push(qo.node(e.pos-1,n.pos+1,{class:Rf}))})),Wo.create(n,r)}return null}var Bf=n(928),Ff=n.n(Bf),Hf=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return Ff()(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach((function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)}))},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),zf="en-US",jf=new(function(){function t(){this.code=zf,this.langs=new Hf}return t.prototype.setCode=function(t){this.code=t||zf},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach((function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,Et()(r,e))}else n.langs.set(t,e)}))},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(zf));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}()),_f=[[{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 qf(t,e){return _f.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:jf.get(r),onClick:function(){t.emit("command",o,i)},disabled:e&&!!s,className:a}}))})).concat()}function Vf(t){return new fn({props:{handleDOMEvents:{contextmenu:function(e,n){var r=Sf(n.target,e.dom);if(r){n.preventDefault();var o=n,i=o.clientX,s=o.clientY,a=e.dom.parentNode.getBoundingClientRect(),c=a.left,l=a.top,u="TH"===r.nodeName;return t.emit("contextmenu",{pos:{left:i-c+10+"px",top:s-l+30+"px"},menuGroups:qf(t,u),tableCell:r}),!0}return!1}}}})}var $f=["image","link","customBlock","frontMatter"],Uf=["strong","strike","emph","code"],Wf=["bulletList","orderedList","taskList"];function Jf(t,e,n){var r=t.$from,i=t.$to,s=t.from,a=t.to,c={},l={};return e.nodesBetween(s,a,(function(t,e,o){var s=function(t,e){var n=t.type.name;return"listItem"===n?t.attrs.task?"taskList":e.type.name:-1!==n.indexOf("table")?"table":n}(t,o);Kt($f,s)||(Kt(Wf,s)?function(t,e){e[t]=!0,Wf.filter((function(e){return e!==t})).forEach((function(t){e[t]&&delete e[t]}))}(s,c):"paragraph"===s||"text"===s?l=function(t,e,n){var r={};return Uf.forEach((function(o){var i=n.marks[o],s=t.marksAcross(e)||[];i.isInSet(s)&&(r[o]=!0)})),r}(r,i,n):c[s]=!0)})),o(o({},c),l)}function Gf(t){return new fn({view:function(){return{update:function(e){var n=e.state,r=n.selection,o=n.doc,i=n.schema;t.emit("changeToolbarState",{toolbarState:Jf(r,o,i)})}}}})}var Kf=function(){function t(t,e,n,r){var o=this;this.openEditor=function(){if(o.innerEditorView)throw new Error("The editor is already opened.");o.wrapper.style.display="none",o.innerViewContainer.style.display="block",o.innerEditorView=new ri(o.innerViewContainer,{state:ln.create({doc:o.node,plugins:[xi({"Mod-z":function(){return ds(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return fs(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(t,e){return e(t.tr.insertText("\t")),!0},Enter:Oi,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),ps()]}),dispatchTransaction:function(t){return o.dispatchInner(t)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=t,this.editorView=e,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Ea("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Ea("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return t.prototype.renderToolArea=function(){var t=this,e=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");e.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",(function(){return t.openEditor()})),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e)},t.prototype.renderCustomBlock=function(){var t=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(t){for(var e=t(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);e&&this.wrapper.appendChild(e),this.renderToolArea()}},t.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Ea("custom-block-editor"),this.innerViewContainer.style.display="none"},t.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},t.prototype.saveAndFinishEditing=function(){var t=this.editorView.state.selection.to,e=this.editorView.state;this.editorView.dispatch(e.tr.setSelection(vs(e.tr,t))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},t.prototype.cancelEditing=function(){var t,e,n=(t=this.innerEditorView.state,(e=ls.getState(t))?e.done.eventCount:0);for(this.canceled=!0;n--;)ds(this.innerEditorView.state,this.innerEditorView.dispatch),ds(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var r=this.editorView.state.selection.to,o=this.editorView.state;this.editorView.dispatch(o.tr.setSelection(Ke.create(o.doc,r))),this.editorView.focus(),this.closeEditor()},t.prototype.dispatchInner=function(t){var e=this.innerEditorView.state.applyTransaction(t),n=e.state,r=e.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&la()(this.getPos)){for(var o=this.editorView.state.tr,i=he.offset(this.getPos()+1),s=0;s
":"")+e.innerHTML}var lh="\x3c!--StartFragment--\x3e";function uh(t){return function(t){return th.test(t)}(t=function(t){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(t)&&(t=""+t+" "),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(t)&&(t=""),t}(t=function(t){var e=t.indexOf(lh),n=t.lastIndexOf("\x3c!--EndFragment--\x3e");return e>-1&&n>-1&&(t=t.slice(e+lh.length,n)),t.replace(/ ]*>/g,Ta)}(t)))&&(t=ch(t)),t}function ph(t,e,n){for(var r=[],o=t.childCount,i=0;ie.childCount?t:e})).childCount}(t);if(n&&r)return e.nodes.table.create(null,[vh(t,o,e)]);var i=t[0],s=t.slice(1),a=[mh(i,0,e)];return s.length&&a.push(vh(s,o,e)),e.nodes.table.create(null,a)}(i,e,s,n);r.push(a)}}else r.push(t)})),new y(p.from(r),i,s)}function yh(t){return 4*t}function bh(t,e){var n=t.state,r=n.selection,o=n.schema,i=n.tr,s=Nf(r),a=s.anchor,c=s.head;if(a&&c){var l=Of(e);if(!l)return!1;var u=wf.create(a),p=u.getRectOffsets(a,c),d=function(t,e,n){var r=[],o=hh(t),i=(o[0].childCount,o.length),s=0===e.startRowIdx,a=o.slice(0,i);if(s){var c=a.shift();if(c){var l=dh(c,0,n).content;r.push(l)}}return a.forEach((function(t){if(!t.attrs.dummyRowForPasting){var e=fh(t,0,n).content;r.push(e)}})),r}(l,p,o),f=function(t,e,n){for(var r=e.startRowIdx,o=e.startColIdx,i=n.length,s=0,a=function(t){var e=n[t].childCount;n[t].forEach((function(t){var n=t.attrs.colspan;n>1&&(e+=n-1)})),s=Math.max(s,e)},c=0;c=i&&f<=a-l){var b=n.getCellInfo(f,c-u),w=t.mapping.map(b.offset),k=g+yh(u);o[d]={rowIdx:f,startColIdx:s,endColIdx:c,dummyOffsets:[w,k]},d+=1}}}(i,o,u,f,h),f.addedRowCount&&function(t,e,n,r,o){var i=r.addedRowCount,s=r.addedColumnCount,a=r.startColIdx,c=r.endColIdx,l=t.mapping.maps.length,u=n.tableEndOffset-2,p=Tf(i,n.totalColumnCount+s,e),d=u;t.insert(t.mapping.slice(l).map(d),p);for(var f=0;f=d[0]&&o<=i&&!h){var m=gs(s,f,c);if(m)return r(m),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},n}(ra),Eh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[cf("ul")],toDOM:function(t){return["ul",pf(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.changeList=function(){return function(t,e){return hf(t.schema.nodes.bulletList)(t,e)}},n.prototype.commands=function(){return{bulletList:this.changeList,taskList:mf}},n.prototype.keymaps=function(){var t=this.changeList(),e=yf(),n=e.indent,r=e.outdent;return{"Mod-u":t,"Mod-U":t,Tab:n(),"Shift-Tab":r()}},n}(ra),Nh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(t){var e=t.getAttribute("start"),n=t.getAttribute("data-raw-html");return o({order:t.hasAttribute("start")?Number(e):1},n&&{rawHTML:n})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"ol",o({start:1===e.order?null:e.order},pf(e)),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return hf(t.schema.nodes.orderedList)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()(),e=yf(),n=e.indent,r=e.outdent;return{"Mod-o":t,"Mod-O":t,Tab:n(),"Shift-Tab":r()}},n}(ra),Oh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(n.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(t){var e=t.getAttribute("data-raw-html");return o({task:t.hasAttribute("data-task"),checked:t.hasAttribute("data-task-checked")},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs,n=e.task,r=e.checked;if(!n)return[e.rawHTML||"li",0];var i=["task-list-item"];return r&&i.push("checked"),[e.rawHTML||"li",o({class:i.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),n.prototype.liftToPrevListItem=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,s=n.empty,a=o.nodes.listItem,c=i.parent,l=i.node(-1);if(s&&!c.childCount&&l.type===a){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),e(r),!0;if(i.node(-3).type===a)return r.delete(i.start(-2)-1,i.end(-1)),e(r),!0}return!1}},n.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(t,e){return function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to;if(i.depth<2||!i.sameParent(s))return!1;var a=i.node(-1);if(a.type!==t)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==t||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,l=p.empty,u=i.depth-(c?1:2);u>=i.depth-3;u-=1)l=p.from(i.node(u).copy(l));return l=l.append(p.from(t.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new y(l,c?3:2,2)),r.setSelection(We.near(r.doc.resolve(i.pos+(c?3:2)))),n(r),!0}var d=s.pos===i.end()?a.contentMatchAt(0).defaultType:null,f=d&&[null,{type:d}];return r.delete(i.pos,s.pos),!!Oe(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),n(r),!0)}}(t.schema.nodes.listItem)(t,e)}}},n}(ra),Dh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[cf("blockquote")],toDOM:function(t){return["blockquote",pf(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return Pi(t.schema.nodes.blockQuote)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()();return{"Alt-q":t,"Alt-Q":t}},n}(ra),Ah={left:function(t,e){var n=t[0],r=t[1],o=e.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var s=e.getCellInfo(n,r),a=s.offset,c=s.nodeSize;return a+c-2}return null},right:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount,i=e.totalColumnCount,s=r===i-1;if(n!==o-1||!s){var a=r+1,c=e.getColspanStartInfo(n,r);return(null==c?void 0:c.count)>1&&(a+=c.count-1),(s||a===i)&&(n+=1,a=0),e.getCellInfo(n,a).offset+2}return null},up:function(t,e){var n=t[0],r=t[1];if(n>0){var o=e.getCellInfo(n-1,r),i=o.offset,s=o.nodeSize;return i+s-2}return null},down:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount;if(n1&&(i+=s.count-1),e.getCellInfo(i,r).offset+2}return null}};function Lh(t,e,n,r){var o=e[0],i=e[1],s=o+3,a=i>=s,c=a?o+1:i,l=function(t,e,n,r,o){var i=e[0],s=e[1],a=e[2];if(t===wh.LEFT||t===wh.UP){if(o&&!function(t,e,n){var r=n[0],o=n[1],i=e.resolve(t.before(r-1));return o===r&&!i.nodeBefore}(n,r,[i,s]))return!1;var c=n.before(a);if(r.resolve(c).nodeBefore)return!1}return!0}(t,[i,s,c],n,r,a),u=function(t,e,n,r,o){if(t===wh.RIGHT||t===wh.DOWN){if(o&&!function(t){for(var e,n,r=t.depth;r&&"tableBodyCell"!==(n=t.node(r)).type.name;){if("listItem"===n.type.name){var o=t.node(r-1).lastChild===n,i="paragraph"!==(null===(e=n.lastChild)||void 0===e?void 0:e.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(e);if(r.resolve(i).nodeAfter)return!1}return!0}(t,c,n,r,a);return l&&u}function Ih(t,e,n){var r=n[0],o=n[1],i=e.getRowspanStartInfo(r,o),s=t===wh.UP&&0===r,a=t===wh.DOWN&&((null==i?void 0:i.count)>1?r+i.count-1:r)===e.totalRowCount-1;return s||a}function Rh(t,e,n){var r=t.doc.resolve(e.tableEndOffset);return r.nodeAfter?t.setSelection(We.near(r,1)):gs(t,r,n)}function Ph(t,e,n,r){var o=(0,Ah[t])(n,r);if(o){var i=t===wh.RIGHT||t===wh.DOWN?1:-1;return e.setSelection(We.near(e.doc.resolve(o),i))}return null}function Bh(t,e,n){var r=t.getCellInfo(e,0).offset,o=t.getCellInfo(e,n-1);return{from:r,to:o.offset+o.nodeSize}}!function(t){t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down"}(wh||(wh={}));var Fh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[cf("table")],toDOM:function(t){return["table",pf(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.addTable=function(){return function(t){return void 0===t&&(t={rowCount:2,columnCount:1,data:[]}),function(e,n){var r=t.rowCount,o=t.columnCount,i=t.data,s=e.schema,a=e.selection,c=e.tr,l=a.from,u=a.to,p=a.$from;if(l===u&&!sf(p)){var d=s.nodes,f=d.tableHead,h=d.tableBody,m=null==i?void 0:i.slice(0,o),v=null==i?void 0:i.slice(o,i.length),g=function(t,e,n){for(var r=e.nodes,o=r.tableRow,i=r.tableHeadCell,s=r.paragraph,a=[],c=0;c=p;m-=1){var v=a.getCellInfo(h,m),g=v.offset,y=v.nodeSize,b=r.mapping.slice(f).map(g),w=b+y;r.delete(b,w)}return e(r),!0}return!1}}},n.prototype.addRow=function(t){return function(){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,s=Nf(r),a=s.anchor,c=s.head;if(a&&c){var l=wf.create(a),u=l.totalColumnCount,p=l.getRectOffsets(a,c),d=Df(p).rowCount,f=function(t,e,n){var r,o,i;return t===wh.UP?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=e.totalColumnCount-1,i=e.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(t,l,p),h=f.targetRowIdx,m=f.insertColIdx,v=f.nodeSize;if(!(0===h)){for(var g=[],y=i.mapping.map(l.posAt(h,m))+v,b=[],w=0;w=d;h-=1){var m=Bh(a,h,l),v=m.from,g=m.to;r.delete(v-1,g+1)}return e(r),!0}return!1}}},n.prototype.alignColumn=function(){return function(t){return void 0===t&&(t={align:"center"}),function(e,n){var r=t.align,o=e.selection,i=e.tr,s=Nf(o),a=s.anchor,c=s.head;if(a&&c){for(var l=wf.create(a),u=l.totalRowCount,p=l.getRectOffsets(a,c),d=p.startColIdx,f=p.endColIdx,h=0;h=s&&function(t){return!t.length||Kt(t,u)}(i)&&(c=(a+=e)+r)}))}return{range:[a,c],type:l}},n}(aa),tm=n(404),em=n.n(tm),nm=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","change","caretChange","destroy","focus","blur","keydown","keyup"],rm=function(){function t(){var t=this;this.events=new Hf,this.eventTypes=nm.reduce((function(t,e){return o(o({},t),{type:e})}),{}),this.hold=!1,nm.forEach((function(e){t.addEventType(e)}))}return t.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},t.prototype.emit=function(t){for(var e=[],n=1;n=0&&n.splice(r,1)}},t.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map((function(t){return t.namespace!==e&&n.push(t),null})),this.events.set(t,n))},t.prototype.getEvents=function(){return this.events},t.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},t}(),om=function(){function t(t,e,n,r){this.eventEmitter=t,this.mdCommands=e,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return t.prototype.initEvent=function(){var t=this;this.eventEmitter.listen("command",(function(e,n){t.exec(e,n)}))},t.prototype.addCommand=function(t,e,n){"markdown"===t?this.mdCommands[e]=n:this.wwCommands[e]=n},t.prototype.deleteCommand=function(t,e){"markdown"===t?delete this.mdCommands[e]:delete this.wwCommands[e]},t.prototype.exec=function(t,e){"markdown"===this.getEditorType()?this.mdCommands[t](e):this.wwCommands[t](e)},t}();function im(t){return"\n"===t[t.length-1]?t.slice(0,t.length-1):t}function sm(t,e){var n=t.schema,r=e.literal.match(xa);if(r){var o=r[1],i=r[3],s=(o||i).toLowerCase();return"htmlInline"===e.type&&!(!n.marks[s]&&!n.nodes[s])}return!1}function am(t){return Kt(["text","strong","emph","strike","image","link","code"],t.type)}function cm(t){return"softbreak"===(null==t?void 0:t.type)}function lm(t){var e=t.type,n=t.literal,r="htmlInline"===e&&n.match(xa);if(r){var o=r[1],i=r[3],s=o||i;if(s)return Kt(["ul","ol","li"],s.toLowerCase())}return!1}function um(t){for(var e=[],n=1;n=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()}},t.prototype.convert=function(t,e){for(var n=t.walker(),r=n.next(),o=function(){var t=r.node,o=r.entering,s=i.convertors[t.type],a=!1;if(s){var c={entering:o,leaf:!Is(t),getChildrenText:Rs,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){a=!0}};if(i.closeUnmatchedHTMLInline(t,o),s(i,t,c),(null==e?void 0:e.node)===t){var l=i.stack.reduce((function(t,e){return t+e.content.reduce((function(t,e){return t+e.nodeSize}),0)}),0)+1;e.setMappedPos(l)}}a&&(n.resumeAt(t,!1),n.next()),r=n.next()},i=this;r;)o()},t.prototype.convertNode=function(t,e){return this.convert(t,e),this.stack.length?this.closeNode():null},t}();var vm={text:function(t,e){var n,r=e.node;t.text(null!==(n=r.text)&&void 0!==n?n:"")},paragraph:function(t,e){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o;if(t.stopNewline)t.convertInline(n);else{var s=0===i,a=!s&&r.child(i-1),c=a&&0===a.childCount,l=i\n"):!p||c||s?(t.convertInline(n),u?t.write("\n"):t.closeBlock(n)):t.write("\n")}},heading:function(t,e,n){var r=e.node,o=n.delim;"atx"===r.attrs.headingType?(t.write(o+" "),t.convertInline(r),t.closeBlock(r)):(t.convertInline(r),t.ensureNewLine(),t.write(o),t.closeBlock(r))},codeBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},blockQuote:function(t,e,n){var r=e.node,o=e.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&t.flushClose(1),t.wrapBlock(i,null,r,(function(){return t.convertNode(r)}))},bulletList:function(t,e,n){var r=e.node,o=n.delim;t.convertList(r,Yt(" ",4),(function(){return o+" "}))},orderedList:function(t,e){var n=e.node,r=n.attrs.order||1;t.convertList(n,Yt(" ",4),(function(t){return String(r+t)+". "}))},listItem:function(t,e){var n=e.node,r=n.attrs,o=r.task,i=r.checked;o&&t.write("["+(i?"x":" ")+"] "),t.convertNode(n)},image:function(t,e,n){var r=n.attrs;t.write("+")")},thematicBreak:function(t,e,n){var r=e.node,o=n.delim;t.write(o),t.closeBlock(r)},table:function(t,e){var n=e.node;t.convertNode(n),t.closeBlock(n)},tableHead:function(t,e,n){var r=e.node,o=n.delim,i=r.firstChild;t.convertNode(r);var s=null!=o?o:"";!o&&i&&i.forEach((function(t){var e=function(t,e){var n=t.length,r="",o="";return"left"===e?(r=":",n-=1):"right"===e?(o=":",n-=1):"center"===e&&(r=":",o=":",n-=2),""+r+Yt("-",Math.max(n,3))+o}(t.textContent,t.attrs.align);s+="| "+e+" "})),t.write(s+"|"),t.ensureNewLine()},tableBody:function(t,e){var n=e.node;t.convertNode(n)},tableRow:function(t,e){var n=e.node;t.convertNode(n),t.write("|"),t.ensureNewLine()},tableHeadCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},tableBodyCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},customBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},frontMatter:function(t,e,n){var r=e.node,o=n.text;t.text(o,!1),t.closeBlock(r)},widget:function(t,e,n){var r=n.text;t.write(r)},html:function(t,e,n){var r=n.text;t.write(r)}};function gm(t,e){var n=t.text,r=/`+/g,o=0;if(t.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&&e>0?" `":"`",a=0;a0&&e<0&&(s+=" "),s}function ym(t){return t?["<"+t+">",""+t+">"]:null}function bm(t){return t?"<"+t+">":null}function wm(t){return t?""+t+">":null}var km={heading:function(t){var e=t.node.attrs,n=e.level,r=Yt("#",n);return"setext"===e.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:ym(e.rawHTML)}},codeBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:ym(n.rawHTML),text:r}},blockQuote:function(t){return{delim:"> ",rawHTML:ym(t.node.attrs.rawHTML)}},bulletList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:ym(o)}},orderedList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:ym(o)}},listItem:function(t,e){var n=t.node,r=e.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(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},tableHead:function(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},tableBody:function(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},tableRow:function(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},tableHeadCell:function(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},tableBodyCell:function(t){return{rawHTML:ym(t.node.attrs.rawHTML)}},image:function(t){var e=t.node.attrs,n=te(e.altText||""),r=te(e.imageUrl),o=n?' alt="'+n+'"':"";return{rawHTML:e.rawHTML?"<"+e.rawHTML+' src="'+r+'"'+o+">":null,attrs:{altText:n,imageUrl:r}}},thematicBreak:function(t){return{delim:"***",rawHTML:bm(t.node.attrs.rawHTML)}},customBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(t){return{text:t.node.textContent}},widget:function(t){return{text:t.node.textContent}},strong:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"**",rawHTML:r?bm(o):wm(o)}},emph:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"*",rawHTML:r?bm(o):wm(o)}},strike:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"~~",rawHTML:r?bm(o):wm(o)}},link:function(t,e){var n=t.node,r=e.entering,o=n.attrs,i=te(o.linkUrl),s=o.rawHTML;return r?{delim:"[",rawHTML:s?"<"+s+' href="'+i+'">':null}:{delim:"]("+(o.title?" "+function(t){var e;return(e=-1===t.indexOf('"')?'""':-1===t.indexOf("'")?"''":"()")[0]+t+e[1]}(o.linkText):"")+i+")",rawHTML:wm(s)}},code:function(t,e){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o,s=e.entering;return{delim:s?gm(r.child(i),-1):gm(r.child(i-1),1),rawHTML:s?bm(n.attrs.rawHTML):wm(n.attrs.rawHTML)}},html:function(t,e){var n=t.node,r=e.entering,o=n.type.name,i=n.attrs.htmlAttrs,s="<"+o,a=""+o+">";return Object.keys(i).forEach((function(t){s+=" "+t+'="'+i[t]+'"'})),s+=">",n.attrs.htmlInline?{rawHTML:r?s:a}:{text:""+s+n.attrs.childrenHTML+a}}},xm={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Cm(t){var e={};return Object.keys(vm).forEach((function(n){e[n]=function(e,r){if(vm[n]){var o=t[n],i=o?o(r,{inTable:e.inTable}):{};!function(t,e){var n=e.state,r=e.nodeInfo,o=e.params,i=o.rawHTML;i?Ff()(t,["heading","codeBlock"])>-1?function(t,e,n){var r=n[0],o=n[1];t.write(r),t.convertInline(e),t.write(o)}(n,r.node,i):Ff()(t,["image","thematicBreak"])>-1?n.write(i):function(t,e,n){var r=e.node,o=e.parent,i=n[0],s=n[1];t.stopNewline=!0,t.write(i),t.convertNode(r),t.write(s),"doc"===(null==o?void 0:o.type.name)&&(t.closeBlock(r),t.stopNewline=!1)}(n,r,i):vm[t](n,r,o)}(n,{state:e,nodeInfo:r,params:i})}}})),e}function Tm(t){return Object.keys(t).forEach((function(e){var n=km[e],r=t[e];km[e]=n?function(t,e){return e.origin=function(){return n(t,e)},r(t,e)}:r,delete t[e]})),{nodeTypeConvertors:Cm(km),markTypeConvertors:function(t){var e={};return Object.keys(xm).forEach((function(n){e[n]=function(e,r){var i=xm[n],s=t[n],a=s&&e&&!zt()(r)?s(e,{entering:r}):{};return o(o({},a),i)}})),e}(km)}}var Mm=function(){function t(t){var e=t.nodeTypeConvertors,n=t.markTypeConvertors;this.nodeTypeConvertors=e,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return t.prototype.getMarkConvertor=function(t){var e=t.attrs.htmlInline?"html":t.type.name;return this.markTypeConvertors[e]},t.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},t.prototype.markText=function(t,e,n,r){var o=this.getMarkConvertor(t);if(o){var i=o({node:t,parent:n,index:r},e),s=i.delim;return i.rawHTML||s}return""},t.prototype.flushClose=function(t){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),t||(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;rb?a=a.slice(0,b).concat(p).concat(a.slice(b,y)).concat(a.slice(y+1,g)):b>y&&(a=a.slice(0,y).concat(a.slice(y+1,b)).concat(p).concat(a.slice(b,g)));break}}}for(var k=0;k"))})),this.stopNewline=!1,this.inTable=!1},t.prototype.convertNode=function(t,e){var n=this;return t.forEach((function(r,o,i){if(n.convertBlock(r,t,i),(null==e?void 0:e.node)===r){var s=n.result.split("\n");e.setMappedPos([s.length,re(s).length+1])}})),this.result},t}(),Sm=function(){function t(t,e,n,r){var i=this;this.setMappedPos=function(t){i.mappedPosWhenConverting=t},this.schema=t,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(t){var e=Object.keys(t),n=o({},hm),r=new Od({gfm:!0,nodeId:!0,convertors:t}).getConvertors();return e.forEach((function(e){var o=hm[e];o&&!Kt(["htmlBlock","htmlInline"],e)&&(n[e]=function(n,i,s){s.origin=function(){return r[e](i,s)};var a,c=t[e](i,s);if(c){var l=Array.isArray(c)?c[0]:c;a={htmlAttrs:l.attributes,classNames:l.classNames}}o(n,i,s,a)})})),n}(n),this.toMdConvertors=Tm(e||{}),this.eventEmitter.listen("setFocusedNode",(function(t){return i.focusedNode=t}))}return t.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},t.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},t.prototype.toWysiwygModel=function(t){return new mm(this.schema,this.toWwConvertors).convertNode(t,this.getInfoForPosSync())},t.prototype.toMarkdownText=function(t){var e=new Mm(this.toMdConvertors).convertNode(t,this.getInfoForPosSync());return e=this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",e)},t}();function Em(t,e,n){return e.listen("mixinTableOffsetMapPrototype",xf),(null!=t?t:[]).reduce((function(t,r){var i=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:fn,Selection:We,TextSelection:Ke},pmView:{Decoration:qo,DecorationSet:Wo},pmModel:{Fragment:p},i18n:jf};if(fa()(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(r,e,n);if(!i)throw new Error("The return value of the executed plugin is empty.");var s=i.markdownParsers,a=i.toHTMLRenderers,c=i.toMarkdownRenderers,l=i.markdownPlugins,u=i.wysiwygPlugins,d=i.wysiwygNodeViews,f=i.markdownCommands,h=i.wysiwygCommands,m=i.toolbarItems;return a&&(t.toHTMLRenderers=ie(t.toHTMLRenderers,a)),c&&(t.toMarkdownRenderers=ie(t.toMarkdownRenderers,c)),l&&(t.mdPlugins=t.mdPlugins.concat(l)),u&&(t.wwPlugins=t.wwPlugins.concat(u)),d&&(t.wwNodeViews=o(o({},t.wwNodeViews),d)),f&&(t.mdCommands=o(o({},t.mdCommands),f)),h&&(t.wwCommands=o(o({},t.wwCommands),h)),m&&(t.toolbarItems=t.toolbarItems.concat(m)),s&&(t.markdownParsers=o(o({},t.markdownParsers),s)),t}),{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Nm=function(){function t(t){var e=this;this.options=Et()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},t),this.eventEmitter=new rm;var n,r=Qt(this.options.linkAttributes),i=Em(this.options.plugins,this.eventEmitter,this.options.usageStatistics)||{},s=i.toHTMLRenderers,a=i.markdownParsers,c=this.options,l=c.customHTMLRenderer,u=c.extendedAutolinks,p=c.referenceDefinition,d=c.frontMatter,f=c.customHTMLSanitizer,h={linkAttributes:r,customHTMLRenderer:o(o({},s),l),extendedAutolinks:u,referenceDefinition:p,frontMatter:d,sanitizer:f||Pd};n=h.customHTMLRenderer,["htmlBlock","htmlInline"].forEach((function(t){n[t]&&Object.keys(n[t]).forEach((function(t){return Rd(t)}))})),this.options.events&&Mt()(this.options.events,(function(t,n){e.on(n,t)}));var m=this.options,v=m.el,g=m.initialValue,y=m.theme,b=v.innerHTML;"light"!==y&&v.classList.add(Ea(y)),v.innerHTML="",this.toastMark=new xd("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:u,referenceDefinition:p,disallowDeepHeading:!0,frontMatter:d,customParser:a}),this.preview=new nf(this.eventEmitter,o(o({},h),{isViewer:!0})),Tl()(this.preview.el,"mousedown",this.toggleTask.bind(this)),g?this.setMarkdown(g):b&&this.preview.setHTML(b),v.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return t.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&Ma(n,t.offsetX,t.offsetY)&&Aa(e,"checked")},t.prototype.setMarkdown=function(t){var e=this.toastMark.getLineTexts(),n=[e.length,re(e).length+1],r=this.toastMark.editMarkdown([1,1],n,t||"");this.eventEmitter.emit("updatePreview",r)},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.destroy=function(){xl()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},t.prototype.isViewer=function(){return!0},t.prototype.isMarkdownMode=function(){return!1},t.prototype.isWysiwygMode=function(){return!1},t}();function Om(t){return t instanceof z}function Dm(t){return Kt(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],t)}var Am={openTag:function(t,e){var n=t,r=n.tagName,i=n.classNames,s=n.attributes,a=document.createElement(r),c={};i&&(a.className=i.join(" ")),s&&(c=o(o({},c),s)),Ba(c,a),e.push(a)},closeTag:function(t,e){if(e.length>1){var n=e.pop();re(e).appendChild(n)}},html:function(t,e){re(e).insertAdjacentHTML("beforeend",t.content)},text:function(t,e){var n=document.createTextNode(t.content);re(e).appendChild(n)}},Lm=function(){function t(t,e){var n=Vd(t,e),r=o(o({},e.htmlBlock),e.htmlInline);this.customConvertorKeys=Object.keys(e).concat(Object.keys(r)),this.renderer=new Od({gfm:!0,convertors:o(o({},n),r)}),this.convertors=this.renderer.getConvertors()}return t.prototype.generateTokens=function(t){var e=function(t){var e=t.attrs,n=t.type.name,r={type:n,wysiwygNode:!0,literal:!Dm(n)&&Om(t)?t.textContent:null},i={heading:{level:e.level},link:{destination:e.linkUrl,title:e.linkText},image:{destination:e.imageUrl},codeBlock:{info:e.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:e.order}},listItem:{type:"item",listData:{task:e.task,checked:e.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:e.align},tableBodyCell:{type:"tableCell",cellType:"body",align:e.align},customBlock:{info:e.info}}[n],s=o(o({},r),i),a=t.attrs,c=a.htmlAttrs,l=a.childrenHTML;return c?o(o({},s),{attrs:c,childrenHTML:l}):s}(t),n={entering:!0,leaf:!!Om(t)&&t.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Om(t)?t.textContent:""},skipChildren:function(){return!1}},r=this.convertors[t.type.name],i=r(e,n,this.convertors),s=fa()(i)?i:[i];return(Dm(t.type.name)||t.attrs.htmlInline)&&(n.entering=!1,s.push({type:"text",content:Om(t)?t.textContent:""}),s=s.concat(r(e,n,this.convertors))),s},t.prototype.toDOMNode=function(t){var e=this.generateTokens(t),n=[];return e.forEach((function(t){return Am[t.type](t,n)})),n[0]},t.prototype.getToDOMNode=function(t){return Kt(this.customConvertorKeys,t)?this.toDOMNode.bind(this):null},t}(),Im=null,Rm=null;function Pm(t,e){var n=e.syncScrollTop,r=e.releaseEventBlock;Rm&&clearTimeout(Rm),n(t),Rm=setTimeout((function(){r()}),15)}var Bm=function(){function t(t,e,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0;var r=e.previewContent,o=e.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=t,this.editorView=t.view,this.toastMark=t.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return t.prototype.addScrollSyncEvent=function(){var t=this;this.eventEmitter.listen("afterPreviewRender",(function(){setTimeout((function(){t.syncPreviewScrollTop(!0)}),200)})),this.eventEmitter.listen("scroll",(function(e,n){t.active&&("editor"===e&&"editor"!==t.blockedScroll?t.syncPreviewScrollTop():"preview"===e&&"preview"!==t.blockedScroll&&t.syncEditorScrollTop(n))})),this.eventEmitter.listen("toggleScrollSync",(function(e){t.active=e}))},t.prototype.getMdNodeAtPos=function(t,e){var n=t.content.findIndex(e.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},t.prototype.getScrollTopByCaretPos=function(){var t=this.mdEditor.getSelection(),e=this.toastMark.findFirstNodeAtLine(t[0][0]),n=this.previewEl.clientHeight,r=Xd(e).el,o=(Kd(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().topT.top?Math.min((a-T.top)/C,1):0)}y=this.getResolvedScrollTop("editor",f,y,p),this.latestEditorScrollTop=f}y!==p&&this.run("editor",y,p)}},t.prototype.syncEditorScrollTop=function(t){var e=this,n=e.toastMark,r=e.editorView,o=e.previewRoot,i=e.previewEl,s=r.dom,a=r.state,c=i.scrollTop,l=i.clientHeight,u=i.scrollHeight-c<=l,p=s.scrollTop,d=u?s.scrollHeight:0;if(c&&t&&!u){if(!(t=function(t,e){for(;!t.getAttribute("data-nodeid")&&t.parentElement!==e;)t=t.parentElement;return t}(t,o)).getAttribute("data-nodeid"))return;var f=s.children,h=Number(t.getAttribute("data-nodeid")),m=Xd(n.findNodeById(h)),v=m.mdNode,g=m.el;d=f[ws(v)-1].offsetTop;var y=Jd(a.doc,v,f).height,b=tf(g,o,h),w=b.nodeHeight;d+=function(t,e,n,r){return Math.min((t-e)/n,1)*r}(c,b.offsetTop,w,y),d=this.getResolvedScrollTop("preview",c,d,p),this.latestPreviewScrollTop=c}d!==p&&this.run("preview",d,p)},t.prototype.getResolvedScrollTop=function(t,e,n,r){var o="editor"===t?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o <\/p>/gi,"
"),n=new RegExp(ka,"ig"),r=e.match(n);return null==r||r.forEach((function(t,n){if(Ca.test(t)){var o=Ta;if(n){var i=r[n-1].match(wa);if(i&&!/br/i.test(i[1])){var s=i[1];o=""+s+"><"+s+">"}}e=e.replace(Ca,o)}})),e}(t);var r=ut.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),e):this.wwEditor.setModel(r,e)},t.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},t.prototype.getHTML=function(){var t=this;return this.eventEmitter.holdEventInvoke((function(){if(t.isMarkdownMode()){var e=t.toastMark.getRootNode(),n=t.convertor.toWysiwygModel(e);t.wwEditor.setModel(n)}})),this.wwEditor.view.dom.innerHTML},t.prototype.insertText=function(t){this.getCurrentModeEditor().replaceSelection(t)},t.prototype.setSelection=function(t,e){this.getCurrentModeEditor().setSelection(t,e)},t.prototype.replaceSelection=function(t,e,n){this.getCurrentModeEditor().replaceSelection(t,e,n)},t.prototype.deleteSelection=function(t,e){this.getCurrentModeEditor().deleteSelection(t,e)},t.prototype.getSelectedText=function(t,e){return this.getCurrentModeEditor().getSelectedText(t,e)},t.prototype.getRangeInfoOfNode=function(t){return this.getCurrentModeEditor().getRangeInfoOfNode(t)},t.prototype.addWidget=function(t,e,n){this.getCurrentModeEditor().addWidget(t,e,n)},t.prototype.replaceWithWidget=function(t,e,n){this.getCurrentModeEditor().replaceWithWidget(t,e,n)},t.prototype.setHeight=function(t){var e=this.options.el;Pt()(t)&&("auto"===t?(At()(e,"auto-height"),this.setMinHeight(this.getMinHeight())):(It()(e,"auto-height"),this.setMinHeight(t))),Ot()(e,{height:t}),this.height=t},t.prototype.getHeight=function(){return this.height},t.prototype.setMinHeight=function(t){var e;this.minHeight=t;var n=this.options.el.clientHeight-((null===(e=document.querySelector("."+Ea("main")))||void 0===e?void 0:e.clientHeight)||0),r=parseInt(t,10);r=Math.max(r-n,0),this.wwEditor.setMinHeight(r),this.mdEditor.setMinHeight(r),this.preview.setMinHeight(r)},t.prototype.getMinHeight=function(){return this.minHeight},t.prototype.isMarkdownMode=function(){return"markdown"===this.mode},t.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},t.prototype.isViewer=function(){return!1},t.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},t.prototype.changeMode=function(t,e){if(this.mode!==t){if(this.mode=t,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),!e)}if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",t),!e){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&Ft()(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},t.prototype.destroy=function(){var t=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach((function(e,n){return t.off(n)}))},t.prototype.hide=function(){this.eventEmitter.emit("hide")},t.prototype.show=function(){this.eventEmitter.emit("show")},t.prototype.setScrollTop=function(t){this.getCurrentModeEditor().setScrollTop(t)},t.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},t.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},t.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},t.prototype.setPlaceholder=function(t){this.mdEditor.setPlaceholder(t),this.wwEditor.setPlaceholder(t)},t.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},t}();var Hm=n(326),zm=n.n(Hm),jm=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.walk=function(){var t=this.entering,e=this.current;return e?(t?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:e.next?(this.current=e.next,this.entering=!0):(this.current=e.parent,this.entering=!1),{vnode:e,entering:t}):null},t}(),_m=function(){function t(t,e,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=t,this.props=e,this.children=n,this.props.children=n,e.ref&&(this.ref=e.ref,delete e.ref),e.key&&(this.key=e.key,delete e.key)}return t.prototype.walker=function(){return new jm(this)},t.removalNodes=[],t}();function qm(t,e){var n,r=t;zm()(t)||null==t?r=null:(Pt()(t)||Ft()(t))&&(n=String(t),r=new _m("TEXT_NODE",{nodeValue:n},[])),r&&e.push(r)}var Vm=function(t){for(var e,n,r=arguments,o=1,i="",s="",a=[0],c=function(t){1===o&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(t?r[t]:i):3===o&&(t||i)?(a[1]=t?r[t]:i,o=2):2===o&&"..."===i&&t?a[2]=ce(a[2]||{},r[t]):2===o&&i&&!t?(a[2]=a[2]||{})[i]=!0:o>=5&&(5===o?((a[2]=a[2]||{})[n]=t?i?i+r[t]:r[t]:i,o=6):(t||i)&&(a[2][n]+=t?i+r[t]:i)),i=""},l=0;l"===e?(o=1,i=""):i=e+i[0]:s?e===s?s="":i+=e:'"'===e||"'"===e?s=e:">"===e?(c(),o=1):o&&("="===e?(o=5,n=i,i=""):"/"===e&&(o<5||">"===t[l][u+1])?(c(),3===o&&(a=a[0]),o=a,(a=a[0]).push(this.apply(null,o.slice(1))),o=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(c(),o=2):i+=e),3===o&&"!--"===i&&(o=4,a=a[0])}return c(),a.length>2?a.slice(1):a[1]}.bind((function(t,e){for(var n=[],r=2;r\n \n
\n
\n
0},t}(),Nv="undefined"!=typeof WeakMap?new WeakMap:new lv,Ov=function t(e){if(!(this instanceof t))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=mv.getInstance(),r=new Ev(e,n,this);Nv.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){Ov.prototype[t]=function(){var e;return(e=Nv.get(this))[t].apply(e,arguments)}}));var Dv,Av,Lv,Iv,Rv,Pv,Bv,Fv,Hv,zv,jv,_v,qv,Vv,$v,Uv,Wv=void 0!==pv.ResizeObserver?pv.ResizeObserver:Ov,Jv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.execCommand=function(t){var e=Ra(t.target,"li");this.props.execCommand("heading",{level:Number(e.getAttribute("data-level"))})},n.prototype.render=function(){var t=this;return Vm(Av||(Av=s(["\n
\n "],["\n
\n "])),(function(e){return t.execCommand(e)}),jf.get("Headings"),[1,2,3,4,5,6].map((function(t){return Vm(Dv||(Dv=s(['\n
\n <',">"," ","$>\n \n "],['\n
\n <',">"," ","$>\n \n "])),t,"h"+t,jf.get("Heading"),t)})),jf.get("Paragraph"))},n}(iv),Gv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.toggleTab=function(t,e){this.props.onClick(t,e)},n.prototype.render=function(){var t=this;return Vm(Iv||(Iv=s(['\n
\n ',"\n
\n "],['\n
\n ',"\n
\n "])),Ea("tabs"),this.props.tabs.map((function(e){var n=e.name,r=e.text,o=t.props.activeTab===n;return Vm(Lv||(Lv=s(['\n
\n ',"\n
\n "],['\n
\n ',"\n
\n "])),o?" active":"",(function(e){return t.toggleTab(e,n)}),jf.get(r),o?"true":"false",o?"0":"-1",jf.get(r))})))},n}(iv),Kv=function(t){function n(e){var n=t.call(this,e)||this;return n.initialize=function(t){void 0===t&&(t="file");var e=n.refs.url;e.value="",n.refs.altText.value="",n.refs.file.value="",It()(e,"wrong"),n.setState({activeTab:t,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(t,e){e!==n.state.activeTab&&n.initialize(e)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(t){var e=t.target.files;(null==e?void 0:e.length)&&n.setState({file:e[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return e(n,t),n.prototype.emitAddImageBlob=function(){var t=this,e=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null==e?void 0:e.length){r="";var o=e.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,(function(e,r){return t.props.execCommand("addImage",{imageUrl:e,altText:r||n.value})}),"ui")}this.setState({fileNameElClassName:r})},n.prototype.emitAddImage=function(){var t=this.refs.url,e=this.refs.altText,n=t.value,r=e.value||"image";It()(t,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):At()(t,"wrong")},n.prototype.preventSelectStart=function(t){t.preventDefault()},n.prototype.updated=function(){this.props.show||this.initialize()},n.prototype.render=function(){var t=this,e=this.state,n=e.activeTab,r=e.file,o=e.fileNameElClassName;return Vm(Rv||(Rv=s(['\n
\n <'," tabs="," activeTab="," onClick=",' />\n
\n ',' \n \n
\n
\n ',' \n \n \n \n
\n
',' \n
\n
\n
\n \n <'," tabs="," activeTab="," onClick=",' />\n \n ',' \n \n
\n \n ',' \n \n \n \n
\n ',' \n \n \n
\n \n ',' \n \n ',' \n \n \n
\n \n ',' \n \n ',' \n \n \n \n
'],['
'])),c))}r.push(Vm(Fv||(Fv=s(['',"
"],['',"
"])),Ea("table-row"),i))}return Vm(Hv||(Hv=s(['',"
"],['',"
"])),Ea("table"),r)},n.prototype.render=function(){var t=this,e=this.getTableRange(),n=this.getSelectionAreaBound();return Vm(zv||(zv=s(['\n \n ',"
\n \n "],['\n \n ',"
\n \n "])),jf.get("Insert table"),Ea("table-selection"),(function(e){return t.refs.tableEl=e}),this.extendSelectionRange,this.execCommand,this.createTableArea(e),Ea("table-selection-layer"),n,Ea("table-description"),this.getDescription())},n}(iv),Qv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},n.prototype.render=function(){var t=this;return Vm(jv||(jv=s(["
"],["
"])),(function(e){return t.refs.el=e}))},n}(iv);function Yv(t){return Pt()(t)?function(t){var e;switch(t){case"heading":e={name:"heading",className:"heading",tooltip:jf.get("Headings"),state:"heading"};break;case"bold":e={name:"bold",className:"bold",command:"bold",tooltip:jf.get("Bold"),state:"strong"};break;case"italic":e={name:"italic",className:"italic",command:"italic",tooltip:jf.get("Italic"),state:"emph"};break;case"strike":e={name:"strike",className:"strike",command:"strike",tooltip:jf.get("Strike"),state:"strike"};break;case"hr":e={name:"hr",className:"hrline",command:"hr",tooltip:jf.get("Line"),state:"thematicBreak"};break;case"quote":e={name:"quote",className:"quote",command:"blockQuote",tooltip:jf.get("Blockquote"),state:"blockQuote"};break;case"ul":e={name:"ul",className:"bullet-list",command:"bulletList",tooltip:jf.get("Unordered list"),state:"bulletList"};break;case"ol":e={name:"ol",className:"ordered-list",command:"orderedList",tooltip:jf.get("Ordered list"),state:"orderedList"};break;case"task":e={name:"task",className:"task-list",command:"taskList",tooltip:jf.get("Task"),state:"taskList"};break;case"table":e={name:"table",className:"table",tooltip:jf.get("Insert table"),state:"table"};break;case"image":e={name:"image",className:"image",tooltip:jf.get("Insert image")};break;case"link":e={name:"link",className:"link",tooltip:jf.get("Insert link")};break;case"code":e={name:"code",className:"code",command:"code",tooltip:jf.get("Code"),state:"code"};break;case"codeblock":e={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:jf.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":e={name:"indent",className:"indent",command:"indent",tooltip:jf.get("Indent")};break;case"outdent":e={name:"outdent",className:"outdent",command:"outdent",tooltip:jf.get("Outdent")};break;case"scrollSync":e=function(){var t=document.createElement("label"),e=document.createElement("input"),n=document.createElement("span");t.className="scroll-sync active",e.type="checkbox",e.checked=!0,n.className="switch";var r=function(n){return e.addEventListener("change",(function(e){var r=e.target.checked;r?At()(t,"active"):It()(t,"active"),n("toggleScrollSync",{active:r})}))};return t.appendChild(e),t.appendChild(n),{name:"scrollSync",el:t,onMounted:r}}();break;case"more":e={name:"more",className:"more",tooltip:jf.get("More")}}"scrollSync"!==e.name&&(e.className+=" "+Ea("toolbar-icons"));return e}(t):t}function tg(t,e){var n=e.el,r=e.pos,i=e.popup,a=e.initialValues;switch(t){case"heading":return{render:function(t){return Vm(_v||(_v=s(["<"," ..."," />"],["<"," ..."," />"])),Jv,t)},className:Ea("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(t){return Vm(qv||(qv=s(["<"," ..."," />"],["<"," ..."," />"])),Zv,t)},className:Ea("popup-add-link"),fromEl:n,pos:r,initialValues:a};case"image":return{render:function(t){return Vm(Vv||(Vv=s(["<"," ..."," />"],["<"," ..."," />"])),Kv,t)},className:Ea("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(t){return Vm($v||($v=s(["<"," ..."," />"],["<"," ..."," />"])),Xv,t)},className:Ea("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return i?o({render:function(t){return Vm(Uv||(Uv=s(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),Qv,t,i.body)},fromEl:n,pos:r},i):null;default:return null}}function eg(t){t.hidden=t.length===t.filter((function(t){return t.hidden})).length}function ng(t,e){return t.reduce((function(t,n){t.push(n.map((function(t){return function(t){return t.hidden="scrollSync"===t.name&&e,t}(Yv(t))})));var r=t[(t.length||1)-1];return r&&eg(r),t}),[])}var rg,og,ig=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleMousedown=function(t){Ra(t.target,"."+Ea("popup"))||Ra(t.target,e.props.info.fromEl)||e.props.hidePopup()},e}return e(n,t),n.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},n.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},n.prototype.updated=function(t){var e=this.props,n=e.show,r=e.info;if(n&&r.pos&&t.show!==n){var i=o({},r.pos),s=this.refs.el.offsetWidth,a=Ra(this.refs.el,"."+Ea("toolbar")).offsetWidth;i.left+s>=a&&(i.left=a-s-20),ne(this.state.popupPos,i)||this.setState({popupPos:i})}},n.prototype.render=function(){var t=this,e=this.props,n=e.info,r=e.show,i=e.hidePopup,a=e.eventEmitter,c=e.execCommand,l=n||{},u=l.className,p=void 0===u?"":u,d=l.style,f=l.render,h=l.initialValues,m=void 0===h?{}:h,v=o(o({display:r?"block":"none"},d),this.state.popupPos);return Vm(rg||(rg=s(['\n \n "],['\n \n "])),Ea("popup"),p,v,(function(e){return t.refs.el=e}),Ea("popup-body"),f&&f({eventEmitter:a,show:r,hidePopup:i,execCommand:c,initialValues:m}))},n}(iv);function sg(t){return function(n){function r(t){var e=n.call(this,t)||this;return e.showTooltip=function(t){var n=e.props.item.tooltip;if(!e.props.disabled&&n){var r=e.getBound(t),o=r.left+6+"px",i=r.top+6+"px";Ot()(e.props.tooltipRef.current,{display:"block",left:o,top:i}),e.props.tooltipRef.current.querySelector(".text").textContent=n}},e.hideTooltip=function(){Ot()(e.props.tooltipRef.current,"display","none")},e.state={active:!1},e.addEvent(),e}return e(r,n),r.prototype.addEvent=function(){var t=this,e=this.props,n=e.item,r=e.eventEmitter;n.state&&r.listen("changeToolbarState",(function(e){var r=!!e.toolbarState[n.state];t.setState({active:r})}))},r.prototype.getBound=function(t){var e=Pa(t,Ra(t,"."+Ea("toolbar"))),n=e.offsetLeft,r=e.offsetTop;return{left:n,top:t.offsetHeight+r}},r.prototype.render=function(){return Vm(og||(og=s(["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "],["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "])),t,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound)},r}(iv)}var ag,cg,lg,ug,pg,dg,fg,hg,mg,vg,gg,yg,bg,wg,kg=sg(function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.execCommand=function(){var t=e.props,n=t.item,r=t.execCommand,o=t.setPopupInfo,i=t.getBound,s=n.command,a=n.name,c=n.popup;if(s)r(s);else{var l=tg(c?"customPopupBody":a,{el:e.refs.el,pos:i(e.refs.el),popup:c});l&&o(l)}},e}return e(n,t),n.prototype.mounted=function(){this.setItemWidth()},n.prototype.updated=function(t){t.item.name!==this.props.item.name&&this.setItemWidth()},n.prototype.setItemWidth=function(){var t=this.props,e=t.setItemWidth,n=t.item;e&&e(n.name,Ia(this.refs.el)+(n.hidden?80:0))},n.prototype.render=function(){var t=this,e=this.props,n=e.hideTooltip,r=e.disabled,i=e.item,a=e.active,c=o({display:i.hidden?"none":null},i.style),l=(i.className||"")+(a?" active":"");return Vm(ag||(ag=s(["\n \n \n
';this.tooltipRef.current=La(t,this.refs.el)},n.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},n.prototype.movePrevItemToDropdownToolbar=function(t,e,n,r){var o=function(t){var e=t.pop();e&&r.push(e)};if(t>1)o(n);else{var i=re(e);i&&o(i)}},n.prototype.classifyToolbarItems=function(){var t=this,e=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+Ea("toolbar-divider")),o=r?Ia(r):0,i=[],s=[],a=!1;return this.initialItems.forEach((function(r,c){var l=[],u=[];r.forEach((function(r,o){r.hidden||((e+=t.itemWidthMap[r.name])>n-50?(a||(t.movePrevItemToDropdownToolbar(o,i,l,u),a=!0),u.push(r)):l.push(r))})),l.length&&(eg(l),i.push(l)),u.length&&(eg(u),s.push(u)),c
\n \n <'," tabs="," activeTab="," onClick=",' />\n
\n \n
\n <'," tabs="," activeTab="," onClick=",' />\n
\n
\n
'," \n \n "],["\n
\n '," \n \n "])),(function(){a||(c(),t.setState({pos:null}))}),a?" disabled":"",i,n))})),e.push(Vm(vg||(vg=s(['"],['"])),r)),e}),[]):[]},n.prototype.render=function(){var t=o({display:this.state.pos?"block":"none"},this.state.pos);return Vm(gg||(gg=s(['
\n ',"\n
"],['
\n ',"\n
"])),Ea("context-menu"),t,this.getMenuGroupElements())},n}(iv),Eg=function(t){function n(e){var n=t.call(this,e)||this;n.changeMode=function(t){t!==n.state.editorType&&n.setState({editorType:t})},n.changePreviewStyle=function(t){t!==n.state.previewStyle&&n.setState({previewStyle:t})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=e.editorType,o=e.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return e(n,t),n.prototype.mounted=function(){var t=this.props.slots,e=t.wwEditor,n=t.mdEditor,r=t.mdPreview;this.refs.wwContainer.appendChild(e),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},n.prototype.insertToolbarItem=function(t,e){this.toolbar.insertToolbarItem(t,e)},n.prototype.removeToolbarItem=function(t){this.toolbar.removeToolbarItem(t)},n.prototype.render=function(){var t=this,e=this.props,n=e.eventEmitter,r=e.hideModeSwitch,o=e.toolbarItems,i=e.theme,a=this.state,c=a.hide,l=a.previewStyle,u=a.editorType,p=c?" hidden":"",d=Ea("markdown"===u?"md-mode":"ww-mode"),f=Ea("md")+"-"+l+"-style",h=Ea(["light"!==i,i+" "]);return Vm(bg||(bg=s(['\n
\n
\n
\n
\n
\n
\n
\n
\n
"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(V.prototype,$),V.empty=new V(!0);var U=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},W={next:{configurable:!0}};function J(t){var e=[];do{e.push(G(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function G(t){var e=[];do{e.push(K(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function K(t){for(var e=function(t){if(t.eat("(")){var e=J(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=X(t,e)}return e}function Z(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function X(t,e){var n=Z(t),r=n;return t.eat(",")&&(r="}"!=t.next?Z(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q(t,e){return e-t}function Y(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i
-1},rt.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var ct=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=c.from(t.nodes),this.spec.marks=c.from(t.marks),this.nodes=rt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var o=this.nodes[r],i=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[i]||(n[i]=V.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?lt(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var a in this.marks){var l=this.marks[a],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:lt(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function lt(t,e){for(var n=[],r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}ct.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof rt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},ct.prototype.text=function(t,e){var n=this.nodes.text;return new _(n,n.defaultAttrs,t,v.setFrom(e))},ct.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},ct.prototype.nodeFromJSON=function(t){return z.fromJSON(this,t)},ct.prototype.markFromJSON=function(t){return v.fromJSON(this,t)},ct.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ut=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};ut.prototype.parse=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ut.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!0);return n.addAll(t,null,e.from,e.to),y.maxOpen(n.finish())},ut.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ut.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},mt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},vt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},vt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},gt.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},vt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},vt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},vt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(vt.prototype,gt);var kt=function(t,e){this.nodes=t||{},this.marks=e||{}};function xt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ct(t){return t.document||window.document}kt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=Ct(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},kt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&kt.renderSpec(Ct(n),r(t,e))},kt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var l in c=2,a)if(null!=a[l]){var u=l.indexOf(" ");u>0?s.setAttributeNS(l.slice(0,u),l.slice(u+1),a[l]):s.setAttribute(l,a[l])}for(var p=c;pc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=kt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},kt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new kt(this.nodesFromSchema(t),this.marksFromSchema(t)))},kt.nodesFromSchema=function(t){var e=xt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},kt.marksFromSchema=function(t){return xt(t.marks)};var Tt=n(956),Mt=n.n(Tt),St=n(969),Et=n.n(St),Nt=n(522),Ot=n.n(Nt),Dt=n(204),At=n.n(Dt),Lt=n(462),It=n.n(Lt),Rt=n(758),Pt=n.n(Rt),Bt=n(321),Ft=n.n(Bt),Ht=n(929),zt=n.n(Ht),jt=n(934),_t=n.n(jt),qt=n(391),Vt=n.n(qt),$t=(/Mac/.test(navigator.platform),/[\u0020]+/g),Ut=/[>(){}[\]+-.!#|]/g,Wt=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>||<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,Jt=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,Gt=/[*_~`]/g,Kt=new RegExp('[&<>"]',"g");function Zt(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function Xt(t){return Kt.test(t)?t.replace(Kt,Zt):t}function Qt(t,e){return-1!==t.indexOf(e)}var Yt=["rel","target","hreflang","type"],te={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 ee(t){if(!t)return null;var e={};return Yt.forEach((function(n){zt()(t[n])||(e[n]=t[n])})),e}function ne(t,e){for(var n="",r=0;re?[e,t]:[t,e]}var fe=Math.pow(2,16);function he(t,e){return t+e*fe}function me(t){return 65535&t}var ve=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},ge=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};ge.prototype.recover=function(t){var e=0,n=me(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var d=t==(e<0?a:u)?null:he(s/3,t-a);return new ve(p,e<0?t!=a:t!=u,d)}r+=l-c}return n?t+r:new ve(t+r)},ge.prototype.touches=function(t,e){for(var n=0,r=me(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},ge.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},ye.prototype.invert=function(){var t=new ye;return t.appendMappingInverted(this),t},ye.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},we.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(we.prototype,ke);var Ce=Object.create(null),Te=function(){};Te.prototype.apply=function(t){return xe()},Te.prototype.getMap=function(){return ge.empty},Te.prototype.invert=function(t){return xe()},Te.prototype.map=function(t){return xe()},Te.prototype.merge=function(t){return null},Te.prototype.toJSON=function(){return xe()},Te.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ce[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},Te.jsonID=function(t,e){if(t in Ce)throw new RangeError("Duplicate use of step JSON ID "+t);return Ce[t]=e,e.prototype.jsonID=t,e};var Me=function(t,e){this.doc=t,this.failed=e};Me.ok=function(t){return new Me(t,null)},Me.fail=function(t){return new Me(null,t)},Me.fromReplace=function(t,e,n,r){try{return Me.ok(t.replace(e,n,r))}catch(t){if(t instanceof g)return Me.fail(t.message);throw t}};var Se=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Ne(t,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new ge([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?y.empty:new y(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?y.empty:new y(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,y.fromJSON(t,n.slice),!!n.structure)},e}(Te);Te.jsonID("replace",Se);var Ee=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Ne(t,this.from,this.gapFrom)||Ne(t,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Me.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Me.fromReplace(t,this.from,this.to,n):Me.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new ge([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||or.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,y.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(Te);function Ne(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Oe(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function De(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(ni;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),d=r&&r[c]||l;if(d!=l&&(p=p.replaceChild(0,d.type.create(d.attrs))),!l.canReplace(u+1,l.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Ie(t,e){var n=t.resolve(e),r=n.index();return Re(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Re(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Pe(t,e,n){for(var r=[],o=0;oe;d--)f||n.index(d)>0?(f=!0,l=p.from(n.node(d).copy(l)),u++):a--;for(var h=p.empty,m=0,v=o,g=!1;v>e;v--)g||r.after(v+1)=0;r--)n=p.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Ee(o,i,o,i,new y(n,0,0),e.length,!0))},we.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new Ee(a,c,a+1,c-1,new y(p.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},we.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Ee(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new y(p.from(i),0,0),1,!0))},we.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=p.empty,i=p.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=p.from(r.node(s).copy(o));var l=n&&n[c];i=p.from(l?l.type.create(l.attrs,i):r.node(s).copy(i))}return this.step(new Se(t,t,new y(o.append(i),e,e),!0))},we.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Se(t-e,t+e,y.empty,!0);return this.step(n)};var Be=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new y(Pe(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Fe(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);Te.jsonID("addMark",Be);var Fe=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new y(Pe(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Be(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);function He(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}Te.jsonID("removeMark",Fe),we.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),d=Math.min(c+r.nodeSize,e),f=n.addToSet(u),h=0;h=0;f--)this.step(o[f]);return this},we.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=y.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=y.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return He(o,i,r)?new Se(e,n,r):new ze(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},we.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new y(p.from(n),0,0))},we.prototype.delete=function(t,e){return this.replace(t,e,y.empty)},we.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var ze=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=p.empty;for(var i=t.depth;i>0;i--)this.placed=p.from(t.node(i).copy(this.placed))},je={depth:{configurable:!0}};function _e(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(_e(t.firstChild.content,e-1,n)))}function qe(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qe(t.lastChild.content,e-1,n)))}function Ve(t,e){for(var n=0;n1&&(r=r.replaceChild(0,$e(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(p.empty,!0)))),t.copy(r)}function Ue(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(p.empty,!0))}return t}function Je(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}je.depth.get=function(){return this.frontier.length-1},ze.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new y(i,s,a);return e>-1?new Ee(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Se(r.pos,o.pos,c):void 0},ze.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Ve(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,l=void 0;if(1==t&&(r?a.matchType(r.type)||(l=a.fillBefore(p.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},ze.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new y(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},ze.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new y(_e(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new y(_e(e,n,1),n,r)},ze.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var s=0;s1||0==l||b.content.size)&&(h=w,d.push($e(b.mark(m.allowedMarks(b.marks)),1==u?l:0,u==c.childCount?g:-1)))}var k=u==c.childCount;k||(g=-1),this.placed=qe(this.placed,n,p.from(d)),this.frontier[n].match=h,k&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x1&&r==this.$to.end(--n);)++r;return r},ze.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e=0;a--){var c=this.frontier[a],l=c.match,u=Ue(t,a,c.type,l,!0);if(!u||u.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},ze.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=qe(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},ze.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=qe(this.placed,this.depth,p.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},ze.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(p.empty,!0);t.childCount&&(this.placed=qe(this.placed,this.frontier.length,t))},Object.defineProperties(ze.prototype,je),we.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(He(r,o,n))return this.step(new Se(t,e,n));var i=Je(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=n.openStart,f=n.content,h=0;;h++){var m=f.firstChild;if(p.push(m),h==n.openStart)break;f=m.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var v=n.openStart;v>=0;v--){var g=(v+d+1)%(n.openStart+1),b=p[g];if(b)for(var w=0;w=0&&(this.replace(t,e,n),!(this.steps.length>M));S--){var E=i[S];S<0||(t=r.before(E),e=o.after(E))}return this},we.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Ge=Object.create(null),Ke=function(t,e,n){this.ranges=n||[new Xe(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ze={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ze.anchor.get=function(){return this.$anchor.pos},Ze.head.get=function(){return this.$head.pos},Ze.from.get=function(){return this.$from.pos},Ze.to.get=function(){return this.$to.pos},Ze.$from.get=function(){return this.ranges[0].$from},Ze.$to.get=function(){return this.ranges[0].$to},Ze.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?on(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):on(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Ke.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new nn(t.node(0))},Ke.atStart=function(t){return on(t,t,0,0,1)||new nn(t)},Ke.atEnd=function(t){return on(t,t,t.content.size,t.childCount,-1)||new nn(t)},Ke.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ge[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Ke.jsonID=function(t,e){if(t in Ge)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ge[t]=e,e.prototype.jsonID=t,e},Ke.prototype.getBookmark=function(){return Qe.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Ke.prototype,Ze),Ke.prototype.visible=!0;var Xe=function(t,e){this.$from=t,this.$to=e},Qe=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=y.empty),t.prototype.replace.call(this,e,n),n==y.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new Ye(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&tn.isSelectable(a))return tn.create(t,n-(o<0?a.nodeSize:0))}else{var c=on(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function sn(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return v.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||v.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Ke.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(we);function cn(t,e){return e&&t?t.bind(e):t}var ln=function(t,e,n){this.name=t,this.init=cn(e.init,n),this.apply=cn(e.apply,n)},un=[new ln("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ln("selection",{init:function(t,e){return t.selection||Ke.atStart(e.doc)},apply:function(t){return t.selection}}),new ln("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ln("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],pn=function(t,e){var n=this;this.schema=t,this.fields=un.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new ln(t.key,t.spec.state,t))}))},dn=function(t){this.config=t},fn={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};fn.schema.get=function(){return this.config.schema},fn.plugins.get=function(){return this.config.plugins},dn.prototype.apply=function(t){return this.applyTransaction(t).state},dn.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&hn.splice(e,1)},Object.defineProperties(dn.prototype,fn);var hn=[];function mn(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=mn(o,e,{})),n[r]=o}return n}var vn=function(t){this.props={},t.props&&mn(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:yn("plugin")};vn.prototype.getState=function(t){return t[this.key]};var gn=Object.create(null);function yn(t){return t in gn?t+"$"+ ++gn[t]:(gn[t]=0,t+"$")}var bn=function(t){void 0===t&&(t="key"),this.key=yn(t)};bn.prototype.get=function(t){return t.config.pluginsByKey[this.key]},bn.prototype.getState=function(t){return t[this.key]};var wn={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var kn=/Edge\/(\d+)/.exec(navigator.userAgent),xn=/MSIE \d/.test(navigator.userAgent),Cn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);wn.mac=/Mac/.test(navigator.platform);var Tn=wn.ie=!!(xn||Cn||kn);wn.ie_version=xn?document.documentMode||6:Cn?+Cn[1]:kn?+kn[1]:null,wn.gecko=!Tn&&/gecko\/(\d+)/i.test(navigator.userAgent),wn.gecko_version=wn.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Mn=!Tn&&/Chrome\/(\d+)/.exec(navigator.userAgent);wn.chrome=!!Mn,wn.chrome_version=Mn&&+Mn[1],wn.safari=!Tn&&/Apple Computer/.test(navigator.vendor),wn.ios=wn.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),wn.android=/Android \d/.test(navigator.userAgent),wn.webkit="webkitFontSmoothing"in document.documentElement.style,wn.webkit_version=wn.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Sn=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},En=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Nn=null,On=function(t,e,n){var r=Nn||(Nn=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Dn=function(t,e,n,r){return n&&(Ln(t,e,n,r,-1)||Ln(t,e,n,r,1))},An=/^(img|br|input|textarea|hr)$/i;function Ln(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:In(t))){var i=t.parentNode;if(1!=i.nodeType||Rn(t)||An.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Sn(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?In(t):0}}}function In(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Rn(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Pn=function(t){var e=t.isCollapsed;return e&&wn.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Bn(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Hn(t,e){return"number"==typeof t?t:t[e]}function zn(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function jn(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=En(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?Fn(i):zn(s),l=0,u=0;if(e.topc.bottom-Hn(r,"bottom")&&(u=e.bottom-c.bottom+Hn(o,"bottom")),e.leftc.right-Hn(r,"right")&&(l=e.right-c.right+Hn(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var f=s.scrollLeft-p,h=s.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(a)break}}function _n(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=En(t));return e}function qn(t,e){for(var n=0;n=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var f=d.left>e.left?d.left-e.left:d.right=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:$n(n,r)}function Un(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Wn(t,e,n){var r=t.childNodes.length;if(r&&n.tope.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=$n(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:l,inside:m?m.posAtStart-m.border:-1}}function Gn(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Kn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Zn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=wn.webkit||wn.gecko;if(3==o.nodeType){if(!s||!Kn.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==o.nodeValue.length?(a--,l=1):n<0?a--:c++,Xn(Gn(On(o,a,c),l),l<0)}var u=Gn(On(o,i,i),n);if(wn.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(i&&(n<0||i==In(o))){var m=o.childNodes[i-1],v=3==m.nodeType?On(m,In(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return Xn(Gn(v,1),!1)}if(i=0)}function Xn(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Qn(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Yn(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var tr=/[\u0590-\u08ac]/;var er=null,nr=null,rr=!1;function or(t,e,n){return er==e&&nr==n?rr:(er=e,nr=n,rr="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return Yn(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Zn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=On(s,0,s.nodeValue.length).getClientRects()}for(var c=0;cl.top&&("up"==n?l.bottomi.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return tr.test(r.parent.textContent)&&a.modify?Yn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var ir=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},sr={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};ir.prototype.matchesWidget=function(){return!1},ir.prototype.matchesMark=function(){return!1},ir.prototype.matchesNode=function(){return!1},ir.prototype.matchesHack=function(){return!1},sr.beforePosition.get=function(){return!1},ir.prototype.parseRule=function(){return null},ir.prototype.stopEvent=function(){return!1},sr.size.get=function(){for(var t=0,e=0;eSn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},ir.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},ir.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},ir.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},ir.prototype.descAt=function(t){for(var e=0,n=0;e=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},ir.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Sn(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var d=s+1;da&&ie){var b=u;u=p,p=b}var w=document.createRange();w.setEnd(p.node,p.offset),w.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(w)}}},ir.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},sr.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},ir.prototype.markDirty=function(t,e){for(var n=0,r=0;r=n:tn){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},ir.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty0&&(i=Er(i,0,t,r));for(var a=0;ai;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c=0&&!a&&s.syncToMarks(i==n.node.childCount?v.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(ar,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),vr(this.contentDOM,this.children,t),wn.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof Qe)||re+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=In(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new lr(this,i,n,o);t.compositionNodes.push(s),this.children=Er(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!Cr(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=wr(this.dom,this.nodeDOM,br(this.outerDeco,this.node,e),br(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(ir);function dr(t,e,n,r,o){return xr(r,e,t),new pr(null,t,e,n,r,r,r,o,0)}var fr=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(pr),hr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ir),mr=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(pr);function vr(t,e,n){for(var r=t.firstChild,o=!1,i=0;i0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Sr(t,e){return t.type.side-e.type.side}function Er(t,e,n,r,o){for(var i=[],s=0,a=0;s=n||u<=e?i.push(c):(ln&&i.push(c.slice(n-l,c.size,r)))}return i}function Nr(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,l=r.resolve(s);if(Pn(n)){for(a=l;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&tn.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==In(t);r||o;){if(t==n)return!0;var i=Sn(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==In(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;c=new tn(s==u?l:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;a=r.resolve(p)}c||(c=Fr(t,a,l,"pointer"==e||t.state.selection.head>1,i=Math.min(o,t.length);r-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=ur.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},Mr.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ke.findFrom(s,e)}function jr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _r(t,e,n){var r=t.state.selection;if(!(r instanceof Qe)){if(r instanceof tn&&r.node.isInline)return jr(t,new Qe(e>0?r.$to:r.$from));var o=zr(t.state,e);return!!o&&jr(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=zr(t.state,e);return!!(i&&i instanceof tn)&&jr(t,i)}if(!(wn.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var l=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM)&&(tn.isSelectable(c)?jr(t,new tn(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!wn.webkit&&jr(t,new Qe(t.state.doc.resolve(e<0?l:l+c.nodeSize))))}}function qr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Vr(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function $r(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(wn.gecko&&1==n.nodeType&&r0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Vr(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Wr(n))break;for(var c=n.previousSibling;c&&Vr(c);)o=n.parentNode,i=Sn(c),c=c.previousSibling;if(c)r=qr(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Jr(t,e,n,r):o&&Jr(t,e,o,i)}}function Ur(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=qr(n);;)if(r-1)return!1;if(wn.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=zr(t.state,e);if(s&&s instanceof tn)return jr(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof nn?Ke.near(a,e):Ke.findFrom(a,e);return!!c&&jr(t,c)}return!1}function Kr(t,e){if(!(t.state.selection instanceof Qe))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function Zr(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xr(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||wn.mac&&72==n&&"c"==r?Kr(t,-1)||$r(t):46==n||wn.mac&&68==n&&"c"==r?Kr(t,1)||Ur(t):13==n||27==n||(37==n?_r(t,-1,r)||$r(t):39==n?_r(t,1,r)||Ur(t):38==n?Gr(t,-1,r)||$r(t):40==n?function(t){if(wn.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;Zr(t,o,!0),setTimeout((function(){return Zr(t,o,!1)}),20)}}}(t)||Gr(t,1,r)||Ur(t):r==(wn.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Qr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(wn.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||wn.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Yr(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,s=Nr(t,i);if(s&&!t.state.selection.eq(s)){var a=t.state.tr.setSelection(s);"pointer"==i?a.setMeta("pointer",!0):"key"==i&&a.scrollIntoView(),t.dispatch(a)}}else{var c=t.state.doc.resolve(e),l=c.sharedDepth(n);e=c.before(l+1),n=t.state.doc.resolve(n).after(l+1);var u=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Pn(l)||u.push({node:l.focusNode,offset:l.focusOffset})),wn.chrome&&8===t.lastKeyCode)for(var d=s;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){s=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||ut.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Qr,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(wn.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100=a?i-r:0)+(c-a),a=i}else if(c=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((wn.ios&&t.lastIOSEnter>Date.now()-225||wn.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})))return void(t.lastIOSEnter=0);if(d.sel){var w=to(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:u.from,endA:u.to,endB:u.to}}t.domChangeCount++,t.state.selection.fromt.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),wn.ie&&wn.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&" "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((wn.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!T&&x.posb.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||eo(r,!0,!1)n||eo(s,!0,!1)e.content.size?null:Fr(t,e.resolve(n.anchor),e.resolve(n.head))}function eo(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function no(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||kt.fromSchema(t.state.schema),c=uo(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=co[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=c.createElement(u[d]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function ro(t,e,n,r,o){var i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||a||!n);if(c){if(t.someProp("transformPastedText",(function(t){e=t(e,a||r)})),a)return new y(p.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?s=l:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/^(\s* ]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=uo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&co[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return""+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i=0;a-=2){var c=r.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;o=p.from(c.create(n[a+1],o)),i++,s++}return new y(o,i,s)}(function(t,e,n){e=0;r--){var o=n(r);if(o)return o.v}return t}(s.content,o),!1),t.someProp("transformPasted",(function(t){s=t(s)})),s}function oo(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,p.from(t));return t}function io(t,e,n,r,o){if(o=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(p.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}var co={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},lo=null;function uo(){return lo||(lo=document.implementation.createHTMLDocument("title"))}var po={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fo=wn.ie&&wn.ie_version<=11,ho=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};ho.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},ho.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var mo=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;et.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new ho,fo&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};mo.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},mo.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},mo.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,po),fo&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},mo.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Hr(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(vo)return;vo=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&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.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Dr(this.view),this.currentSelection.set(e))}},mo.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;ri.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function To(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Mo(t,e,n,r,o){return Co(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof tn&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(tn.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(To(t,tn.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&tn.isSelectable(r))&&(To(t,new tn(n),"pointer"),!0)}(t,n))}function So(t,e,n,r){return Co(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function Eo(t,e,n,r){return Co(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(To(t,Qe.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)To(t,Qe.create(n,s+1,s+1+i.content.size),"pointer");else{if(!tn.isSelectable(i))continue;To(t,tn.create(n,s),"pointer")}return!0}}(t,n)}function No(t){return Po(t)}yo.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!Ao(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!wn.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Xr(t,e)?e.preventDefault():bo(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},yo.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},yo.keypress=function(t,e){if(!(Ao(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||wn.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof Qe&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var Oo=wn.mac?"metaKey":"ctrlKey";go.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=No(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[Oo]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(xo(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Do(t,i,e,n)):("doubleClick"==o?So:Eo)(t,i.pos,i.inside,e)?e.preventDefault():bo(t,"pointer"))};var Do=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Oo],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null;var u=t.state.selection;(o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof tn&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&wn.gecko&&!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((function(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),bo(t,"pointer")};function Ao(t,e){return!!t.composing||!!(wn.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Do.prototype.done=function(){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.view.mouseDown=null},Do.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(xo(t))),this.allowDefault||!e?bo(this.view,"pointer"):Mo(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||wn.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||wn.chrome&&!(this.view.state.selection instanceof Qe)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2?(To(this.view,Ke.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):bo(this.view,"pointer")}},Do.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),bo(this.view,"pointer"),0==t.buttons&&this.done()},go.touchdown=function(t){No(t),bo(t,"pointer")},go.contextmenu=function(t){return No(t)};var Lo=wn.android?5e3:-1;function Io(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Po(t)}),e))}function Ro(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Po(t,e){if(t.domObserver.forceFlush(),Ro(t),e||t.docView.dirty){var n=Nr(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}yo.compositionstart=yo.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Po(t,!0),t.markCursor=null;else if(Po(t),wn.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Io(t,Lo)},yo.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Io(t,20))};var Bo=wn.ie&&wn.ie_version<15||wn.ios&&wn.webkit_version<604;function Fo(t,e,n,r){var o=ro(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||y.empty)})))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}go.copy=yo.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Bo?null:e.clipboardData,i=no(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},yo.paste=function(t,e){var n=Bo?null:e.clipboardData;n&&Fo(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Fo(t,r.value,null,e):Fo(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Ho=function(t,e){this.slice=t,this.move=e},zo=wn.mac?"altKey":"ctrlKey";for(var jo in go.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(xo(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof tn?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=no(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Bo?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",Bo||e.dataTransfer.setData("text/plain",l),t.dragging=new Ho(s,!e[zo])}},go.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},yo.dragover=yo.dragenter=function(t,e){return e.preventDefault()},yo.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(xo(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=ro(t,e.dataTransfer.getData(Bo?"Text":"text/plain"),Bo?null:e.dataTransfer.getData("text/html"),!1,o);var s=n&&!e[zo];if(t.someProp("handleDrop",(function(n){return n(t,e,i||y.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?function(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var l=c.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=c.doc;if(u?c.replaceRangeWith(l,l,i.content.firstChild):c.replaceRange(l,l,i),!c.doc.eq(p)){var d=c.doc.resolve(l);if(u&&tn.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new tn(d));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Fr(t,d,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},go.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Dr(t)}),20))},go.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},go.beforeinput=function(t,e){if(wn.chrome&&wn.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Bn(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},yo)go[jo]=yo[jo];function _o(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var qo=function(t,e){this.spec=e||Go,this.side=this.spec.side||0,this.toDOM=t};qo.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Uo(i-n,i-n,this)},qo.prototype.valid=function(){return!0},qo.prototype.eq=function(t){return this==t||t instanceof qo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&_o(this.spec,t.spec))};var Vo=function(t,e){this.spec=e||Go,this.attrs=t};Vo.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Uo(o,i,this)},Vo.prototype.valid=function(t,e){return e.from=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;at){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Ko.prototype.map=function(t,e,n){return this==Zo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Go)},Ko.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;sc+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(l=r-n-(e-t))&&(a[s]+=l,a[s+1]+=l))}},l=0;l=r.content.size){u=!0;continue}var h=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=a[p+2].mapInner(n,y,d+1,t[p]+i+1,s);b!=Zo?(a[p]=f,a[p+1]=h,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var w=ei(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;is&&l.to=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;ai&&c.type instanceof Vo){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;ln&&s.to0;)e++;t.splice(e,0,n)}function ii(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Zo&&e.push(r)})),t.cursorWrapper&&e.push(Ko.create(t.state.doc,[t.cursorWrapper.deco])),Xo.from(e)}Xo.prototype.forChild=function(t,e){if(e.isLeaf)return Ko.empty;for(var n=[],r=0;rr.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,c,a);!u&&t.selection.eq(r.selection)||(i=!0);var p,d,f,h,m,v,g,y,b,w,k,x="preserve"==l&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:_n(t.dom)}}(this);if(i){this.domObserver.stop();var C=u&&(wn.ie||wn.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(h=r.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(u){var T=wn.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=dr(t.doc,c,a,this.dom,this)),T&&!this.trackWrites&&(C=!0)}C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(p=this,d=p.docView.domFromPos(p.state.selection.anchor,0),f=p.root.getSelection(),Dn(d.node,d.offset,f.anchorNode,f.anchorOffset)))?Dr(this,C):(Pr(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==l)this.dom.scrollTop=0;else if("to selection"==l){var M=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof tn?jn(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),M):jn(this,this.coordsAtPos(t.selection.head,1),M))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,qn(w,0==k?0:k-b))},si.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},si.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},hi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),mi="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),vi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),gi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),yi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),bi=hi&&(gi||+hi[1]<57)||vi&&gi,wi=0;wi<10;wi++)di[48+wi]=di[96+wi]=String(wi);for(wi=1;wi<=24;wi++)di[wi+111]="F"+wi;for(wi=65;wi<=90;wi++)di[wi]=String.fromCharCode(wi+32),fi[wi]=String.fromCharCode(wi);for(var ki in di)fi.hasOwnProperty(ki)||(fi[ki]=di[ki]);var xi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function Ci(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a127)&&(r=di[n.keyCode])&&r!=o){var a=e[Ti(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[Ti(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}function Ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Di(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){var n=t.node(e);if(t.index(e)+1=0;u--)l=p.from(r[u].create(null,l));l=p.from(i.copy(l));var d=t.tr.step(new Ee(e.pos-1,c,e.pos,c,new y(l,1,0),r.length,!0)),f=c+2*r.length;Ie(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=Ke.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),v=m&&De(m);if(null!=v&&v>=e.depth)return n&&n(t.tr.lift(m,v).scrollIntoView()),!0;if(a&&s.isTextblock&&Ni(i,"end")){for(var g=i,b=[];b.push(g),!g.isTextblock;)g=g.lastChild;if(g.canReplace(g.childCount,g.childCount,s.content)){if(n){for(var w=p.empty,k=b.length-1;k>=0;k--)w=p.from(b[k].copy(w));n(t.tr.step(new Ee(e.pos-b.length,e.pos+s.nodeSize,e.pos+1,e.pos+s.nodeSize-1,new y(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Hi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&function(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c0))return!1;var o=Oi(r);if(!o){var i=r.blockRange(),s=i&&De(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Fi(t,o,e))return!0;if(0==r.parent.content.size&&(Ni(a,"end")||tn.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Ni(a,"end")?Ke.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):tn.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Oi(o)}var s=i&&i.nodeBefore;return!(!s||!tn.isSelectable(s))&&(e&&e(t.tr.setSelection(tn.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)})),Vi=_i(Ei,Di,(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset1&&n.after()!=n.end(-1)){var r=n.before();if(Le(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&De(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),Pi),"Mod-Enter":Ri,Backspace:qi,"Mod-Backspace":qi,Delete:Vi,"Mod-Delete":Vi,"Mod-a":Bi},Ui={"Ctrl-h":$i.Backspace,"Alt-Backspace":$i["Mod-Backspace"],"Ctrl-d":$i.Delete,"Ctrl-Alt-Backspace":$i["Mod-Delete"],"Alt-Delete":$i["Mod-Delete"],"Alt-d":$i["Mod-Delete"]};for(var Wi in $i)Ui[Wi]=$i[Wi];var Ji=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Ui:$i,Gi=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Ki(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l=e?Xi.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Xi.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Xi.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Xi.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Xi.from=function(t){return t instanceof Xi?t:t&&t.length?new Qi(t):Xi.empty};var Qi=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Zi)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Zi)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Xi);Xi.empty=new Qi([]);var Yi=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return to&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Xi),ts=Xi,es=function(t,e){this.items=t,this.eventCount=e};es.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new ns(t.map));var p,d=t.step.map(r.slice(o));d&&c.maybeStep(d).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new ns(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new es(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},es.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;cis&&(f=m,(d=s).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),s=d.slice(h),i-=m),new es(s.append(o),i)},es.prototype.remapping=function(t,e){var n=new ye;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},es.prototype.addMaps=function(t){return 0==this.eventCount?this:new es(this.items.append(t.map((function(t){return new ns(t)}))),this.eventCount)},es.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new ns(c,l,u))}else n.push(new ns(c))}}),r);for(var c=[],l=e;l500&&(p=p.compress(this.items.length-n.length)),p},es.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},es.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new ns(c.invert(),a,l),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new es(ts.from(r.reverse()),o)},es.empty=new es(ts.empty,0);var ns=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};ns.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new ns(e.getMap().invert(),e,this.selection)}};var rs=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},is=20;function ss(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function as(t,e){if(!t)return null;for(var n=[],r=0;r=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?as(t.prevRanges,n.mapping):ss(n.mapping.maps[n.steps.length-1]);return new rs(t.done.addTransform(n,a?e.selection.getBookmark():null,r,ps(e)),es.empty,c,n.time)}(n,r,e,t)}},config:t})}function ms(t,e){var n=ds.getState(t);return!(!n||0==n.done.eventCount)&&(e&&cs(n,t,e,!1),!0)}function vs(t,e){var n=ds.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&cs(n,t,e,!0),!0)}function gs(t,e){var n=t.nodes.paragraph;return e?n.create(null,Pt()(e)?t.text(e):e):n.createAndFill()}function ys(t,e,n){return t.text(e,n)}function bs(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return Qe.create(t.doc,Math.min(e,o),Math.min(n,o))}function ws(t,e,n){var r=e.pos;return t.replaceWith(r,r,gs(n)),t.setSelection(bs(t,r+1))}function ks(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,s=e.tr,a=e.doc,c=e.schema,l=r;l<=o;l+=1){var u=a.child(l),d=u.nodeSize,f=u.textContent,h=u.content,m=i(f),v=m?ys(c,m):p.empty,g=s.mapping.map(n),y=g+h.size;s.replaceWith(g,y,v),n+=d}return s}function xs(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(bs(t,t.mapping.map(e)-o))}function Cs(t){return t.sourcepos[0][0]}function Ts(t){return t.sourcepos[1][0]}function Ms(t){return t.sourcepos[0][1]}function Ss(t){return t.sourcepos[1][1]}function Es(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Ns(t){return t&&("item"===t.type||"list"===t.type)}function Os(t){return Ns(t)&&"ordered"===t.listData.type}function Ds(t){return Ns(t)&&"ordered"!==t.listData.type}function As(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function Ls(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function Is(t,e){return[t[0],t[1]+e]}function Rs(t,e){return[t[0],e]}function Ps(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function Bs(t){switch(t.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 Fs(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var Hs=[],zs={},js=/\$\$widget\d+\s/;function _s(t){var e=t.search(js);if(-1!==e){var n=t.substring(e).replace(js,"").replace("$$","");t=t.substring(0,e),t+=_s(n)}return t}function qs(t,e){return"$$"+t+" "+e+"$$"}function Vs(t,e){var n=zs[t],r=n.rule;return(0,n.toDOM)(e=_s(e).match(r)[0])}function $s(){return Hs}function Us(t){(Hs=t).forEach((function(t,e){zs["widget"+e]=t}))}function Ws(t,e,n,r){return t.concat(Js(e,n,r))}function Js(t,e,n){void 0===n&&(n=0);var r=[],o=(Hs[n]||{}).rule,i=n+1;if(t=_s(t),o&&o.test(t)){for(var s=void 0;-1!==(s=t.search(o));){var a=t.substring(0,s);a&&(r=Ws(r,a,e,i));var c=(t=t.substring(s)).match(o)[0],l="widget"+n;r.push(e.nodes.widget.create({info:l},e.text(qs(l,c)))),t=t.substring(c.length)}t&&(r=Ws(r,t,e,i))}else t&&(r=np){var d=se(c),f=Js(d,i);return s.replaceWith(o-d.length+1,o,f)}return null}))}));return t.length?function(t){var e=t.rules,n=new vn({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Ki(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&Ki(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:t}):null},t.prototype.createSchema=function(){return new ct({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){return t?this.specs.keymaps():[]},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map((function(e){return e(t.eventEmitter)}))},t.prototype.focus=function(){var t=this;setTimeout((function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())}))},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.view.destroy(),Object.keys(this).forEach((function(e){delete t[e]}))},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),pa=n(294),da=n.n(pa);function fa(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var ha=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter((function(t){return"node"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter((function(t){return"mark"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter((function(t){return t.commands})).reduce((function(e,n){var r={},i=n.commands();return da()(i)?r[n.name]=function(e){return fa(t,i,e)}:Object.keys(i).forEach((function(e){r[e]=function(n){return fa(t,i[e],n)}})),o(o({},e),r)}),{}),r=Ks();return Object.keys(r).forEach((function(e){n[e]=function(n){return fa(t,r[e],n)}})),e&&Object.keys(e).forEach((function(r){n[r]=function(n){return fa(t,e[r],n)}})),n},t.prototype.keymaps=function(){return this.specs.filter((function(t){return t.keymaps})).map((function(t){return t.keymaps()})).map((function(t){return Mi(t)}))},t.prototype.setContext=function(t){this.specs.forEach((function(e){e.setContext(t)}))},t}(),ma=n(322),va=n.n(ma),ga=n(714),ya=n.n(ga),ba=n(471),wa=n.n(ba),ka="[A-Za-z][A-Za-z0-9-]*",xa="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ca="<("+ka+")("+xa+")*\\s*/?>",Ta="(?:"+Ca+"|([A-Za-z][A-Za-z0-9-]*)\\s*[>])",Ma=new RegExp("^"+Ta,"i"),Sa=/ /i,Ea="";function Na(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),s=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+s}var Oa="toastui-editor-";function Da(){for(var t=[],e=0;e ?/,wc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("block-quote")},0]}}},enumerable:!1,configurable:!0}),n.prototype.createBlockQuoteText=function(t,e){return e?t.replace(bc,"").trim():"> "+t.trim()},n.prototype.extendBlockQuote=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,s=e.schema,a=Wa(r),c=a.endFromOffset,l=a.endToOffset,u=a.endIndex,p=a.to,d=yc(o,u);if(bc.test(d)&&p>c&&r.empty){if(!d.replace(bc,"").trim())i.deleteRange(c,l).split(i.mapping.map(l));else{var f=d.slice(p-c).trim();xs(i,l,f,ys(s,t.createBlockQuoteText(f)))}return n(i),!0}return!1}},n.prototype.commands=function(){var t=this;return function(){return function(e,n){var r=e.selection,o=e.doc,i=Wa(r),s=i.startFromOffset,a=i.endToOffset,c=i.startIndex,l=i.endIndex,u=bc.test(yc(o,c)),p=ks({state:e,startIndex:c,endIndex:l,from:s,createText:function(e){return t.createBlockQuoteText(e,u)}});return n(p.setSelection(bs(p,p.mapping.map(a)))),!0}}},n.prototype.keymaps=function(){var t=this.commands()();return{"alt-q":t,"alt-Q":t,Enter:this.extendBlockQuote()}},n}(vc),kc=/(^\s*)([-*+] |[\d]+\. )/,xc=/(^\s*)([\d])+\.( \[[ xX]])? /,Cc=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Tc=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Mc=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,Sc=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Ec=/(^\s*)([-*+])( \[[ xX]]) /;function Nc(t){return xc.test(t)?"ordered":"bullet"}function Oc(t){for(var e=0;t&&"document"!==t.type;)"list"===t.type&&(e+=1),t=t.parent;return e}function Dc(t,e,n,r){for(var o=t.getLineTexts().length,i=[],s=e;r?s1;){s=r?s+1:s-1;var a=t.findFirstNodeAtLine(s),c=Oc(a);if(c===n)i.push({line:s,depth:n,mdNode:a});else if(c0;l-=1){var u=e.findFirstNodeAtLine(l),p=gc(n,l)&&!!Ls(u,(function(t){return Ns(t)})),d=Cc.exec(gc(n,l));if(!d&&!p)break;if(d||!p){var f=d,h=f[1],m=f[3];if(!h){s=Number(m),a=l;break}}else c+=1}return{changedResults:[{text:s+r-a-c+". "+i,line:r}]}},task:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* [ ] "+gc(e,n),line:n}]}}},Pc={bullet:function(t){var e=t.line,n=gc(t.doc,e),r=Mc.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(t){var e=t.toastMark,n=t.line,r=t.mdNode,i=t.doc,s=Oc(r),a=gc(i,n),c=Cc.exec(a),l=c[1],u=c[3],p=c[4],d=Number(u)+1,f=""+l+d+p,h=Dc(e,n,s,!0).filter((function(t){var e=Cc.exec(gc(i,t.line));return e&&e[1].length===l.length&&!!Ls(t.mdNode,(function(t){return Os(t)}))}));return o({listSyntax:f},Ac(i,h,"ordered",d))}};function Bc(t,e,n,r,o){for(var i=[],s=gc(t,n),a=Cc.exec(s);a;){var c=a[1],l=a[4],u=a[5],p=c.length;if(p===o)i.push(ys(e,""+c+r+l+u)),r+=1,n+=1;else if(p>o){var d=Bc(t,e,n,1,p);n=d.line,i=i.concat(d.nodes)}if(pt.childCount)break;s=gc(t,n),a=Cc.exec(s)}return{nodes:i,line:n}}var Fc=/(^\s{1,4})(.*)/;function Hc(t,e,n){return t0){var u=r.child(l-1),p=u.nodeSize,d=u.textContent;return n.delete(a-p,a).split(n.mapping.map(c)).insert(n.mapping.map(c),ys(i,d)),e(n),!0}return!1}},n.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},n.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()}},n}(sa),qc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),n}(sa),Vc=/^#{1,6}\s/,$c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(t){var e=t.attrs,n="heading|heading"+e.level;return e.seText&&(n+="|delimiter|setext"),["span",{class:Aa.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.createHeadingText=function(t,e,n){for(var r=e.replace(n,"").trim(),o="";t>0;)o+="#",t-=1;return o+" "+r},n.prototype.commands=function(){var t=this;return function(e){return function(n,r){var o=e.level,i=Wa(n.selection),s=i.startFromOffset,a=i.endToOffset,c=ks({state:n,from:s,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(e){var n=e.match(Vc),r=n?n[0]:"";return t.createHeadingText(o,e,r)}});return r(c.setSelection(bs(c,c.mapping.map(a)))),!0}}},n}(vc),Uc="```",Wc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("code-block")},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=Wa(n),s=i.startFromOffset,a=i.endToOffset,c=ys(r,Uc);return o.insert(s,c).split(s+Uc.length),o.split(o.mapping.map(a)).insert(o.mapping.map(a),c),e(o.setSelection(bs(o,o.mapping.map(a)-(Uc.length+2)))),!0}}},n.prototype.keepIndentation=function(){var t=this;return function(e,n){var r=e.selection,o=e.tr,i=e.doc,s=e.schema,a=t.context.toastMark,c=Wa(r),l=c.startFromOffset,u=c.endToOffset,p=c.endIndex,d=c.from,f=c.to,h=yc(i,p);if(d===f&&h.trim()){var m=h.match(/^\s+/);if(function(t){return t&&"codeBlock"===t.type}(a.findFirstNodeAtLine(p+1))&&m){var v=m[0],g=h.slice(f-l);return xs(o,u,g,ys(s,v+g)),n(o),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,Enter:this.keepIndentation()}},n}(vc),Jc=/\||\s/g;function Gc(t,e){for(var n="|",r=0;r/g,encoded:"%3E",escaped:"\\>"},{regExp:/ /g,encoded:"%20",escaped:" "}];function ll(t){return cl.reduce((function(t,e){var n=e.regExp,r=e.escaped;return t.replace(n,r)}),t)}var ul=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(t){var e=t.attrs,n="link";return e.url&&(n+="|link-url|marked-text"),e.desc&&(n+="|link-desc|marked-text"),["span",{class:Aa.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.addLinkOrImage=function(t){return function(e){return function(n,r){var o=n.selection,i=n.tr,s=n.schema,a=ja(o),c=a[0],l=a[1],u=e,p=u.linkText,d=u.altText,f=u.linkUrl,h=u.imageUrl,m=p,v=f,g="";return"image"===t&&(m=d,v=h,g="!"),g+="["+(m=ll(m))+"]("+(v=function(t){return cl.reduce((function(t,e){var n=e.regExp,r=e.encoded;return t.replace(n,r)}),t)}(v))+")",r(i.replaceWith(c,l,ys(s,g))),!0}}},n.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},n}(vc),pl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),n}(vc),dl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("delimiter")},0]}}},enumerable:!1,configurable:!0}),n}(vc),fl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("meta")},0]}}},enumerable:!1,configurable:!0}),n}(vc),hl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("marked-text")},0]}}},enumerable:!1,configurable:!0}),n}(vc),ml=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("table-cell")},0]}}},enumerable:!1,configurable:!0}),n}(vc),vl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("html")},0]}}},enumerable:!1,configurable:!0}),n}(vc),gl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("custom-block")},0]}}},enumerable:!1,configurable:!0}),n}(vc),yl=/x|backspace/i,bl=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;var wl="cut",kl=/\r\n|\n|\r/,xl=function(t){function n(e,n){var r=t.call(this,e)||this,i=n.toastMark,s=n.useCommandShortcut,a=void 0===s||s,c=n.mdPlugins,l=void 0===c?[]:c;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=i,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(a),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(o(o({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",(function(t){return r.toggleActive(!0,t)})),r.eventEmitter.listen("changePreviewTabPreview",(function(){return r.toggleActive(!1)})),r.initEvent(),r}return e(n,t),n.prototype.toggleActive=function(t,e){Ra(this.el,"active",t),t?e||this.focus():this.blur()},n.prototype.createClipboard=function(){var t=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Da("pseudo-clipboard"),this.clipboard.addEventListener("paste",(function(e){var n=e.clipboardData||window.clipboardData,r=n&&n.items;if(r){var o=oa(r);o&&(e.preventDefault(),ra(t.eventEmitter,o,e.type))}})),this.clipboard.addEventListener("input",(function(e){var n=e.target.value;t.replaceSelection(n),e.preventDefault(),e.target.value=""})),this.el.insertBefore(this.clipboard,this.view.dom)},n.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},n.prototype.createSpecs=function(){return new ha([new mc,new _c,new la,new qc,new $c,new wc,new Wc,new gl,new Kc,new ml,new Zc,new Qc,new el,new rl,new il,new al,new ul,new dl,new pl,new hl,new fl,new vl])},n.prototype.createPlugins=function(){return this.defaultPlugins.concat(i([uc(this.context),hc(this.context),(t=this.context,e=t.schema,n=t.toastMark,new vn({props:{handleDOMEvents:{keyup:function(t,r){var o,i=t.state,s=i.doc,a=i.tr,c=i.selection;if(c.empty&&yl.test(r.key)){var l=Wa(c),u=l.startIndex,p=l.startFromOffset,d=[u+1,l.from-p+1],f=Ls(n.findNodeAtPosition(d),(function(t){var e;return"paragraph"===t.type&&"item"===(null===(e=t.parent)||void 0===e?void 0:e.type)}));if(null===(o=null==f?void 0:f.firstChild)||void 0===o?void 0:o.literal){var h=f.firstChild,m=h.literal.match(bl);if(m){var v=h.sourcepos[0],g=m[1],y=m[2],b=m[3],w=g.length+b.length,k=Ja(s,v[0]-1).startOffset,x=v[1]+k;if(y){var C=w?w+1:0;a.replaceWith(x,C+x,e.text(y)),t.dispatch(a)}else w||(a.insertText(" ",x),t.dispatch(a))}}}return!1}}}}))],this.createPluginProps()));var t,e,n},n.prototype.createView=function(){var t=this;return new si(this.el,{state:this.createState(),dispatchTransaction:function(e){t.updateMarkdown(e);var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e)},handleKeyDown:function(e,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&t.clipboard.focus(),t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{copy:function(e,n){return t.captureCopy(n)},cut:function(e,n){return t.captureCopy(n,wl)},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1}},nodeViews:{widget:aa}})},n.prototype.createCommands=function(){return this.specs.commands(this.view)},n.prototype.captureCopy=function(t,e){t.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return t.clipboardData?t.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),e===wl&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",wl)),!0},n.prototype.updateMarkdown=function(t){var e=this;t.docChanged&&t.steps.forEach((function(n,r){if(n.slice&&!(n instanceof Ee)){var o=t.docs[r],i=[n.from,n.to],s=Va(o,i[0],i[1]),a=s[0],c=s[1],l=e.getChanged(n.slice);a[0]===c[0]&&a[1]===c[1]&&""===l&&(l="\n");var u=e.toastMark.editMarkdown(a,c,l);e.eventEmitter.emit("updatePreview",u),t.setMeta("editResult",u).scrollIntoView()}}))},n.prototype.getChanged=function(t){var e="",n=t.content.size;return t.content.nodesBetween(0,n,(function(t,r){t.isText?e+=t.text.slice(Math.max(0,r)-r,n-r):t.isBlock&&r>0&&(e+="\n")})),e},n.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=Ua(n.doc,t,e),o=r[0],i=r[1];this.view.dispatch(n.setSelection(bs(n,o,i)).scrollIntoView())},n.prototype.replaceSelection=function(t,e,n){var r,o=this.view.state,i=o.tr,s=o.schema,a=o.doc,c=t.split(kl).map((function(t){return gs(s,Js(t,s))})),l=new y(p.from(c),1,1);if(this.focus(),e&&n){var u=Ua(a,e,n),d=u[0],f=u[1];r=i.replaceRange(d,f,l)}else r=i.replaceSelection(l);this.view.dispatch(r.scrollIntoView())},n.prototype.deleteSelection=function(t,e){var n,r=this.view.state,o=r.tr,i=r.doc;if(t&&e){var s=Ua(i,t,e),a=s[0],c=s[1];n=o.deleteRange(a,c)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},n.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;if(t&&e){var a=Ua(r,t,e);i=a[0],s=a[1]}return r.textBetween(i,s,"\n")},n.prototype.getSelection=function(){var t=this.view.state.selection,e=t.from,n=t.to;return Va(this.view.state.tr.doc,e,n)},n.prototype.setMarkdown=function(t,e){void 0===e&&(e=!0);var n=t.split(kl),r=this.view.state,o=r.tr,i=r.doc,s=r.schema,a=n.map((function(t){return gs(s,Js(t,s))}));this.view.dispatch(o.replaceWith(0,i.content.size,a)),e&&this.moveCursorToEnd(!0)},n.prototype.addWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.doc,s=r.selection,a=n?Ua(i,n,n)[0]:s.to;this.view.dispatch(o.setMeta("widget",{pos:a,node:t,style:e}))},n.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.schema,s=Ua(r.doc,t,e),a=Js(n,i);this.view.dispatch(o.replaceWith(s[0],s[1],a))},n.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t||Va(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}},n.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map((function(t){return _s(t)})).join("\n")},n.prototype.getToastMark=function(){return this.toastMark},n}(ua),Cl=n(349),Tl=n.n(Cl),Ml=n(348),Sl=n.n(Ml),El=function(t,e){return(El=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Nl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}El(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ol=function(){return(Ol=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1=56320&&s<=57343){c+=encodeURIComponent(t[r]+t[r+1]),r++;continue}c+="%EF%BF%BD"}else c+=encodeURIComponent(t[r]);return c}Il.defaultChars=";/?:@&=+$,-_.!~*'()#",Il.componentChars="-_.!~*'()";var Rl=Il,Pl={},Bl={},Fl={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:""},Hl={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:"ÿ"},zl={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},jl={},_l=Al&&Al.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jl,"__esModule",{value:!0});var ql=_l({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}),Vl=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t)};jl.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in ql.default&&(t=ql.default[t]),Vl(t))};var $l=Al&&Al.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.decodeHTML=Bl.decodeHTMLStrict=Bl.decodeXML=void 0;var Ul=$l(Fl),Wl=$l(Hl),Jl=$l(zl),Gl=$l(jl),Kl=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function Zl(t){var e=Ql(t);return function(t){return String(t).replace(Kl,e)}}Bl.decodeXML=Zl(Jl.default),Bl.decodeHTMLStrict=Zl(Ul.default);var Xl=function(t,e){return t1?uu(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var du=new RegExp(nu.source+"|"+lu.source,"g");function fu(t){return function(e){return e.replace(du,(function(e){return t[e]||pu(e)}))}}Yl.escape=function(t){return t.replace(du,pu)},Yl.escapeUTF8=function(t){return t.replace(nu,pu)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=Bl,n=Yl;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=Yl;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=Bl;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(Pl);var hu="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",mu=/[\\&]/,vu="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",gu=new RegExp("\\\\"+vu+"|"+hu,"gi"),yu=new RegExp('[&<>"]',"g"),bu=function(t){return 92===t.charCodeAt(0)?t.charAt(1):Pl.decodeHTML(t)};function wu(t){return mu.test(t)?t.replace(gu,bu):t}function ku(t){try{return Rl(t)}catch(e){return t}}function xu(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function Cu(t){return yu.test(t)?t.replace(yu,xu):t}function Tu(t,e){for(var n=[],r=0;r`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Yu=""+Xu+"\\s*[>]",tp=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|[A-Za-z][A-Za-z0-9-]*\\s*[>]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i");if(String.fromCodePoint)Zu=function(t){try{return String.fromCodePoint(t)}catch(t){if(t instanceof RangeError)return String.fromCharCode(65533);throw t}};else{var ep=String.fromCharCode,np=Math.floor;Zu=function(){for(var t=[],e=0;e1114111||np(l)!==l)return String.fromCharCode(65533);l<=65535?i.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,i.push(n,r)),(s+1===a||i.length>o)&&(c+=ep.apply(void 0,i),i.length=0)}return c}}var rp=Zu;function op(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r?@\[\]\\^_`{|}~\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]/),gp=new RegExp('^(?:"('+mp+'|[^"\\x00])*"|\'('+mp+"|[^'\\x00])*'|\\(("+mp+"|[^()\\x00])*\\))"),yp=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,bp=new RegExp("^"+vu),wp=new RegExp("^"+hu,"i"),kp=/`+/,xp=/^`+/,Cp=/\.\.\./g,Tp=/--+/g,Mp=/^<([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])?)*)>/,Sp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Ep=/^ *(?:\n *)?/,Np=/^[ \t\n\x0b\x0c\x0d]/,Op=/^\s/,Dp=/ *$/,Ap=/^ */,Lp=/^ *(?:\n|$)/,Ip=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,Rp=/^[^\n`\[\]\\!<&*_'"~$]+/m,Pp=function(){function t(t){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=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos1){var c=ap(a);this.lineIdx+=a.length-1,this.linePosOffset=-(this.pos-c.length-n.length),s[1]=this.sourcepos(this.pos),i=a.join(" ")}var l=$u("code",s);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?l.literal=i.slice(1,i.length-1):l.literal=i,l.tickCount=n.length,t.appendChild(l),!0}return this.pos=o,t.appendChild(Ku(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=$u("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):bp.test(n.charAt(this.pos))?(t.appendChild(Ku(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(Ku("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Mp))?(n=e.slice(1,e.length-1),(r=$u("link",this.sourcepos(o,this.pos))).destination=ku("mailto:"+n),r.title="",r.appendChild(Ku(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Sp))&&(n=e.slice(1,e.length-1),(r=$u("link",this.sourcepos(o,this.pos))).destination=ku(n),r.title="",r.appendChild(Ku(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(tp);if(null===n)return!1;var r=$u("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===dp||t===fp)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(t===pp||t===hp))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":rp(i);var s,a,c=Op.test(r),l=vp.test(r),u=Op.test(o),p=vp.test(o),d=!c&&(!l||u||p),f=!u&&(!p||c||l);return 95===t?(s=d&&(!f||p),a=f&&(!d||l)):t===dp||t===fp?(s=d&&!f,a=f):t===hp?(s=!c,a=!u):(s=d,a=f),this.pos=n,{numdelims:e,canOpen:s,canClose:a}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=Ku(t===dp?"’":t===fp?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==dp&&t!==fp)&&(this.delimiters={cc:t,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},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,s,a,c=!1,l=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,a=!1;null!==n&&n!==t&&n!==l[u][p?r.origdelims%3:0];){if(c=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!c){a=!0;break}n=n.previous}if(o=r,p||u===pp||u===hp)if(a){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,s=r.node;var h=p?1===d?"emph":"strong":"strike";u===hp&&(h="customInline");var m=$u(h),v=i.sourcepos[1],g=s.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,s.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),s.literal=s.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==s;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===hp){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length===x.length+1?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&s.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===dp?(r.node.literal="’",a&&(n.node.literal="‘"),r=r.next):u===fp&&(r.node.literal="”",a&&(n.node.literal="“"),r=r.next);a||(l[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(gp);return null===t?null:wu(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(yp);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&bp.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!==Np.exec(rp(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:ku(wu(t=this.subject.substr(e,this.pos-e)))}return ku(wu(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(Ip);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=Ku("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=Ku("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else{n=Ku("!",this.sourcepos(this.pos,this.pos));t.appendChild(n)}return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(Ku("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(Ku("]",this.sourcepos(o,o))),this.removeBracket(),!0;var s=i.image,a=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(Np.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 c="";if(!r){var l=this.pos,u=this.parseLinkLabel();if(u>2?c=this.subject.slice(l,l+u):i.bracketAfter||(c=this.subject.slice(i.index,o)),0===u&&(this.pos=a),c){c=cp(c);var p=this.refMap[c];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=$u(s?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),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[t.id]={node:t,refLabel:c}),!0}return this.removeBracket(),this.pos=o,t.appendChild(Ku("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:c}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(wp))&&(t.appendChild(Ku(Pl.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(Rp)){if(this.options.smart){var r=e.replace(Cp,"…").replace(Tp,(function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),Tu("—",n)+Tu("–",e)}));t.appendChild(Ku(r,this.sourcepos(n,this.pos)))}else{var o=Ku(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(Dp,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild($u(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild($u("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(Ap),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.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 c=!0;if(null===this.match(Lp)&&(""===n?c=!1:(n="",this.pos=a,c=null!==this.match(Lp))),!c)return this.pos=r,0;var l=cp(i);if(""===l)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=$u("refDef",u);return p.title=n,p.dest=s,p.label=l,t.insertBefore(p),e[l]?this.refDefCandidateMap[p.id]=p:e[l]=Cd(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.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;as&&p.push(Ku(o.substring(s,m[0]),u(s,m[0]-1)));var y=$u("link",u.apply(void 0,m));y.appendChild(Ku(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),s=m[1]+1}s=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(Bp);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},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:{continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(Hp);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&qp(jp(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),s=r.slice(o+1),a=i.match(/^(\s*)(.*)/);e.infoPadding=a[1].length,e.info=wu(a[2].trim()),e.literal=s}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===jp(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&_p(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:$p,customBlock:{continue:function(t,e){var n=t.currentLine,r=n.match(Vp);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&qp(jp(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),s=o.match(/^(\s*)(.*)/);e.info=wu(s[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},frontMatter:$p};function Wp(t){for(var e=0,n=0,r=[],o=0;o|$)/i,/^/,/\?>/,/>/,/\]\]>/],ud=/^[#`~*+_=<>0-9-;$]/,pd=/\r\n|\n|\r/;function dd(){return $u("document",[[1,1],[0,0]])}var fd={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},hd=function(){function t(t){this.options=Ol(Ol({},fd),t),this.doc=dd(),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&&(Up.frontMatter=cd,id.unshift(ad)),this.inlineParser=new Pp(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=Tu(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!Up[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=$u(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],Up[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.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)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),Up[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&Up[e.type].acceptsLines,i=id.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!ud.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var s=0;s=1&&e.htmlBlockType<=5&&ld[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offsete[0]?-1:t[1]e[1]?-1:0}function vd(t,e){var n=t[0];return 1===md(t[1],e)?1:-1===md(n,e)?-1:0}function gd(t,e){for(var n=0,r=e;ne?-1:0}function bd(t,e){for(var n=t.firstChild;n;){var r=yd(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function wd(t){return function(t){return Ou[t]}(t)||null}function kd(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var xd=/\r\n|\n|\r/;function Cd(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var Td=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new hd(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(xd),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,o=t[0],i=t[1],s=e[0],a=e[1],c=n.split(xd),l=c.length,u=this.lineTexts[o-1],p=this.lineTexts[s-1];c[0]=u.slice(0,i-1)+c[0],c[l-1]=c[l-1]+p.slice(a-1);var d=s-o+1;return(r=this.lineTexts).splice.apply(r,Dl([o-1,d],c)),l-d},t.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 t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?(gd(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=bd(this.root,t[0]),r=bd(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach((function(t){t(e)}))},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&(Wu(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return nd.test(n)||rd.test(n)}(this.lineTexts[n-1])||function(t){return"table"===t.type}(t.prev)&&(!_p(o=this.lineTexts[n-1])&&-1!==o.indexOf("|")))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),s=this.parser.partialParseStart(n,i),a=e?e.next:this.root.firstChild,c=s.lastChild,l=c&&Uu(c)&&c.open,u=c&&Gu(c)&&c.open,p=c&&Wu(c);(l||u)&&a||p&&a&&("list"===a.type||a.sourcepos[0][1]>=2);){var d=this.extendEndLine(a.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=a,r=d,a=a.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(s),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&Ju(t)||e&&Ju(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!up(this.refMap)){var r=function(t){if(Ju(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&kd(r,t.parent,e),e&&kd(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!up(this.refMap)){var n=function(t){if(Ju(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=Cd(t))}};t.forEach((function(t){kd(n,t)}))}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;up(this.refDefCandidateMap)||lp(this.refDefCandidateMap,(function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=Cd(n))}))},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!up(this.refMap)){var i=bd(this.root,t-1),s=bd(this.root,e+1);i&&Ju(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),s&&Ju(s)&&s!==n&&s!==r&&(r=s,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],s=o?Math.min(o.sourcepos[0][0],t[0]):t[0],a=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),c=this.parseRange.apply(this,this.getRangeWithRefDef(s,a,o,i,n)),l=c.newNodes,u=c.extStartNode,p=c.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,l),this.replaceWithNewRefDefState(l)):this.replaceRangeNodes(u,p,l),{nodes:l,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return up(this.refMap)||lp(this.refMap,(function(n,r){r.unlinked&&delete t.refMap[n],lp(t.refLinkCandidateMap,(function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))}))})),e},t.prototype.removeUnlinkedCandidate=function(){up(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(t){lp(t,(function(e){(function(t){var e=wd(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]}))}))},t.prototype.editMarkdown=function(t,e,n){var r=this.updateLineTexts(t,e,n),o=this.parse(t,e,r),i=function(t){for(var e=[],n=1;n]*>)","ig");function Sd(t){return Md.test(t)?t.replace(Md,(function(t,e){return"<"+e})):t}var Ed={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:" \n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.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(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.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(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?Sd(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?Sd(t.literal):t.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(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+Cu(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:Ol({href:Cu(o)},r&&{title:Cu(r)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,r=e.skipChildren,o=t,i=o.title,s=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:Ol({src:Cu(s),alt:n(t)},i&&{title:Cu(i)})}},customBlock:function(t,e,n){var r=t.info.trim().toLowerCase(),o=n[r];if(o)try{return o(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+r+" block node was parsed in markdown renderer: "+t)}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.sourcepos,i=r.info,s=i.trim().toLowerCase(),a=n[s],c=e.entering;if(a)try{return a(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+s+" inline node was parsed in markdown renderer: "+t)}var l=o[1][1]-o[0][1]+1===i.length+4?"":i+" ";return c?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+l}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},Nd={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,r=t.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:Ol(Ol({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;o0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach((function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')})),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push(""+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==ap(ap(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(Cu(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),Ld=n(368),Id=n.n(Ld),Rd=["iframe","embed"],Pd=[];function Bd(t){Qt(Rd,t)&&Pd.push(t.toLowerCase())}function Fd(t,e){return Id().sanitize(t,o({ADD_TAGS:Pd,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},e))}function Hd(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]+?>)|("+e+"\\s*[>])","ig"),"").trim()}function zd(t){var e=(t=t.match(Ma)[0]).match(new RegExp(xa,"g"));return e?e.reduce((function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t}),{}):{}}function jd(t){return na()(t.attributes).reduce((function(t,e){return t[e.nodeName]=e.nodeValue,t}),{})}function _d(t,e,n,r){var o=r.getToDOMNode(e)(t),i=n(o.outerHTML),s=document.createElement("div");return s.innerHTML=i,{dom:o=s.firstChild,htmlAttrs:jd(o)}}var qd={htmlBlock:function(t,e,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:jd(t),childrenHTML:t.innerHTML}}}],toDOM:function(r){var o=_d(r,t,e,n),s=o.dom,a=o.htmlAttrs;return a.class=a.class?a.class+" html-block":"html-block",i([t,a],na()(s.childNodes))}}},htmlInline:function(t,e,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:jd(t)}}}],toDOM:function(r){var o=_d(r,t,e,n).htmlAttrs;return[t,o,0]}}}};var Vd=/^\s*<\s*\//,$d={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/ /.test(t.prev.literal)?"\n":" \n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.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(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.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:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:Vs(i,Gs(t)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function Ud(t,e){var n=o({},$d);return t&&(n.link=function(e,n){var r=n.entering,i=(0,n.origin)();return r&&(i.attributes=o(o({},i.attributes),t)),i}),e&&Object.keys(e).forEach((function(t){var r=n[t],i=e[t];r&&da()(i)?n[t]=function(t,e){var n=o({},e);return n.origin=function(){return r(t,e)},i(t,n)}:Qt(["htmlBlock","htmlInline"],t)&&!da()(i)?n[t]=function(t,e){var n=t.literal.match(Ma);if(n){var r=n[0],s=n[1],a=n[3],c=(s||a).toLowerCase(),l=i[c],u=Hd(t,c);if(l){var p=o({},t);return p.attrs=zd(r),p.childrenHTML=u,p.type=c,e.entering=!Vd.test(t.literal),l(p,e)}}return e.origin()}:n[t]=i})),n}var Wd=["list","item","blockQuote"],Jd=["UL","OL","BLOCKQUOTE"];function Gd(t,e){var n,r=t.child(e);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function Kd(t,e,n){var r=Cs(e)-1,o=Ts(e)-1,i=n[r].getBoundingClientRect(),s=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:s<=0?n[r].clientHeight:s+Zd(t,n,Math.min(o+1,t.childCount-1)),rect:i}}function Zd(t,e,n){for(var r=t.childCount-1,o=0;n<=r&&Gd(t,n);)o+=e[n].clientHeight,n+=1;return o}function Xd(t,e){for(var n=0;t&&t!==e&&(Qt(Jd,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function Qd(t,e,n){return t&&e>n+t.offsetTop?Qd(t.nextElementSibling,e,n)||t:null}function Yd(t){for(var e=document.querySelector('[data-nodeid="'+t.id+'"]');!e||Es(t);)t=t.parent,e=document.querySelector('[data-nodeid="'+t.id+'"]');return function(t){var e=t.mdNode,n=t.el;for(;(Qt(Wd,e.type)||"table"===e.type)&&e.firstChild;)e=e.firstChild,n=n.firstElementChild;return{mdNode:e,el:n}}({mdNode:t,el:e})}var tf={};function ef(t){t&&(delete tf[Number(t.getAttribute("data-nodeid"))],na()(t.children).forEach((function(t){ef(t)})))}function nf(t,e,n){var r,o=tf[r=n]&&tf[r].height,i=function(t){return tf[t]&&tf[t].offsetTop}(n),s=o||t.clientHeight,a=i||Xd(t,e)||t.offsetTop;return o||function(t,e){tf[t]=tf[t]||{},tf[t].height=e}(n,s),i||function(t,e){tf[t]=tf[t]||{},tf[t].offsetTop=e}(n,a),{nodeHeight:s,offsetTop:a}}var rf=Da("md-preview-highlight");var of=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=Da("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,s=e.highlight,a=void 0!==s&&s;this.renderer=new Ad({gfm:!0,nodeId:!0,convertors:Ud(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(a),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return t.prototype.initContentSection=function(){this.previewContent=Pa('
'),this.isViewer||this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){Ra(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(t&&(this.eventEmitter.listen("changeToolbarState",(function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)})),this.eventEmitter.listen("blur",(function(){e.removeHighlight()}))),Sl()(this.el,"scroll",(function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=Qd(o,t,Xd(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))})),this.eventEmitter.listen("changePreviewTabPreview",(function(){return e.toggleActive(!0)})),this.eventEmitter.listen("changePreviewTabWrite",(function(){return e.toggleActive(!1)})))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&It()(t,rf)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=Ls(t,(function(t){return!function(t){switch(t.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}}(t)}))).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(Ms(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&It()(r,rf),o&&At()(o,rf),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach((function(t){return e.replaceRangeNodes(t)})),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map((function(t){return e.renderer.render(t)})).join("")));if(r){var s=r.id,a=s[0],c=s[1],l=this.getElementByNodeId(a),u=this.getElementByNodeId(c);if(l){l.insertAdjacentHTML("beforebegin",i);for(var p=l;p&&p!==u;){var d=p.nextElementSibling;Ia(p),ef(p),p=d}(null==p?void 0:p.parentNode)&&(Ia(p),ef(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){Tl()(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t}();function sf(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r,n))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}function af(t){return!!sf(t,(function(t){var e=t.type;return"listItem"===e.name||"bulletList"===e.name||"orderedList"===e.name}))}function cf(t){return!!sf(t,(function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name}))}function lf(t){return sf(t,(function(t){return"listItem"===t.type.name}))}function uf(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}function pf(t){return Object.keys(t).reduce((function(e,n){return"rawHTML"!==n&&t[n]&&(e[n="className"===n?"class":n]=t[n]),e}),{})}function df(t){return{tag:t,getAttrs:function(t){return["rawHTML","colspan","rowspan","extended"].reduce((function(e,n){var r="rawHTML"===n?"data-raw-html":n,o=t.getAttribute(r);return o&&(e[n]=Qt(["rawHTML","extended"],n)?o:Number(o)),e}),{})}}}function ff(t){var e=t.htmlAttrs,n=t.classNames;return o(o({},e),{class:n?n.join(" "):null})}function hf(t,e,n,r){var o=e.$from,i=e.$to,s=e.depth,a=e,c=!1;if(s>=2&&o.node(s-1).type.compatibleContent(n)&&0===e.startIndex&&o.index(s-1)){var l=t.doc.resolve(e.start-2);a=new B(l,l,s),e.endIndex=0;d-=1)u=p.from(n[d].type.create(n[d].attrs,u));t.step(new Ee(i-(r?2:0),s,i,s,new y(u,0,0),n.length,!0));var f=0;for(d=0;di;o-=1)r-=n.child(o).nodeSize,t.delete(r-1,r+1);var s=t.doc.resolve(e.start),a=s.nodeAfter,c=0===e.startIndex,l=e.endIndex===n.childCount,u=s.node(-1),d=s.index(-1),f=u.canReplace(d+(c?0:1),d+1,null==a?void 0:a.content.append(l?p.empty:p.from(n)));if(a&&f){var h=s.pos,m=h+a.nodeSize;t.step(new Ee(h-(c?1:0),m+(l?1:0),h+1,m-1,new y((c?p.empty:p.from(n.copy(p.empty))).append(l?p.empty:p.from(n.copy(p.empty))),c?0:1,l?0:1),c?0:1))}return t}(r,a)),!0)}}function bf(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!af(o))&&function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s,(function(e){var n=e.childCount,r=e.firstChild;return!!n&&r.type===t}));if(a&&a.startIndex>0){var c=a.parent,l=c.child(a.startIndex-1);if(l.type!==t)return!1;var u=l.lastChild&&l.lastChild.type===c.type,d=u?p.from(t.create()):null,f=new y(p.from(t.create(null,p.from(c.type.create(null,d)))),u?3:1,0),h=a.start,m=a.end;return r.step(new Ee(h-(u?3:1),m,h,m,f,1,!0)),n(r),!0}return!1}}(r.nodes.listItem)(t,e)}}}function wf(){return{indent:bf(),outdent:function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!af(o))&&yf(r.nodes.listItem)(t,e)}}}}var kf=new Map,xf=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=sf(e,(function(t){return"table"===t.type.name}));if(n){var r=n.node,o=n.depth,i=n.offset,s=kf.get(r);if((null==s?void 0:s.tableStartPos)===i+1)return s;var a=[],c=e.start(o),l=r.child(0),u=r.child(1),p=Cf(l,c),d=Cf(u,c+l.nodeSize);l.forEach((function(t){return a.push(t)})),u.forEach((function(t){return a.push(t)}));var f=new t(r,a,c,p.concat(d));return kf.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;it.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),s=i[0],a=i[1],c=this.getCellIndex(e),l=c[0],u=c[1];return s=(r=de(s,l))[0],l=r[1],a=(o=de(a,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:s,startColIdx:a,endRowIdx:l,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),Cf=function(t,e){var n=[];return t.forEach((function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach((function(t,n){for(var i=t.nodeSize,s=0;o[s];)s+=1;o[s]={offset:e+r+n+2,nodeSize:i},o.length+=1})),n.push(o)})),n};function Tf(t,e){return pe(xf.prototype,t),Cf=e,xf}var Mf=function(t){function n(e,n){void 0===n&&(n=e);var r=this,o=e.node(0),i=xf.create(e),s=i.getRectOffsets(e,n),a=function(t,e,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,s=n.endColIdx,a=[],c=r;c<=i;c+=1)for(var l=o;l<=s;l+=1){var u=e.getCellInfo(c,l),p=u.offset,d=u.nodeSize;a.push(new Xe(t.resolve(p+1),t.resolve(p+d-1)))}return a}(o,i,s);return(r=t.call(this,a[0].$from,a[0].$to,a)||this).startCell=e,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return e(n,t),n.prototype.map=function(t,e){var r=this.startCell.pos,o=this.endCell.pos,i=t.resolve(e.map(r)),s=t.resolve(e.map(o)),a=xf.create(i);if(this.offsetMap.totalColumnCount>a.totalColumnCount||this.offsetMap.totalRowCount>a.totalRowCount){var c={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[s.parent.type.name],l=s.end(s.depth-c),u=Math.min(l-4,s.pos);return Qe.create(t,u)}return new n(i,s)},n.prototype.eq=function(t){return t instanceof n&&t.startCell.pos===this.startCell.pos&&t.endCell.pos===this.endCell.pos},n.prototype.content=function(){for(var t=this.startCell.node(-2),e=this.startCell.start(-2),n=t.child(1).firstChild,r=t.child(0).type.create(),o=t.child(1).type.create(),i=xf.create(this.startCell),s=i.getRectOffsets(this.startCell,this.endCell),a=s.startRowIdx,c=s.startColIdx,l=s.endRowIdx,u=s.endColIdx,d=!1,f=a;f<=l;f+=1){for(var h=[],m=c;m<=u;m+=1){var v=i.getCellInfo(f,m).offset,g=t.nodeAt(v-e);g&&(d="tableHeadCell"===g.type.name,i.extendedRowspan(f,m)||i.extendedColspan(f,m)?h.push(g.type.create({extended:!0})):h.push(g.copy(g.content)))}var b=n.copy(p.from(h)),w=d?r:o;w.content=w.content.append(p.from(b))}return new y(function(t,e){var n=[];return t.childCount&&n.push(t),e.childCount&&n.push(e),p.from(n)}(r,o),1,1)},n}(Ke);function Sf(t,e,n,r){for(var o=n.nodes,i=o.tableRow,s=o.tableBodyCell,a=o.paragraph,c=[],l=0;l0&&o>0||"table"===(null===(e=n.firstChild)||void 0===e?void 0:e.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 Lf(t){var e=t.startRowIdx,n=t.startColIdx;return{rowCount:t.endRowIdx-e+1,columnCount:t.endColIdx-n+1}}function If(t,e){return o(o({},t.attrs),e)}var Rf=new bn("cellSelection"),Pf=function(){function t(t){this.view=t,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return t.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},t.prototype.handleMousedown=function(t){var e=Nf(t.target,this.view.dom);if(2!==t.button){if(e){var n=this.getCellPos(t);n&&(this.startCellPos=n),this.bindEvent()}}else t.preventDefault()},t.prototype.handleMousemove=function(t){var e,n=Rf.getState(this.view.state),r=this.getCellPos(t),o=this.startCellPos;n?e=this.view.state.doc.resolve(n):o!==r&&(e=o),e&&o&&r&&this.setCellSelection(o,r)},t.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==Rf.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(Rf,-1))},t.prototype.bindEvent=function(){var t=this.view.dom;t.addEventListener("mousemove",this.handlers.mousemove),t.addEventListener("mouseup",this.handlers.mouseup)},t.prototype.unbindEvent=function(){var t=this.view.dom;t.removeEventListener("mousemove",this.handlers.mousemove),t.removeEventListener("mouseup",this.handlers.mouseup)},t.prototype.getCellPos=function(t){var e=t.clientX,n=t.clientY,r=this.view.posAtCoords({left:e,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),s=Of(i);if(s){var a=i.before(s.depth);return o.resolve(a)}}return null},t.prototype.setCellSelection=function(t,e){var n=this.view.state,r=n.selection,o=n.tr,i=null===Rf.getState(this.view.state),s=new Mf(t,e);if(i||!r.eq(s)){var a=o.setSelection(s);i&&a.setMeta(Rf,e.pos),this.view.dispatch(a)}},t.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},t}(),Bf=Da("cell-selected");function Ff(t){var e=t.selection,n=t.doc;if(e instanceof Mf){var r=[];return e.ranges.forEach((function(t){var e=t.$from,n=t.$to;r.push(Uo.node(e.pos-1,n.pos+1,{class:Bf}))})),Ko.create(n,r)}return null}var Hf=n(928),zf=n.n(Hf),jf=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return zf()(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach((function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)}))},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),_f="en-US",qf=new(function(){function t(){this.code=_f,this.langs=new jf}return t.prototype.setCode=function(t){this.code=t||_f},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach((function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,Et()(r,e))}else n.langs.set(t,e)}))},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(_f));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}()),Vf=[[{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 $f(t,e){return Vf.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:qf.get(r),onClick:function(){t.emit("command",o,i)},disabled:e&&!!s,className:a}}))})).concat()}function Uf(t){return new vn({props:{handleDOMEvents:{contextmenu:function(e,n){var r=Nf(n.target,e.dom);if(r){n.preventDefault();var o=n,i=o.clientX,s=o.clientY,a=e.dom.parentNode.getBoundingClientRect(),c=a.left,l=a.top,u="TH"===r.nodeName;return t.emit("contextmenu",{pos:{left:i-c+10+"px",top:s-l+30+"px"},menuGroups:$f(t,u),tableCell:r}),!0}return!1}}}})}var Wf=["image","link","customBlock","frontMatter"],Jf=["strong","strike","emph","code"],Gf=["bulletList","orderedList","taskList"];function Kf(t,e,n){var r=t.$from,i=t.$to,s=t.from,a=t.to,c={},l={};return e.nodesBetween(s,a,(function(t,e,o){var s=function(t,e){var n=t.type.name;return"listItem"===n?t.attrs.task?"taskList":e.type.name:-1!==n.indexOf("table")?"table":n}(t,o);Qt(Wf,s)||(Qt(Gf,s)?function(t,e){e[t]=!0,Gf.filter((function(e){return e!==t})).forEach((function(t){e[t]&&delete e[t]}))}(s,c):"paragraph"===s||"text"===s?l=function(t,e,n){var r={};return Jf.forEach((function(o){var i=n.marks[o],s=t.marksAcross(e)||[];i.isInSet(s)&&(r[o]=!0)})),r}(r,i,n):c[s]=!0)})),o(o({},c),l)}function Zf(t){return new vn({view:function(){return{update:function(e){var n=e.state,r=n.selection,o=n.doc,i=n.schema;t.emit("changeToolbarState",{toolbarState:Kf(r,o,i)})}}}})}var Xf=function(){function t(t,e,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 si(o.innerViewContainer,{state:dn.create({doc:o.node,plugins:[Mi({"Mod-z":function(){return ms(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return vs(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(t,e){return e(t.tr.insertText("\t")),!0},Enter:Li,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),hs()]}),dispatchTransaction:function(t){return o.dispatchInner(t)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=t,this.editorView=e,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Da("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Da("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return t.prototype.renderToolArea=function(){var t=this,e=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");e.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",(function(){return t.openEditor()})),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e)},t.prototype.renderCustomBlock=function(){var t=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(t){for(var e=t(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);e&&this.wrapper.appendChild(e),this.renderToolArea()}},t.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Da("custom-block-editor"),this.innerViewContainer.style.display="none"},t.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},t.prototype.saveAndFinishEditing=function(){var t=this.editorView.state.selection.to,e=this.editorView.state;this.editorView.dispatch(e.tr.setSelection(bs(e.tr,t))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},t.prototype.cancelEditing=function(){var t,e,n=(t=this.innerEditorView.state,(e=ds.getState(t))?e.done.eventCount:0);for(this.canceled=!0;n--;)ms(this.innerEditorView.state,this.innerEditorView.dispatch),ms(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var r=this.editorView.state.selection.to,o=this.editorView.state;this.editorView.dispatch(o.tr.setSelection(Qe.create(o.doc,r))),this.editorView.focus(),this.closeEditor()},t.prototype.dispatchInner=function(t){var e=this.innerEditorView.state.applyTransaction(t),n=e.state,r=e.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&da()(this.getPos)){for(var o=this.editorView.state.tr,i=ge.offset(this.getPos()+1),s=0;s
":"")+e.innerHTML}var ph="\x3c!--StartFragment--\x3e";function dh(t){return function(t){return nh.test(t)}(t=function(t){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(t)&&(t=""+t+" "),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(t)&&(t=""),t}(t=function(t){var e=t.indexOf(ph),n=t.lastIndexOf("\x3c!--EndFragment--\x3e");return e>-1&&n>-1&&(t=t.slice(e+ph.length,n)),t.replace(/ ]*>/g,Ea)}(t)))&&(t=uh(t)),t}function fh(t,e,n){for(var r=[],o=t.childCount,i=0;ie.childCount?t:e})).childCount}(t);if(n&&r)return e.nodes.table.create(null,[yh(t,o,e)]);var i=t[0],s=t.slice(1),a=[gh(i,0,e)];return s.length&&a.push(yh(s,o,e)),e.nodes.table.create(null,a)}(i,e,s,n);r.push(a)}}else r.push(t)})),new y(p.from(r),i,s)}function wh(t){return 4*t}function kh(t,e){var n=t.state,r=n.selection,o=n.schema,i=n.tr,s=Df(r),a=s.anchor,c=s.head;if(a&&c){var l=Af(e);if(!l)return!1;var u=xf.create(a),p=u.getRectOffsets(a,c),d=function(t,e,n){var r=[],o=vh(t),i=(o[0].childCount,o.length),s=0===e.startRowIdx,a=o.slice(0,i);if(s){var c=a.shift();if(c){var l=hh(c,0,n).content;r.push(l)}}return a.forEach((function(t){if(!t.attrs.dummyRowForPasting){var e=mh(t,0,n).content;r.push(e)}})),r}(l,p,o),f=function(t,e,n){for(var r=e.startRowIdx,o=e.startColIdx,i=n.length,s=0,a=function(t){var e=n[t].childCount;n[t].forEach((function(t){var n=t.attrs.colspan;n>1&&(e+=n-1)})),s=Math.max(s,e)},c=0;c=i&&f<=a-l){var b=n.getCellInfo(f,c-u),w=t.mapping.map(b.offset),k=g+wh(u);o[d]={rowIdx:f,startColIdx:s,endColIdx:c,dummyOffsets:[w,k]},d+=1}}}(i,o,u,f,h),f.addedRowCount&&function(t,e,n,r,o){var i=r.addedRowCount,s=r.addedColumnCount,a=r.startColIdx,c=r.endColIdx,l=t.mapping.maps.length,u=n.tableEndOffset-2,p=Sf(i,n.totalColumnCount+s,e),d=u;t.insert(t.mapping.slice(l).map(d),p);for(var f=0;f=d[0]&&o<=i&&!h){var m=ws(s,f,c);if(m)return r(m),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},n}(sa),Oh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[uf("ul")],toDOM:function(t){return["ul",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.changeList=function(){return function(t,e){return vf(t.schema.nodes.bulletList)(t,e)}},n.prototype.commands=function(){return{bulletList:this.changeList,taskList:gf}},n.prototype.keymaps=function(){var t=this.changeList(),e=wf(),n=e.indent,r=e.outdent;return{"Mod-u":t,"Mod-U":t,Tab:n(),"Shift-Tab":r()}},n}(sa),Dh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(t){var e=t.getAttribute("start"),n=t.getAttribute("data-raw-html");return o({order:t.hasAttribute("start")?Number(e):1},n&&{rawHTML:n})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"ol",o({start:1===e.order?null:e.order},ff(e)),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return vf(t.schema.nodes.orderedList)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()(),e=wf(),n=e.indent,r=e.outdent;return{"Mod-o":t,"Mod-O":t,Tab:n(),"Shift-Tab":r()}},n}(sa),Ah=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(n.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(t){var e=t.getAttribute("data-raw-html");return o({task:t.hasAttribute("data-task"),checked:t.hasAttribute("data-task-checked")},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs,n=e.task,r=e.checked;if(!n)return[e.rawHTML||"li",0];var i=["task-list-item"];return r&&i.push("checked"),[e.rawHTML||"li",o({class:i.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),n.prototype.liftToPrevListItem=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,s=n.empty,a=o.nodes.listItem,c=i.parent,l=i.node(-1);if(s&&!c.childCount&&l.type===a){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),e(r),!0;if(i.node(-3).type===a)return r.delete(i.start(-2)-1,i.end(-1)),e(r),!0}return!1}},n.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(t,e){return function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to;if(i.depth<2||!i.sameParent(s))return!1;var a=i.node(-1);if(a.type!==t)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==t||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,l=p.empty,u=i.depth-(c?1:2);u>=i.depth-3;u-=1)l=p.from(i.node(u).copy(l));return l=l.append(p.from(t.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new y(l,c?3:2,2)),r.setSelection(Ke.near(r.doc.resolve(i.pos+(c?3:2)))),n(r),!0}var d=s.pos===i.end()?a.contentMatchAt(0).defaultType:null,f=d&&[null,{type:d}];return r.delete(i.pos,s.pos),!!Le(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),n(r),!0)}}(t.schema.nodes.listItem)(t,e)}}},n}(sa),Lh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[uf("blockquote")],toDOM:function(t){return["blockquote",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return Hi(t.schema.nodes.blockQuote)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()();return{"Alt-q":t,"Alt-Q":t}},n}(sa),Ih={left:function(t,e){var n=t[0],r=t[1],o=e.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var s=e.getCellInfo(n,r),a=s.offset,c=s.nodeSize;return a+c-2}return null},right:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount,i=e.totalColumnCount,s=r===i-1;if(n!==o-1||!s){var a=r+1,c=e.getColspanStartInfo(n,r);return(null==c?void 0:c.count)>1&&(a+=c.count-1),(s||a===i)&&(n+=1,a=0),e.getCellInfo(n,a).offset+2}return null},up:function(t,e){var n=t[0],r=t[1];if(n>0){var o=e.getCellInfo(n-1,r),i=o.offset,s=o.nodeSize;return i+s-2}return null},down:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount;if(n1&&(i+=s.count-1),e.getCellInfo(i,r).offset+2}return null}};function Rh(t,e,n,r){var o=e[0],i=e[1],s=o+3,a=i>=s,c=a?o+1:i,l=function(t,e,n,r,o){var i=e[0],s=e[1],a=e[2];if(t===xh.LEFT||t===xh.UP){if(o&&!function(t,e,n){var r=n[0],o=n[1],i=e.resolve(t.before(r-1));return o===r&&!i.nodeBefore}(n,r,[i,s]))return!1;var c=n.before(a);if(r.resolve(c).nodeBefore)return!1}return!0}(t,[i,s,c],n,r,a),u=function(t,e,n,r,o){if(t===xh.RIGHT||t===xh.DOWN){if(o&&!function(t){for(var e,n,r=t.depth;r&&"tableBodyCell"!==(n=t.node(r)).type.name;){if("listItem"===n.type.name){var o=t.node(r-1).lastChild===n,i="paragraph"!==(null===(e=n.lastChild)||void 0===e?void 0:e.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(e);if(r.resolve(i).nodeAfter)return!1}return!0}(t,c,n,r,a);return l&&u}function Ph(t,e,n){var r=n[0],o=n[1],i=e.getRowspanStartInfo(r,o),s=t===xh.UP&&0===r,a=t===xh.DOWN&&((null==i?void 0:i.count)>1?r+i.count-1:r)===e.totalRowCount-1;return s||a}function Bh(t,e,n){var r=t.doc.resolve(e.tableEndOffset);return r.nodeAfter?t.setSelection(Ke.near(r,1)):ws(t,r,n)}function Fh(t,e,n,r){var o=(0,Ih[t])(n,r);if(o){var i=t===xh.RIGHT||t===xh.DOWN?1:-1;return e.setSelection(Ke.near(e.doc.resolve(o),i))}return null}function Hh(t,e,n){var r=t.getCellInfo(e,0).offset,o=t.getCellInfo(e,n-1);return{from:r,to:o.offset+o.nodeSize}}!function(t){t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down"}(xh||(xh={}));var zh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[uf("table")],toDOM:function(t){return["table",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.addTable=function(){return function(t){return void 0===t&&(t={rowCount:2,columnCount:1,data:[]}),function(e,n){var r=t.rowCount,o=t.columnCount,i=t.data,s=e.schema,a=e.selection,c=e.tr,l=a.from,u=a.to,p=a.$from;if(l===u&&!cf(p)){var d=s.nodes,f=d.tableHead,h=d.tableBody,m=null==i?void 0:i.slice(0,o),v=null==i?void 0:i.slice(o,i.length),g=function(t,e,n){for(var r=e.nodes,o=r.tableRow,i=r.tableHeadCell,s=r.paragraph,a=[],c=0;c=p;m-=1){var v=a.getCellInfo(h,m),g=v.offset,y=v.nodeSize,b=r.mapping.slice(f).map(g),w=b+y;r.delete(b,w)}return e(r),!0}return!1}}},n.prototype.addRow=function(t){return function(){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,s=Df(r),a=s.anchor,c=s.head;if(a&&c){var l=xf.create(a),u=l.totalColumnCount,p=l.getRectOffsets(a,c),d=Lf(p).rowCount,f=function(t,e,n){var r,o,i;return t===xh.UP?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=e.totalColumnCount-1,i=e.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(t,l,p),h=f.targetRowIdx,m=f.insertColIdx,v=f.nodeSize;if(!(0===h)){for(var g=[],y=i.mapping.map(l.posAt(h,m))+v,b=[],w=0;w=d;h-=1){var m=Hh(a,h,l),v=m.from,g=m.to;r.delete(v-1,g+1)}return e(r),!0}return!1}}},n.prototype.alignColumn=function(){return function(t){return void 0===t&&(t={align:"center"}),function(e,n){var r=t.align,o=e.selection,i=e.tr,s=Df(o),a=s.anchor,c=s.head;if(a&&c){for(var l=xf.create(a),u=l.totalRowCount,p=l.getRectOffsets(a,c),d=p.startColIdx,f=p.endColIdx,h=0;h=s&&function(t){return!t.length||Qt(t,u)}(i)&&(c=(a+=e)+r)}))}return{range:[a,c],type:l}},n}(ua),nm=n(404),rm=n.n(nm),om=["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","change","caretChange","destroy","focus","blur","keydown","keyup"],im=function(){function t(){var t=this;this.events=new jf,this.eventTypes=om.reduce((function(t,e){return o(o({},t),{type:e})}),{}),this.hold=!1,om.forEach((function(e){t.addEventType(e)}))}return t.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},t.prototype.emit=function(t){for(var e=[],n=1;n=0&&n.splice(r,1)}},t.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map((function(t){return t.namespace!==e&&n.push(t),null})),this.events.set(t,n))},t.prototype.getEvents=function(){return this.events},t.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},t}(),sm=function(){function t(t,e,n,r){this.eventEmitter=t,this.mdCommands=e,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return t.prototype.initEvent=function(){var t=this;this.eventEmitter.listen("command",(function(e,n){t.exec(e,n)}))},t.prototype.addCommand=function(t,e,n){"markdown"===t?this.mdCommands[e]=n:this.wwCommands[e]=n},t.prototype.deleteCommand=function(t,e){"markdown"===t?delete this.mdCommands[e]:delete this.wwCommands[e]},t.prototype.exec=function(t,e){"markdown"===this.getEditorType()?this.mdCommands[t](e):this.wwCommands[t](e)},t}();function am(t){return"\n"===t[t.length-1]?t.slice(0,t.length-1):t}function cm(t,e){var n=t.schema,r=e.literal.match(Ma);if(r){var o=r[1],i=r[3],s=(o||i).toLowerCase();return"htmlInline"===e.type&&!(!n.marks[s]&&!n.nodes[s])}return!1}function lm(t){return Qt(["text","strong","emph","strike","image","link","code"],t.type)}function um(t){return"softbreak"===(null==t?void 0:t.type)}function pm(t){var e=t.type,n=t.literal,r="htmlInline"===e&&n.match(Ma);if(r){var o=r[1],i=r[3],s=o||i;if(s)return Qt(["ul","ol","li"],s.toLowerCase())}return!1}function dm(t){for(var e=[],n=1;nh){var m=f.columns[h].align;d=null!==(r=e.attrs)&&void 0!==r?r:{},m&&(d.align=m)}}t.openNode(u,d),p(e.firstChild)&&t.openNode(c)}else p(e.lastChild)&&t.closeNode(),t.closeNode()},strike:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strike;o?t.openMark(i.create(r)):t.closeMark(i)},code:function(t,e,n,r){var o=t.schema.marks.code;t.openMark(o.create(r)),t.addText(am(e.literal||"")),t.closeMark(o)},customBlock:function(t,e){var n=t.schema.nodes,r=n.customBlock,o=n.paragraph,i=e,s=i.info,a=i.literal;t.openNode(r,{info:s}),t.addText(am(a||"")),t.closeNode(),e.next||(t.openNode(o),t.closeNode())},frontMatter:function(t,e){t.openNode(t.schema.nodes.frontMatter),t.addText(e.literal),t.closeNode()},htmlInline:function(t,e){var n=e.literal,r=n.match(Ma),o=r[1],i=r[3],s=(o||i).toLowerCase(),a=t.schema.marks[s],c=Fd(n);if(null==a?void 0:a.spec.attrs.htmlInline)if(o){var l=zd(c);t.openMark(a.create({htmlAttrs:l}))}else t.closeMark(a);else{var u=fm[s];u&&u(t,e,o)}},htmlBlock:function(t,e){var n=e.literal,r=document.createElement("div"),o=n.match(Ma),i=o[1],s=o[3],a=(i||s).toLowerCase(),c=t.schema.nodes[a],l=Fd(n);if(null==c?void 0:c.spec.attrs.htmlBlock){var u=zd(l),p=Hd(e,a);t.addNode(c,{htmlAttrs:u,childrenHTML:p})}else r.innerHTML=l,mm(r),t.convertByDOMParser(r)},customInline:function(t,e,n){var r=n.entering,o=n.skipChildren,i=e.info,s=t.schema;if(-1!==i.indexOf("widget")&&r){var a=Gs(e);o(),t.addNode(s.nodes.widget,{info:i},[s.text(qs(i,a))])}}};var gm=function(){function t(t,e){this.schema=t,this.convertors=e,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=v.none}return t.prototype.top=function(){return se(this.stack)},t.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},t.prototype.addText=function(t){if(t){var e=this.top().content,n=se(e),r=this.schema.text(t,this.marks),o=n&&(s=r,!!((i=n).isText&&s.isText&&v.sameSet(i.marks,s.marks))&&i.withText(i.text+s.text));o?e[e.length-1]=o:e.push(r)}var i,s},t.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},t.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},t.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},t.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},t.prototype.closeNode=function(){this.marks.length&&(this.marks=v.none);var t=this.stack.pop(),e=t.type,n=t.attrs,r=t.content;return this.addNode(e,n,r)},t.prototype.convertByDOMParser=function(t){var e=this;ut.fromSchema(this.schema).parse(t).content.forEach((function(t){return e.push(t)}))},t.prototype.closeUnmatchedHTMLInline=function(t,e){var n;if(!e&&"htmlInline"!==t.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()}},t.prototype.convert=function(t,e){for(var n=t.walker(),r=n.next(),o=function(){var t=r.node,o=r.entering,s=i.convertors[t.type],a=!1;if(s){var c={entering:o,leaf:!Bs(t),getChildrenText:Fs,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){a=!0}};if(i.closeUnmatchedHTMLInline(t,o),s(i,t,c),(null==e?void 0:e.node)===t){var l=i.stack.reduce((function(t,e){return t+e.content.reduce((function(t,e){return t+e.nodeSize}),0)}),0)+1;e.setMappedPos(l)}}a&&(n.resumeAt(t,!1),n.next()),r=n.next()},i=this;r;)o()},t.prototype.convertNode=function(t,e){return this.convert(t,e),this.stack.length?this.closeNode():null},t}();var ym={text:function(t,e){var n,r=e.node;t.text(null!==(n=r.text)&&void 0!==n?n:"")},paragraph:function(t,e){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o;if(t.stopNewline)t.convertInline(n);else{var s=0===i,a=!s&&r.child(i-1),c=a&&0===a.childCount,l=i\n"):!p||c||s?(t.convertInline(n),u?t.write("\n"):t.closeBlock(n)):t.write("\n")}},heading:function(t,e,n){var r=e.node,o=n.delim;"atx"===r.attrs.headingType?(t.write(o+" "),t.convertInline(r),t.closeBlock(r)):(t.convertInline(r),t.ensureNewLine(),t.write(o),t.closeBlock(r))},codeBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},blockQuote:function(t,e,n){var r=e.node,o=e.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&t.flushClose(1),t.wrapBlock(i,null,r,(function(){return t.convertNode(r)}))},bulletList:function(t,e,n){var r=e.node,o=n.delim;t.convertList(r,ne(" ",4),(function(){return o+" "}))},orderedList:function(t,e){var n=e.node,r=n.attrs.order||1;t.convertList(n,ne(" ",4),(function(t){return String(r+t)+". "}))},listItem:function(t,e){var n=e.node,r=n.attrs,o=r.task,i=r.checked;o&&t.write("["+(i?"x":" ")+"] "),t.convertNode(n)},image:function(t,e,n){var r=n.attrs;t.write("+")")},thematicBreak:function(t,e,n){var r=e.node,o=n.delim;t.write(o),t.closeBlock(r)},table:function(t,e){var n=e.node;t.convertNode(n),t.closeBlock(n)},tableHead:function(t,e,n){var r=e.node,o=n.delim,i=r.firstChild;t.convertNode(r);var s=null!=o?o:"";!o&&i&&i.forEach((function(t){var e=function(t,e){var n=t.length,r="",o="";return"left"===e?(r=":",n-=1):"right"===e?(o=":",n-=1):"center"===e&&(r=":",o=":",n-=2),""+r+ne("-",Math.max(n,3))+o}(t.textContent,t.attrs.align);s+="| "+e+" "})),t.write(s+"|"),t.ensureNewLine()},tableBody:function(t,e){var n=e.node;t.convertNode(n)},tableRow:function(t,e){var n=e.node;t.convertNode(n),t.write("|"),t.ensureNewLine()},tableHeadCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},tableBodyCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},customBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},frontMatter:function(t,e,n){var r=e.node,o=n.text;t.text(o,!1),t.closeBlock(r)},widget:function(t,e,n){var r=n.text;t.write(r)},html:function(t,e,n){var r=n.text;t.write(r)}};function bm(t,e){var n=t.text,r=/`+/g,o=0;if(t.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&&e>0?" `":"`",a=0;a0&&e<0&&(s+=" "),s}function wm(t){return t?["<"+t+">",""+t+">"]:null}function km(t){return t?"<"+t+">":null}function xm(t){return t?""+t+">":null}var Cm={heading:function(t){var e=t.node.attrs,n=e.level,r=ne("#",n);return"setext"===e.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:wm(e.rawHTML)}},codeBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:wm(n.rawHTML),text:r}},blockQuote:function(t){return{delim:"> ",rawHTML:wm(t.node.attrs.rawHTML)}},bulletList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:wm(o)}},orderedList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:wm(o)}},listItem:function(t,e){var n=t.node,r=e.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(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableHead:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableBody:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableRow:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableHeadCell:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableBodyCell:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},image:function(t){var e=t.node.attrs,n=re(e.altText||""),r=Xt(e.imageUrl),o=n?' alt="'+n+'"':"";return{rawHTML:e.rawHTML?"<"+e.rawHTML+' src="'+r+'"'+o+">":null,attrs:{altText:n,imageUrl:r}}},thematicBreak:function(t){return{delim:"***",rawHTML:km(t.node.attrs.rawHTML)}},customBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(t){return{text:t.node.textContent}},widget:function(t){return{text:t.node.textContent}},strong:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"**",rawHTML:r?km(o):xm(o)}},emph:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"*",rawHTML:r?km(o):xm(o)}},strike:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"~~",rawHTML:r?km(o):xm(o)}},link:function(t,e){var n=t.node,r=e.entering,o=n.attrs,i=Xt(o.linkUrl),s=o.rawHTML;return r?{delim:"[",rawHTML:s?"<"+s+' href="'+i+'">':null}:{delim:"]("+(o.title?" "+function(t){var e;return(e=-1===t.indexOf('"')?'""':-1===t.indexOf("'")?"''":"()")[0]+t+e[1]}(o.linkText):"")+i+")",rawHTML:xm(s)}},code:function(t,e){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o,s=e.entering;return{delim:s?bm(r.child(i),-1):bm(r.child(i-1),1),rawHTML:s?km(n.attrs.rawHTML):xm(n.attrs.rawHTML)}},html:function(t,e){var n=t.node,r=e.entering,o=n.type.name,i=n.attrs.htmlAttrs,s="<"+o,a=""+o+">";return Object.keys(i).forEach((function(t){s+=" "+t+'="'+i[t].replace(/"/g,"'")+'"'})),s+=">",n.attrs.htmlInline?{rawHTML:r?s:a}:{text:""+s+n.attrs.childrenHTML+a}}},Tm={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Mm(t){var e={};return Object.keys(ym).forEach((function(n){e[n]=function(e,r){if(ym[n]){var o=t[n],i=o?o(r,{inTable:e.inTable}):{};!function(t,e){var n=e.state,r=e.nodeInfo,o=e.params,i=o.rawHTML;i?zf()(t,["heading","codeBlock"])>-1?function(t,e,n){var r=n[0],o=n[1];t.write(r),t.convertInline(e),t.write(o)}(n,r.node,i):zf()(t,["image","thematicBreak"])>-1?n.write(i):function(t,e,n){var r=e.node,o=e.parent,i=n[0],s=n[1];t.stopNewline=!0,t.write(i),t.convertNode(r),t.write(s),"doc"===(null==o?void 0:o.type.name)&&(t.closeBlock(r),t.stopNewline=!1)}(n,r,i):ym[t](n,r,o)}(n,{state:e,nodeInfo:r,params:i})}}})),e}function Sm(t){return Object.keys(t).forEach((function(e){var n=Cm[e],r=t[e];Cm[e]=n?function(t,e){return e.origin=function(){return n(t,e)},r(t,e)}:r,delete t[e]})),{nodeTypeConvertors:Mm(Cm),markTypeConvertors:function(t){var e={};return Object.keys(Tm).forEach((function(n){e[n]=function(e,r){var i=Tm[n],s=t[n],a=s&&e&&!zt()(r)?s(e,{entering:r}):{};return o(o({},a),i)}})),e}(Cm)}}var Em=function(){function t(t){var e=t.nodeTypeConvertors,n=t.markTypeConvertors;this.nodeTypeConvertors=e,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return t.prototype.getMarkConvertor=function(t){var e=t.attrs.htmlInline?"html":t.type.name;return this.markTypeConvertors[e]},t.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},t.prototype.markText=function(t,e,n,r){var o=this.getMarkConvertor(t);if(o){var i=o({node:t,parent:n,index:r},e),s=i.delim;return i.rawHTML||s}return""},t.prototype.flushClose=function(t){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),t||(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;rb?a=a.slice(0,b).concat(p).concat(a.slice(b,y)).concat(a.slice(y+1,g)):b>y&&(a=a.slice(0,y).concat(a.slice(y+1,b)).concat(p).concat(a.slice(b,g)));break}}}for(var k=0;k"))})),this.stopNewline=!1,this.inTable=!1},t.prototype.convertNode=function(t,e){var n=this;return t.forEach((function(r,o,i){if(n.convertBlock(r,t,i),(null==e?void 0:e.node)===r){var s=n.result.split("\n");e.setMappedPos([s.length,se(s).length+1])}})),this.result},t}(),Nm=function(){function t(t,e,n,r){var i=this;this.setMappedPos=function(t){i.mappedPosWhenConverting=t},this.schema=t,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(t){var e=Object.keys(t),n=o({},vm),r=new Ad({gfm:!0,nodeId:!0,convertors:t}).getConvertors();return e.forEach((function(e){var o=vm[e];o&&!Qt(["htmlBlock","htmlInline"],e)&&(n[e]=function(n,i,s){s.origin=function(){return r[e](i,s)};var a,c=t[e](i,s);if(c){var l=Array.isArray(c)?c[0]:c;a={htmlAttrs:l.attributes,classNames:l.classNames}}o(n,i,s,a)})})),n}(n),this.toMdConvertors=Sm(e||{}),this.eventEmitter.listen("setFocusedNode",(function(t){return i.focusedNode=t}))}return t.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},t.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},t.prototype.toWysiwygModel=function(t){return new gm(this.schema,this.toWwConvertors).convertNode(t,this.getInfoForPosSync())},t.prototype.toMarkdownText=function(t){var e=new Em(this.toMdConvertors).convertNode(t,this.getInfoForPosSync());return e=this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",e)},t}();function Om(t,e,n){return e.listen("mixinTableOffsetMapPrototype",Tf),(null!=t?t:[]).reduce((function(t,r){var i=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:vn,Selection:Ke,TextSelection:Qe},pmView:{Decoration:Uo,DecorationSet:Ko},pmModel:{Fragment:p},i18n:qf};if(va()(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(r,e,n);if(!i)throw new Error("The return value of the executed plugin is empty.");var s=i.markdownParsers,a=i.toHTMLRenderers,c=i.toMarkdownRenderers,l=i.markdownPlugins,u=i.wysiwygPlugins,d=i.wysiwygNodeViews,f=i.markdownCommands,h=i.wysiwygCommands,m=i.toolbarItems;return a&&(t.toHTMLRenderers=ce(t.toHTMLRenderers,a)),c&&(t.toMarkdownRenderers=ce(t.toMarkdownRenderers,c)),l&&(t.mdPlugins=t.mdPlugins.concat(l)),u&&(t.wwPlugins=t.wwPlugins.concat(u)),d&&(t.wwNodeViews=o(o({},t.wwNodeViews),d)),f&&(t.mdCommands=o(o({},t.mdCommands),f)),h&&(t.wwCommands=o(o({},t.wwCommands),h)),m&&(t.toolbarItems=t.toolbarItems.concat(m)),s&&(t.markdownParsers=o(o({},t.markdownParsers),s)),t}),{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Dm=function(){function t(t){var e=this;this.options=Et()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},t),this.eventEmitter=new im;var n,r=ee(this.options.linkAttributes),i=Om(this.options.plugins,this.eventEmitter,this.options.usageStatistics)||{},s=i.toHTMLRenderers,a=i.markdownParsers,c=this.options,l=c.customHTMLRenderer,u=c.extendedAutolinks,p=c.referenceDefinition,d=c.frontMatter,f=c.customHTMLSanitizer,h={linkAttributes:r,customHTMLRenderer:o(o({},s),l),extendedAutolinks:u,referenceDefinition:p,frontMatter:d,sanitizer:f||Fd};n=h.customHTMLRenderer,["htmlBlock","htmlInline"].forEach((function(t){n[t]&&Object.keys(n[t]).forEach((function(t){return Bd(t)}))})),this.options.events&&Mt()(this.options.events,(function(t,n){e.on(n,t)}));var m=this.options,v=m.el,g=m.initialValue,y=m.theme,b=v.innerHTML;"light"!==y&&v.classList.add(Da(y)),v.innerHTML="",this.toastMark=new Td("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:u,referenceDefinition:p,disallowDeepHeading:!0,frontMatter:d,customParser:a}),this.preview=new of(this.eventEmitter,o(o({},h),{isViewer:!0})),Sl()(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),g?this.setMarkdown(g):b&&this.preview.setHTML(b),v.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return t.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&Na(n,t.offsetX,t.offsetY)&&Ra(e,"checked")},t.prototype.setMarkdown=function(t){var e=this.toastMark.getLineTexts(),n=[e.length,se(e).length+1],r=this.toastMark.editMarkdown([1,1],n,t||"");this.eventEmitter.emit("updatePreview",r)},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.destroy=function(){Tl()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},t.prototype.isViewer=function(){return!0},t.prototype.isMarkdownMode=function(){return!1},t.prototype.isWysiwygMode=function(){return!1},t}();function Am(t){return t instanceof z}function Lm(t){return Qt(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],t)}var Im={openTag:function(t,e){var n=t,r=n.tagName,i=n.classNames,s=n.attributes,a=document.createElement(r),c={};i&&(a.className=i.join(" ")),s&&(c=o(o({},c),s)),za(c,a),e.push(a)},closeTag:function(t,e){if(e.length>1){var n=e.pop();se(e).appendChild(n)}},html:function(t,e){se(e).insertAdjacentHTML("beforeend",t.content)},text:function(t,e){var n=document.createTextNode(t.content);se(e).appendChild(n)}},Rm=function(){function t(t,e){var n=Ud(t,e),r=o(o({},e.htmlBlock),e.htmlInline);this.customConvertorKeys=Object.keys(e).concat(Object.keys(r)),this.renderer=new Ad({gfm:!0,convertors:o(o({},n),r)}),this.convertors=this.renderer.getConvertors()}return t.prototype.generateTokens=function(t){var e=function(t){var e=t.attrs,n=t.type.name,r={type:n,wysiwygNode:!0,literal:!Lm(n)&&Am(t)?t.textContent:null},i={heading:{level:e.level},link:{destination:e.linkUrl,title:e.linkText},image:{destination:e.imageUrl},codeBlock:{info:e.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:e.order}},listItem:{type:"item",listData:{task:e.task,checked:e.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:e.align},tableBodyCell:{type:"tableCell",cellType:"body",align:e.align},customBlock:{info:e.info}}[n],s=o(o({},r),i),a=t.attrs,c=a.htmlAttrs,l=a.childrenHTML;return c?o(o({},s),{attrs:c,childrenHTML:l}):s}(t),n={entering:!0,leaf:!!Am(t)&&t.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Am(t)?t.textContent:""},skipChildren:function(){return!1}},r=this.convertors[t.type.name],i=r(e,n,this.convertors),s=va()(i)?i:[i];return(Lm(t.type.name)||t.attrs.htmlInline)&&(n.entering=!1,s.push({type:"text",content:Am(t)?t.textContent:""}),s=s.concat(r(e,n,this.convertors))),s},t.prototype.toDOMNode=function(t){var e=this.generateTokens(t),n=[];return e.forEach((function(t){return Im[t.type](t,n)})),n[0]},t.prototype.getToDOMNode=function(t){return Qt(this.customConvertorKeys,t)?this.toDOMNode.bind(this):null},t}(),Pm=null,Bm=null;function Fm(t,e){var n=e.syncScrollTop,r=e.releaseEventBlock;Bm&&clearTimeout(Bm),n(t),Bm=setTimeout((function(){r()}),15)}var Hm=function(){function t(t,e,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0;var r=e.previewContent,o=e.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=t,this.editorView=t.view,this.toastMark=t.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return t.prototype.addScrollSyncEvent=function(){var t=this;this.eventEmitter.listen("afterPreviewRender",(function(){setTimeout((function(){t.syncPreviewScrollTop(!0)}),200)})),this.eventEmitter.listen("scroll",(function(e,n){t.active&&("editor"===e&&"editor"!==t.blockedScroll?t.syncPreviewScrollTop():"preview"===e&&"preview"!==t.blockedScroll&&t.syncEditorScrollTop(n))})),this.eventEmitter.listen("toggleScrollSync",(function(e){t.active=e}))},t.prototype.getMdNodeAtPos=function(t,e){var n=t.content.findIndex(e.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},t.prototype.getScrollTopByCaretPos=function(){var t=this.mdEditor.getSelection(),e=this.toastMark.findFirstNodeAtLine(t[0][0]),n=this.previewEl.clientHeight,r=Yd(e).el,o=(Xd(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().topT.top?Math.min((a-T.top)/C,1):0)}y=this.getResolvedScrollTop("editor",f,y,p),this.latestEditorScrollTop=f}y!==p&&this.run("editor",y,p)}},t.prototype.syncEditorScrollTop=function(t){var e=this,n=e.toastMark,r=e.editorView,o=e.previewRoot,i=e.previewEl,s=r.dom,a=r.state,c=i.scrollTop,l=i.clientHeight,u=i.scrollHeight-c<=l,p=s.scrollTop,d=u?s.scrollHeight:0;if(c&&t&&!u){if(!(t=function(t,e){for(;!t.getAttribute("data-nodeid")&&t.parentElement!==e;)t=t.parentElement;return t}(t,o)).getAttribute("data-nodeid"))return;var f=s.children,h=Number(t.getAttribute("data-nodeid")),m=Yd(n.findNodeById(h)),v=m.mdNode,g=m.el;d=f[Cs(v)-1].offsetTop;var y=Kd(a.doc,v,f).height,b=nf(g,o,h),w=b.nodeHeight;d+=function(t,e,n,r){return Math.min((t-e)/n,1)*r}(c,b.offsetTop,w,y),d=this.getResolvedScrollTop("preview",c,d,p),this.latestPreviewScrollTop=c}d!==p&&this.run("preview",d,p)},t.prototype.getResolvedScrollTop=function(t,e,n,r){var o="editor"===t?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o <\/p>/gi,"
"),n=new RegExp(Ta,"ig"),r=e.match(n);return null==r||r.forEach((function(t,n){if(Sa.test(t)){var o=Ea;if(n){var i=r[n-1].match(Ca);if(i&&!/br/i.test(i[1])){var s=i[1];o=""+s+"><"+s+">"}}e=e.replace(Sa,o)}})),e}(t);var r=ut.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),e):this.wwEditor.setModel(r,e)},t.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},t.prototype.getHTML=function(){var t=this;return this.eventEmitter.holdEventInvoke((function(){if(t.isMarkdownMode()){var e=t.toastMark.getRootNode(),n=t.convertor.toWysiwygModel(e);t.wwEditor.setModel(n)}})),this.wwEditor.view.dom.innerHTML},t.prototype.insertText=function(t){this.getCurrentModeEditor().replaceSelection(t)},t.prototype.setSelection=function(t,e){this.getCurrentModeEditor().setSelection(t,e)},t.prototype.replaceSelection=function(t,e,n){this.getCurrentModeEditor().replaceSelection(t,e,n)},t.prototype.deleteSelection=function(t,e){this.getCurrentModeEditor().deleteSelection(t,e)},t.prototype.getSelectedText=function(t,e){return this.getCurrentModeEditor().getSelectedText(t,e)},t.prototype.getRangeInfoOfNode=function(t){return this.getCurrentModeEditor().getRangeInfoOfNode(t)},t.prototype.addWidget=function(t,e,n){this.getCurrentModeEditor().addWidget(t,e,n)},t.prototype.replaceWithWidget=function(t,e,n){this.getCurrentModeEditor().replaceWithWidget(t,e,n)},t.prototype.setHeight=function(t){var e=this.options.el;Pt()(t)&&("auto"===t?(At()(e,"auto-height"),this.setMinHeight(this.getMinHeight())):(It()(e,"auto-height"),this.setMinHeight(t))),Ot()(e,{height:t}),this.height=t},t.prototype.getHeight=function(){return this.height},t.prototype.setMinHeight=function(t){var e;this.minHeight=t;var n=this.options.el.clientHeight-((null===(e=document.querySelector("."+Da("main")))||void 0===e?void 0:e.clientHeight)||0),r=parseInt(t,10);r=Math.max(r-n,0),this.wwEditor.setMinHeight(r),this.mdEditor.setMinHeight(r),this.preview.setMinHeight(r)},t.prototype.getMinHeight=function(){return this.minHeight},t.prototype.isMarkdownMode=function(){return"markdown"===this.mode},t.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},t.prototype.isViewer=function(){return!1},t.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},t.prototype.changeMode=function(t,e){if(this.mode!==t){if(this.mode=t,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),!e)}if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",t),!e){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&Ft()(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},t.prototype.destroy=function(){var t=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach((function(e,n){return t.off(n)}))},t.prototype.hide=function(){this.eventEmitter.emit("hide")},t.prototype.show=function(){this.eventEmitter.emit("show")},t.prototype.setScrollTop=function(t){this.getCurrentModeEditor().setScrollTop(t)},t.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},t.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},t.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},t.prototype.setPlaceholder=function(t){this.mdEditor.setPlaceholder(t),this.wwEditor.setPlaceholder(t)},t.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},t}();var _m=n(326),qm=n.n(_m),Vm=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.walk=function(){var t=this.entering,e=this.current;return e?(t?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:e.next?(this.current=e.next,this.entering=!0):(this.current=e.parent,this.entering=!1),{vnode:e,entering:t}):null},t}(),$m=function(){function t(t,e,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=t,this.props=e,this.children=n,this.props.children=n,e.ref&&(this.ref=e.ref,delete e.ref),e.key&&(this.key=e.key,delete e.key)}return t.prototype.walker=function(){return new Vm(this)},t.removalNodes=[],t}();function Um(t,e){var n,r=t;qm()(t)||null==t?r=null:(Pt()(t)||Ft()(t))&&(n=String(t),r=new $m("TEXT_NODE",{nodeValue:n},[])),r&&e.push(r)}var Wm=function(t){for(var e,n,r=arguments,o=1,i="",s="",a=[0],c=function(t){1===o&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(t?r[t]:i):3===o&&(t||i)?(a[1]=t?r[t]:i,o=2):2===o&&"..."===i&&t?a[2]=pe(a[2]||{},r[t]):2===o&&i&&!t?(a[2]=a[2]||{})[i]=!0:o>=5&&(5===o?((a[2]=a[2]||{})[n]=t?i?i+r[t]:r[t]:i,o=6):(t||i)&&(a[2][n]+=t?i+r[t]:i)),i=""},l=0;l"===e?(o=1,i=""):i=e+i[0]:s?e===s?s="":i+=e:'"'===e||"'"===e?s=e:">"===e?(c(),o=1):o&&("="===e?(o=5,n=i,i=""):"/"===e&&(o<5||">"===t[l][u+1])?(c(),3===o&&(a=a[0]),o=a,(a=a[0]).push(this.apply(null,o.slice(1))),o=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(c(),o=2):i+=e),3===o&&"!--"===i&&(o=4,a=a[0])}return c(),a.length>2?a.slice(1):a[1]}.bind((function(t,e){for(var n=[],r=2;r\n \n
\n
\n
0},t}(),Av="undefined"!=typeof WeakMap?new WeakMap:new dv,Lv=function t(e){if(!(this instanceof t))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=yv.getInstance(),r=new Dv(e,n,this);Av.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){Lv.prototype[t]=function(){var e;return(e=Av.get(this))[t].apply(e,arguments)}}));var Iv,Rv,Pv,Bv,Fv,Hv,zv,jv,_v,qv,Vv,$v,Uv,Wv,Jv,Gv,Kv=void 0!==hv.ResizeObserver?hv.ResizeObserver:Lv,Zv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.execCommand=function(t){var e=Fa(t.target,"li");this.props.execCommand("heading",{level:Number(e.getAttribute("data-level"))})},n.prototype.render=function(){var t=this;return Wm(Rv||(Rv=s(["\n
\n "],["\n
\n "])),(function(e){return t.execCommand(e)}),qf.get("Headings"),[1,2,3,4,5,6].map((function(t){return Wm(Iv||(Iv=s(['\n
\n <',">"," ","$>\n \n "],['\n
\n <',">"," ","$>\n \n "])),t,"h"+t,qf.get("Heading"),t)})),qf.get("Paragraph"))},n}(cv),Xv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.toggleTab=function(t,e){this.props.onClick(t,e)},n.prototype.render=function(){var t=this;return Wm(Bv||(Bv=s(['\n
\n ',"\n
\n "],['\n
\n ',"\n
\n "])),Da("tabs"),this.props.tabs.map((function(e){var n=e.name,r=e.text,o=t.props.activeTab===n;return Wm(Pv||(Pv=s(['\n
\n ',"\n
\n "],['\n
\n ',"\n
\n "])),o?" active":"",(function(e){return t.toggleTab(e,n)}),qf.get(r),o?"true":"false",o?"0":"-1",qf.get(r))})))},n}(cv),Qv=function(t){function n(e){var n=t.call(this,e)||this;return n.initialize=function(t){void 0===t&&(t="file");var e=n.refs.url;e.value="",n.refs.altText.value="",n.refs.file.value="",It()(e,"wrong"),n.setState({activeTab:t,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(t,e){e!==n.state.activeTab&&n.initialize(e)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(t){var e=t.target.files;(null==e?void 0:e.length)&&n.setState({file:e[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return e(n,t),n.prototype.emitAddImageBlob=function(){var t=this,e=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null==e?void 0:e.length){r="";var o=e.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,(function(e,r){return t.props.execCommand("addImage",{imageUrl:e,altText:r||n.value})}),"ui")}this.setState({fileNameElClassName:r})},n.prototype.emitAddImage=function(){var t=this.refs.url,e=this.refs.altText,n=t.value,r=e.value||"image";It()(t,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):At()(t,"wrong")},n.prototype.preventSelectStart=function(t){t.preventDefault()},n.prototype.updated=function(){this.props.show||this.initialize()},n.prototype.render=function(){var t=this,e=this.state,n=e.activeTab,r=e.file,o=e.fileNameElClassName;return Wm(Fv||(Fv=s(['\n
\n <'," tabs="," activeTab="," onClick=",' />\n
\n ',' \n \n
\n
\n ',' \n \n \n \n
\n
',' \n
\n
\n
\n \n <'," tabs="," activeTab="," onClick=",' />\n \n ',' \n \n
\n \n ',' \n \n \n \n
\n ',' \n \n \n
\n \n ',' \n \n ',' \n \n \n
\n \n ',' \n \n ',' \n \n \n \n
'],['
'])),c))}r.push(Wm(jv||(jv=s(['',"
"],['',"
"])),Da("table-row"),i))}return Wm(_v||(_v=s(['',"
"],['',"
"])),Da("table"),r)},n.prototype.render=function(){var t=this,e=this.getTableRange(),n=this.getSelectionAreaBound();return Wm(qv||(qv=s(['\n \n ',"
\n \n "],['\n \n ',"
\n \n "])),qf.get("Insert table"),Da("table-selection"),(function(e){return t.refs.tableEl=e}),this.extendSelectionRange,this.execCommand,this.createTableArea(e),Da("table-selection-layer"),n,Da("table-description"),this.getDescription())},n}(cv),eg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},n.prototype.updated=function(t){this.refs.el.replaceChild(this.props.body,t.body)},n.prototype.render=function(){var t=this;return Wm(Vv||(Vv=s(["
"],["
"])),(function(e){return t.refs.el=e}))},n}(cv);function ng(t){return Pt()(t)?function(t){var e;switch(t){case"heading":e={name:"heading",className:"heading",tooltip:qf.get("Headings"),state:"heading"};break;case"bold":e={name:"bold",className:"bold",command:"bold",tooltip:qf.get("Bold"),state:"strong"};break;case"italic":e={name:"italic",className:"italic",command:"italic",tooltip:qf.get("Italic"),state:"emph"};break;case"strike":e={name:"strike",className:"strike",command:"strike",tooltip:qf.get("Strike"),state:"strike"};break;case"hr":e={name:"hr",className:"hrline",command:"hr",tooltip:qf.get("Line"),state:"thematicBreak"};break;case"quote":e={name:"quote",className:"quote",command:"blockQuote",tooltip:qf.get("Blockquote"),state:"blockQuote"};break;case"ul":e={name:"ul",className:"bullet-list",command:"bulletList",tooltip:qf.get("Unordered list"),state:"bulletList"};break;case"ol":e={name:"ol",className:"ordered-list",command:"orderedList",tooltip:qf.get("Ordered list"),state:"orderedList"};break;case"task":e={name:"task",className:"task-list",command:"taskList",tooltip:qf.get("Task"),state:"taskList"};break;case"table":e={name:"table",className:"table",tooltip:qf.get("Insert table"),state:"table"};break;case"image":e={name:"image",className:"image",tooltip:qf.get("Insert image")};break;case"link":e={name:"link",className:"link",tooltip:qf.get("Insert link")};break;case"code":e={name:"code",className:"code",command:"code",tooltip:qf.get("Code"),state:"code"};break;case"codeblock":e={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:qf.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":e={name:"indent",className:"indent",command:"indent",tooltip:qf.get("Indent")};break;case"outdent":e={name:"outdent",className:"outdent",command:"outdent",tooltip:qf.get("Outdent")};break;case"scrollSync":e=function(){var t=document.createElement("label"),e=document.createElement("input"),n=document.createElement("span");t.className="scroll-sync active",e.type="checkbox",e.checked=!0,n.className="switch";var r=function(n){return e.addEventListener("change",(function(e){var r=e.target.checked;r?At()(t,"active"):It()(t,"active"),n("toggleScrollSync",{active:r})}))};return t.appendChild(e),t.appendChild(n),{name:"scrollSync",el:t,onMounted:r}}();break;case"more":e={name:"more",className:"more",tooltip:qf.get("More")}}"scrollSync"!==e.name&&(e.className+=" "+Da("toolbar-icons"));return e}(t):t}function rg(t,e){var n=e.el,r=e.pos,i=e.popup,a=e.initialValues;switch(t){case"heading":return{render:function(t){return Wm($v||($v=s(["<"," ..."," />"],["<"," ..."," />"])),Zv,t)},className:Da("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(t){return Wm(Uv||(Uv=s(["<"," ..."," />"],["<"," ..."," />"])),Yv,t)},className:Da("popup-add-link"),fromEl:n,pos:r,initialValues:a};case"image":return{render:function(t){return Wm(Wv||(Wv=s(["<"," ..."," />"],["<"," ..."," />"])),Qv,t)},className:Da("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(t){return Wm(Jv||(Jv=s(["<"," ..."," />"],["<"," ..."," />"])),tg,t)},className:Da("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return i?o({render:function(t){return Wm(Gv||(Gv=s(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),eg,t,i.body)},fromEl:n,pos:r},i):null;default:return null}}function og(t){t.hidden=t.length===t.filter((function(t){return t.hidden})).length}function ig(t,e){return t.reduce((function(t,n){t.push(n.map((function(t){return function(t){return t.hidden="scrollSync"===t.name&&e,t}(ng(t))})));var r=t[(t.length||1)-1];return r&&og(r),t}),[])}var sg,ag,cg=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleMousedown=function(t){Fa(t.target,"."+Da("popup"))||Fa(t.target,e.props.info.fromEl)||e.props.hidePopup()},e}return e(n,t),n.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},n.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},n.prototype.updated=function(t){var e=this.props,n=e.show,r=e.info;if(n&&r.pos&&t.show!==n){var i=o({},r.pos),s=this.refs.el.offsetWidth,a=Fa(this.refs.el,"."+Da("toolbar")).offsetWidth;i.left+s>=a&&(i.left=a-s-20),ie(this.state.popupPos,i)||this.setState({popupPos:i})}},n.prototype.render=function(){var t=this,e=this.props,n=e.info,r=e.show,i=e.hidePopup,a=e.eventEmitter,c=e.execCommand,l=n||{},u=l.className,p=void 0===u?"":u,d=l.style,f=l.render,h=l.initialValues,m=void 0===h?{}:h,v=o(o({display:r?"block":"none"},d),this.state.popupPos);return Wm(sg||(sg=s(['\n \n "],['\n \n "])),Da("popup"),p,v,(function(e){return t.refs.el=e}),Da("popup-body"),f&&f({eventEmitter:a,show:r,hidePopup:i,execCommand:c,initialValues:m}))},n}(cv);function lg(t){return function(n){function r(t){var e=n.call(this,t)||this;return e.showTooltip=function(t){var n=e.props.item.tooltip;if(!e.props.disabled&&n){var r=e.getBound(t),o=r.left+6+"px",i=r.top+6+"px";Ot()(e.props.tooltipRef.current,{display:"block",left:o,top:i}),e.props.tooltipRef.current.querySelector(".text").textContent=n}},e.hideTooltip=function(){Ot()(e.props.tooltipRef.current,"display","none")},e.state={active:!1},e.addEvent(),e}return e(r,n),r.prototype.addEvent=function(){var t=this,e=this.props,n=e.item,r=e.eventEmitter;n.state&&r.listen("changeToolbarState",(function(e){var r=!!e.toolbarState[n.state];t.setState({active:r})}))},r.prototype.getBound=function(t){var e=Ha(t,Fa(t,"."+Da("toolbar"))),n=e.offsetLeft,r=e.offsetTop;return{left:n,top:t.offsetHeight+r}},r.prototype.render=function(){return Wm(ag||(ag=s(["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "],["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "])),t,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound)},r}(cv)}var ug,pg,dg,fg,hg,mg,vg,gg,yg,bg,wg,kg,xg,Cg,Tg=lg(function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.execCommand=function(){var t=e.props,n=t.item,r=t.execCommand,o=t.setPopupInfo,i=t.getBound,s=t.eventEmitter,a=n.command,c=n.name,l=n.popup;if(a)r(a);else{var u=l?"customPopupBody":c,p=s.emit("query","getPopupInitialValues",{popupName:u})[0],d=rg(u,{el:e.refs.el,pos:i(e.refs.el),popup:l,initialValues:p});d&&o(d)}},e}return e(n,t),n.prototype.mounted=function(){this.setItemWidth()},n.prototype.updated=function(t){t.item.name!==this.props.item.name&&this.setItemWidth()},n.prototype.setItemWidth=function(){var t=this.props,e=t.setItemWidth,n=t.item;e&&e(n.name,Ba(this.refs.el)+(n.hidden?80:0))},n.prototype.render=function(){var t=this,e=this.props,n=e.hideTooltip,r=e.disabled,i=e.item,a=e.active,c=o({display:i.hidden?"none":null},i.style),l=(i.className||"")+(a?" active":"");return Wm(ug||(ug=s(["\n \n \n
';this.tooltipRef.current=Pa(t,this.refs.el)},n.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},n.prototype.movePrevItemToDropdownToolbar=function(t,e,n,r){var o=function(t){var e=t.pop();e&&r.push(e)};if(t>1)o(n);else{var i=se(e);i&&o(i)}},n.prototype.classifyToolbarItems=function(){var t=this,e=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+Da("toolbar-divider")),o=r?Ba(r):0,i=[],s=[],a=!1;return this.initialItems.forEach((function(r,c){var l=[],u=[];r.forEach((function(r,o){r.hidden||((e+=t.itemWidthMap[r.name])>n-50?(a||(t.movePrevItemToDropdownToolbar(o,i,l,u),a=!0),u.push(r)):l.push(r))})),l.length&&(og(l),i.push(l)),u.length&&(og(u),s.push(u)),c
\n \n <'," tabs="," activeTab="," onClick=",' />\n
\n \n
\n <'," tabs="," activeTab="," onClick=",' />\n
\n
\n
'," \n \n "],["\n
\n '," \n \n "])),(function(){a||(c(),t.setState({pos:null}))}),a?" disabled":"",i,n))})),e.push(Wm(bg||(bg=s(['"],['"])),r)),e}),[]):[]},n.prototype.render=function(){var t=o({display:this.state.pos?"block":"none"},this.state.pos);return Wm(wg||(wg=s(['
\n ',"\n
"],['
\n ',"\n
"])),Da("context-menu"),t,this.getMenuGroupElements())},n}(cv),Dg=function(t){function n(e){var n=t.call(this,e)||this;n.changeMode=function(t){t!==n.state.editorType&&n.setState({editorType:t})},n.changePreviewStyle=function(t){t!==n.state.previewStyle&&n.setState({previewStyle:t})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=e.editorType,o=e.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return e(n,t),n.prototype.mounted=function(){var t=this.props.slots,e=t.wwEditor,n=t.mdEditor,r=t.mdPreview;this.refs.wwContainer.appendChild(e),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},n.prototype.insertToolbarItem=function(t,e){this.toolbar.insertToolbarItem(t,e)},n.prototype.removeToolbarItem=function(t){this.toolbar.removeToolbarItem(t)},n.prototype.render=function(){var t=this,e=this.props,n=e.eventEmitter,r=e.hideModeSwitch,o=e.toolbarItems,i=e.theme,a=this.state,c=a.hide,l=a.previewStyle,u=a.editorType,p=c?" hidden":"",d=Da("markdown"===u?"md-mode":"ww-mode"),f=Da("md")+"-"+l+"-style",h=Da(["light"!==i,i+" "]);return Wm(xg||(xg=s(['\n
\n