chunk-0e1a.59b8ada2.js 527 KB

12345678910111213141516
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-0e1a"],{"49oK":function(e,t,n){"use strict";for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),a="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),l=s||i&&+i[1]<57,c=0;c<10;c++)r[48+c]=r[96+c]=String(c);for(c=1;c<=24;c++)r[c+111]="F"+c;for(c=65;c<=90;c++)r[c]=String.fromCharCode(c+32),o[c]=String.fromCharCode(c);for(var u in r)o.hasOwnProperty(u)||(o[u]=r[u]);var d=n("b/sn");n.d(t,"a",function(){return m});const p="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function h(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let a=0;a<i.length-1;a++){let e=i[a];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);p?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function f(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}function m(e){return new d.d({props:{handleKeyDown:function(e){let t=function(e){let t=Object.create(null);for(let n in e)t[h(n)]=e[n];return t}(e);return function(e,n){let i,s=function(e){var t=!(l&&(e.ctrlKey||e.altKey||e.metaKey)||a&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),c=1==s.length&&" "!=s,u=t[f(s,n,!c)];if(u&&u(e.state,e.dispatch,e))return!0;if(c&&(n.shiftKey||n.altKey||n.metaKey||s.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=s){let r=t[f(i,n,!0)];if(r&&r(e.state,e.dispatch,e))return!0}else if(c&&n.shiftKey){let r=t[f(s,n,!0)];if(r&&r(e.state,e.dispatch,e))return!0}return!1}}(e)}})}},"8gFn":function(e,t,n){"use strict";var r=function(){};r.prototype.append=function(e){return e.length?(e=r.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},r.prototype.prepend=function(e){return e.length?r.from(e).append(this):this},r.prototype.appendInner=function(e){return new i(this,e)},r.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?r.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},r.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},r.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},r.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},r.from=function(e){return e instanceof r?e:e&&e.length?new o(e):r.empty};var o=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(r);r.empty=new o([]);var i=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(r),s=r,a=n("uSMm"),l=n("b/sn");n.d(t,"a",function(){return x}),n.d(t,"b",function(){return T}),n.d(t,"c",function(){return C}),n.d(t,"d",function(){return M});const c=500;class u{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new d(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new d(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new u(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let n,l=e.steps[c].invert(e.docs[c]),u=new d(e.mapping.maps[c],l,t);(n=a&&a.merge(u))&&(u=n,c?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>h&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new u(s.append(o),i)}remapping(e,t){let n=new a.a;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new u(this.items.append(e.map(e=>new d(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new d(l,i,c))}else n.push(new d(l))},r);let l=[];for(let c=t;c<i;c++)l.push(new d(o.maps[c]));let p=this.items.slice(0,r).append(l).append(n),h=new u(p,s);return h.emptyItemCount()>c&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new d(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new u(s.from(r.reverse()),o)}}u.empty=new u(s.empty,0);class d{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new d(t.getMap().invert(),t,this.selection)}}}class p{constructor(e,t,n,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r}}const h=20;function f(e){let t=[];return e.forEach((e,n,r,o)=>t.push(r,o)),t}function m(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function g(e,t,n,r){let o=b(t),i=w.get(t).spec.config,s=(r?e.undone:e.done).popEvent(t,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),c=new p(r?l:s.remaining,r?s.remaining:l,null,0);n(s.transform.setSelection(a).setMeta(w,{redo:r,historyState:c}).scrollIntoView())}let v=!1,y=null;function b(e){let t=e.plugins;if(y!=t){v=!1,y=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){v=!0;break}}return v}const w=new l.e("history"),k=new l.e("closeHistory");function x(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new l.d({key:w,state:{init:()=>new p(u.empty,u.empty,null,0),apply:(t,n,r)=>(function(e,t,n,r){let o,i=n.getMeta(w);if(i)return i.historyState;n.getMeta(k)&&(e=new p(e.done,e.undone,null,0));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(w))return s.getMeta(w).redo?new p(e.done.addTransform(n,void 0,r,b(t)),e.undone,f(n.mapping.maps[n.steps.length-1]),e.prevTime):new p(e.done,e.undone.addTransform(n,void 0,r,b(t)),null,e.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new p(e.done.rebased(n,o),e.undone.rebased(n,o),m(e.prevRanges,n.mapping),e.prevTime):new p(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),m(e.prevRanges,n.mapping),e.prevTime);{let o=0==e.prevTime||!s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),i=s?m(e.prevRanges,n.mapping):f(n.mapping.maps[n.steps.length-1]);return new p(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,b(t)),u.empty,i,n.time)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?C:"historyRedo"==n?T:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}const C=(e,t)=>{let n=w.getState(e);return!(!n||0==n.done.eventCount)&&(t&&g(n,e,t,!1),!0)},T=(e,t)=>{let n=w.getState(e);return!(!n||0==n.undone.eventCount)&&(t&&g(n,e,t,!0),!0)};function M(e){let t=w.getState(e);return t?t.done.eventCount:0}},"9RMS":function(e,t,n){},RCw7:function(e,t,n){"use strict";n.d(t,"a",function(){return D}),n.d(t,"b",function(){return M}),n.d(t,"c",function(){return s}),n.d(t,"d",function(){return m}),n.d(t,"e",function(){return d}),n.d(t,"f",function(){return h}),n.d(t,"g",function(){return v}),n.d(t,"h",function(){return C}),n.d(t,"i",function(){return T}),n.d(t,"j",function(){return x});var r=n("uSMm"),o=n("byeC"),i=n("b/sn");const s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function a(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}function l(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function c(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function u(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const d=(e,t,n)=>{let s=u(e,n);if(!s)return!1;let a=p(s);if(!a)return!1;let c=a.nodeAfter;if(y(e,a,t))return!0;if(0==s.parent.content.size&&(l(c,"start")||i.c.isSelectable(c))){let n=Object(r.l)(e.doc,s.before(),s.after(),o.j.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(l(c,"start")?i.f.findFrom(r.doc.resolve(r.mapping.map(a.pos)),1):i.c.create(r.doc,r.mapping.map(a.pos))),t(r.scrollIntoView())}return!0}}return!(!c.isAtom||a.depth!=s.depth-1)&&(t&&t(e.tr.delete(a.pos,a.pos+c.nodeSize).scrollIntoView()),!0)};function p(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const h=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function f(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const m=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),a=f(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,a.createAndFill());o.setSelection(i.f.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0};const g=function(e){return(t,n)=>{let{$from:o,$to:s}=t.selection;if(t.selection instanceof i.c&&t.selection.node.isBlock)return!(!o.parentOffset||!Object(r.g)(t.doc,o.pos)||(n&&n(t.tr.split(o.pos).scrollIntoView()),0));if(!o.parent.isBlock)return!1;if(n){let a=s.parentOffset==s.parent.content.size,l=t.tr;(t.selection instanceof i.h||t.selection instanceof i.a)&&l.deleteSelection();let c=0==o.depth?null:f(o.node(-1).contentMatchAt(o.indexAfter(-1))),u=e&&e(s.parent,a),d=u?[u]:a&&c?[{type:c}]:void 0,p=Object(r.g)(l.doc,l.mapping.map(o.pos),1,d);if(d||p||!Object(r.g)(l.doc,l.mapping.map(o.pos),1,c?[{type:c}]:void 0)||(c&&(d=[{type:c}]),p=!0),p&&(l.split(l.mapping.map(o.pos),1,d),!a&&!o.parentOffset&&o.parent.type!=c)){let e=l.mapping.map(o.before()),t=l.doc.resolve(e);c&&o.node(-1).canReplaceWith(t.index(),t.index()+1,c)&&l.setNodeMarkup(l.mapping.map(o.before()),c)}n(l.scrollIntoView())}return!0}}(),v=(e,t)=>(t&&t(e.tr.setSelection(new i.a(e.doc))),!0);function y(e,t,n){let s,a,c=t.nodeBefore,u=t.nodeAfter;if(c.type.spec.isolating||u.type.spec.isolating)return!1;if(function(e,t,n){let o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!Object(r.f)(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,o.type,o.contentMatchAt(o.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=t.parent.canReplace(t.index(),t.index()+1);if(d&&(s=(a=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&a.matchType(s[0]||u.type).validEnd){if(n){let i=t.pos+u.nodeSize,a=o.c.empty;for(let e=s.length-1;e>=0;e--)a=o.c.from(s[e].create(null,a));a=o.c.from(c.copy(a));let l=e.tr.step(new r.b(t.pos-1,i,t.pos,i,new o.j(a,1,0),s.length,!0)),d=i+2*s.length;Object(r.f)(l.doc,d)&&l.join(d),n(l.scrollIntoView())}return!0}let p=i.f.findFrom(t,1),h=p&&p.$from.blockRange(p.$to),f=h&&Object(r.k)(h);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(h,f).scrollIntoView()),!0;if(d&&l(u,"start",!0)&&l(c,"end")){let i=c,s=[];for(;s.push(i),!i.isTextblock;)i=i.lastChild;let a=u,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(i.canReplace(i.childCount,i.childCount,a.content)){if(n){let i=o.c.empty;for(let e=s.length-1;e>=0;e--)i=o.c.from(s[e].copy(i));n(e.tr.step(new r.b(t.pos-s.length,t.pos+u.nodeSize,t.pos+l,t.pos+u.nodeSize-l,new o.j(i,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function b(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.h.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}const w=b(-1),k=b(1);function x(e,t=null){return function(n,o){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),l=a&&Object(r.i)(a,e,t);return!!l&&(o&&o(n.tr.wrap(a,l).scrollIntoView()),!0)}}function C(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function T(e,t=null){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,e=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o=!1,i=n.tr;for(let t=0;!o&&t<s.length;t++){let{$from:r,$to:i}=s[t];o=n.doc.rangeHasMark(r.pos,i.pos,e)}for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(o)i.removeMark(r.pos,a.pos,e);else{let n=r.pos,o=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,u=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<o&&(n+=c,o-=u),i.addMark(n,o,e.create(t))}}r(i.scrollIntoView())}return!0}}function M(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let S=M(s,(e,t,n)=>{let s=a(e,n);if(!s)return!1;let u=c(s);if(!u){let n=s.blockRange(),o=n&&Object(r.k)(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let d=u.nodeBefore;if(!d.type.spec.isolating&&y(e,u,t))return!0;if(0==s.parent.content.size&&(l(d,"end")||i.c.isSelectable(d))){let n=Object(r.l)(e.doc,s.before(),s.after(),o.j.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(l(d,"end")?i.f.findFrom(r.doc.resolve(r.mapping.map(u.pos,-1)),-1):i.c.create(r.doc,u.pos-d.nodeSize)),t(r.scrollIntoView())}return!0}}return!(!d.isAtom||u.depth!=s.depth-1||(t&&t(e.tr.delete(u.pos-d.nodeSize,u.pos).scrollIntoView()),0))},(e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=c(r)}let a=s&&s.nodeBefore;return!(!a||!i.c.isSelectable(a)||(t&&t(e.tr.setSelection(i.c.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),0))}),E=M(s,d,(e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=p(r)}let a=s&&s.nodeAfter;return!(!a||!i.c.isSelectable(a)||(t&&t(e.tr.setSelection(i.c.create(e.doc,s.pos)).scrollIntoView()),0))});const N={Enter:M(h,(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof i.a||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=f(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(n,s.createAndFill());a.setSelection(i.h.create(a.doc,n+1)),t(a.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Object(r.g)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&Object(r.k)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},g),"Mod-Enter":m,Backspace:S,"Mod-Backspace":S,"Shift-Backspace":S,Delete:E,"Mod-Delete":E,"Mod-a":v},O={"Ctrl-h":N.Backspace,"Alt-Backspace":N["Mod-Backspace"],"Ctrl-d":N.Delete,"Ctrl-Alt-Backspace":N["Mod-Delete"],"Alt-Delete":N["Mod-Delete"],"Alt-d":N["Mod-Delete"],"Ctrl-a":w,"Ctrl-e":k};for(let A in N)O[A]=N[A];const D=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?O:N},WGVu:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return jp});var r=n("byeC"),o=n("cD+i"),i=n("uSMm"),s=n("b/sn"),a=n("49oK"),l=n("RCw7"),c=n("cqjR"),u=n("8gFn"),d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function f(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function m(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var g=function(e,t,n){var r;for(r in n=n||null,e)if(e.hasOwnProperty(r)&&!1===t.call(n,e[r],r,e))break};var v=function(e,t){var n,r,o,i,s=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o<i;o+=1)for(r in n=arguments[o])s.call(n,r)&&(e[r]=n[r]);return e};var y=function(e){return"string"==typeof e||e instanceof String};var b=function(e){return e instanceof Array};var w=function(e,t,n){var r=0,o=e.length;for(n=n||null;r<o&&!1!==t.call(n,e[r],r,e);r+=1);},k=b,x=w,C=g;var T=function(e,t,n){k(e)?x(e,t,n):C(e,t,n)},M=y,S=T;var E=function(e,t,n){var r=e.style;M(t)?r[t]=n:S(t,function(e,t){r[t]=e})},N=b;var O=function(e,t,n){var r,o;if(n=n||0,!N(t))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e,n);for(o=t.length,r=n;n>=0&&r<o;r+=1)if(t[r]===e)return r;return-1};var D=function(e){return void 0===e},A=D;var L=function(e){return e&&e.className?A(e.className.baseVal)?e.className:e.className.baseVal:""},I=b,R=D;var P=function(e,t){t=(t=I(t)?t.join(" "):t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),R(e.className.baseVal)?e.className=t:e.className.baseVal=t},B=T,F=O,H=L,j=P;var z=function(e){var t,n=Array.prototype.slice.call(arguments,1),r=[];e.classList?B(n,function(t){e.classList.add(t)}):((t=H(e))&&(n=[].concat(t.split(/\s+/),n)),B(n,function(e){F(e,r)<0&&r.push(e)}),j(e,r))},q=w,V=O,$=L,_=P;var U=function(e){var t,n,r=Array.prototype.slice.call(arguments,1),o=e.classList;o?q(r,function(e){o.remove(e)}):(t=$(e).split(/\s+/),n=[],q(t,function(e){V(e,r)<0&&n.push(e)}),_(e,n))};var W=function(e){return"number"==typeof e||e instanceof Number};var J=function(e){return null===e},K=g;var G=D,Z=function(e,t){var n=document.createElement("img"),r="";return K(t,function(e,t){r+="&"+t+"="+e}),r=r.substring(1),n.src=e+"?"+r,n.style.display="none",document.body.appendChild(n),document.body.removeChild(n),n},X=6048e5;var Q=function(e,t){var n=location.hostname,r="TOAST UI "+e+" for "+n+": Statistics",o=window.localStorage.getItem(r);(G(window.tui)||!1!==window.tui.usageStatistics)&&(o&&!function(e){return(new Date).getTime()-e>X}(o)||(window.localStorage.setItem(r,(new Date).getTime()),setTimeout(function(){"interactive"!==document.readyState&&"complete"!==document.readyState||Z("https://www.google-analytics.com/collect",{v:1,t:"event",tid:t,cid:n,dp:n,dh:e,el:e,ec:"use"})},1e3)))};/Mac/.test(navigator.platform);var Y=/[\u0020]+/g,ee=/[>(){}[\]+-.!#|]/g,te=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,ne=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,re=/[*_~`]/g,oe=/!\[.*\]\(.*\)/g,ie=/[[\]]/g,se=/(?:^|[^\\])\\(?!\\)/g,ae=new RegExp('[&<>"]',"g");function le(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return e}}function ce(e){return ae.test(e)?e.replace(ae,le):e}function ue(e,t){return-1!==e.indexOf(t)}var de=["rel","target","hreflang","type"],pe={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 he(e){if(!e)return null;var t={};return de.forEach(function(n){D(e[n])||(t[n]=e[n])}),t}function fe(e,t){for(var n="",r=0;r<t;r+=1)n+=e;return n}function me(e){for(var t=[],n=oe.exec(e);n;)t.push([n.index,n.index+n[0].length]),n=oe.exec(e);return e.replace(ie,function(e,n){return t.some(function(e){return n>e[0]&&n<e[1]})?e:"\\"+e})}function ge(e){var t=function(e){return"\\"+e},n=e.replace(Y," ");return ne.test(n)&&(n=n.replace(ne,t)),se.test(n)&&(n=n.replace(se,function(e){return e+"\\"})),n=n.replace(re,t),te.test(n)&&(n=n.replace(te,t)),function(e){var t=!1;return g(pe,function(n){return n.test(e)&&(t=!0),!t}),t}(n)&&(n=n.replace(ee,t)),n}function ve(e){return J(e)||D(e)}function ye(e,t){if(null===e&&e===t)return!0;if("object"!=typeof e||"object"!=typeof t||ve(e)||ve(t))return e===t;for(var n in e)if(e[n]!==t[n])return!1;for(var n in t)if(!(n in e))return!1;return!0}function be(e){return e[e.length-1]}function we(e){return"object"==typeof e&&null!==e}function ke(e,t){var n=h({},e);return e&&t&&Object.keys(t).forEach(function(e){we(n[e])?Array.isArray(t[e])?n[e]=xe(t[e]):n.hasOwnProperty(e)?n[e]=ke(n[e],t[e]):n[e]=Ce(t[e]):n[e]=t[e]}),n}function xe(e){return e.map(function(e){return we(e)?Array.isArray(e)?xe(e):Ce(e):e})}function Ce(e){var t=Object.keys(e);return t.length?t.reduce(function(t,n){return we(e[n])?t[n]=Array.isArray(e[n])?xe(e[n]):Ce(e[n]):t[n]=e[n],t},{}):e}function Te(e,t){return void 0===t&&(t={}),Object.keys(t).forEach(function(n){e.hasOwnProperty(n)&&"object"==typeof e[n]?Array.isArray(t[n])?e[n]=t[n]:Te(e[n],t[n]):e[n]=t[n]}),e}function Me(e,t){return e>t?[t,e]:[e,t]}var Se=w;var Ee=function(e){var t;try{t=Array.prototype.slice.call(e)}catch(n){t=[],Se(e,function(e){t.push(e)})}return t};function Ne(e,t){var n=e.nodes.paragraph;return t?n.create(null,y(t)?e.text(t):t):n.createAndFill()}function Oe(e,t,n){return e.text(t,n)}function De(e,t,n){void 0===n&&(n=t);var r=e.doc.content.size,o=r>0?r-1:1;return s.h.create(e.doc,Math.min(t,o),Math.min(n,o))}function Ae(e,t,n){var r=t.pos;return e.replaceWith(r,r,Ne(n)),e.setSelection(De(e,r+1))}function Le(e){for(var t=e.state,n=e.from,o=e.startIndex,i=e.endIndex,s=e.createText,a=t.tr,l=t.doc,c=t.schema,u=o;u<=i;u+=1){var d=l.child(u),p=d.nodeSize,h=d.textContent,f=d.content,m=s(h),g=m?Oe(c,m):r.c.empty,v=a.mapping.map(n),y=v+f.size;a.replaceWith(v,y,g),n+=p}return a}function Ie(e,t,n,r){var o=n.length;e.split(t).delete(t-o,t).insert(e.mapping.map(t),r).setSelection(De(e,e.mapping.map(t)-o))}function Re(e){return e.sourcepos[0][0]}function Pe(e){return e.sourcepos[1][0]}function Be(e){return e.sourcepos[0][1]}function Fe(e){return e.sourcepos[1][1]}function He(e){var t=e.type;return"strike"===t||"strong"===t||"emph"===t||"code"===t||"link"===t||"image"===t}function je(e){return e&&("item"===e.type||"list"===e.type)}function ze(e){return je(e)&&"ordered"===e.listData.type}function qe(e){return je(e)&&"ordered"!==e.listData.type}function Ve(e){return e&&("tableCell"===e.type||"tableDelimCell"===e.type)}function $e(e,t,n){for(void 0===n&&(n=!0),e=n?e:e.parent;e&&"document"!==e.type;){if(t(e))return e;e=e.parent}return null}function _e(e,t){return[e[0],e[1]+t]}function Ue(e,t){return[e[0],t]}function We(e){var t=e.firstChild.literal;switch(e.type){case"emph":return"*"+t+"*";case"strong":return"**"+t+"**";case"strike":return"~~"+t+"~~";case"code":return"`"+t+"`";case"link":case"image":var n=e,r=n.destination,o=n.title;return("link"===e.type?"":"!")+"["+t+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function Je(e){for(var t=[],n=e.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&t.push(o.literal)}return t.join("")}var Ke=[],Ge={},Ze=/\$\$widget\d+\s/;function Xe(e){var t=e.search(Ze);if(-1!==t){var n=e.substring(t).replace(Ze,"").replace("$$","");e=e.substring(0,t),e+=Xe(n)}return e}function Qe(e,t){return"$$"+e+" "+t+"$$"}function Ye(e,t){var n=Ge[e],r=n.rule,o=n.toDOM,i=Xe(t).match(r);return i&&(t=i[0]),o(t)}function et(){return Ke}function tt(e){(Ke=e).forEach(function(e,t){Ge["widget"+t]=e})}function nt(e,t,n,r){return e.concat(rt(t,n,r))}function rt(e,t,n){void 0===n&&(n=0);var r=[],o=(Ke[n]||{}).rule,i=n+1;if(e=Xe(e),o&&o.test(e)){for(var s=void 0;-1!==(s=e.search(o));){var a=e.substring(0,s);a&&(r=nt(r,a,t,i));var l=(e=e.substring(s)).match(o)[0],c="widget"+n;r.push(t.nodes.widget.create({info:c},t.text(Qe(c,l)))),e=e.substring(l.length)}e&&(r=nt(r,e,t,i))}else e&&(r=n<Ke.length-1?nt(r,e,t,i):[t.text(e)]);return r}function ot(e){for(var t,n="",r=e.walker();t=r.next();){var o=t.node;t.entering&&(o!==e&&"text"!==o.type?(n+=We(o),r.resumeAt(e,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}function it(){return{deleteSelection:function(){return l.c},selectAll:function(){return l.g},undo:function(){return u.c},redo:function(){return u.b}}}var st=O,at=L;var lt=function(e,t){var n;return e.classList?e.classList.contains(t):(n=at(e).split(/\s+/),st(t,n)>-1)},ct=O,ut=Ee,dt=Element.prototype,pt=dt.matches||dt.webkitMatchesSelector||dt.mozMatchesSelector||dt.msMatchesSelector||function(e){var t=this.document||this.ownerDocument;return ct(this,ut(t.querySelectorAll(e)))>-1};var ht=function(e,t){return pt.call(e,t)},ft="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",mt="<([A-Za-z][A-Za-z0-9-]*)("+ft+")*\\s*/?>",gt="(?:"+mt+"|</([A-Za-z][A-Za-z0-9-]*)\\s*[>])",vt=new RegExp("^"+gt,"i"),yt=/<br\s*\/*>/i,bt=/<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,wt="</p><p>";function kt(e,t,n){var r=parseInt(e.left,10),o=parseInt(e.top,10),i=parseInt(e.width,10)+parseInt(e.paddingLeft,10)+parseInt(e.paddingRight,10),s=parseInt(e.height,10)+parseInt(e.paddingTop,10)+parseInt(e.paddingBottom,10);return t>=r&&t<=r+i&&n>=o&&n<=o+s}var xt="toastui-editor-";function Ct(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],r=0,o=e;r<o.length;r++){var i=o[r],s=void 0;(s=Array.isArray(i)?i[0]?i[1]:null:i)&&n.push(""+xt+s)}return n.join(" ")}function Tt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.map(function(e){return xt+"md-"+e}).join(" ")}function Mt(e){return e&&e.nodeType===Node.ELEMENT_NODE}function St(e){e.parentNode&&e.parentNode.removeChild(e)}function Et(e,t,n){D(n)&&(n=!lt(e,t)),(n?z:U)(e,t)}function Nt(e,t){var n=document.createElement("div");y(e)?n.innerHTML=e:n.appendChild(e);var r=n.firstChild;return t&&t.appendChild(r),r}function Ot(e){var t=window.getComputedStyle(e);return["margin-left","margin-right"].reduce(function(e,n){return e+parseInt(t.getPropertyValue(n),10)},0)+e.offsetWidth}function Dt(e,t){var n;for(n=y(t)?function(e){return ht(e,t)}:function(e){return e===t};e&&e!==document;){if(Mt(e)&&n(e))return e;e=e.parentNode}return null}function At(e,t){for(var n=0,r=0;e&&e!==t;){if(n+=e.offsetTop,r+=e.offsetLeft,e.offsetParent===t.offsetParent)break;e=e.offsetParent}return{offsetTop:n,offsetLeft:r}}function Lt(e,t){Object.keys(e).forEach(function(n){ve(e[n])?t.removeAttribute(n):t.setAttribute(n,e[n])})}function It(e){var t=e;return t=(t=t.replace(/<img class="ProseMirror-separator" alt="">/g,"")).replace(/ class="ProseMirror-trailingBreak"/g,"")}var Rt=new s.e("widget"),Pt=function(){function e(e,t){var n=this;this.popup=null,this.removeWidget=function(){n.popup&&(n.rootEl.removeChild(n.popup),n.popup=null)},this.rootEl=e.dom.parentElement,this.eventEmitter=t,this.eventEmitter.listen("blur",this.removeWidget),this.eventEmitter.listen("loadUI",function(){n.rootEl=Dt(e.dom.parentElement,"."+Ct("defaultUI"))}),this.eventEmitter.listen("removePopupWidget",this.removeWidget)}return e.prototype.update=function(e){var t=Rt.getState(e.state);if(this.removeWidget(),t){var n=t.node,r=t.style,o=e.coordsAtPos(t.pos),i=o.top,s=o.left,a=o.bottom-i,l=this.rootEl.getBoundingClientRect(),c=i-l.top;E(n,{opacity:"0"}),this.rootEl.appendChild(n),E(n,{position:"absolute",left:s-l.left+5+"px",top:("bottom"===r?c+a-5:c-a)+"px",opacity:"1"}),this.popup=n,e.focus()}},e.prototype.destroy=function(){this.eventEmitter.removeEventHandler("blur",this.removeWidget)},e}();function Bt(e,t,n){e.emit("addImageBlobHook",t,function(n,r){e.emit("command","addImage",{imageUrl:n,altText:r||t.name||"image"})},n)}function Ft(e){var t=Ee(e).filter(function(e){return-1!==e.type.indexOf("image")});if(1===t.length){var n=t[0];if(n)return n.getAsFile()}return null}var Ht=function(){function e(){}return Object.defineProperty(e.prototype,"type",{get:function(){return"node"},enumerable:!1,configurable:!0}),e.prototype.setContext=function(e){this.context=e},e}();function jt(e){var t=document.createElement("span"),n=Ye(e.attrs.info,e.textContent);return t.className="tui-widget",t.appendChild(n),{dom:t}}function zt(e){return"widget"===e.type.name}var qt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"widget"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{info:{default:null}},group:"inline",inline:!0,content:"text*",selectable:!1,atom:!0,toDOM:function(){return["span",{class:"tui-widget"},0]},parseDOM:[{tag:"span.tui-widget",getAttrs:function(e){return{info:e.textContent.match(/\$\$(widget\d+)/)[1]}}}]}},enumerable:!1,configurable:!0}),t}(Ht),Vt=function(){function e(e){this.timer=null,this.el=document.createElement("div"),this.el.className="toastui-editor",this.eventEmitter=e,this.placeholder={text:""}}return e.prototype.createState=function(){return s.b.create({schema:this.schema,plugins:this.createPlugins()})},e.prototype.initEvent=function(){var e=this.eventEmitter,t=this.view,n=this.editorType;t.dom.addEventListener("focus",function(){return e.emit("focus",n)}),t.dom.addEventListener("blur",function(){return e.emit("blur",n)})},e.prototype.emitChangeEvent=function(e){this.eventEmitter.emit("caretChange",this.editorType),e.docChanged&&this.eventEmitter.emit("change",this.editorType)},Object.defineProperty(e.prototype,"defaultPlugins",{get:function(){var e=this.createInputRules(),t=f(f([],this.keymaps),[Object(a.a)(h({"Shift-Enter":l.a.Enter},l.a)),Object(u.a)(),function(e){return new s.d({props:{decorations:function(t){var n=t.doc;if(e.text&&1===n.childCount&&n.firstChild.isTextblock&&0===n.firstChild.content.size){var r=document.createElement("span");return z(r,"placeholder"),e.className&&z(r,e.className),r.textContent=e.text,o.b.create(n,[o.a.widget(1,r)])}return null}}})}(this.placeholder),function(e){return new s.d({key:Rt,state:{init:function(){return null},apply:function(e){return e.getMeta("widget")}},view:function(t){return new Pt(t,e)}})}(this.eventEmitter),function(e){var t=e.eventEmitter;return new s.d({props:{handleDOMEvents:{drop:function(e,n){var r,o=null===(r=n.dataTransfer)||void 0===r?void 0:r.files;return o&&w(o,function(e){return-1===e.type.indexOf("image")||(n.preventDefault(),n.stopPropagation(),Bt(t,e,n.type),!1)}),!0}}}})}(this.context)]);return e?t.concat(e):t},enumerable:!1,configurable:!0}),e.prototype.createInputRules=function(){var e=et().map(function(e){var t=e.rule;return new c.a(t,function(e,n,r,o){var i=e.schema,s=e.tr,a=e.doc,l=n.input.match(new RegExp(t,"g")),c=a.resolve(r),u=c.parent,d=0;if(zt(u)&&(u=c.node(c.depth-1)),u.forEach(function(e){return zt(e)&&(d+=1)}),l.length>d){var p=be(l),h=rt(p,i);return s.replaceWith(o-p.length+1,o,h)}return null})});return e.length?Object(c.b)({rules:e}):null},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.createSchema=function(){return new r.i({nodes:this.specs.nodes,marks:this.specs.marks})},e.prototype.createKeymaps=function(e){var t=it(),n=t.undo,r=t.redo,o=this.specs.keymaps(e),i={"Mod-z":n(),"Shift-Mod-z":r()};return e?o.concat(Object(a.a)(i)):o},e.prototype.createCommands=function(){return this.specs.commands(this.view)},e.prototype.createPluginProps=function(){var e=this;return this.extraPlugins.map(function(t){return t(e.eventEmitter)})},e.prototype.focus=function(){var e=this;this.clearTimer(),this.timer=setTimeout(function(){e.view.focus(),e.view.dispatch(e.view.state.tr.scrollIntoView())})},e.prototype.blur=function(){this.view.dom.blur()},e.prototype.destroy=function(){var e=this;this.clearTimer(),this.view.destroy(),Object.keys(this).forEach(function(t){delete e[t]})},e.prototype.moveCursorToStart=function(e){var t=this.view.state.tr;this.view.dispatch(t.setSelection(De(t,1)).scrollIntoView()),e&&this.focus()},e.prototype.moveCursorToEnd=function(e){var t=this.view.state.tr;this.view.dispatch(t.setSelection(De(t,t.doc.content.size-1)).scrollIntoView()),e&&this.focus()},e.prototype.setScrollTop=function(e){this.view.dom.scrollTop=e},e.prototype.getScrollTop=function(){return this.view.dom.scrollTop},e.prototype.setPlaceholder=function(e){this.placeholder.text=e,this.view.dispatch(this.view.state.tr.scrollIntoView())},e.prototype.setHeight=function(e){E(this.el,{height:e+"px"})},e.prototype.setMinHeight=function(e){E(this.el,{minHeight:e+"px"})},e.prototype.getElement=function(){return this.el},e}();var $t=function(e){return e instanceof Function},_t=["Enter","Shift-Enter","Mod-Enter","Tab","Shift-Tab","Delete","Backspace","Mod-Delete","Mod-Backspace","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Mod-d","Mod-D","Alt-ArrowUp","Alt-ArrowDown"];function Ut(e,t,n){return e.focus(),t(n)(e.state,e.dispatch,e)}var Wt=function(){function e(e){this.specs=e}return Object.defineProperty(e.prototype,"nodes",{get:function(){return this.specs.filter(function(e){return"node"===e.type}).reduce(function(e,t){var n,r=t.name,o=t.schema;return h(h({},e),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marks",{get:function(){return this.specs.filter(function(e){return"mark"===e.type}).reduce(function(e,t){var n,r=t.name,o=t.schema;return h(h({},e),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),e.prototype.commands=function(e,t){var n=this.specs.filter(function(e){return e.commands}).reduce(function(t,n){var r={},o=n.commands();return $t(o)?r[n.name]=function(t){return Ut(e,o,t)}:Object.keys(o).forEach(function(t){r[t]=function(n){return Ut(e,o[t],n)}}),h(h({},t),r)},{}),r=it();return Object.keys(r).forEach(function(t){n[t]=function(n){return Ut(e,r[t],n)}}),t&&Object.keys(t).forEach(function(r){n[r]=function(n){return Ut(e,t[r],n)}}),n},e.prototype.keymaps=function(e){return this.specs.filter(function(e){return e.keymaps}).map(function(e){return e.keymaps()}).map(function(t){return e||Object.keys(t).forEach(function(e){ue(_t,e)||delete t[e]}),Object(a.a)(t)})},e.prototype.setContext=function(e){this.specs.forEach(function(t){t.setContext(e)})},e}();function Jt(e){var t=e.from,n=e.to;return e instanceof s.a?[t+1,n-1]:[t,n]}function Kt(e){return e.index(0)+1}function Gt(e,t,n){void 0===n&&(n=1);var r=0;return e.forEach(function(e,o){zt(e)&&o+2<t&&(r+=2*n)}),r}function Zt(e,t,n){void 0===n&&(n=t);var r=t===n,o=e.resolve(t),i=Kt(o),s=i,a=o.start(1),l=a;if(!r){var c=e.resolve(n===e.content.size?n-1:n);l=c.start(1),s=Kt(c),c.pos===e.content.size&&(n=e.content.size-2)}var u=Math.max(t-a+1,1),d=Math.max(n-l+1,1);return[[i,u+Gt(e.child(i-1),u,-1)],[s,d+Gt(e.child(s-1),d,-1)]]}function Xt(e,t){for(var n=[],r=0,o=0;r<t;r+=1){var i=e.child(r);n[r]=o,o+=i.nodeSize}return n}function Qt(e,t,n){var r=Xt(e,n[0]),o=t[0]-1,i=n[0]-1,s=e.child(o),a=e.child(i),l=r[o],c=r[i];return l+=t[1]+Gt(s,t[1]-1),c+=n[1]+Gt(a,n[1]-1),[l,Math.min(c,e.content.size)]}function Yt(e){var t=e.$from,n=e.$to,r=e.from,o=e.to,i=t.doc;return e instanceof s.a&&(t=i.resolve(r+1),n=i.resolve(o-1)),0===t.depth&&(n=t=i.resolve(r-1)),{startFromOffset:t.start(1),endFromOffset:n.start(1),startToOffset:t.end(1),endToOffset:n.end(1),startIndex:t.index(0),endIndex:n.index(0),from:t.pos,to:n.pos}}function en(e,t){for(var n=1,r=1,o=0,i=0;o<e.childCount;o+=1){var s=e.child(o).nodeSize;if(n=i+1,r=i+s-1,o===t)break;i+=s}return{startOffset:n,endOffset:r}}var tn="heading",nn="blockQuote",rn="listItem",on="codeBlock",sn="link",an="code",ln="meta",cn="delimiter",un="taskDelimiter",dn="markedText",pn="customBlock",hn={strong:2,emph:1,strike:2};function fn(e,t,n,r){return{start:e,end:t,spec:{type:n,attrs:r}}}function mn(e,t,n){var r=e.type,o=_e(t,hn[r]),i=_e(n,-hn[r]);return[fn(o,i,r),fn(t,o,cn),fn(i,n,cn)]}function gn(e,t,n,r){return[fn(e,t,sn),fn(Ue(e,n[1]+1),Ue(t,r),sn,{desc:!0}),fn(Ue(t,r+2),_e(t,-1),sn,{url:!0})]}function vn(e,t,n,r){var o={start:t,end:n,spec:{attrs:{className:r+"-line-background",codeStart:t[0],codeEnd:n[0]}},lineBackground:!0};return"item"!==e.type&&"blockQuote"!==e.type?[h(h({},o),{end:t,spec:{attrs:{className:r+"-line-background start"}}}),h(h({},o),{start:[Math.min(t[0]+1,n[0]),t[1]]})]:null}function yn(e,t){for(var n=[];e;){var r=e.type;"paragraph"!==r&&"codeBlock"!==r||n.push(fn([Re(e),Be(e)-1],[Pe(e),Fe(e)+1],t)),e=e.next}return n}var bn={heading:function(e,t,n){var r=e.level,o=e.headingType,i=[fn(t,n,tn,{level:r})];return"atx"===o?i.push(fn(t,_e(t,r),cn)):i.push(fn(Ue(n,0),n,tn,{seText:!0})),i},strong:mn,emph:mn,strike:mn,link:function(e,t,n){var r=e.lastChild,o=e.extendedAutolink,i=r?Fe(r)+1:2;return o?[fn(t,n,sn,{desc:!0})]:gn(t,n,t,i)},image:function(e,t,n){var r=e.lastChild,o=r?Fe(r)+1:3,i=_e(t,1);return f([fn(t,i,ln)],gn(t,n,i,o))},code:function(e,t,n){var r=e.tickCount,o=_e(t,r),i=_e(n,-r);return[fn(t,n,an),fn(t,o,an,{start:!0}),fn(o,i,an,{marked:!0}),fn(i,n,an,{end:!0})]},codeBlock:function(e,t,n,r){var o=e.fenceOffset,i=e.fenceLength,s=e.fenceChar,a=e.info,l=e.infoPadding,c=e.parent,u=o+i,d=[fn(Ue(t,1),n,on)];s&&d.push(fn(t,_e(t,u),cn)),a&&d.push(fn(_e(t,i),_e(t,i+l+a.length),ln)),new RegExp("^(\\s{0,4})("+s+"{"+i+",})").test(r)&&d.push(fn(Ue(n,1),n,cn));var p=vn(c,t,n,"code-block");return p?d.concat(p):d},blockQuote:function(e,t,n){var r=e.parent&&"blockQuote"!==e.parent.type?[fn(t,n,nn)]:[];if(e.firstChild){var o=[];"paragraph"===e.firstChild.type?o=function(e){for(var t=[];e;)t.push(fn([Re(e),Be(e)],[Pe(e),Fe(e)+1],dn)),e=e.next;return t}(e.firstChild.firstChild):"list"===e.firstChild.type&&(o=yn(e.firstChild,dn)),r=f(f([],r),o)}return r},item:function(e,t){var n=e.listData,r=n.padding,o=n.task,i=function(e){for(var t=0;e.parent.parent&&"item"===e.parent.parent.type;)e=e.parent.parent,t+=1;return[rn,h(h({},[{odd:!0},{even:!0}][t%2]),{listStyle:!0})]}(e),s=[fn.apply(void 0,f([t,_e(t,r)],i))];return o&&(s.push(fn(_e(t,r),_e(t,r+3),un)),s.push(fn(_e(t,r+1),_e(t,r+2),ln))),s.concat(yn(e.firstChild,dn))},customBlock:function(e,t,n){var r=e,o=r.offset,i=r.syntaxLength,s=r.info,a=r.parent,l=o+i,c=[fn(Ue(t,1),n,pn)];c.push(fn(t,_e(t,l),cn)),s&&c.push(fn(_e(t,l),_e(t,i+s.length),ln)),c.push(fn(Ue(n,1),n,cn));var u=vn(a,t,n,"custom-block");return u?c.concat(u):c}},wn={thematicBreak:"thematicBreak",table:"table",tableCell:"tableCell",htmlInline:"html"};function kn(e,t,n,r){var o=e.type;return $t(bn[o])?bn[o](e,t,n,r):wn[o]?[fn(t,n,wn[o])]:null}var xn={};function Cn(e){var t=e.schema,n=e.toastMark;return new s.d({appendTransaction:function(e,r,o){var i=e[0],s=o.tr;if(i.docChanged){var a=[];i.getMeta("editResult").forEach(function(e){var t=e.nodes,r=e.removedNodeRange;if(t.length){a=a.concat(function(e,t){var n=e.doc,r=t[0].sourcepos[0],o=be(t).sourcepos[1],i=[r[0],r[1]],s=[o[0],o[1]+1],a=[];return function(e,t,n){var r=[];xn={};for(var o=t[0]-1;o<n[0];o+=1){var i=e.child(o),s=i.attrs.codeEnd,a=i.attrs.codeStart;if(a&&s&&!ue(r,a)){r.push(a),s=Math.min(s,e.childCount);for(var l=a-1,c=n[0],u=l;u<c;u+=1)xn[u]=!0}}}(n,r,o),a.push({start:i,end:s}),a}(s,t));for(var o=0,i=t;o<i.length;o++)for(var l=i[o].walker(),c=l.next();c;){var u=c.node;c.entering&&(a=a.concat(Mn(u,n))),c=l.next()}}else if(r)for(var d=s.doc.childCount-1,p=r.line,h=p[0],f=p[1],m=Math.min(h,d),g=Math.min(f,d),v=m;v<=g;v+=1)xn[v]=!0}),function(e,t,n){var r=e.doc,o=t.nodes.paragraph,i=Xt(r,r.childCount);n.forEach(function(n){var s=n.start,a=n.end,l=n.spec,c=n.lineBackground,u=Math.min(s[0],r.childCount)-1,d=Math.min(a[0],r.childCount)-1,p=r.child(u),h=r.child(d),f=i[u],m=i[d];if(f+=s[1]+Gt(p,s[1]-1),m+=a[1]+Gt(h,a[1]-1),l)if(c){var g={from:f,to:m,startIndex:u,endIndex:d};!function(e,t,n,r,o){void 0===o&&(o={});for(var i=r.startIndex,s=r.endIndex,a=r.from,l=r.to,c=!1,u=i;u<=s;u+=1)delete xn[u],c=Tn(t,u,o);c&&e.setBlockType(a,l,n,o)}(e,r,o,g,l.attrs)}else e.addMark(f,m,t.mark(l.type,l.attrs));else e.removeMark(f,m)}),function(e,t,n){Object.keys(xn).forEach(function(r){var o=Number(r),i=Math.min(Number(r)+1,e.doc.childCount-1),s=t[o],a=t[i]-1;o===i&&(a+=2),e.setBlockType(s,a,n)})}(e,i,o)}(s,t,a)}return s.setMeta("widget",i.getMeta("widget"))}})}function Tn(e,t,n){return Object.keys(n).some(function(r){return n[r]!==e.child(t).attrs[r]})}function Mn(e,t){var n=t.getLineTexts(),r=[Re(e),Be(e)],o=[Pe(e),Fe(e)+1],i=kn(e,r,o,n[o[0]-1]);return null!==i&&void 0!==i?i:[]}var Sn=["taskList","orderedList","bulletList","table","strong","emph","strike","heading","thematicBreak","blockQuote","code","codeBlock","indent","outdent"];function En(e){var t={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}},n=!0;return function(e,t,n){for(void 0===n&&(n=!0),e=n?e:e.parent;e&&"document"!==e.type;)t(e),e=e.parent}(e,function(e){var r=function(e){var t=e.type;return je(e)?e.listData.task?"taskList":"ordered"===e.listData.type?"orderedList":"bulletList":-1!==t.indexOf("table")?"table":ue(Sn,t)?t:null}(e);r&&("bulletList"===r||"orderedList"===r?n&&(t[r]={active:!0},t.indent.disabled=!1,t.outdent.disabled=!1,n=!1):t[r]={active:!0})}),t}var Nn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),t}(Ht),On=function(){function e(){}return Object.defineProperty(e.prototype,"type",{get:function(){return"mark"},enumerable:!1,configurable:!0}),e.prototype.setContext=function(e){this.context=e},e}();function Dn(e,t){return An(e,t-1)}function An(e,t){return e.child(t).textContent}var Ln=/^\s*> ?/,In=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("block-quote")},0]}}},enumerable:!1,configurable:!0}),t.prototype.createBlockQuoteText=function(e,t){return t?e.replace(Ln,"").trim():"> "+e.trim()},t.prototype.extendBlockQuote=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.tr,s=t.schema,a=Yt(r),l=a.endFromOffset,c=a.endToOffset,u=a.endIndex,d=a.to,p=An(o,u);if(Ln.test(p)&&d>l&&r.empty){if(!p.replace(Ln,"").trim())i.deleteRange(l,c).split(i.mapping.map(c));else{var h=p.slice(d-l).trim();Ie(i,c,h,Oe(s,e.createBlockQuoteText(h)))}return n(i),!0}return!1}},t.prototype.commands=function(){var e=this;return function(){return function(t,n){var r=t.selection,o=t.doc,i=Yt(r),s=i.startFromOffset,a=i.endToOffset,l=i.startIndex,c=i.endIndex,u=Ln.test(An(o,l)),d=Le({state:t,startIndex:l,endIndex:c,from:s,createText:function(t){return e.createBlockQuoteText(t,u)}});return n(d.setSelection(De(d,d.mapping.map(a)))),!0}}},t.prototype.keymaps=function(){var e=this.commands()();return{"alt-q":e,"alt-Q":e,Enter:this.extendBlockQuote()}},t}(On),Rn=/(^\s*)([-*+] |[\d]+\. )/,Pn=/(^\s*)([\d])+\.( \[[ xX]])? /,Bn=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Fn=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Hn=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,jn=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,zn=/(^\s*)([-*+])( \[[ xX]]) /;function qn(e){return Pn.test(e)?"ordered":"bullet"}function Vn(e){for(var t=0;e&&"document"!==e.type;)"list"===e.type&&(t+=1),e=e.parent;return t}function $n(e,t,n,r){for(var o=e.getLineTexts().length,i=[],s=t;r?s<o:s>1;){s=r?s+1:s-1;var a=e.findFirstNodeAtLine(s),l=Vn(a);if(l===n)i.push({line:s,depth:n,mdNode:a});else if(l<n)break}return i}function _n(e,t,n,r){void 0===r&&(r=0);var o=Number.MAX_VALUE,i=0;return{changedResults:t.map(function(t,s){var a=t.line;o=Math.min(a-1,o),i=Math.max(a-1,i);var l=Dn(e,a);return{text:l="bullet"===n?function(e){if(!Rn.test(e))return"* "+e;var t=qn(e);return"bullet"===t&&Fn.test(e)?e=e.replace(zn,"$1$2 "):"ordered"===t&&(e=e.replace(Pn,"$1* ")),e}(l):function(e,t){if(!Rn.test(e))return t+". "+e;var n=qn(e);if("bullet"===n||"ordered"===n&&Fn.test(e))e=e.replace(Fn,"$1"+t+". ");else if("ordered"===n){var r=Bn.exec(e)[3];Number(r)!==t&&(e=e.replace(Pn,"$1"+t+". "))}return e}(l,s+1+r),line:a}}),firstIndex:o,lastIndex:i}}function Un(e,t){var n=function(e){var t=e.toastMark,n=e.mdNode,r=e.line,o=Vn(n),i=$n(t,r,o,!1).reverse(),s=$n(t,r,o,!0);return i.concat([{line:r,depth:o,mdNode:n}]).concat(s)}(t);return _n(t.doc,n,e)}var Wn={bullet:function(e){return Un("bullet",e)},ordered:function(e){return Un("ordered",e)},task:function(e){var t=e.mdNode,n=e.doc,r=e.line,o=Dn(n,r);return t.listData.task?o=o.replace(jn,"$1$2"):je(t)&&(o=o.replace(Rn,"$1$2[ ] ")),{changedResults:[{text:o,line:r}]}}},Jn={bullet:function(e){var t=e.doc,n=e.line;return{changedResults:[{text:"* "+Dn(t,n),line:n}]}},ordered:function(e){for(var t=e.toastMark,n=e.doc,r=e.line,o=e.startLine,i=Dn(n,r),s=1,a=o,l=0,c=o-1;c>0;c-=1){var u=t.findFirstNodeAtLine(c),d=Dn(n,c)&&!!$e(u,function(e){return je(e)}),p=Bn.exec(Dn(n,c));if(!p&&!d)break;if(p||!d){var h=p,f=h[1],m=h[3];if(!f){s=Number(m),a=c;break}}else l+=1}return{changedResults:[{text:s+r-a-l+". "+i,line:r}]}},task:function(e){var t=e.doc,n=e.line;return{changedResults:[{text:"* [ ] "+Dn(t,n),line:n}]}}},Kn={bullet:function(e){var t=e.line,n=Dn(e.doc,t),r=Hn.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(e){var t=e.toastMark,n=e.line,r=e.mdNode,o=e.doc,i=Vn(r),s=Dn(o,n),a=Bn.exec(s),l=a[1],c=a[3],u=a[4],d=Number(c)+1,p=""+l+d+u,f=$n(t,n,i,!0).filter(function(e){var t=Bn.exec(Dn(o,e.line));return t&&t[1].length===l.length&&!!$e(e.mdNode,function(e){return ze(e)})});return h({listSyntax:p},_n(o,f,"ordered",d))}};var Gn=/(^\s{1,4})(.*)/;function Zn(e,t,n){return e<t||Rn.test(n)||Ln.test(n)}function Xn(e,t,n){var r=n.$from;0===r.depth&&(r=e.resolve(r.pos-1));var o=r.node(1),i=r.start(1),s=o.content.size;return o.rangeHasMark(0,s,t.marks.table)&&r.pos-i!==s&&r.pos!==i}function Qn(e,t){var n=t.from,r=t.to;if("indent"===t.type){n+=4,r+=4*(t.lineLen+1)}else{var o=t.spaceLenList;n-=o[0];for(var i=0;i<o.length;i+=1)r-=o[i]}return De(e,n,r)}var Yn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"inline*",attrs:{className:{default:null},codeStart:{default:null},codeEnd:{default:null}},selectable:!1,group:"block",parseDOM:[{tag:"div"}],toDOM:function(e){var t=e.attrs;return t.className?["div",{class:Tt(t.className)},0]:["div",0]}}},enumerable:!1,configurable:!0}),t.prototype.reorderList=function(e,t){for(var n=this.context,r=n.view,o=n.toastMark,i=n.schema,s=r.state,a=s.tr,l=s.selection,c=s.doc,u=o.findFirstNodeAtLine(e),d=u;u&&!qe(u)&&"document"!==u.parent.type;)if(ze(u=u.parent)){d=u;break}d&&(e=d.sourcepos[0][0]);var p=Bn.exec(Dn(c,e)),h=p[1],f=p[3],m=h.length,g=function e(t,n,r,o,i){for(var s=[],a=Dn(t,r),l=Bn.exec(a);l;){var c=l[1],u=l[4],d=l[5],p=c.length;if(p===i)s.push(Oe(n,""+c+o+u+d)),o+=1,r+=1;else if(p>i){var h=e(t,n,r,1,p);r=h.line,s=s.concat(h.nodes)}if(p<i||r>t.childCount)break;a=Dn(t,r),l=Bn.exec(a)}return{nodes:s,line:r}}(c,i,e,Number(f),m),v=g.line,y=g.nodes;t=Math.max(t,v-1);for(var b=en(c,e-1).startOffset,w=e-1;w<=t-1;w+=1){var k=c.child(w),x=k.nodeSize,C=k.content,T=a.mapping.map(b),M=T+C.size;a.replaceWith(T,M,y[w-e+1]),b+=x}var S=De(a,l.from,l.to);r.dispatch(a.setSelection(S))},t.prototype.indent=function(e){var t=this;return void 0===e&&(e=!1),function(){return function(n,r){var o=n.schema,i=n.selection,s=n.doc,a=Yt(i),l=a.from,c=a.to,u=a.startFromOffset,d=a.startIndex,p=a.endIndex;if(e&&Xn(s,o,i))return!1;var h=An(s,d);if(e&&Zn(l,c,h)||!e&&Rn.test(h)){var f=Le({state:n,from:u,startIndex:d,endIndex:p,createText:function(e){return" "+e}}),m={type:"indent",from:l,to:c,lineLen:p-d};r(f.setSelection(Qn(f,m))),Bn.test(h)&&t.reorderList(d+1,p+1)}else e&&r(n.tr.insert(c,Oe(o," ")));return!0}}},t.prototype.outdent=function(e){var t=this;return void 0===e&&(e=!1),function(){return function(n,r){var o=n.selection,i=n.doc,s=n.schema,a=Yt(o),l=a.from,c=a.to,u=a.startFromOffset,d=a.startIndex,p=a.endIndex;if(e&&Xn(i,s,o))return!1;var h=An(i,d);if(e&&Zn(l,c,h)||!e&&Rn.test(h)){var f=[],m=Le({state:n,from:u,startIndex:d,endIndex:p,createText:function(e){var t=Gn.exec(e);return f.push(t?t[1].length:0),e.replace(Gn,"$2")}}),g={type:"outdent",from:l,to:c,spaceLenList:f};r(m.setSelection(Qn(m,g))),Bn.test(h)&&t.reorderList(d+1,p+1)}else if(e){var v=h.slice(0,c-u),y=v.replace(/\s{1,4}$/,""),b=c-(v.length-y.length);r(n.tr.delete(b,c))}return!0}}},t.prototype.deleteLines=function(){var e=this;return function(t,n){var r=e.context.view,o=Yt(t.selection),i=o.startFromOffset,s=o.endToOffset;return Object(l.b)(function(){return n(t.tr.deleteRange(i,s)),!0},l.e)(t,n,r)}},t.prototype.moveDown=function(){return function(e,t){var n=e.doc,r=e.tr,o=e.selection,i=e.schema,s=Yt(o),a=s.startFromOffset,l=s.endToOffset,c=s.endIndex;if(c<n.content.childCount-1){var u=n.child(c+1),d=u.nodeSize,p=u.textContent;return r.delete(l,l+d).split(a).insert(r.mapping.map(a)-2,Oe(i,p)),t(r),!0}return!1}},t.prototype.moveUp=function(){return function(e,t){var n=e.tr,r=e.doc,o=e.selection,i=e.schema,s=Yt(o),a=s.startFromOffset,l=s.endToOffset,c=s.startIndex;if(c>0){var u=r.child(c-1),d=u.nodeSize,p=u.textContent;return n.delete(a-d,a).split(n.mapping.map(l)).insert(n.mapping.map(l),Oe(i,p)),t(n),!0}return!1}},t.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},t.prototype.keymaps=function(){return{Tab:this.indent(!0)(),"Shift-Tab":this.outdent(!0)(),"Mod-d":this.deleteLines(),"Mod-D":this.deleteLines(),"Alt-ArrowUp":this.moveUp(),"Alt-ArrowDown":this.moveDown()}},t}(Ht),er=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),t}(Ht),tr=/^#{1,6}\s/,nr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(e){var t=e.attrs,n="heading|heading"+t.level;return t.seText&&(n+="|delimiter|setext"),["span",{class:Tt.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.createHeadingText=function(e,t,n){for(var r=t.replace(n,"").trim(),o="";e>0;)o+="#",e-=1;return o+" "+r},t.prototype.commands=function(){var e=this;return function(t){return function(n,r){var o=t.level,i=Yt(n.selection),s=i.startFromOffset,a=i.endToOffset,l=Le({state:n,from:s,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(t){var n=t.match(tr),r=n?n[0]:"";return e.createHeadingText(o,t,r)}});return r(l.setSelection(De(l,l.mapping.map(a)))),!0}}},t}(On),rr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("code-block")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){var n=e.selection,r=e.schema,o=e.tr,i=Yt(n),s=i.startFromOffset,a=i.endToOffset,l=Oe(r,"```");return o.insert(s,l).split(s+"```".length),o.split(o.mapping.map(a)).insert(o.mapping.map(a),l),t(o.setSelection(De(o,o.mapping.map(a)-("```".length+2)))),!0}}},t.prototype.keepIndentation=function(){var e=this;return function(t,n){var r=t.selection,o=t.tr,i=t.doc,s=t.schema,a=e.context.toastMark,l=Yt(r),c=l.startFromOffset,u=l.endToOffset,d=l.endIndex,p=l.from,h=l.to,f=An(i,d);if(p===h&&f.trim()){var m=f.match(/^\s+/);if(function(e){return e&&"codeBlock"===e.type}(a.findFirstNodeAtLine(d+1))&&m){var g=m[0],v=f.slice(h-c);return Ie(o,u,v,Oe(s,g+v)),n(o),!0}}return!1}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-p":e,"Shift-Mod-P":e,Enter:this.keepIndentation()}},t}(On),or=/\||\s/g;function ir(e,t){for(var n="|",r=0;r<e;r+=1)n+=t?" --- |":" |";return n}var sr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("table")},0]}}},enumerable:!1,configurable:!0}),t.prototype.extendTable=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.tr,s=t.schema;if(!r.empty)return!1;var a=Yt(r),l=a.endFromOffset,c=a.endToOffset,u=a.endIndex,d=a.to,p=An(o,u),h=[u+1,d-l+1],f=$e(e.context.toastMark.findNodeAtPosition(h),function(e){return Ve(e)&&("tableDelimRow"===e.parent.type||"tableBody"===e.parent.parent.type)});if(f){var m=!p.replace(or,"").trim(),g=ir(f.parent.parent.parent.columns.length);return m?i.deleteRange(l,c).split(i.mapping.map(c)):i.split(c).insert(i.mapping.map(c),Oe(s,g)).setSelection(De(i,i.mapping.map(c)-2)),n(i),!0}return!1}},t.prototype.moveTableCell=function(e){var t=this;return function(n,r){var o=n.selection,i=n.tr,s=Yt(o),a=s.endFromOffset,l=[s.endIndex+1,s.to-a],c=$e(t.context.toastMark.findNodeAtPosition(l),function(e){return Ve(e)});if(c){var u=c.parent,d=function(e){return e?{type:"next",parentType:"tableHead",childType:"firstChild"}:{type:"prev",parentType:"tableBody",childType:"lastChild"}}(e),p=d.type,h=d.parentType,f=d.childType,m=Fe(c);if(c[p])m=Fe(c[p])-1;else{var g=u[p]||u.parent.type!==h?u[p]:u.parent[p][f];if("next"===p)m+=(g?Fe(g[f]):0)+2;else"prev"===p&&(m=g?-4:0)}return r(i.setSelection(De(i,a+m))),!0}return!1}},t.prototype.addTable=function(){return function(e){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=e,a=s.columnCount,l=s.rowCount,c=Yt(r).endToOffset,u=function(e){return[ir(e),ir(e,!0)]}(a),d=function(e,t){for(var n=[],r=0;r<t;r+=1)n.push(ir(e));return n}(a,l-1);return f(f([],u),d).forEach(function(e){o.split(o.mapping.map(c)).insert(o.mapping.map(c),Oe(i,e))}),n(o.setSelection(De(o,c+4))),!0}}},t.prototype.commands=function(){return{addTable:this.addTable()}},t.prototype.keymaps=function(){return{Enter:this.extendTable(),Tab:this.moveTableCell(!0),"Shift-Tab":this.moveTableCell(!1)}},t}(On),ar=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("thematic-break")},0]}}},enumerable:!1,configurable:!0}),t.prototype.hr=function(){return function(){return function(e,t){var n=e.selection,r=e.schema,o=e.tr,i=Yt(n),s=i.from,a=i.to,l=i.endToOffset,c=Oe(r,"***");return o.split(s).replaceWith(o.mapping.map(s),o.mapping.map(a),c).split(o.mapping.map(a)).setSelection(De(o,o.mapping.map(l))),t(o),!0}}},t.prototype.commands=function(){return{hr:this.hr()}},t.prototype.keymaps=function(){var e=this.hr()();return{"Mod-l":e,"Mod-L":e}},t}(On);function lr(e,t){var n=e.type;return t<=e.sourcepos[0][0]&&("codeBlock"===n||"heading"===n||n.match("table"))}var cr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{odd:{default:!1},even:{default:!1},listStyle:{default:!1}},toDOM:function(e){var t=e.attrs,n=t.odd,r=t.even,o="list-item";return t.listStyle&&(o+="|list-item-style"),n&&(o+="|list-item-odd"),r&&(o+="|list-item-even"),["span",{class:Tt.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.extendList=function(){var e=this;return function(t,n){var r=t.selection,o=t.doc,i=t.schema,s=t.tr,a=e.context.toastMark,l=Yt(r),c=l.to,u=l.startFromOffset,d=l.endFromOffset,p=l.endIndex,h=l.endToOffset,f=An(o,p);if(!Rn.test(f)||r.from===u||!r.empty)return!1;if(!f.replace(Fn,"").trim())s.deleteRange(d,h).split(s.mapping.map(h));else{var m=qn(f),g=a.findFirstNodeAtLine(p+1),v=f.slice(c-d),y={toastMark:a,mdNode:g,doc:o,line:p+1},b=Kn[m](y),w=b.listSyntax,k=b.changedResults;if(null===k||void 0===k?void 0:k.length){s.split(c),k.unshift({text:w+v,line:p+1}),e.changeToListPerLine(s,k,{from:c,startLine:k[0].line,endLine:be(k).line});var x=s.mapping.map(h)-v.length;s.setSelection(De(s,x))}else{Ie(s,h,v,Oe(i,w+v))}}return n(s),!0}},t.prototype.toList=function(e){var t=this;return function(){return function(n,r){for(var o=n.doc,i=n.tr,s=n.selection,a=t.context.toastMark,l=Yt(s),c=l.startIndex+1,u=l.endIndex+1,d=l.endToOffset,p=[],h=c;h<=u;h+=1){var f=a.findFirstNodeAtLine(h);if(f&&lr(f,h))break;if(-1===p.indexOf(h)){var m={toastMark:a,mdNode:f,doc:o,line:h,startLine:c},g=(je(f)?Wn[e](m):Jn[e](m)).changedResults,v=t.changeToListPerLine(i,g,{from:en(o,g[0].line-1).startOffset,startLine:g[0].line,endLine:be(g).line,indexDiff:1});d=Math.max(v,d),g&&(p=p.concat(g.map(function(e){return e.line})))}}return r(i.setSelection(De(i,i.mapping.map(d)))),!0}}},t.prototype.changeToListPerLine=function(e,t,n){for(var r=n.from,o=n.startLine,i=n.endLine,s=n.indexDiff,a=void 0===s?0:s,l=0,c=function(n){var o=e.doc.child(n),i=o.nodeSize,s=o.content,c=e.mapping.map(r),d=c+s.size,p=t.filter(function(e){return e.line-a===n})[0];p&&(e.replaceWith(c,d,Oe(u.context.schema,p.text)),l=Math.max(l,r+s.size)),r+=i},u=this,d=o-a;d<=i-a;d+=1)c(d);return l},t.prototype.toggleTask=function(){var e=this;return function(t,n){for(var r=t.selection,o=t.tr,i=t.doc,s=t.schema,a=e.context.toastMark,l=Yt(r),c=l.startIndex,u=l.endIndex,d=null,p=c;p<=u;p+=1){var h=a.findFirstNodeAtLine(p+1);if(je(h)&&h.listData.task){var f=h.listData,m=f.checked,g=f.padding,v=m?" ":"x",y=h.sourcepos[0],b=en(i,y[0]-1).startOffset;b+=y[1]+g,d=o.replaceWith(b,b+1,s.text(v))}}return!!d&&(n(d),!0)}},t.prototype.commands=function(){return{bulletList:this.toList("bullet"),orderedList:this.toList("ordered"),taskList:this.toList("task")}},t.prototype.keymaps=function(){var e=this.toList("bullet")(),t=this.toList("ordered")(),n=this.toList("task")(),r=this.toggleTask();return{"Mod-u":e,"Mod-U":e,"Mod-o":t,"Mod-O":t,"alt-t":n,"alt-T":n,"Shift-Ctrl-x":r,"Shift-Ctrl-X":r,Enter:this.extendList()}},t}(On);function ur(e,t){return function(){return function(n,r){var o=n.tr,i=n.selection,s=$t(e)?e:function(t){return e.test(t)},a=t.length,l=o.doc,c=Jt(i),u=c[0],d=c[1],p=Math.max(u-a,1),h=Math.min(d+a,l.content.size-1),f=i.content(),m=f.content.textBetween(0,f.content.size,"\n"),g=l.textBetween(p,u,"\n"),v=l.textBetween(d,h,"\n");if(m=""+g+m+v,g&&v&&s(m))o.delete(h-a,h).delete(p,p+a);else{o.insertText(t,d).insertText(t,u);var y=i.empty?De(o,u+a):De(o,u+a,d+a);o.setSelection(y)}return r(o),!0}}}var dr=/^(\*{2}|_{2}).*([\s\S]*)\1$/m,pr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("strong")},0]}}},enumerable:!1,configurable:!0}),t.prototype.bold=function(){return ur(dr,"**")},t.prototype.commands=function(){return{bold:this.bold()}},t.prototype.keymaps=function(){var e=this.bold()();return{"Mod-b":e,"Mod-B":e}},t}(On),hr=/^(~{2}).*([\s\S]*)\1$/m,fr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("strike")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return ur(hr,"~~")},t.prototype.keymaps=function(){var e=this.commands()();return{"Mod-s":e,"Mod-S":e}},t}(On),mr=/^(\*|_).*([\s\S]*)\1$/m,gr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("emph")},0]}}},enumerable:!1,configurable:!0}),t.prototype.italic=function(){return ur(mr,"*")},t.prototype.commands=function(){return{italic:this.italic()}},t.prototype.keymaps=function(){var e=this.italic()();return{"Mod-i":e,"Mod-I":e}},t}(On),vr=/^(`).*([\s\S]*)\1$/m,yr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{start:{default:!1},end:{default:!1},marked:{default:!1}},toDOM:function(e){var t=e.attrs,n=t.start,r=t.end,o=t.marked,i="code";return n&&(i+="|delimiter|start"),r&&(i+="|delimiter|end"),o&&(i+="|marked-text"),["span",{class:Tt.apply(void 0,i.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return ur(vr,"`")},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-c":e,"Shift-Mod-C":e}},t}(On),br=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(e){var t=e.attrs,n=t.url,r=t.desc,o="link";return n&&(o+="|link-url|marked-text"),r&&(o+="|link-desc|marked-text"),["span",{class:Tt.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),t.prototype.addLinkOrImage=function(e){return function(t){return function(n,r){var o=n.selection,i=n.tr,s=n.schema,a=Jt(o),l=a[0],c=a[1],u=t,d=u.linkText,p=u.altText,h=u.linkUrl,f=u.imageUrl,m=d,g=h,v="";return"image"===e&&(m=p,g=f,v="!"),v+="["+(m=me(m))+"]("+g+")",r(i.replaceWith(l,c,Oe(s,v))),!0}}},t.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},t}(On),wr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),t}(On),kr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("delimiter")},0]}}},enumerable:!1,configurable:!0}),t}(On),xr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("meta")},0]}}},enumerable:!1,configurable:!0}),t}(On),Cr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("marked-text")},0]}}},enumerable:!1,configurable:!0}),t}(On),Tr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("table-cell")},0]}}},enumerable:!1,configurable:!0}),t}(On),Mr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("html")},0]}}},enumerable:!1,configurable:!0}),t}(On),Sr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Tt("custom-block")},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){var r=t.selection,o=t.schema,i=t.tr,s=Yt(r),a=s.startFromOffset,l=s.endToOffset;if(!(null===e||void 0===e?void 0:e.info))return!1;var c="$$"+e.info,u=Oe(o,c),d=Oe(o,"$$");return i.insert(a,u).split(a+c.length),i.split(i.mapping.map(l)).insert(i.mapping.map(l),d),n(i.setSelection(De(i,i.mapping.map(l)-("$$".length+2)))),!0}}},t}(On),Er=/x|backspace/i,Nr=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;var Or=/\r\n|\n|\r/,Dr=function(e){function t(t,n){var r=e.call(this,t)||this,o=n.toastMark,i=n.useCommandShortcut,s=void 0===i||i,a=n.mdPlugins,l=void 0===a?[]:a;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=o,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(s),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(h(h({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",function(e){return r.toggleActive(!0,e)}),r.eventEmitter.listen("changePreviewTabPreview",function(){return r.toggleActive(!1)}),r.initEvent(),r}return p(t,e),t.prototype.toggleActive=function(e,t){Et(this.el,"active",e),e?t||this.focus():this.blur()},t.prototype.createClipboard=function(){var e=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Ct("pseudo-clipboard"),this.clipboard.addEventListener("paste",function(t){var n=t.clipboardData||window.clipboardData,r=n&&n.items;if(r&&!Ee(r).some(function(e){return"string"===e.kind&&"text/rtf"===e.type})){var o=Ft(r);o&&(t.preventDefault(),Bt(e.eventEmitter,o,t.type))}}),this.clipboard.addEventListener("input",function(t){var n=t.target.value;e.replaceSelection(n),t.preventDefault(),t.target.value=""}),this.el.insertBefore(this.clipboard,this.view.dom)},t.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},t.prototype.createSpecs=function(){return new Wt([new Nn,new Yn,new qt,new er,new nr,new In,new rr,new Sr,new sr,new Tr,new ar,new cr,new pr,new fr,new gr,new yr,new br,new kr,new wr,new Cr,new xr,new Mr])},t.prototype.createPlugins=function(){return f([Cn(this.context),function(e){var t=e.toastMark,n=e.eventEmitter;return new s.d({view:function(){return{update:function(e,r){var o=e.state,i=o.doc,s=o.selection;if(!(r&&r.doc.eq(i)&&r.selection.eq(s))){var a=s.from,l=o.doc.resolve(a).start(),c=o.doc.content.findIndex(a).index+1,u=a-l;a===l&&(u+=1);var d=[c,u],p=t.findNodeAtPosition(d),h=En(p);n.emit("changeToolbarState",{cursorPos:d,mdNode:p,toolbarState:h}),n.emit("setFocusedNode",p)}}}}})}(this.context),function(e){var t=e.schema,n=e.toastMark;return new s.d({props:{handleDOMEvents:{keyup:function(e,r){var o,i=e.state,s=i.doc,a=i.tr,l=i.selection;if(l.empty&&Er.test(r.key)){var c=Yt(l),u=c.startIndex,d=c.startFromOffset,p=[u+1,c.from-d+1],h=$e(n.findNodeAtPosition(p),function(e){var t;return"paragraph"===e.type&&"item"===(null===(t=e.parent)||void 0===t?void 0:t.type)});if(null===(o=null===h||void 0===h?void 0:h.firstChild)||void 0===o?void 0:o.literal){var f=h.firstChild,m=f.literal.match(Nr);if(m){var g=f.sourcepos[0],v=m[1],y=m[2],b=m[3],w=v.length+b.length,k=en(s,g[0]-1).startOffset,x=g[1]+k;if(y){var C=w?w+1:0;a.replaceWith(x,C+x,t.text(y)),e.dispatch(a)}else w||(a.insertText(" ",x),e.dispatch(a))}}}return!1}}}})}(this.context)],this.createPluginProps()).concat(this.defaultPlugins)},t.prototype.createView=function(){var e=this;return new o.c(this.el,{state:this.createState(),dispatchTransaction:function(t){e.updateMarkdown(t);var n=e.view.state.applyTransaction(t).state;e.view.updateState(n),e.emitChangeEvent(t)},handleKeyDown:function(t,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&e.clipboard.focus(),e.eventEmitter.emit("keydown",e.editorType,n),!1},handleDOMEvents:{copy:function(t,n){return e.captureCopy(n)},cut:function(t,n){return e.captureCopy(n,"cut")},scroll:function(){return e.eventEmitter.emit("scroll","editor"),!0},keyup:function(t,n){return e.eventEmitter.emit("keyup",e.editorType,n),!1}},nodeViews:{widget:jt}})},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.captureCopy=function(e,t){e.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return e.clipboardData?e.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),"cut"===t&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent","cut")),!0},t.prototype.updateMarkdown=function(e){var t=this;e.docChanged&&e.steps.forEach(function(n,r){if(n.slice&&!(n instanceof i.b)){var o=e.docs[r],s=[n.from,n.to],a=Zt(o,s[0],s[1]),l=a[0],c=a[1],u=t.getChanged(n.slice);l[0]===c[0]&&l[1]===c[1]&&""===u&&(u="\n");var d=t.toastMark.editMarkdown(l,c,u);t.eventEmitter.emit("updatePreview",d),e.setMeta("editResult",d).scrollIntoView()}})},t.prototype.getChanged=function(e){var t="",n=e.content.size;return e.content.nodesBetween(0,n,function(e,r){e.isText?t+=e.text.slice(Math.max(0,r)-r,n-r):e.isBlock&&r>0&&(t+="\n")}),t},t.prototype.setSelection=function(e,t){void 0===t&&(t=e);var n=this.view.state.tr,r=Qt(n.doc,e,t),o=r[0],i=r[1];this.view.dispatch(n.setSelection(De(n,o,i)).scrollIntoView())},t.prototype.replaceSelection=function(e,t,n){var o,i=this.view.state,s=i.tr,a=i.schema,l=i.doc,c=e.split(Or).map(function(e){return Ne(a,rt(e,a))}),u=new r.j(r.c.from(c),1,1);if(this.focus(),t&&n){var d=Qt(l,t,n),p=d[0],h=d[1];o=s.replaceRange(p,h,u)}else o=s.replaceSelection(u);this.view.dispatch(o.scrollIntoView())},t.prototype.deleteSelection=function(e,t){var n,r=this.view.state,o=r.tr,i=r.doc;if(e&&t){var s=Qt(i,e,t),a=s[0],l=s[1];n=o.deleteRange(a,l)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},t.prototype.getSelectedText=function(e,t){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;if(e&&t){var a=Qt(r,e,t);i=a[0],s=a[1]}return r.textBetween(i,s,"\n")},t.prototype.getSelection=function(){var e=this.view.state.selection,t=e.from,n=e.to;return Zt(this.view.state.tr.doc,t,n)},t.prototype.setMarkdown=function(e,t){void 0===t&&(t=!0);var n=e.split(Or),r=this.view.state,o=r.tr,i=r.doc,s=r.schema,a=n.map(function(e){return Ne(s,rt(e,s))});this.view.dispatch(o.replaceWith(0,i.content.size,a)),t&&this.moveCursorToEnd(!0)},t.prototype.addWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=r.doc,s=r.selection,a=n?Qt(i,n,n)[0]:s.to;this.view.dispatch(o.setMeta("widget",{pos:a,node:e,style:t}))},t.prototype.replaceWithWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=r.schema,s=Qt(r.doc,e,t),a=rt(n,i);this.view.dispatch(o.replaceWith(s[0],s[1],a))},t.prototype.getRangeInfoOfNode=function(e){var t=this.view.state,n=t.doc,r=t.selection,o=e||Zt(n,r.from)[0],i=this.toastMark.findNodeAtPosition(o);return"text"===i.type&&"paragraph"!==i.parent.type&&(i=i.parent),i.sourcepos[1][1]+=1,{range:i.sourcepos,type:i.type}},t.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map(function(e){return Xe(e)}).join("\n")},t.prototype.getToastMark=function(){return this.toastMark},t}(Vt),Ar="_feEventKey";var Lr=function(e,t){var n,r=e[Ar];return r||(r=e[Ar]={}),(n=r[t])||(n=r[t]=[]),n},Ir=y,Rr=T,Pr=Lr;function Br(e,t,n){var r,o=Pr(e,t);n?(Rr(o,function(o,i){return n!==o.handler||(Fr(e,t,o.wrappedHandler),r=i,!1)}),o.splice(r,1)):(Rr(o,function(n){Fr(e,t,n.wrappedHandler)}),o.splice(0,o.length))}function Fr(e,t,n){"removeEventListener"in e?e.removeEventListener(t,n):"detachEvent"in e&&e.detachEvent("on"+t,n)}var Hr=function(e,t,n){Ir(t)?Rr(t.split(/\s+/g),function(t){Br(e,t,n)}):Rr(t,function(t,n){Br(e,n,t)})},jr=y,zr=T,qr=Lr;function Vr(e,t,n,r){function o(t){n.call(r||e,t||window.event)}"addEventListener"in e?e.addEventListener(t,o):"attachEvent"in e&&e.attachEvent("on"+t,o),function(e,t,n,r){var o=qr(e,t),i=!1;zr(o,function(e){return e.handler!==n||(i=!0,!1)}),i||o.push({handler:n,wrappedHandler:r})}(e,t,n,o)}var $r=function(e,t,n,r){jr(t)?zr(t.split(/\s+/g),function(t){Vr(e,t,n,r)}):zr(t,function(t,r){Vr(e,r,t,n)})},_r=function(e,t){return(_r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};
  2. /*! *****************************************************************************
  3. Copyright (c) Microsoft Corporation.
  4. Permission to use, copy, modify, and/or distribute this software for any
  5. purpose with or without fee is hereby granted.
  6. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  7. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  8. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  9. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  10. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  11. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  12. PERFORMANCE OF THIS SOFTWARE.
  13. ***************************************************************************** */function Ur(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}_r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Wr=function(){return(Wr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function Jr(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var Kr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Gr={};function Zr(e,t,n){var r,o,i,s,a,l="";for("string"!=typeof t&&(n=t,t=Zr.defaultChars),void 0===n&&(n=!0),a=function(e){var t,n,r=Gr[e];if(r)return r;for(r=Gr[e]=[],t=0;t<128;t++)n=String.fromCharCode(t),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2));for(t=0;t<e.length;t++)r[e.charCodeAt(t)]=e[t];return r}(t),r=0,o=e.length;r<o;r++)if(i=e.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(e.slice(r+1,r+3)))l+=e.slice(r,r+3),r+=2;else if(i<128)l+=a[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(s=e.charCodeAt(r+1))>=56320&&s<=57343){l+=encodeURIComponent(e[r]+e[r+1]),r++;continue}l+="%EF%BF%BD"}else l+=encodeURIComponent(e[r]);return l}Zr.defaultChars=";/?:@&=+$,-_.!~*'()#",Zr.componentChars="-_.!~*'()";var Xr=Zr,Qr={},Yr={},eo={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:"‌"},to={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:"ÿ"},no={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},ro={},oo=Kr&&Kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ro,"__esModule",{value:!0});var io=oo({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}),so=String.fromCodePoint||function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)};ro.default=function(e){return e>=55296&&e<=57343||e>1114111?"�":(e in io.default&&(e=io.default[e]),so(e))};var ao=Kr&&Kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.decodeHTML=Yr.decodeHTMLStrict=Yr.decodeXML=void 0;var lo=ao(eo),co=ao(to),uo=ao(no),po=ao(ro),ho=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function fo(e){var t=go(e);return function(e){return String(e).replace(ho,t)}}Yr.decodeXML=fo(uo.default),Yr.decodeHTMLStrict=fo(lo.default);var mo=function(e,t){return e<t?1:-1};function go(e){return function(t){if("#"===t.charAt(1)){var n=t.charAt(2);return"X"===n||"x"===n?po.default(parseInt(t.substr(3),16)):po.default(parseInt(t.substr(2),10))}return e[t.slice(1,-1)]||t}}Yr.decodeHTML=function(){for(var e=Object.keys(co.default).sort(mo),t=Object.keys(lo.default).sort(mo),n=0,r=0;n<t.length;n++)e[r]===t[n]?(t[n]+=";?",r++):t[n]+=";";var o=new RegExp("&(?:"+t.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=go(lo.default);function s(e){return";"!==e.substr(-1)&&(e+=";"),i(e)}return function(e){return String(e).replace(o,s)}}();var vo={},yo=Kr&&Kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vo,"__esModule",{value:!0}),vo.escapeUTF8=vo.escape=vo.encodeNonAsciiHTML=vo.encodeHTML=vo.encodeXML=void 0;var bo=Co(yo(no).default),wo=To(bo);vo.encodeXML=Oo(bo);var ko=Co(yo(eo).default),xo=To(ko);function Co(e){return Object.keys(e).sort().reduce(function(t,n){return t[e[n]]="&"+n+";",t},{})}function To(e){for(var t=[],n=[],r=0,o=Object.keys(e);r<o.length;r++){var i=o[r];1===i.length?t.push("\\"+i):n.push(i)}t.sort();for(var s=0;s<t.length-1;s++){for(var a=s;a<t.length-1&&t[a].charCodeAt(1)+1===t[a+1].charCodeAt(1);)a+=1;var l=1+a-s;l<3||t.splice(s,l,t[s]+"-"+t[a])}return n.unshift("["+t.join("")+"]"),new RegExp(n.join("|"),"g")}vo.encodeHTML=function(e,t){return function(n){return n.replace(t,function(t){return e[t]}).replace(Mo,Eo)}}(ko,xo),vo.encodeNonAsciiHTML=Oo(ko);var Mo=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,So=null!=String.prototype.codePointAt?function(e){return e.codePointAt(0)}:function(e){return 1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536};function Eo(e){return"&#x"+(e.length>1?So(e):e.charCodeAt(0)).toString(16).toUpperCase()+";"}var No=new RegExp(wo.source+"|"+Mo.source,"g");function Oo(e){return function(t){return t.replace(No,function(t){return e[t]||Eo(t)})}}vo.escape=function(e){return e.replace(No,Eo)},vo.escapeUTF8=function(e){return e.replace(wo,Eo)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeXMLStrict=e.decodeHTML5Strict=e.decodeHTML4Strict=e.decodeHTML5=e.decodeHTML4=e.decodeHTMLStrict=e.decodeHTML=e.decodeXML=e.encodeHTML5=e.encodeHTML4=e.escapeUTF8=e.escape=e.encodeNonAsciiHTML=e.encodeHTML=e.encodeXML=e.encode=e.decodeStrict=e.decode=void 0;var t=Yr,n=vo;e.decode=function(e,n){return(!n||n<=0?t.decodeXML:t.decodeHTML)(e)},e.decodeStrict=function(e,n){return(!n||n<=0?t.decodeXML:t.decodeHTMLStrict)(e)},e.encode=function(e,t){return(!t||t<=0?n.encodeXML:n.encodeHTML)(e)};var r=vo;Object.defineProperty(e,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(e,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(e,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(e,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(e,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(e,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(e,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=Yr;Object.defineProperty(e,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(e,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(e,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(e,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(Qr);var Do="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",Ao=/[\\&]/,Lo="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",Io=new RegExp("\\\\"+Lo+"|"+Do,"gi"),Ro=new RegExp('[&<>"]',"g"),Po=function(e){return 92===e.charCodeAt(0)?e.charAt(1):Qr.decodeHTML(e)};function Bo(e){return Ao.test(e)?e.replace(Io,Po):e}function Fo(e){try{return Xr(e)}catch(t){return e}}function Ho(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return e}}function jo(e){return Ro.test(e)?e.replace(Ro,Ho):e}function zo(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n.join("")}function qo(e){return!e||!/[^ \t]+/.test(e)}var Vo=function(){function e(e){this.current=e,this.root=e,this.entering=!0}return e.prototype.next=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=$o(e);return t&&n?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e.next?(this.current=e.parent,this.entering=!1):(this.current=e.next,this.entering=!0),{entering:t,node:e}},e.prototype.resumeAt=function(e,t){this.current=e,this.entering=!0===t},e}();function $o(e){switch(e.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var _o=1,Uo={};function Wo(e){delete Uo[e]}var Jo=function(){function e(e,t){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===e?-1:_o++,this.type=e,this.sourcepos=t,Uo[this.id]=this}return e.prototype.isContainer=function(){return $o(this)},e.prototype.unlink=function(){this.prev?this.prev.next=this.next:this.parent&&(this.parent.firstChild=this.next),this.next?this.next.prev=this.prev:this.parent&&(this.parent.lastChild=this.prev),this.parent=null,this.next=null,this.prev=null},e.prototype.replaceWith=function(e){this.insertBefore(e),this.unlink()},e.prototype.insertAfter=function(e){e.unlink(),e.next=this.next,e.next&&(e.next.prev=e),e.prev=this,this.next=e,this.parent&&(e.parent=this.parent,e.next||(e.parent.lastChild=e))},e.prototype.insertBefore=function(e){e.unlink(),e.prev=this.prev,e.prev&&(e.prev.next=e),e.next=this,this.prev=e,e.parent=this.parent,e.prev||(e.parent.firstChild=e)},e.prototype.appendChild=function(e){e.unlink(),e.parent=this,this.lastChild?(this.lastChild.next=e,e.prev=this.lastChild,this.lastChild=e):(this.firstChild=e,this.lastChild=e)},e.prototype.prependChild=function(e){e.unlink(),e.parent=this,this.firstChild?(this.firstChild.prev=e,e.next=this.firstChild,this.firstChild=e):(this.firstChild=e,this.lastChild=e)},e.prototype.walker=function(){return new Vo(this)},e}(),Ko=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=t,r}return Ur(t,e),t}(Jo),Go=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.listData=null,t}return Ur(t,e),t}(Ko),Zo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.level=0,t.headingType="atx",t}return Ur(t,e),t}(Ko),Xo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isFenced=!1,t.fenceChar=null,t.fenceLength=0,t.fenceOffset=-1,t.info=null,t.infoPadding=0,t}return Ur(t,e),t}(Ko),Qo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.columns=[],t}return Ur(t,e),t}(Ko),Yo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.startIdx=0,t.endIdx=0,t.paddingLeft=0,t.paddingRight=0,t.ignored=!1,t}return Ur(t,e),t}(Ko),ei=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.title="",t.dest="",t.label="",t}return Ur(t,e),t}(Ko),ti=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.syntaxLength=0,t.offset=-1,t.info="",t}return Ur(t,e),t}(Ko),ni=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.htmlBlockType=-1,t}return Ur(t,e),t}(Ko),ri=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.destination=null,t.title=null,t.extendedAutolink=!1,t}return Ur(t,e),t}(Jo),oi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.tickCount=0,t}return Ur(t,e),t}(Jo),ii=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.info="",t}return Ur(t,e),t}(Jo);function si(e,t){switch(e){case"heading":return new Zo(e,t);case"list":case"item":return new Go(e,t);case"link":case"image":return new ri(e,t);case"codeBlock":return new Xo(e,t);case"htmlBlock":return new ni(e,t);case"table":return new Qo(e,t);case"tableCell":return new Yo(e,t);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new Ko(e,t);case"code":return new oi(e,t);case"refDef":return new ei(e,t);case"customBlock":return new ti(e,t);case"customInline":return new ii(e,t);default:return new Jo(e,t)}}function ai(e){return"codeBlock"===e.type}function li(e){return"list"===e.type}function ci(e){return"refDef"===e.type}function ui(e){return"customBlock"===e.type}function di(e,t){var n=si("text",t);return n.literal=e,n}var pi,hi="<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",fi="</[A-Za-z][A-Za-z0-9-]*\\s*[>]",mi=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|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)pi=function(e){try{return String.fromCodePoint(e)}catch(e){if(e instanceof RangeError)return String.fromCharCode(65533);throw e}};else{var gi=String.fromCharCode,vi=Math.floor;pi=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r,o=[],i=-1,s=e.length;if(!s)return"";for(var a="";++i<s;){var l=Number(e[i]);if(!isFinite(l)||l<0||l>1114111||vi(l)!==l)return String.fromCharCode(65533);l<=65535?o.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,o.push(n,r)),(i+1===s||o.length>16384)&&(a+=gi.apply(void 0,o),o.length=0)}return a}}var yi=pi,bi="(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+",wi="[^<\\s]*[^<?!.,:*_?~\\s]",ki="[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+";function xi(e){var t=/\)+$/.exec(e);if(t){for(var n=0,r=0,o=e;r<o.length;r++){var i=o[r];"("===i?n<0?n=1:n+=1:")"===i&&(n-=1)}if(n<0){var s=Math.min(-n,t[0].length);return e.substring(0,e.length-s)}}return e}function Ci(e){return e.replace(/&[A-Za-z0-9]+;$/,"")}function Ti(e){return Jr(Jr([],function(e){for(var t,n=new RegExp("(www|https?://)."+bi+wi,"g"),r=[];t=n.exec(e);){var o=Ci(xi(t[0])),i="www"===t[1]?"http://":"";r.push({text:o,range:[t.index,t.index+o.length-1],url:""+i+o})}return r}(e)),function(e){for(var t,n=new RegExp(ki,"g"),r=[];t=n.exec(e);){var o=t[0];/[_-]+$/.test(o)||r.push({text:o,range:[t.index,t.index+o.length-1],url:"mailto:"+o})}return r}(e)).sort(function(e,t){return e.range[0]-t.range[0]})}function Mi(e){return e[e.length-1]}function Si(e){return e.slice(1,e.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function Ei(e,t){Object.keys(e).forEach(function(n){t(n,e[n])})}function Ni(e){return!Object.keys(e).length}var Oi="\\\\"+Lo,Di=new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),Ai=new RegExp('^(?:"('+Oi+'|[^"\\x00])*"|\'('+Oi+"|[^'\\x00])*'|\\(("+Oi+"|[^()\\x00])*\\))"),Li=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,Ii=new RegExp("^"+Lo),Ri=new RegExp("^"+Do,"i"),Pi=/`+/,Bi=/^`+/,Fi=/\.\.\./g,Hi=/--+/g,ji=/^<([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])?)*)>/,zi=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,qi=/^ *(?:\n *)?/,Vi=/^[ \t\n\x0b\x0c\x0d]/,$i=/^\s/,_i=/ *$/,Ui=/^ */,Wi=/^ *(?:\n|$)/,Ji=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,Ki=/^[^\n`\[\]\\!<&*_'"~$]+/m,Gi=function(){function e(e){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=e}return e.prototype.sourcepos=function(e,t){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,e+n];return"number"==typeof t?[o,[r,t+n]]:o},e.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},e.prototype.match=function(e){var t=e.exec(this.subject.slice(this.pos));return null===t?null:(this.pos+=t.index+t[0].length,t[0])},e.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},e.prototype.spnl=function(){return this.match(qi),!0},e.prototype.parseBackticks=function(e){var t=this.pos+1,n=this.match(Bi);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match(Pi));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),s=this.sourcepos(t,this.pos),a=i.split("\n");if(a.length>1){var l=Mi(a);this.lineIdx+=a.length-1,this.linePosOffset=-(this.pos-l.length-n.length),s[1]=this.sourcepos(this.pos),i=a.join(" ")}var c=si("code",s);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?c.literal=i.slice(1,i.length-1):c.literal=i,c.tickCount=n.length,e.appendChild(c),!0}return this.pos=o,e.appendChild(di(n,this.sourcepos(t,this.pos-1))),!0},e.prototype.parseBackslash=function(e){var t,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,t=si("linebreak",this.sourcepos(this.pos-1,this.pos)),e.appendChild(t),this.nextLine()):Ii.test(n.charAt(this.pos))?(e.appendChild(di(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):e.appendChild(di("\\",this.sourcepos(r,r))),!0},e.prototype.parseAutolink=function(e){var t,n,r,o=this.pos+1;return(t=this.match(ji))?(n=t.slice(1,t.length-1),(r=si("link",this.sourcepos(o,this.pos))).destination=Fo("mailto:"+n),r.title="",r.appendChild(di(n,this.sourcepos(o+1,this.pos-1))),e.appendChild(r),!0):!!(t=this.match(zi))&&(n=t.slice(1,t.length-1),(r=si("link",this.sourcepos(o,this.pos))).destination=Fo(n),r.title="",r.appendChild(di(n,this.sourcepos(o+1,this.pos-1))),e.appendChild(r),!0)},e.prototype.parseHtmlTag=function(e){var t=this.pos+1,n=this.match(mi);if(null===n)return!1;var r=si("htmlInline",this.sourcepos(t,this.pos));return r.literal=n,e.appendChild(r),!0},e.prototype.scanDelims=function(e){var t=0,n=this.pos;if(39===e||34===e)t++,this.pos++;else for(;this.peek()===e;)t++,this.pos++;if(0===t||t<2&&(126===e||36===e))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":yi(i);var s,a,l=$i.test(r),c=Di.test(r),u=$i.test(o),d=Di.test(o),p=!l&&(!c||u||d),h=!u&&(!d||l||c);return 95===e?(s=p&&(!h||d),a=h&&(!p||c)):39===e||34===e?(s=p&&!h,a=h):36===e?(s=!l,a=!u):(s=p,a=h),this.pos=n,{numdelims:t,canOpen:s,canClose:a}},e.prototype.handleDelim=function(e,t){var n=this.scanDelims(e);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=di(39===e?"’":34===e?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return t.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||39!==e&&34!==e)&&(this.delimiters={cc:e,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},e.prototype.removeDelimiter=function(e){null!==e.previous&&(e.previous.next=e.next),null===e.next?this.delimiters=e.previous:e.next.previous=e.previous},e.prototype.removeDelimitersBetween=function(e,t){e.next!==t&&(e.next=t,t.previous=e)},e.prototype.processEmphasis=function(e){var t,n,r,o,i,s,a,l=!1,c=((t={})[95]=[e,e,e],t[42]=[e,e,e],t[39]=[e],t[34]=[e],t[126]=[e],t[36]=[e],t);for(r=this.delimiters;null!==r&&r.previous!==e;)r=r.previous;for(;null!==r;){var u=r.cc,d=95===u||42===u;if(r.canClose){for(n=r.previous,a=!1;null!==n&&n!==e&&n!==c[u][d?r.origdelims%3:0];){if(l=d&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!l){a=!0;break}n=n.previous}if(o=r,d||126===u||36===u)if(a){if(n){var p=r.numdelims>=2&&n.numdelims>=2?2:1,h=d?0:1;i=n.node,s=r.node;var f=d?1===p?"emph":"strong":"strike";36===u&&(f="customInline");var m=si(f),g=i.sourcepos[1],v=s.sourcepos[0];m.sourcepos=[[g[0],g[1]-p+1],[v[0],v[1]+p-1]],i.sourcepos[1][1]-=p,s.sourcepos[0][1]+=p,i.literal=i.literal.slice(p),s.literal=s.literal.slice(p),n.numdelims-=p,r.numdelims-=p;for(var y=i.next,b=void 0;y&&y!==s;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(36===u){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length<=x.length?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=h&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=h){0===r.numdelims&&s.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else 39===u?(r.node.literal="’",a&&(n.node.literal="‘"),r=r.next):34===u&&(r.node.literal="”",a&&(n.node.literal="“"),r=r.next);a||(c[u][d?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==e;)this.removeDelimiter(this.delimiters)},e.prototype.parseLinkTitle=function(){var e=this.match(Ai);return null===e?null:Bo(e.substr(1,e.length-2))},e.prototype.parseLinkDestination=function(){var e=this.match(Li);if(null===e){if(60===this.peek())return null;for(var t=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&Ii.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!==Vi.exec(yi(r)))break;this.pos+=1}return this.pos===t&&41!==r?null:0!==n?null:Fo(Bo(e=this.subject.substr(t,this.pos-t)))}return Fo(Bo(e.substr(1,e.length-2)))},e.prototype.parseLinkLabel=function(){var e=this.match(Ji);return null===e||e.length>1001?0:e.length},e.prototype.parseOpenBracket=function(e){var t=this.pos;this.pos+=1;var n=di("[",this.sourcepos(this.pos,this.pos));return e.appendChild(n),this.addBracket(n,t,!1),!0},e.prototype.parseBang=function(e){var t=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=di("![",this.sourcepos(this.pos-1,this.pos));e.appendChild(n),this.addBracket(n,t+1,!0)}else{n=di("!",this.sourcepos(this.pos,this.pos));e.appendChild(n)}return!0},e.prototype.parseCloseBracket=function(e){var t=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return e.appendChild(di("]",this.sourcepos(o,o))),!0;if(!i.active)return e.appendChild(di("]",this.sourcepos(o,o))),this.removeBracket(),!0;var s=i.image,a=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(t=this.parseLinkDestination())&&this.spnl()&&(Vi.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=a);var l="";if(!r){var c=this.pos,u=this.parseLinkLabel();if(u>2?l=this.subject.slice(c,c+u):i.bracketAfter||(l=this.subject.slice(i.index,o)),0===u&&(this.pos=a),l){l=Si(l);var d=this.refMap[l];d&&(t=d.destination,n=d.title,r=!0)}}if(r){var p=si(s?"image":"link");p.destination=t,p.title=n||"",p.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var h=i.node.next,f=void 0;h;)f=h.next,h.unlink(),p.appendChild(h),h=f;if(e.appendChild(p),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!s)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[e.id]={node:e,refLabel:l}),!0}return this.removeBracket(),this.pos=o,e.appendChild(di("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[e.id]={node:e,refLabel:l}),!0},e.prototype.addBracket=function(e,t,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:e,startpos:this.sourcepos(t+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:t,image:n,active:!0}},e.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},e.prototype.parseEntity=function(e){var t,n=this.pos+1;return!!(t=this.match(Ri))&&(e.appendChild(di(Qr.decodeHTML(t),this.sourcepos(n,this.pos))),!0)},e.prototype.parseString=function(e){var t,n=this.pos+1;if(t=this.match(Ki)){if(this.options.smart){var r=t.replace(Fi,"…").replace(Hi,function(e){var t=0,n=0;return e.length%3==0?n=e.length/3:e.length%2==0?t=e.length/2:e.length%3==2?(t=1,n=(e.length-2)/3):(t=2,n=(e.length-4)/3),zo("—",n)+zo("–",t)});e.appendChild(di(r,this.sourcepos(n,this.pos)))}else{var o=di(t,this.sourcepos(n,this.pos));e.appendChild(o)}return!0}return!1},e.prototype.parseNewline=function(e){this.pos+=1;var t=e.lastChild;if(t&&"text"===t.type&&" "===t.literal[t.literal.length-1]){var n=" "===t.literal[t.literal.length-2],r=t.literal.length;t.literal=t.literal.replace(_i,"");var o=r-t.literal.length;t.sourcepos[1][1]-=o,e.appendChild(si(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else e.appendChild(si("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(Ui),!0},e.prototype.parseReference=function(e,t){if(!this.options.referenceDefinition)return 0;this.subject=e.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var s=this.parseLinkDestination();if(null===s)return this.pos=r,0;var a=this.pos;this.spnl(),this.pos!==a&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=a);var l=!0;if(null===this.match(Wi)&&(""===n?l=!1:(n="",this.pos=a,l=null!==this.match(Wi))),!l)return this.pos=r,0;var c=Si(i);if(""===c)return this.pos=r,0;var u=this.getReferenceDefSourcepos(e);e.sourcepos[0][0]=u[1][0]+1;var d=si("refDef",u);return d.title=n,d.dest=s,d.label=c,e.insertBefore(d),t[c]?this.refDefCandidateMap[d.id]=d:t[c]=js(d),this.pos-r},e.prototype.mergeTextNodes=function(e){for(var t,n=[];t=e.next();){var r=t.entering,o=t.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],s=n[n.length-1];i.sourcepos&&s.sourcepos&&(i.sourcepos[1]=s.sourcepos[1]),i.next=s.next,i.next&&(i.next.prev=i);for(var a=1;a<n.length;a+=1)i.literal+=n[a].literal,n[a].unlink();n=[]}}},e.prototype.getReferenceDefSourcepos=function(e){for(var t=e.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<t.length;i+=1){var s=t[i];if(Vi.test(s))break;if(/\:/.test(s)&&0===r){if(n)break;var a=s.indexOf(":")===s.length-1?i+1:i;o={line:a,ch:t[a].length},n=!0}var l=s.match(/'|"/g);if(l&&(r+=l.length),2===r){o={line:i,ch:s.length};break}}return[[e.sourcepos[0][0],e.sourcepos[0][1]],[e.sourcepos[0][0]+o.line,o.ch]]},e.prototype.parseInline=function(e){var t,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(e);break;case 92:n=this.parseBackslash(e);break;case 96:n=this.parseBackticks(e);break;case 42:case 95:case 126:case 36:n=this.handleDelim(r,e);break;case 39:case 34:n=!!(null===(t=this.options)||void 0===t?void 0:t.smart)&&this.handleDelim(r,e);break;case 91:n=this.parseOpenBracket(e);break;case 33:n=this.parseBang(e);break;case 93:n=this.parseCloseBracket(e);break;case 60:n=this.parseAutolink(e)||this.parseHtmlTag(e);break;case 38:e.disabledEntityParse||(n=this.parseEntity(e));break;default:n=this.parseString(e)}return n||(this.pos+=1,e.appendChild(di(yi(r),this.sourcepos(this.pos,this.pos+1)))),!0},e.prototype.parse=function(e){for(this.subject=e.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=e.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=e.sourcepos[0][0],function(e){return"heading"===e.type}(e)&&(this.lineOffsets[0]+=e.level+1);this.parseInline(e););e.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(e.walker());var t=this.options,n=t.extendedAutolinks,r=t.customParser;if(n&&function(e,t){var n;"boolean"==typeof t&&(t=Ti);for(var r=function(){var e=n.entering,r=n.node;if(e&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=t(o);if(!i||!i.length)return"continue";for(var s=0,a=r.sourcepos[0],l=a[0],c=a[1],u=function(e,t){return[[l,c+e],[l,c+t]]},d=[],p=0,h=i;p<h.length;p++){var f=h[p],m=f.range,g=f.url,v=f.text;m[0]>s&&d.push(di(o.substring(s,m[0]),u(s,m[0]-1)));var y=si("link",u.apply(void 0,m));y.appendChild(di(v,u.apply(void 0,m))),y.destination=g,y.extendedAutolink=!0,d.push(y),s=m[1]+1}s<o.length&&d.push(di(o.substring(s),u(s,o.length-1)));for(var b=0,w=d;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=e.next();)r()}(e.walker(),n),r&&e.firstChild)for(var o,i=e.firstChild.walker();o=i.next();){var s=o.node,a=o.entering;r[s.type]&&r[s.type](s,{entering:a,options:this.options})}},e}(),Zi=/^\[([ \txX])\][ \t]+/;var Xi=9,Qi=32,Yi=/[^ \t\f\v\r\n]/,es=/^(?:`{3,}|~{3,})(?= *$)/;function ts(e){for(var t=e;t;){if(t.lastLineBlank)return!0;var n=t.type;if(t.lastLineChecked||"list"!==n&&"item"!==n){t.lastLineChecked=!0;break}t.lastLineChecked=!0,t=t.lastChild}return!1}function ns(e,t){return t<e.length?e.charCodeAt(t):-1}function rs(e){return!Yi.test(e)}function os(e){return e===Qi||e===Xi}var is=/^\$\$$/,ss={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},as={document:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"item"!==e},acceptsLines:!1},list:{continue:function(){return 0},finalize:function(e,t){for(var n=t.firstChild;n;){if(ts(n)&&n.next){t.listData.tight=!1;break}for(var r=n.firstChild;r;){if(ts(r)&&(n.next||r.next)){t.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(e){return"item"===e},acceptsLines:!1},blockQuote:{continue:function(e){var t=e.currentLine;return e.indented||62!==ns(t,e.nextNonspace)?1:(e.advanceNextNonspace(),e.advanceOffset(1,!1),os(ns(t,e.offset))&&e.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(e){return"item"!==e},acceptsLines:!1},item:{continue:function(e,t){if(e.blank){if(null===t.firstChild)return 1;e.advanceNextNonspace()}else{if(!(e.indent>=t.listData.markerOffset+t.listData.padding))return 1;e.advanceOffset(t.listData.markerOffset+t.listData.padding,!0)}return 0},finalize:function(e,t){if(t.firstChild&&"paragraph"===t.firstChild.type){var n=t.firstChild,r=n.stringContent.match(Zi);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,t.listData.task=!0,t.listData.checked=/[xX]/.test(r[1])}}},canContain:function(e){return"item"!==e},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:{continue:function(e,t){var n=e.currentLine,r=e.indent;if(t.isFenced){var o=r<=3&&n.charAt(e.nextNonspace)===t.fenceChar&&n.slice(e.nextNonspace).match(es);if(o&&o[0].length>=t.fenceLength)return e.lastLineLength=e.offset+r+o[0].length,e.finalize(t,e.lineNumber),2;for(var i=t.fenceOffset;i>0&&os(ns(n,e.offset));)e.advanceOffset(1,!0),i--}else if(r>=4)e.advanceOffset(4,!0);else{if(!e.blank)return 1;e.advanceNextNonspace()}return 0},finalize:function(e,t){var n;if(null!==t.stringContent){if(t.isFenced){var r=t.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),s=r.slice(o+1),a=i.match(/^(\s*)(.*)/);t.infoPadding=a[1].length,t.info=Bo(a[2].trim()),t.literal=s}else t.literal=null===(n=t.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");t.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},htmlBlock:{continue:function(e,t){return!e.blank||6!==t.htmlBlockType&&7!==t.htmlBlockType?0:1},finalize:function(e,t){var n;t.literal=(null===(n=t.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,t.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(e){return e.blank?1:0},finalize:function(e,t){if(null!==t.stringContent){for(var n,r=!1;91===ns(t.stringContent,0)&&(n=e.inlineParser.parseReference(t,e.refMap));)t.stringContent=t.stringContent.slice(n),r=!0;r&&rs(t.stringContent)&&t.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"tableHead"===e||"tableBody"===e},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(e){return"tableRow"===e},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableRow"===e||"tableDelimRow"===e},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableCell"===e},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(e){return"tableDelimCell"===e},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:ss,customBlock:{continue:function(e,t){var n=e.currentLine,r=n.match(is);if(r)return e.lastLineLength=r[0].length,e.finalize(t,e.lineNumber),2;for(var o=t.offset;o>0&&os(ns(n,e.offset));)e.advanceOffset(1,!0),o--;return 0},finalize:function(e,t){if(null!==t.stringContent){var n=t.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),s=o.match(/^(\s*)(.*)/);t.info=Bo(s[2].trim()),t.literal=i,t.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},frontMatter:ss};function ls(e){for(var t=0,n=0,r=[],o=0;o<e.length;o+=1)if("|"===e[o]&&"\\"!==e[o-1]){var i=e.substring(t,o);0===t&&qo(i)?n=o+1:r.push(i),t=o+1}t<e.length&&(qo(i=e.substring(t,e.length))||r.push(i));return[n,r]}function cs(e,t,n,r){for(var o=[],i=0,s=t;i<s.length;i++){var a=s[i],l=a.match(/^[ \t]+/),c=l?l[0].length:0,u=void 0,d=void 0;if(c===a.length)c=0,u=0,d="";else{var p=a.match(/[ \t]+$/);u=p?p[0].length:0,d=a.slice(c,a.length-u)}var h=r+c,f=si(e,[[n,r],[n,r+a.length-1]]);f.stringContent=d.replace(/\\\|/g,"|"),f.startIdx=o.length,f.endIdx=o.length,f.lineOffsets=[h-1],f.paddingLeft=c,f.paddingRight=u,o.push(f),r+=a.length+1}return o}function us(e){var t=null,n=e.stringContent,r=n[0];return":"===n[n.length-1]?t=":"===r?"center":"right":":"===r&&(t="left"),{align:t}}var ds=/^(\$\$)(\s*[a-zA-Z])+/,ps=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,hs=/^`{3,}(?!.*`)|^~{3,}/,fs=[/./,/^<(?:script|pre|style)(?:\s|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Z]/,/^<!\[CDATA\[/,/^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,new RegExp("^(?:"+hi+"|"+fi+")\\s*$","i")],ms=/^(?:=+|-+)[ \t]*$/,gs=/^#{1,6}(?:[ \t]+|$)/,vs=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,ys=/^[*+-]/,bs=/^(\d{1,9})([.)])/;function ws(e,t){return e.options.disallowDeepHeading&&("blockQuote"===t.type||"item"===t.type)}var ks=[function(e){return e.indented||62!==ns(e.currentLine,e.nextNonspace)?0:(e.advanceNextNonspace(),e.advanceOffset(1,!1),os(ns(e.currentLine,e.offset))&&e.advanceOffset(1,!0),e.closeUnmatchedBlocks(),e.addChild("blockQuote",e.nextNonspace),1)},function(e,t){var n;if(!e.indented&&!ws(e,t)&&(n=e.currentLine.slice(e.nextNonspace).match(gs))){e.advanceNextNonspace(),e.advanceOffset(n[0].length,!1),e.closeUnmatchedBlocks();var r=e.addChild("heading",e.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=e.currentLine.slice(e.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),e.advanceOffset(e.currentLine.length-e.offset),2}return 0},function(e){var t;if(!e.indented&&(t=e.currentLine.slice(e.nextNonspace).match(hs))){var n=t[0].length;e.closeUnmatchedBlocks();var r=e.addChild("codeBlock",e.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=t[0][0],r.fenceOffset=e.indent,e.advanceNextNonspace(),e.advanceOffset(n,!1),2}return 0},function(e,t){if(!e.indented&&60===ns(e.currentLine,e.nextNonspace)){var n=e.currentLine.slice(e.nextNonspace),r=e.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(fs[o]);if(i){if(7===o){if("paragraph"===t.type)return 0;if(r.length>0&&new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return e.closeUnmatchedBlocks(),e.addChild("htmlBlock",e.offset).htmlBlockType=o,2}}}return 0},function(e,t){var n;if(null!==t.stringContent&&!e.indented&&"paragraph"===t.type&&!ws(e,t.parent)&&(n=e.currentLine.slice(e.nextNonspace).match(ms))){e.closeUnmatchedBlocks();for(var r=void 0;91===ns(t.stringContent,0)&&(r=e.inlineParser.parseReference(t,e.refMap));)t.stringContent=t.stringContent.slice(r);if(t.stringContent.length>0){var o=si("heading",t.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=t.stringContent,t.insertAfter(o),t.unlink(),e.tip=o,e.advanceOffset(e.currentLine.length-e.offset,!1),2}return 0}return 0},function(e){return!e.indented&&vs.test(e.currentLine.slice(e.nextNonspace))?(e.closeUnmatchedBlocks(),e.addChild("thematicBreak",e.nextNonspace),e.advanceOffset(e.currentLine.length-e.offset,!1),2):0},function(e,t){var n,r=t;return e.indented&&"list"!==t.type||!(n=function(e,t){var n,r,o=e.currentLine.slice(e.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:e.indent,task:!1,checked:!1};if(e.indent>=4)return null;if(n=o.match(ys))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(bs))||"paragraph"===t.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=ns(e.currentLine,e.nextNonspace+n[0].length))&&r!==Xi&&r!==Qi)return null;if("paragraph"===t.type&&!e.currentLine.slice(e.nextNonspace+n[0].length).match(Yi))return null;e.advanceNextNonspace(),e.advanceOffset(n[0].length,!0);var s=e.column,a=e.offset;do{e.advanceOffset(1,!0),r=ns(e.currentLine,e.offset)}while(e.column-s<5&&os(r));var l=-1===ns(e.currentLine,e.offset),c=e.column-s;return c>=5||c<1||l?(i.padding=n[0].length+1,e.column=s,e.offset=a,os(ns(e.currentLine,e.offset))&&e.advanceOffset(1,!0)):i.padding=n[0].length+c,i}(e,r))?0:(e.closeUnmatchedBlocks(),"list"===e.tip.type&&function(e,t){return e.type===t.type&&e.delimiter===t.delimiter&&e.bulletChar===t.bulletChar}(r.listData,n)||((r=e.addChild("list",e.nextNonspace)).listData=n),(r=e.addChild("item",e.nextNonspace)).listData=n,1)},function(e){return e.indented&&"paragraph"!==e.tip.type&&!e.blank?(e.advanceOffset(4,!0),e.closeUnmatchedBlocks(),e.addChild("codeBlock",e.offset),2):0},function(e,t){var n=t.stringContent;if("paragraph"===t.type&&!e.indented&&!e.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),s=e.currentLine.slice(e.nextNonspace),a=ls(i),l=a[0],c=a[1],u=ls(s),d=u[0],p=u[1],h=/^[ \t]*:?-+:?[ \t]*$/;if(!c.length||!p.length||p.some(function(e){return!h.test(e)})||1===p.length&&0!==s.indexOf("|"))return 0;var f=t.lineOffsets,m=e.lineNumber-1,g=Mi(f)+1,v=si("table",[[m,g],[e.lineNumber,e.offset]]);if(v.columns=p.map(function(){return{align:null}}),t.insertAfter(v),1===f.length)t.unlink();else{t.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;e.lastLineLength=f[f.length-2]+y,e.finalize(t,m-1)}e.advanceOffset(e.currentLine.length-e.offset,!1);var b=si("tableHead",[[m,g],[e.lineNumber,e.offset]]);v.appendChild(b);var w=si("tableRow",[[m,g],[m,g+i.length-1]]),k=si("tableDelimRow",[[e.lineNumber,e.nextNonspace+1],[e.lineNumber,e.offset]]);b.appendChild(w),b.appendChild(k),cs("tableCell",c,m,g+l).forEach(function(e){w.appendChild(e)});var x=cs("tableDelimCell",p,e.lineNumber,e.nextNonspace+1+d);return x.forEach(function(e){k.appendChild(e)}),v.columns=x.map(us),e.tip=v,2}return 0},function(e,t){if("table"!==t.type&&"tableBody"!==t.type||!e.blank&&-1===e.currentLine.indexOf("|"))return 0;if(e.advanceOffset(e.currentLine.length-e.offset,!1),e.blank){var n=t;return"tableBody"===t.type&&(n=t.parent,e.finalize(t,e.lineNumber-1)),e.finalize(n,e.lineNumber-1),0}var r=t;"table"===t.type&&((r=e.addChild("tableBody",e.nextNonspace)).stringContent=null);var o=si("tableRow",[[e.lineNumber,e.nextNonspace+1],[e.lineNumber,e.currentLine.length]]);r.appendChild(o);var i=r.parent,s=ls(e.currentLine.slice(e.nextNonspace)),a=s[0];return cs("tableCell",s[1],e.lineNumber,e.nextNonspace+1+a).forEach(function(e,t){t>=i.columns.length&&(e.ignored=!0),o.appendChild(e)}),2},function(e){var t;if(!e.indented&&!ps.test(e.currentLine)&&(t=e.currentLine.match(ds))){var n=t[1].length;e.closeUnmatchedBlocks();var r=e.addChild("customBlock",e.nextNonspace);return r.syntaxLength=n,r.offset=e.indent,e.advanceNextNonspace(),e.advanceOffset(n,!1),2}return 0}],xs=/^(-{3}|\+{3}|;{3})$/,Cs=function(e,t){var n=e.currentLine,r=e.lineNumber,o=e.indented;return 1===r&&!o&&"document"===t.type&&xs.test(n)?(e.closeUnmatchedBlocks(),e.addChild("frontMatter",e.nextNonspace).stringContent=n,e.advanceNextNonspace(),e.advanceOffset(n.length,!1),2):0},Ts={continue:function(e,t){var n=e.currentLine,r=n.match(xs);return"frontMatter"===t.type&&r?(t.stringContent+=n,e.lastLineLength=r[0].length,e.finalize(t,e.lineNumber),2):0},finalize:function(e,t){null!==t.stringContent&&(t.literal=t.stringContent,t.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},Ms=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],Ss=/^[#`~*+_=<>0-9-;$]/,Es=/\r\n|\n|\r/;function Ns(){return si("document",[[1,1],[0,0]])}var Os={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},Ds=function(){function e(e){this.options=Wr(Wr({},Os),e),this.doc=Ns(),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&&(as.frontMatter=Ts,ks.unshift(Cs)),this.inlineParser=new Gi(this.options)}return e.prototype.advanceOffset=function(e,t){void 0===t&&(t=!1);for(var n,r,o,i=this.currentLine;e>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,t?(this.partiallyConsumedTab=n>e,r=n>e?e:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,e-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,e-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,e-=1)},e.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},e.prototype.findNextNonspace=function(){for(var e,t=this.currentLine,n=this.offset,r=this.column;""!==(e=t.charAt(n));)if(" "===e)n++,r++;else{if("\t"!==e)break;n++,r+=4-r%4}this.blank="\n"===e||"\r"===e||""===e,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},e.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var e=4-this.column%4;this.tip.stringContent+=zo(" ",e)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},e.prototype.addChild=function(e,t){for(;!as[this.tip.type].canContain(e);)this.finalize(this.tip,this.lineNumber-1);var n=t+1,r=si(e,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},e.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var e=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=e}this.allClosed=!0}},e.prototype.finalize=function(e,t){var n=e.parent;e.open=!1,e.sourcepos[1]=[t,this.lastLineLength],as[e.type].finalize(this,e),this.tip=n},e.prototype.processInlines=function(e){var t,n=this.options.customParser,r=e.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;t=r.next();){var o=t.node,i=t.entering,s=o.type;n&&n[s]&&n[s](o,{entering:i,options:this.options}),i||"paragraph"!==s&&"heading"!==s&&("tableCell"!==s||o.ignored)||this.inlineParser.parse(o)}},e.prototype.incorporateLine=function(e){var t=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==e.indexOf("\0")&&(e=e.replace(/\0/g,"�")),this.currentLine=e;for(var n,r=!0;(n=t.lastChild)&&n.open;){switch(t=n,this.findNextNonspace(),as[t.type].continue(this,t)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=e.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){t=t.parent;break}}this.allClosed=t===this.oldtip,this.lastMatchedContainer=t;for(var o="paragraph"!==t.type&&as[t.type].acceptsLines,i=ks.length;!o;){if(this.findNextNonspace(),"table"!==t.type&&"tableBody"!==t.type&&"paragraph"!==t.type&&!this.indented&&!Ss.test(e.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var s=0;s<i;){var a=ks[s](this,t);if(1===a){t=this.tip;break}if(2===a){t=this.tip,o=!0;break}s++}if(s===i){this.advanceNextNonspace();break}}if(this.allClosed||this.blank||"paragraph"!==this.tip.type){this.closeUnmatchedBlocks(),this.blank&&t.lastChild&&(t.lastChild.lastLineBlank=!0);for(var l=t.type,c=this.blank&&!("blockQuote"===l||ai(t)&&t.isFenced||"item"===l&&!t.firstChild&&t.sourcepos[0][0]===this.lineNumber),u=t;u;)u.lastLineBlank=c,u=u.parent;as[l].acceptsLines?(this.addLine(),function(e){return"htmlBlock"===e.type}(t)&&t.htmlBlockType>=1&&t.htmlBlockType<=5&&Ms[t.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=e.length,this.finalize(t,this.lineNumber))):this.offset<e.length&&!this.blank&&(t=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=e.length},e.prototype.parse=function(e,t){this.doc=Ns(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=e.split(Es),r=n.length;this.lines=t||n,this.options.referenceDefinition&&this.clearRefMaps(),10===e.charCodeAt(e.length-1)&&(r-=1);for(var o=0;o<r;o++)this.incorporateLine(n[o]);for(;this.tip;)this.finalize(this.tip,r);return this.processInlines(this.doc),this.doc},e.prototype.partialParseStart=function(e,t){this.doc=Ns(),this.tip=this.doc,this.lineNumber=e-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=t.length,r=0;r<n;r++)this.incorporateLine(t[r]);return this.doc},e.prototype.partialParseExtends=function(e){for(var t=0;t<e.length;t++)this.incorporateLine(e[t])},e.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},e.prototype.setRefMaps=function(e,t,n){this.refMap=e,this.refLinkCandidateMap=t,this.refDefCandidateMap=n},e.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(e){!function(e){Object.keys(e).forEach(function(t){delete e[t]})}(e)})},e}();function As(e,t){return e[0]<t[0]?1:e[0]>t[0]?-1:e[1]<t[1]?1:e[1]>t[1]?-1:0}function Ls(e,t){var n=e[0];return 1===As(e[1],t)?1:-1===As(n,t)?-1:0}function Is(e,t){for(var n=0,r=t;n<r.length;n++){var o=r[n];e.insertBefore(o)}}function Rs(e,t){var n=e[0];return e[1][0]<t?1:n[0]>t?-1:0}function Ps(e,t){for(var n=e.firstChild;n;){var r=Rs(n.sourcepos,t);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return e.lastChild}function Bs(e){return function(e){return Uo[e]}(e)||null}function Fs(e,t,n){if(void 0===n&&(n=null),t)for(var r=t.walker();t&&t!==n;){e(t);var o=r.next();if(!o)break;t=o.node}}var Hs=/\r\n|\n|\r/;function js(e){return{id:e.id,title:e.title,sourcepos:e.sourcepos,unlinked:!1,destination:e.dest}}var zs=function(){function e(e,t){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null===t||void 0===t?void 0:t.referenceDefinition),this.parser=new Ds(t),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},e=e||"",this.lineTexts=e.split(Hs),this.root=this.parser.parse(e,this.lineTexts)}return e.prototype.updateLineTexts=function(e,t,n){var r,o=e[0],i=e[1],s=t[0],a=t[1],l=n.split(Hs),c=l.length,u=this.lineTexts[o-1],d=this.lineTexts[s-1];l[0]=u.slice(0,i-1)+l[0],l[c-1]=l[c-1]+d.slice(a-1);var p=s-o+1;return(r=this.lineTexts).splice.apply(r,Jr([o-1,p],l)),c-p},e.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var e=this.lineTexts,t=e.length-1;""===e[t];)t-=1;e.length-2>t&&(t+=1),this.root.sourcepos[1]=[t+1,e[t].length]},e.prototype.replaceRangeNodes=function(e,t,n){e?(Is(e,n),function(e,t){if(e.parent===t.parent&&e!==t){for(var n=e.next;n&&n!==t;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var s=i[o];n[s]&&(Wo(n[s].id),n[s]=null)}n=r}e.next=t.next,t.next?t.next.prev=e:e.parent.lastChild=e}}(e,t),[e.id,t.id].forEach(function(e){return Wo(e)}),e.unlink()):t?(Is(t,n),Wo(t.id),t.unlink()):function(e,t){for(var n=t.length-1;n>=0;n-=1)e.prependChild(t[n])}(this.root,n)},e.prototype.getNodeRange=function(e,t){var n=Ps(this.root,e[0]),r=Ps(this.root,t[0]);return r&&r.next&&t[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},e.prototype.trigger=function(e,t){this.eventHandlerMap[e].forEach(function(e){e(t)})},e.prototype.extendEndLine=function(e){for(;""===this.lineTexts[e];)e+=1;return e},e.prototype.parseRange=function(e,t,n,r){e&&e.prev&&(li(e.prev)&&function(e){var t=e.match(/^[ \t]+/);if(t&&(t[0].length>=2||/\t/.test(t[0])))return!0;var n=t?e.slice(t.length):e;return ys.test(n)||bs.test(n)}(this.lineTexts[n-1])||function(e){return"table"===e.type}(e.prev)&&function(e){return!rs(e)&&-1!==e.indexOf("|")}(this.lineTexts[n-1]))&&(n=(e=e.prev).sourcepos[0][0]);for(var o=this.lineTexts.slice(n-1,r),i=this.parser.partialParseStart(n,o),s=t?t.next:this.root.firstChild,a=i.lastChild,l=a&&ai(a)&&a.open,c=a&&ui(a)&&a.open,u=a&&li(a);(l||c)&&s||u&&s&&("list"===s.type||s.sourcepos[0][1]>=2);){var d=this.extendEndLine(s.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),e||(e=t),t=s,r=d,s=s.next}return this.parser.partialParseFinish(),{newNodes:function(e){for(var t=[],n=e.firstChild;n;)t.push(n),n=n.next;return t}(i),extStartNode:e,extEndNode:t}},e.prototype.getRemovedNodeRange=function(e,t){return!e||e&&ci(e)||t&&ci(t)?null:{id:[e.id,t.id],line:[e.sourcepos[0][0]-1,t.sourcepos[1][0]-1]}},e.prototype.markDeletedRefMap=function(e,t){var n=this;if(!Ni(this.refMap)){var r=function(e){if(ci(e)){var t=n.refMap[e.label];t&&e.id===t.id&&(t.unlinked=!0)}};e&&Fs(r,e.parent,t),t&&Fs(r,t)}},e.prototype.replaceWithNewRefDefState=function(e){var t=this;if(!Ni(this.refMap)){var n=function(e){if(ci(e)){var n=e.label,r=t.refMap[n];r&&!r.unlinked||(t.refMap[n]=js(e))}};e.forEach(function(e){Fs(n,e)})}},e.prototype.replaceWithRefDefCandidate=function(){var e=this;Ni(this.refDefCandidateMap)||Ei(this.refDefCandidateMap,function(t,n){var r=n.label,o=n.sourcepos,i=e.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(e.refMap[r]=js(n))})},e.prototype.getRangeWithRefDef=function(e,t,n,r,o){if(this.referenceDefinition&&!Ni(this.refMap)){var i=Ps(this.root,e-1),s=Ps(this.root,t+1);i&&ci(i)&&i!==n&&i!==r&&(e=(n=i).sourcepos[0][0]),s&&ci(s)&&s!==n&&s!==r&&(r=s,t=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,e,t]},e.prototype.parse=function(e,t,n){void 0===n&&(n=0);var r=this.getNodeRange(e,t),o=r[0],i=r[1],s=o?Math.min(o.sourcepos[0][0],e[0]):e[0],a=this.extendEndLine((i?Math.max(i.sourcepos[1][0],t[0]):t[0])+n),l=this.parseRange.apply(this,this.getRangeWithRefDef(s,a,o,i,n)),c=l.newNodes,u=l.extStartNode,d=l.extEndNode,p=this.getRemovedNodeRange(u,d),h=d?d.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,d),this.replaceRangeNodes(u,d,c),this.replaceWithNewRefDefState(c)):this.replaceRangeNodes(u,d,c),{nodes:c,removedNodeRange:p,nextNode:h}},e.prototype.parseRefLink=function(){var e=this,t=[];return Ni(this.refMap)||Ei(this.refMap,function(n,r){r.unlinked&&delete e.refMap[n],Ei(e.refLinkCandidateMap,function(r,o){var i=o.node;o.refLabel===n&&t.push(e.parse(i.sourcepos[0],i.sourcepos[1]))})}),t},e.prototype.removeUnlinkedCandidate=function(){Ni(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(e){Ei(e,function(t){(function(e){var t=Bs(e);if(!t)return!0;for(;t&&"document"!==t.type;){if(!t.parent&&!t.prev&&!t.next)return!0;t=t.parent}return!1})(t)&&delete e[t]})})},e.prototype.editMarkdown=function(e,t,n){var r=this.updateLineTexts(e,t,n),o=this.parse(e,t,r),i=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Wr({},e);return t.forEach(function(e){delete r[e]}),r}(o,"nextNode");!function(e,t){if(e&&e.parent&&0!==t){var n,r=e.parent.walker();for(r.resumeAt(e,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=t,o.sourcepos[1][0]+=t)}}}(o.nextNode,r),this.updateRootNodeState();var s=[i];return this.referenceDefinition&&(this.removeUnlinkedCandidate(),this.replaceWithRefDefCandidate(),s=s.concat(this.parseRefLink())),this.trigger("change",s),s},e.prototype.getLineTexts=function(){return this.lineTexts},e.prototype.getRootNode=function(){return this.root},e.prototype.findNodeAtPosition=function(e){var t=function(e,t){for(var n=e,r=null;n;){var o=Ls(n.sourcepos,t);if(0===o){if(!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)return r;if(!n.next)return r;n=n.next}}return n}(this.root,e);return t&&t!==this.root?t:null},e.prototype.findFirstNodeAtLine=function(e){return function(e,t){for(var n=e.firstChild,r=null;n;){var o=Rs(n.sourcepos,t);if(0===o){if(n.sourcepos[0][0]===t||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(e){for(;e.parent&&"document"!==e.parent.type&&e.parent.sourcepos[0][0]===e.sourcepos[0][0];)e=e.parent;return e}(function(e){for(;e.lastChild;)e=e.lastChild;return e}(r)):null}(this.root,e)},e.prototype.on=function(e,t){this.eventHandlerMap[e].push(t)},e.prototype.off=function(e,t){var n=this.eventHandlerMap[e],r=n.indexOf(t);n.splice(r,1)},e.prototype.findNodeById=function(e){return Bs(e)},e.prototype.removeAllNode=function(){Uo={}},e}(),qs=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function Vs(e){return qs.test(e)?e.replace(qs,function(e,t){return"&lt;"+t}):e}var $s={heading:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"h"+e.level,outerNewLine:!0}},text:function(e){return{type:"text",content:e.literal}},softbreak:function(e,t){return{type:"html",content:t.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"em"}},strong:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(e,t){var n,r=t.entering,o=null===(n=e.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(e,t){var n=t.entering,r=e.listData,o=r.type,i=r.start,s="bullet"===o?"ul":"ol",a={};return"ol"===s&&null!==i&&1!==i&&(a.start=i.toString()),{type:n?"openTag":"closeTag",tagName:s,attributes:a,outerNewLine:!0}},item:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(e,t){return{type:"html",content:t.options.tagFilter?Vs(e.literal):e.literal}},htmlBlock:function(e,t){var n=t.options,r=n.tagFilter?Vs(e.literal):e.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(e){return[{type:"openTag",tagName:"code"},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(e){var t=e.info,n=t?t.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+jo(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(e,t){if(t.entering){var n=e,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:Wr({href:jo(o)},r&&{title:jo(r)})}}return{type:"closeTag",tagName:"a"}},image:function(e,t){var n=t.getChildrenText,r=t.skipChildren,o=e,i=o.title,s=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:Wr({src:jo(s),alt:n(e)},i&&{title:jo(i)})}},customBlock:function(e,t,n){var r=e.info.trim().toLowerCase(),o=n[r];if(o)try{return o(e,t)}catch(e){console.warn("[@toast-ui/editor] - The error occurred when "+r+" block node was parsed in markdown renderer: "+e)}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:e.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(e){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:e.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(e,t,n){var r=e,o=r.info,i=r.firstChild,s=o.trim().toLowerCase(),a=n[s],l=t.entering;if(a)try{return a(e,t)}catch(e){console.warn("[@toast-ui/editor] - The error occurred when "+s+" inline node was parsed in markdown renderer: "+e)}return l?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+o+(i?" ":"")}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},_s={strike:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"del"}},item:function(e,t){var n=t.entering,r=e.listData,o=r.checked,i=r.task;if(n){var s={type:"openTag",tagName:"li",outerNewLine:!0};return i?[s,{type:"openTag",tagName:"input",selfClose:!0,attributes:Wr(Wr({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(e,t){return{type:t.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(e,t){if(t.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(e.lastChild)for(var r=e.parent.parent.columns.length,o=e.lastChild.endIdx+1;o<r;o+=1)n.push({type:"openTag",tagName:"td",outerNewLine:!0},{type:"closeTag",tagName:"td",outerNewLine:!0});return n.push({type:"closeTag",tagName:"tr",outerNewLine:!0}),n},tableCell:function(e,t){var n=t.entering;if(e.ignored)return{type:"text",content:""};var r=e.parent.parent,o="tableHead"===r.type?"th":"td",i=r.parent.columns[e.startIdx],s=(null===i||void 0===i?void 0:i.align)?{align:i.align}:null;return n?Wr({type:"openTag",tagName:o,outerNewLine:!0},s&&{attributes:s}):{type:"closeTag",tagName:o,outerNewLine:!0}}},Us={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function Ws(e){for(var t=[],n=e.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&t.push(o.literal)}return t.join("")}var Js=function(){function e(e){this.buffer=[],this.options=Wr(Wr({},Us),e),this.convertors=this.createConvertors(),delete this.options.convertors}return e.prototype.createConvertors=function(){var e=Wr({},$s);if(this.options.gfm&&(e=Wr(Wr({},e),_s)),this.options.convertors){var t=this.options.convertors,n=Object.keys(t),r=Wr(Wr({},$s),_s);n.forEach(function(n){var o=e[n],i=t[n],s=-1===Object.keys(r).indexOf(n)?n.toLowerCase():n;e[s]=o?function(e,t,n){return t.origin=function(){return o(e,t,n)},i(e,t)}:i})}return e},e.prototype.getConvertors=function(){return this.convertors},e.prototype.getOptions=function(){return this.options},e.prototype.render=function(e){var t=this;this.buffer=[];for(var n=e.walker(),r=null,o=function(){var e=r.node,o=r.entering,s=i.convertors[e.type];if(!s)return"continue";var a=!1,l={entering:o,leaf:!$o(e),options:i.options,getChildrenText:Ws,skipChildren:function(){a=!0}},c=ui(e)||function(e){return"customInline"===e.type}(e)?s(e,l,i.convertors):s(e,l);c&&((Array.isArray(c)?c:[c]).forEach(function(n,r){"openTag"===n.type&&t.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(e.id)),t.renderHTMLNode(n)}),a&&(n.resumeAt(e,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},e.prototype.renderHTMLNode=function(e){switch(e.type){case"openTag":case"closeTag":this.renderElementNode(e);break;case"text":this.renderTextNode(e);break;case"html":this.renderRawHtmlNode(e)}},e.prototype.generateOpenTagString=function(e){var t=this,n=e.tagName,r=e.classNames,o=e.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach(function(e){var n=o[e];t.buffer.push(" "+e+'="'+n+'"')}),e.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},e.prototype.generateCloseTagString=function(e){var t=e.tagName;this.buffer.push("</"+t+">")},e.prototype.addNewLine=function(){this.buffer.length&&"\n"!==Mi(Mi(this.buffer))&&this.buffer.push("\n")},e.prototype.addOuterNewLine=function(e){e.outerNewLine&&this.addNewLine()},e.prototype.addInnerNewLine=function(e){e.innerNewLine&&this.addNewLine()},e.prototype.renderTextNode=function(e){this.buffer.push(jo(e.content))},e.prototype.renderRawHtmlNode=function(e){this.addOuterNewLine(e),this.buffer.push(e.content),this.addOuterNewLine(e)},e.prototype.renderElementNode=function(e){"openTag"===e.type?(this.addOuterNewLine(e),this.generateOpenTagString(e),e.selfClose?this.addOuterNewLine(e):this.addInnerNewLine(e)):(this.addInnerNewLine(e),this.generateCloseTagString(e),this.addOuterNewLine(e))},e}();
  14. /*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */var Ks=Object.hasOwnProperty,Gs=Object.setPrototypeOf,Zs=Object.isFrozen,Xs=Object.getPrototypeOf,Qs=Object.getOwnPropertyDescriptor,Ys=Object.freeze,ea=Object.seal,ta=Object.create,na="undefined"!=typeof Reflect&&Reflect,ra=na.apply,oa=na.construct;ra||(ra=function(e,t,n){return e.apply(t,n)}),Ys||(Ys=function(e){return e}),ea||(ea=function(e){return e}),oa||(oa=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var ia=ma(Array.prototype.forEach),sa=ma(Array.prototype.pop),aa=ma(Array.prototype.push),la=ma(String.prototype.toLowerCase),ca=ma(String.prototype.match),ua=ma(String.prototype.replace),da=ma(String.prototype.indexOf),pa=ma(String.prototype.trim),ha=ma(RegExp.prototype.test),fa=function(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return oa(e,n)}}(TypeError);function ma(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return ra(e,t,r)}}function ga(e,t){Gs&&Gs(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=la(r);o!==r&&(Zs(t)||(t[n]=o),r=o)}e[r]=!0}return e}function va(e){var t=ta(null),n=void 0;for(n in e)ra(Ks,e,[n])&&(t[n]=e[n]);return t}function ya(e,t){for(;null!==e;){var n=Qs(e,t);if(n){if(n.get)return ma(n.get);if("function"==typeof n.value)return ma(n.value)}e=Xs(e)}return function(e){return console.warn("fallback value for",e),null}}var ba=Ys(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),wa=Ys(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ka=Ys(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xa=Ys(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ca=Ys(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Ta=Ys(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ma=Ys(["#text"]),Sa=Ys(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Ea=Ys(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Na=Ys(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Oa=Ys(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Da=ea(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Aa=ea(/<%[\s\S]*|[\s\S]*%>/gm),La=ea(/^data-[\-\w.\u00B7-\uFFFF]/),Ia=ea(/^aria-[\-\w]+$/),Ra=ea(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pa=ea(/^(?:\w+script|data):/i),Ba=ea(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Ha(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var ja=function(){return"undefined"==typeof window?null:window},za=function(e,t){if("object"!==(void 0===e?"undefined":Fa(e))||"function"!=typeof e.createPolicy)return null;var n=null;t.currentScript&&t.currentScript.hasAttribute("data-tt-policy-suffix")&&(n=t.currentScript.getAttribute("data-tt-policy-suffix"));var r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};var qa=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ja(),n=function(t){return e(t)};if(n.version="2.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,i=t.DocumentFragment,s=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,d=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,p=t.Text,h=t.Comment,f=t.DOMParser,m=t.trustedTypes,g=l.prototype,v=ya(g,"cloneNode"),y=ya(g,"nextSibling"),b=ya(g,"childNodes"),w=ya(g,"parentNode");if("function"==typeof s){var k=o.createElement("template");k.content&&k.content.ownerDocument&&(o=k.content.ownerDocument)}var x=za(m,r),C=x&&te?x.createHTML(""):"",T=o,M=T.implementation,S=T.createNodeIterator,E=T.createDocumentFragment,N=T.getElementsByTagName,O=r.importNode,D={};try{D=va(o).documentMode?o.documentMode:{}}catch(e){}var A={};n.isSupported="function"==typeof w&&M&&void 0!==M.createHTMLDocument&&9!==D;var L=Da,I=Aa,R=La,P=Ia,B=Pa,F=Ba,H=Ra,j=null,z=ga({},[].concat(Ha(ba),Ha(wa),Ha(ka),Ha(Ca),Ha(Ma))),q=null,V=ga({},[].concat(Ha(Sa),Ha(Ea),Ha(Na),Ha(Oa))),$=null,_=null,U=!0,W=!0,J=!1,K=!1,G=!1,Z=!1,X=!1,Q=!1,Y=!1,ee=!0,te=!1,ne=!0,re=!0,oe=!1,ie={},se=null,ae=ga({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),le=null,ce=ga({},["audio","video","img","source","image","track"]),ue=null,de=ga({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml",me=fe,ge=!1,ve=void 0,ye=["application/xhtml+xml","text/html"],be=void 0,we=null,ke=o.createElement("form"),xe=function(e){we&&we===e||(e&&"object"===(void 0===e?"undefined":Fa(e))||(e={}),e=va(e),j="ALLOWED_TAGS"in e?ga({},e.ALLOWED_TAGS):z,q="ALLOWED_ATTR"in e?ga({},e.ALLOWED_ATTR):V,ue="ADD_URI_SAFE_ATTR"in e?ga(va(de),e.ADD_URI_SAFE_ATTR):de,le="ADD_DATA_URI_TAGS"in e?ga(va(ce),e.ADD_DATA_URI_TAGS):ce,se="FORBID_CONTENTS"in e?ga({},e.FORBID_CONTENTS):ae,$="FORBID_TAGS"in e?ga({},e.FORBID_TAGS):{},_="FORBID_ATTR"in e?ga({},e.FORBID_ATTR):{},ie="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,K=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,Q=e.RETURN_DOM||!1,Y=e.RETURN_DOM_FRAGMENT||!1,ee=!1!==e.RETURN_DOM_IMPORT,te=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,re=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,H=e.ALLOWED_URI_REGEXP||H,me=e.NAMESPACE||fe,ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===ve?function(e){return e}:la,K&&(W=!1),Y&&(Q=!0),ie&&(j=ga({},[].concat(Ha(Ma))),q=[],!0===ie.html&&(ga(j,ba),ga(q,Sa)),!0===ie.svg&&(ga(j,wa),ga(q,Ea),ga(q,Oa)),!0===ie.svgFilters&&(ga(j,ka),ga(q,Ea),ga(q,Oa)),!0===ie.mathMl&&(ga(j,Ca),ga(q,Na),ga(q,Oa))),e.ADD_TAGS&&(j===z&&(j=va(j)),ga(j,e.ADD_TAGS)),e.ADD_ATTR&&(q===V&&(q=va(q)),ga(q,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&ga(ue,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(se===ae&&(se=va(se)),ga(se,e.FORBID_CONTENTS)),re&&(j["#text"]=!0),G&&ga(j,["html","head","body"]),j.table&&(ga(j,["tbody"]),delete $.tbody),Ys&&Ys(e),we=e)},Ce=ga({},["mi","mo","mn","ms","mtext"]),Te=ga({},["foreignobject","desc","title","annotation-xml"]),Me=ga({},wa);ga(Me,ka),ga(Me,xa);var Se=ga({},Ca);ga(Se,Ta);var Ee=function(e){aa(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=C}catch(t){e.remove()}}},Ne=function(e,t){try{aa(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){aa(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!q[e])if(Q||Y)try{Ee(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Oe=function(e){var t=void 0,n=void 0;if(X)e="<remove></remove>"+e;else{var r=ca(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=x?x.createHTML(e):e;if(me===fe)try{t=(new f).parseFromString(i,ve)}catch(e){}if(!t||!t.documentElement){t=M.createDocument(me,"template",null);try{t.documentElement.innerHTML=ge?"":i}catch(e){}}var s=t.body||t.documentElement;return e&&n&&s.insertBefore(o.createTextNode(n),s.childNodes[0]||null),me===fe?N.call(t,G?"html":"body")[0]:G?t.documentElement:s},De=function(e){return S.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ae=function(e){return"object"===(void 0===a?"undefined":Fa(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":Fa(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,r){A[e]&&ia(A[e],function(e){e.call(n,t,r,we)})},Ie=function(e){var t=void 0;if(Le("beforeSanitizeElements",e,null),function(e){return!(e instanceof p||e instanceof h||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof d&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)}(e))return Ee(e),!0;if(ca(e.nodeName,/[\u0080-\uFFFF]/))return Ee(e),!0;var r=be(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:j}),!Ae(e.firstElementChild)&&(!Ae(e.content)||!Ae(e.content.firstElementChild))&&ha(/<[/\w]/g,e.innerHTML)&&ha(/<[/\w]/g,e.textContent))return Ee(e),!0;if("select"===r&&ha(/<template/i,e.innerHTML))return Ee(e),!0;if(!j[r]||$[r]){if(re&&!se[r]){var o=w(e)||e.parentNode,i=b(e)||e.childNodes;if(i&&o)for(var s=i.length-1;s>=0;--s)o.insertBefore(v(i[s],!0),y(e))}return Ee(e),!0}return e instanceof l&&!function(e){var t=w(e);t&&t.tagName||(t={namespaceURI:fe,tagName:"template"});var n=la(e.tagName),r=la(t.tagName);if(e.namespaceURI===he)return t.namespaceURI===fe?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===r||Ce[r]):Boolean(Me[n]);if(e.namespaceURI===pe)return t.namespaceURI===fe?"math"===n:t.namespaceURI===he?"math"===n&&Te[r]:Boolean(Se[n]);if(e.namespaceURI===fe){if(t.namespaceURI===he&&!Te[r])return!1;if(t.namespaceURI===pe&&!Ce[r])return!1;var o=ga({},["title","style","font","a","script"]);return!Se[n]&&(o[n]||!Me[n])}return!1}(e)?(Ee(e),!0):"noscript"!==r&&"noembed"!==r||!ha(/<\/no(script|embed)/i,e.innerHTML)?(K&&3===e.nodeType&&(t=e.textContent,t=ua(t,L," "),t=ua(t,I," "),e.textContent!==t&&(aa(n.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ee(e),!0)},Re=function(e,t,n){if(ne&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;if(W&&!_[t]&&ha(R,t));else if(U&&ha(P,t));else{if(!q[t]||_[t])return!1;if(ue[t]);else if(ha(H,ua(n,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==da(n,"data:")||!le[e])if(J&&!ha(B,ua(n,F,"")));else if(n)return!1}return!0},Pe=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;Le("beforeSanitizeAttributes",e,null);var s=e.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q};for(i=s.length;i--;){var l=t=s[i],c=l.name,u=l.namespaceURI;if(r=pa(t.value),o=be(c),a.attrName=o,a.attrValue=r,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),r=a.attrValue,!a.forceKeepAttr&&(Ne(c,e),a.keepAttr))if(ha(/\/>/i,r))Ne(c,e);else{K&&(r=ua(r,L," "),r=ua(r,I," "));var d=be(e.nodeName);if(Re(d,o,r))try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),sa(n.removed)}catch(e){}}}Le("afterSanitizeAttributes",e,null)}},Be=function e(t){var n=void 0,r=De(t);for(Le("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Le("uponSanitizeShadowNode",n,null),Ie(n)||(n.content instanceof i&&e(n.content),Pe(n));Le("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var s=void 0,l=void 0,c=void 0,u=void 0,d=void 0;if((ge=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ae(e)){if("function"!=typeof e.toString)throw fa("toString is not a function");if("string"!=typeof(e=e.toString()))throw fa("dirty is not a string, aborting")}if(!n.isSupported){if("object"===Fa(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Ae(e))return t.toStaticHTML(e.outerHTML)}return e}if(Z||xe(o),n.removed=[],"string"==typeof e&&(oe=!1),oe);else if(e instanceof a)1===(l=(s=Oe("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName?s=l:"HTML"===l.nodeName?s=l:s.appendChild(l);else{if(!Q&&!K&&!G&&-1===e.indexOf("<"))return x&&te?x.createHTML(e):e;if(!(s=Oe(e)))return Q?null:C}s&&X&&Ee(s.firstChild);for(var p=De(oe?e:s);c=p.nextNode();)3===c.nodeType&&c===u||Ie(c)||(c.content instanceof i&&Be(c.content),Pe(c),u=c);if(u=null,oe)return e;if(Q){if(Y)for(d=E.call(s.ownerDocument);s.firstChild;)d.appendChild(s.firstChild);else d=s;return ee&&(d=O.call(r,d,!0)),d}var h=G?s.outerHTML:s.innerHTML;return K&&(h=ua(h,L," "),h=ua(h,I," ")),x&&te?x.createHTML(h):h},n.setConfig=function(e){xe(e),Z=!0},n.clearConfig=function(){we=null,Z=!1},n.isValidAttribute=function(e,t,n){we||xe({});var r=be(e),o=be(t);return Re(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(A[e]=A[e]||[],aa(A[e],t))},n.removeHook=function(e){A[e]&&sa(A[e])},n.removeHooks=function(e){A[e]&&(A[e]=[])},n.removeAllHooks=function(){A={}},n}(),Va=["iframe","embed"],$a=[];function _a(e){ue(Va,e)&&$a.push(e.toLowerCase())}function Ua(e,t){return qa.sanitize(e,h({ADD_TAGS:$a,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},t))}function Wa(e,t){return e.literal.replace(new RegExp("(<\\s*"+t+"[^>]*>)|(</"+t+"\\s*[>])","ig"),"").trim()}function Ja(e){var t=(e=e.match(vt)[0]).match(new RegExp(ft,"g"));return t?t.reduce(function(e,t){var n=t.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(e[r]=o.join("=").replace(/'|"/g,"").trim()),e},{}):{}}function Ka(e){return Ee(e.attributes).reduce(function(e,t){return e[t.nodeName]=t.nodeValue,e},{})}function Ga(e,t,n,r){var o=r.getToDOMNode(t)(e),i=n(o.outerHTML),s=document.createElement("div");return s.innerHTML=i,{dom:o=s.firstChild,htmlAttrs:Ka(o)}}var Za={htmlBlock:function(e,t,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:e,getAttrs:function(e){return{htmlAttrs:Ka(e),childrenHTML:e.innerHTML}}}],toDOM:function(r){var o=Ga(r,e,t,n),i=o.dom,s=o.htmlAttrs;return s.class=s.class?s.class+" html-block":"html-block",f([e,s],Ee(i.childNodes))}}},htmlInline:function(e,t,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:e,getAttrs:function(e){return{htmlAttrs:Ka(e)}}}],toDOM:function(r){var o=Ga(r,e,t,n).htmlAttrs;return[e,o,0]}}}};var Xa=/^\s*<\s*\//,Qa={paragraph:function(e,t){var n=t.entering,r=t.origin;return t.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(e){return{type:"html",content:e.prev&&"htmlInline"===e.prev.type&&/<br ?\/?>/.test(e.prev.literal)?"\n":"<br>\n"}},item:function(e,t){if(t.entering){var n={},r=[];return e.listData.task&&(n["data-task"]="",r.push("task-list-item"),e.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(e){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(e.tickCount)}},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(e){var t=e,n=t.fenceLength,r=t.info,o=r?r.split(/\s+/):[],i=[],s={};if(n>3&&(s["data-backticks"]=n),o.length>0&&o[0].length>0){var a=o[0];i.push("lang-"+a),s["data-language"]=a}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:s},{type:"text",content:e.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(e,t){var n=t.origin,r=t.entering,o=t.skipChildren,i=e.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:Ye(i,ot(e)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function Ya(e,t){var n=h({},Qa);return e&&(n.link=function(t,n){var r=n.entering,o=(0,n.origin)();return r&&(o.attributes=h(h({},o.attributes),e)),o}),t&&Object.keys(t).forEach(function(e){var r=n[e],o=t[e];r&&$t(o)?n[e]=function(e,t){var n=h({},t);return n.origin=function(){return r(e,t)},o(e,n)}:ue(["htmlBlock","htmlInline"],e)&&!$t(o)?n[e]=function(e,t){var n=e.literal.match(vt);if(n){var r=n[0],i=n[1],s=n[3],a=(i||s).toLowerCase(),l=o[a],c=Wa(e,a);if(l){var u=h({},e);return u.attrs=Ja(r),u.childrenHTML=c,u.type=a,t.entering=!Xa.test(e.literal),l(u,t)}}return t.origin()}:n[e]=o}),n}var el=["list","item","blockQuote"],tl=["UL","OL","BLOCKQUOTE"];function nl(e,t){var n,r=e.child(t);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function rl(e,t,n){var r=Re(t)-1,o=Pe(t)-1,i=n[r].getBoundingClientRect(),s=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:s<=0?n[r].clientHeight:s+function(e,t,n){var r=e.childCount-1,o=0;for(;n<=r&&nl(e,n);)o+=t[n].clientHeight,n+=1;return o}(e,n,Math.min(o+1,e.childCount-1)),rect:i}}function ol(e,t){for(var n=0;e&&e!==t&&(ue(tl,e.tagName)||(n+=e.offsetTop),e.offsetParent!==t.offsetParent);)e=e.parentElement;return n}function il(e,t,n){return e&&t>n+e.offsetTop?il(e.nextElementSibling,t,n)||e:null}function sl(e,t){for(var n=e.querySelector('[data-nodeid="'+t.id+'"]');!n||He(t);)t=t.parent,n=e.querySelector('[data-nodeid="'+t.id+'"]');return function(e){var t=e.mdNode,n=e.el;for(;(ue(el,t.type)||"table"===t.type)&&t.firstChild;)t=t.firstChild,n=n.firstElementChild;return{mdNode:t,el:n}}({mdNode:t,el:n})}var al={};function ll(e){e&&(delete al[Number(e.getAttribute("data-nodeid"))],Ee(e.children).forEach(function(e){ll(e)}))}function cl(e,t,n){var r=function(e){return al[e]&&al[e].height}(n),o=function(e){return al[e]&&al[e].offsetTop}(n),i=r||e.clientHeight,s=o||ol(e,t)||e.offsetTop;return r||function(e,t){al[e]=al[e]||{},al[e].height=t}(n,i),o||function(e,t){al[e]=al[e]||{},al[e].offsetTop=t}(n,s),{nodeHeight:i,offsetTop:s}}var ul=Ct("md-preview-highlight");var dl=function(){function e(e,t){var n=document.createElement("div");this.el=n,this.eventEmitter=e,this.isViewer=!!t.isViewer,this.el.className=Ct("md-preview");var r=t.linkAttributes,o=t.customHTMLRenderer,i=t.sanitizer,s=t.highlight,a=void 0!==s&&s;this.renderer=new Js({gfm:!0,nodeId:!0,convertors:Ya(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(a),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return e.prototype.initContentSection=function(){this.previewContent=Nt('<div class="'+Ct("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},e.prototype.toggleActive=function(e){Et(this.el,"active",e)},e.prototype.initEvent=function(e){var t=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(e&&(this.eventEmitter.listen("changeToolbarState",function(e){var n=e.mdNode,r=e.cursorPos;t.updateCursorNode(n,r)}),this.eventEmitter.listen("blur",function(){t.removeHighlight()})),$r(this.el,"scroll",function(e){t.eventEmitter.emit("scroll","preview",function(e,t){for(var n=t,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=il(o,e,ol(n,t))}var i=n||r;return i===t?null:i}(e.target.scrollTop,t.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return t.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return t.toggleActive(!1)}))},e.prototype.removeHighlight=function(){if(this.cursorNodeId){var e=this.getElementByNodeId(this.cursorNodeId);e&&U(e,ul)}},e.prototype.updateCursorNode=function(e,t){e&&("tableRow"===(e=$e(e,function(e){return!function(e){switch(e.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(e)})).type?e=function(e,t){for(var n=e.firstChild;n&&n.next&&!(Be(n.next)>t+1);)n=n.next;return n}(e,t[1]):"tableBody"===e.type&&(e=null));var n=e?e.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&U(r,ul),o&&z(o,ul),this.cursorNodeId=n}},e.prototype.getElementByNodeId=function(e){return e?this.previewContent.querySelector('[data-nodeid="'+e+'"]'):null},e.prototype.update=function(e){var t=this;e.forEach(function(e){return t.replaceRangeNodes(e)}),this.eventEmitter.emit("afterPreviewRender",this)},e.prototype.replaceRangeNodes=function(e){var t=this,n=e.nodes,r=e.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map(function(e){return t.renderer.render(e)}).join("")));if(r){var s=r.id,a=s[0],l=s[1],c=this.getElementByNodeId(a),u=this.getElementByNodeId(l);if(c){c.insertAdjacentHTML("beforebegin",i);for(var d=c;d&&d!==u;){var p=d.nextElementSibling;St(d),ll(d),d=p}(null===d||void 0===d?void 0:d.parentNode)&&(St(d),ll(d))}}else o.insertAdjacentHTML("afterbegin",i)},e.prototype.getRenderer=function(){return this.renderer},e.prototype.destroy=function(){Hr(this.el,"scroll"),this.el=null},e.prototype.getElement=function(){return this.el},e.prototype.getHTML=function(){return It(this.previewContent.innerHTML)},e.prototype.setHTML=function(e){this.previewContent.innerHTML=e},e.prototype.setHeight=function(e){E(this.el,{height:e+"px"})},e.prototype.setMinHeight=function(e){E(this.el,{minHeight:e+"px"})},e}();function pl(e,t){for(var n=e.depth;n;){var r=e.node(n);if(t(r,n))return{node:r,depth:n,offset:n>0?e.before(n):0};n-=1}return null}function hl(e){return!!pl(e,function(e){var t=e.type;return"listItem"===t.name||"bulletList"===t.name||"orderedList"===t.name})}function fl(e){return!!pl(e,function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name})}function ml(e){return pl(e,function(e){return"listItem"===e.type.name})}function gl(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({},t&&{rawHTML:t})}}}function vl(e){return Object.keys(e).reduce(function(t,n){return"rawHTML"!==n&&e[n]&&(t[n="className"===n?"class":n]=e[n]),t},{})}function yl(e){return{tag:e,getAttrs:function(e){return["rawHTML","colspan","rowspan","extended"].reduce(function(t,n){var r="rawHTML"===n?"data-raw-html":n,o=e.getAttribute(r);return o&&(t[n]=ue(["rawHTML","extended"],n)?o:Number(o)),t},{})}}}function bl(e){var t=e.htmlAttrs,n=e.classNames;return h(h({},t),{class:n?n.join(" "):null})}function wl(e,t,n,o){var s=t.$from,a=t.$to,l=t.depth,c=t,u=!1;if(l>=2&&s.node(l-1).type.compatibleContent(n)&&0===t.startIndex&&s.index(l-1)){var d=e.doc.resolve(t.start-2);c=new r.g(d,d,l),t.endIndex<t.parent.childCount&&(t=new r.g(s,e.doc.resolve(a.end(l)),l)),u=!0}var p=function(e,t,n,r){var o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(i){var s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}return null}(e,n),i=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(s){for(var a=(s.length?s[s.length-1]:t).contentMatch,l=r;a&&l<o;l+=1)a=a.matchType(n.child(l).type);if(a&&a.validEnd)return s}return null}(t,n);if(o&&i){var s=o.map(function(e){return{type:e}}),a=i.map(function(e){return{type:e,attrs:r}});return s.concat({type:n}).concat(a)}return null}(c,t,n,o);return p?function(e,t,n,o,s){for(var a=t.start,l=t.end,c=t.startIndex,u=t.endIndex,d=t.parent,p=r.c.empty,h=n.length-1;h>=0;h-=1)p=r.c.from(n[h].type.create(n[h].attrs,p));e.step(new i.b(a-(o?2:0),l,a,l,new r.j(p,0,0),n.length,!0));var f=0;for(h=0;h<n.length;h+=1)if(n[h].type===s){f=h+1;break}for(var m=n.length-f,g=a+n.length-(o?2:0),v=(h=c,u);h<v;h+=1)!(h===c)&&Object(i.g)(e.doc,g,m)&&(e.split(g,m),g+=2*m),g+=d.child(h).nodeSize;return e}(e,t,p,u,n):e}function kl(e,t){for(var n=e.resolve(t);"paragraph"!==n.node().type.name;)t-=2,n=e.resolve(t);return ml(n)}function xl(e){return function(t,n){var r=t.selection,o=t.tr,i=r.$from,s=r.$to,a=i.blockRange(s);return!!a&&(n(hl(i)?function(e,t,n){var r=t.$from,o=t.$to,i=ml(r),s=ml(o);if(i&&s)for(;s;){var a=s.offset,l=s.node,c=s.depth;l.attrs.task&&e.setNodeMarkup(a,null,{task:!1,checked:!1});var u=e.doc.resolve(a);if(u.parent.type!==n){var d=u.before(c-1);e.setNodeMarkup(d,n)}if(a===i.offset)break;s=kl(e.doc,a)}return e}(o,a,e):wl(o,a,e)),!0)}}function Cl(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from,s=n.$to,a=i.blockRange(s);return!!a&&(t(hl(i)?function(e,t){var n=t.$from,r=t.$to,o=ml(n),i=ml(r);if(o&&i)for(;i;){var s=i.offset,a={task:!i.node.attrs.task,checked:!1};if(e.setNodeMarkup(s,null,a),s===o.offset)break;i=kl(e.doc,s)}return e}(r,a):wl(r,a,o.nodes.bulletList,{task:!0})),!0)}}function Tl(e){return function(t,n){var o=t.tr,s=t.selection,a=s.$from,l=s.$to,c=a.blockRange(l,function(t){var n=t.childCount,r=t.firstChild;return!!n&&r.type===e});return!!c&&(n(a.node(c.depth-1).type===e?function(e,t,n){var o=t.$from,s=t.$to,a=t.end,l=t.depth,c=t.parent,u=s.end(l);return a<u&&(e.step(new i.b(a-1,u,a,u,new r.j(r.c.from(n.create(null,c.copy())),1,0),1,!0)),t=new r.g(e.doc.resolve(o.pos),e.doc.resolve(u),l)),e.lift(t,Object(i.k)(t)),e}(o,c,e):function(e,t){for(var n=t.parent,o=t.end,s=t.endIndex-1,a=t.startIndex;s>a;s-=1)o-=n.child(s).nodeSize,e.delete(o-1,o+1);var l=e.doc.resolve(t.start),c=l.nodeAfter,u=0===t.startIndex,d=t.endIndex===n.childCount,p=l.node(-1),h=l.index(-1),f=p.canReplace(h+(u?0:1),h+1,null===c||void 0===c?void 0:c.content.append(d?r.c.empty:r.c.from(n)));if(c&&f){var m=l.pos,g=m+c.nodeSize;e.step(new i.b(m-(u?1:0),g+(d?1:0),m+1,g-1,new r.j((u?r.c.empty:r.c.from(n.copy(r.c.empty))).append(d?r.c.empty:r.c.from(n.copy(r.c.empty))),u?0:1,d?0:1),u?0:1))}return e}(o,c)),!0)}}function Ml(){return function(){return function(e,t){var n=e.selection,o=e.schema,s=n.$from,a=n.$to;return!(!s.blockRange(a)||!hl(s))&&function(e){return function(t,n){var o=t.tr,s=t.selection,a=s.$from,l=s.$to,c=a.blockRange(l,function(t){var n=t.childCount,r=t.firstChild;return!!n&&r.type===e});if(c&&c.startIndex>0){var u=c.parent,d=u.child(c.startIndex-1);if(d.type!==e)return!1;var p=d.lastChild&&d.lastChild.type===u.type,h=p?r.c.from(e.create()):null,f=new r.j(r.c.from(e.create(null,r.c.from(u.type.create(null,h)))),p?3:1,0),m=c.start,g=c.end;return o.step(new i.b(m-(p?3:1),g,m,g,f,1,!0)),n(o),!0}return!1}}(o.nodes.listItem)(e,t)}}}function Sl(){return{indent:Ml(),outdent:function(){return function(e,t){var n=e.selection,r=e.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!hl(o))&&Tl(r.nodes.listItem)(e,t)}}}}var El=new Map,Nl=function(){function e(e,t,n,r){this.table=e,this.tableRows=t,this.tableStartPos=n,this.rowInfo=r}return e.create=function(t){var n=pl(t,function(e){return"table"===e.type.name});if(n){var r=n.node,o=n.depth,i=n.offset,s=El.get(r);if((null===s||void 0===s?void 0:s.tableStartPos)===i+1)return s;var a=[],l=t.start(o),c=r.child(0),u=r.child(1),d=Ol(c,l),p=Ol(u,l+c.nodeSize);c.forEach(function(e){return a.push(e)}),u.forEach(function(e){return a.push(e)});var h=new e(r,a,l,d.concat(p));return El.set(r,h),h}return null},Object.defineProperty(e.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),e.prototype.getCellInfo=function(e,t){return this.rowInfo[e][t]},e.prototype.posAt=function(e,t){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===e){for(var i=t;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},e.prototype.getNodeAndPos=function(e,t){var n=this.rowInfo[e][t];return{node:this.table.nodeAt(n.offset-this.tableStartOffset),pos:n.offset}},e.prototype.extendedRowspan=function(e,t){return!1},e.prototype.extendedColspan=function(e,t){return!1},e.prototype.getRowspanCount=function(e,t){return 0},e.prototype.getColspanCount=function(e,t){return 0},e.prototype.decreaseColspanCount=function(e,t){return 0},e.prototype.decreaseRowspanCount=function(e,t){return 0},e.prototype.getColspanStartInfo=function(e,t){return null},e.prototype.getRowspanStartInfo=function(e,t){return null},e.prototype.getCellStartOffset=function(e,t){var n=this.rowInfo[e][t].offset;return this.extendedRowspan(e,t)?this.posAt(e,t):n},e.prototype.getCellEndOffset=function(e,t){var n=this.rowInfo[e][t],r=n.offset,o=n.nodeSize;return this.extendedRowspan(e,t)?this.posAt(e,t):r+o},e.prototype.getCellIndex=function(e){for(var t=0;t<this.totalRowCount;t+=1)for(var n=this.rowInfo[t],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>e.pos)return[t,r];return[0,0]},e.prototype.getRectOffsets=function(e,t){var n,r,o;void 0===t&&(t=e),e.pos>t.pos&&(e=(n=[t,e])[0],t=n[1]);var i=this.getCellIndex(e),s=i[0],a=i[1],l=this.getCellIndex(t),c=l[0],u=l[1];return s=(r=Me(s,c))[0],c=r[1],a=(o=Me(a,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:s,startColIdx:a,endRowIdx:c,endColIdx:u})},e.prototype.getSpannedOffsets=function(e){return e},e}(),Ol=function(e,t){var n=[];return e.forEach(function(e,r){var o={rowspanMap:{},colspanMap:{},length:0};e.forEach(function(e,n){for(var i=e.nodeSize,s=0;o[s];)s+=1;o[s]={offset:t+r+n+2,nodeSize:i},o.length+=1}),n.push(o)}),n};function Dl(e,t){return Te(Nl.prototype,e),Ol=t,Nl}var Al=function(e){function t(t,n){void 0===n&&(n=t);var r=this,o=t.node(0),i=Nl.create(t),a=function(e,t,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,a=n.endColIdx,l=[],c=r;c<=i;c+=1)for(var u=o;u<=a;u+=1){var d=t.getCellInfo(c,u),p=d.offset,h=d.nodeSize;l.push(new s.g(e.resolve(p+1),e.resolve(p+h-1)))}return l}(o,i,i.getRectOffsets(t,n));return(r=e.call(this,a[0].$from,a[0].$to,a)||this).startCell=t,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return p(t,e),t.prototype.map=function(e,n){var r=this.startCell.pos,o=this.endCell.pos,i=e.resolve(n.map(r)),a=e.resolve(n.map(o)),l=Nl.create(i);if(this.offsetMap.totalColumnCount>l.totalColumnCount||this.offsetMap.totalRowCount>l.totalRowCount){var c={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[a.parent.type.name],u=a.end(a.depth-c),d=Math.min(u-4,a.pos);return s.h.create(e,d)}return new t(i,a)},t.prototype.eq=function(e){return e instanceof t&&e.startCell.pos===this.startCell.pos&&e.endCell.pos===this.endCell.pos},t.prototype.content=function(){for(var e=this.startCell.node(-2),t=this.startCell.start(-2),n=e.child(1).firstChild,o=e.child(0).type.create(),i=e.child(1).type.create(),s=Nl.create(this.startCell),a=s.getRectOffsets(this.startCell,this.endCell),l=a.startRowIdx,c=a.startColIdx,u=a.endRowIdx,d=a.endColIdx,p=!1,h=l;h<=u;h+=1){for(var f=[],m=c;m<=d;m+=1){var g=s.getCellInfo(h,m).offset,v=e.nodeAt(g-t);v&&(p="tableHeadCell"===v.type.name,s.extendedRowspan(h,m)||s.extendedColspan(h,m)?f.push(v.type.create({extended:!0})):f.push(v.copy(v.content)))}var y=n.copy(r.c.from(f)),b=p?o:i;b.content=b.content.append(r.c.from(y))}return new r.j(function(e,t){var n=[];return e.childCount&&n.push(e),t.childCount&&n.push(t),r.c.from(n)}(o,i),1,1)},t.prototype.toJSON=function(){return JSON.stringify(this)},t}(s.f);function Ll(e,t,n,r){for(var o=n.nodes,i=o.tableRow,s=o.tableBodyCell,a=o.paragraph,l=[],c=0;c<e;c+=1){for(var u=[],d=0;d<t;d+=1){var p=r&&r[c*t+d],h=a.create(null,p?n.text(p):[]);u.push(s.create(null,h))}l.push(i.create(null,u))}return l}function Il(e,t,n,r){void 0===r&&(r=null);for(var o=n.nodes,i=o.tableHeadCell,s=o.tableBodyCell,a=o.paragraph,l=0===t?i:s,c=[],u=0;u<e;u+=1)c.push(l.create(r,a.create()));return c}function Rl(e,t){for(;e&&e!==t;){if("TD"===e.nodeName||"TH"===e.nodeName)return e;e=e.parentNode}return null}function Pl(e){return pl(e,function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name})}function Bl(e){if(e instanceof s.h){var t=e.$anchor,n=Pl(t);if(n){var r=t.node(0).resolve(t.before(n.depth));return{anchor:r,head:r}}}var o=e;return{anchor:o.startCell,head:o.endCell}}function Fl(e){var t;if(e.size){var n=e.content,r=e.openStart,o=e.openEnd;if(1!==n.childCount)return null;for(;1===n.childCount&&(r>0&&o>0||"table"===(null===(t=n.firstChild)||void 0===t?void 0:t.type.name));)r-=1,o-=1,n=n.firstChild.content;if("tableHead"===n.firstChild.type.name||"tableBody"===n.firstChild.type.name)return n}return null}function Hl(e){var t=e.startRowIdx,n=e.startColIdx;return{rowCount:e.endRowIdx-t+1,columnCount:e.endColIdx-n+1}}function jl(e,t){return h(h({},e.attrs),t)}var zl=new s.e("cellSelection"),ql=function(){function e(e){this.view=e,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return e.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},e.prototype.handleMousedown=function(e){var t=Rl(e.target,this.view.dom);if(2!==e.button){if(t){var n=this.getCellPos(e);n&&(this.startCellPos=n),this.bindEvent()}}else e.preventDefault()},e.prototype.handleMousemove=function(e){var t,n=zl.getState(this.view.state),r=this.getCellPos(e),o=this.startCellPos;n?t=this.view.state.doc.resolve(n):o!==r&&(t=o),t&&o&&r&&this.setCellSelection(o,r)},e.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==zl.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(zl,-1))},e.prototype.bindEvent=function(){var e=this.view.dom;e.addEventListener("mousemove",this.handlers.mousemove),e.addEventListener("mouseup",this.handlers.mouseup)},e.prototype.unbindEvent=function(){var e=this.view.dom;e.removeEventListener("mousemove",this.handlers.mousemove),e.removeEventListener("mouseup",this.handlers.mouseup)},e.prototype.getCellPos=function(e){var t=e.clientX,n=e.clientY,r=this.view.posAtCoords({left:t,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),s=Pl(i);if(s){var a=i.before(s.depth);return o.resolve(a)}}return null},e.prototype.setCellSelection=function(e,t){var n=this.view.state,r=n.selection,o=n.tr,i=null===zl.getState(this.view.state),s=new Al(e,t);if(i||!r.eq(s)){var a=o.setSelection(s);i&&a.setMeta(zl,t.pos),this.view.dispatch(a)}},e.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},e}(),Vl=Ct("cell-selected");function $l(e){var t=e.selection,n=e.doc;if(t instanceof Al){var r=[];return t.ranges.forEach(function(e){var t=e.$from,n=e.$to;r.push(o.a.node(t.pos-1,n.pos+1,{class:Vl}))}),o.b.create(n,r)}return null}var _l=function(){function e(){this.keys=[],this.values=[]}return e.prototype.getKeyIndex=function(e){return O(e,this.keys)},e.prototype.get=function(e){return this.values[this.getKeyIndex(e)]},e.prototype.set=function(e,t){var n=this.getKeyIndex(e);return n>-1?this.values[n]=t:(this.keys.push(e),this.values.push(t)),this},e.prototype.has=function(e){return this.getKeyIndex(e)>-1},e.prototype.delete=function(e){var t=this.getKeyIndex(e);return t>-1&&(this.keys.splice(t,1),this.values.splice(t,1),!0)},e.prototype.forEach=function(e,t){var n=this;void 0===t&&(t=this),this.values.forEach(function(r,o){r&&n.keys[o]&&e.call(t,r,n.keys[o],n)})},e.prototype.clear=function(){this.keys=[],this.values=[]},e}(),Ul="en-US",Wl=new(function(){function e(){this.code=Ul,this.langs=new _l}return e.prototype.setCode=function(e){this.code=e||Ul},e.prototype.setLanguage=function(e,t){var n=this;(e=[].concat(e)).forEach(function(e){if(n.langs.has(e)){var r=n.langs.get(e);n.langs.set(e,v(r,t))}else n.langs.set(e,t)})},e.prototype.get=function(e,t){t||(t=this.code);var n=this.langs.get(t);n||(n=this.langs.get(Ul));var r=n[e];if(!r)throw new Error('There is no text key "'+e+'" in '+t);return r},e}()),Jl=[[{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 Kl(e){return new s.d({props:{handleDOMEvents:{contextmenu:function(t,n){var r=Rl(n.target,t.dom);if(r){n.preventDefault();var o=n,i=o.clientX,s=o.clientY,a=t.dom.parentNode.getBoundingClientRect(),l=a.left,c=a.top,u="TH"===r.nodeName;return e.emit("contextmenu",{pos:{left:i-l+10+"px",top:s-c+30+"px"},menuGroups:function(e,t){return Jl.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:Wl.get(r),onClick:function(){e.emit("command",o,i)},disabled:t&&!!s,className:a}})}).concat()}(e,u),tableCell:r}),!0}return!1}}}})}var Gl=["image","link","customBlock","frontMatter"],Zl=["strong","strike","emph","code"],Xl=["bulletList","orderedList","taskList"];function Ql(e,t,n){var r=e.$from,o=e.$to,i=e.from,s=e.to,a={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}};return t.nodesBetween(i,s,function(e,t,i){var s=function(e,t){var n=e.type.name;return"listItem"===n?e.attrs.task?"taskList":t.type.name:-1!==n.indexOf("table")?"table":n}(e,i);ue(Gl,s)||(ue(Xl,s)?(!function(e,t){t[e]={active:!0},Xl.filter(function(t){return t!==e}).forEach(function(e){t[e]&&delete t[e]})}(s,a),a.indent.disabled=!1,a.outdent.disabled=!1):"paragraph"===s||"text"===s?function(e,t,n,r){Zl.forEach(function(o){var i=n.marks[o],s=e.marksAcross(t)||[];i.isInSet(s)&&(r[o]={active:!0})})}(r,o,n,a):a[s]={active:!0})}),a}var Yl=function(){function e(e,t,n,r){var i=this;this.openEditor=function(){if(i.innerEditorView)throw new Error("The editor is already opened.");i.dom.draggable=!1,i.wrapper.style.display="none",i.innerViewContainer.style.display="block",i.innerEditorView=new o.c(i.innerViewContainer,{state:s.b.create({doc:i.node,plugins:[Object(a.a)({"Mod-z":function(){return Object(u.c)(i.innerEditorView.state,i.innerEditorView.dispatch)},"Shift-Mod-z":function(){return Object(u.b)(i.innerEditorView.state,i.innerEditorView.dispatch)},Tab:function(e,t){return t(e.tr.insertText("\t")),!0},Enter:l.f,Escape:function(){return i.cancelEditing(),!0},"Ctrl-Enter":function(){return i.saveAndFinishEditing(),!0}}),Object(u.a)()]}),dispatchTransaction:function(e){return i.dispatchInner(e)},handleDOMEvents:{mousedown:function(){return i.editorView.hasFocus()&&i.innerEditorView.focus(),!0},blur:function(){return i.saveAndFinishEditing(),!0}}}),i.innerEditorView.focus()},this.node=e,this.editorView=t,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Ct("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Ct("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return e.prototype.renderToolArea=function(){var e=this,t=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");t.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",function(){return e.openEditor()}),t.appendChild(n),t.appendChild(r),this.wrapper.appendChild(t)},e.prototype.renderCustomBlock=function(){var e=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(e){for(var t=e(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);t&&this.wrapper.appendChild(t),this.renderToolArea()}},e.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Ct("custom-block-editor"),this.innerViewContainer.style.display="none"},e.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},e.prototype.saveAndFinishEditing=function(){var e=this.editorView.state.selection.to,t=this.editorView.state;this.editorView.dispatch(t.tr.setSelection(De(t.tr,e))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},e.prototype.cancelEditing=function(){var e=Object(u.d)(this.innerEditorView.state);for(this.canceled=!0;e--;)Object(u.c)(this.innerEditorView.state,this.innerEditorView.dispatch),Object(u.c)(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var t=this.editorView.state.selection.to,n=this.editorView.state;this.editorView.dispatch(n.tr.setSelection(s.h.create(n.doc,t))),this.editorView.focus(),this.closeEditor()},e.prototype.dispatchInner=function(e){var t=this.innerEditorView.state.applyTransaction(e),n=t.state,r=t.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&$t(this.getPos)){for(var o=this.editorView.state.tr,s=i.d.offset(this.getPos()+1),a=0;a<r.length;a+=1)for(var l=r[a].steps,c=0;c<l.length;c+=1)o.step(l[c].map(s));o.docChanged&&this.editorView.dispatch(o)}},e.prototype.update=function(e){return!!e.sameMarkup(this.node)&&(this.node=e,this.innerEditorView||this.renderCustomBlock(),!0)},e.prototype.stopEvent=function(e){return!!this.innerEditorView&&!!e.target&&this.innerEditorView.dom.contains(e.target)},e.prototype.ignoreMutation=function(){return!0},e.prototype.destroy=function(){this.dom.removeEventListener("dblclick",this.openEditor),this.closeEditor()},e}(),ec="image-link",tc=function(){function e(e,t,n,r){var o,i=this;this.handleMousedown=function(e){e.preventDefault();var t=e.target,n=e.offsetX,r=e.offsetY;if(i.imageLink&&$t(i.getPos)&&lt(t,ec)){var o=getComputedStyle(t,":before");if(e.stopPropagation(),kt(o,n,r)){var s=i.view.state.tr,a=i.getPos();s.setSelection(De(s,a,a+1)),i.view.dispatch(s),i.eventEmitter.emit("openPopup","link",i.imageLink.attrs)}}},this.node=e,this.view=t,this.getPos=n,this.eventEmitter=r,this.imageLink=null!==(o=e.marks.filter(function(e){return"link"===e.type.name})[0])&&void 0!==o?o:null,this.dom=this.createElement(),this.bindEvent()}return e.prototype.createElement=function(){var e=this.createImageElement(this.node);if(this.imageLink){var t=document.createElement("span");return t.className=ec,t.appendChild(e),t}return e},e.prototype.createImageElement=function(e){var t=document.createElement("img"),n=e.attrs,r=n.imageUrl,o=n.altText,i=bl(e.attrs);return t.src=r,o&&(t.alt=o),Lt(i,t),t},e.prototype.bindEvent=function(){this.imageLink&&this.dom.addEventListener("mousedown",this.handleMousedown)},e.prototype.stopEvent=function(){return!0},e.prototype.destroy=function(){this.imageLink&&this.dom.removeEventListener("mousedown",this.handleMousedown)},e}(),nc=function(){function e(e,t,n,r){var o=this;this.contentDOM=null,this.input=null,this.timer=null,this.handleMousedown=function(e){var t=e.target;if("none"!==getComputedStyle(t,":after").backgroundImage&&$t(o.getPos)){var n=o.view.coordsAtPos(o.getPos()),r=n.top,i=n.right;o.createLanguageEditor({top:r,right:i})}},this.handleKeydown=function(e){"Enter"===e.key&&o.input&&(e.preventDefault(),o.changeLanguage())},this.node=e,this.view=t,this.getPos=n,this.eventEmitter=r,this.createElement(),this.bindDOMEvent(),this.bindEvent()}return e.prototype.createElement=function(){var e=this.node.attrs.language,t=document.createElement("div");t.setAttribute("data-language",e||"text"),t.className="toastui-editor-ww-code-block";var n=this.createCodeBlockElement(),r=n.firstChild;t.appendChild(n),this.dom=t,this.contentDOM=r},e.prototype.createCodeBlockElement=function(){var e=document.createElement("pre"),t=document.createElement("code"),n=this.node.attrs.language,r=bl(this.node.attrs);return n&&t.setAttribute("data-language",n),Lt(r,e),e.appendChild(t),e},e.prototype.createLanguageEditor=function(e){var t=this,n=e.top,r=e.right,o=document.createElement("span");o.className="toastui-editor-ww-code-block-language";var i=document.createElement("input");i.type="text",i.value=this.node.attrs.language,o.appendChild(i),this.view.dom.parentElement.appendChild(o);var s=o.clientWidth;E(o,{top:n+10+"px",left:r-s-10+"px",width:s+"px"}),this.input=i,this.input.addEventListener("blur",function(){return t.changeLanguage()}),this.input.addEventListener("keydown",this.handleKeydown),this.clearTimer(),this.timer=setTimeout(function(){t.input.focus()})},e.prototype.bindDOMEvent=function(){this.dom&&this.dom.addEventListener("click",this.handleMousedown)},e.prototype.bindEvent=function(){var e=this;this.eventEmitter.listen("scroll",function(){e.input&&e.reset()})},e.prototype.changeLanguage=function(){if(this.input&&$t(this.getPos)){var e=this.input.value;this.reset();var t=this.getPos(),n=this.view.state.tr;n.setNodeMarkup(t,null,{language:e}),this.view.dispatch(n)}},e.prototype.reset=function(){var e;if(null===(e=this.input)||void 0===e?void 0:e.parentElement){var t=this.input.parentElement;this.input=null,St(t)}},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.stopEvent=function(){return!0},e.prototype.update=function(e){return!!e.sameMarkup(this.node)&&(this.node=e,!0)},e.prototype.destroy=function(){this.reset(),this.clearTimer(),this.dom&&this.dom.removeEventListener("click",this.handleMousedown)},e}(),rc=/MsoListParagraph/,oc=/style=(.|\n)*mso-/,ic=/mso-list:(.*)/,sc=/O:P/,ac=/^(n|u|l)/,lc="p.MsoListParagraph";function cc(e){for(var t=[],n=document.createTreeWalker(e,1,null,!1);n.nextNode();){var r=n.currentNode;if(Mt(r)){var o=r,i=o.outerHTML,s=o.textContent,a=oc.test(i),l=ic.test(i);a&&!l&&s?t.push([r,!0]):(sc.test(r.nodeName)||a&&!s||l)&&t.push([r,!1])}}return t.forEach(function(e){var t=e[0];e[1]?function(e){for(var t=[];e.firstChild;)t.push(e.firstChild),e.parentNode&&e.parentNode.insertBefore(e.firstChild,e);St(e)}(t):St(t)}),e.innerHTML.trim()}function uc(e){var t=[];return e.forEach(function(e,n){var r=t[n-1],o=function(e,t){var n=e.getAttribute("style");if(n){var r=n.match(ic)[1].trim().split(" ")[1];return{id:t,level:parseInt(r.replace("level",""),10),prev:null,parent:null,children:[],unordered:ac.test(e.textContent||""),contents:cc(e)}}return null}(e,n);o&&(r&&function(e,t){if(t.level<e.level)t.children.push(e),e.parent=t;else{for(;t&&t.level!==e.level;)t=t.parent;t&&(e.prev=t,e.parent=t.parent,e.parent&&e.parent.children.push(e))}}(o,r),t.push(o))}),t}function dc(e){return function e(t){var n=t[0].unordered?"ul":"ol",r=document.createElement(n);return t.forEach(function(t){var n=t.children,o=t.contents,i=document.createElement("li");i.innerHTML=o,r.appendChild(i),n.length&&r.appendChild(e(n))}),r}(uc(e).filter(function(e){return!e.parent}))}function pc(e){var t=document.createElement("div");t.innerHTML=e;var n=[],r=function(e,t){var n=Ee(e.querySelectorAll(t));return n.length?n:[]}(t,lc);return r.forEach(function(e){var r=function(e){for(;e&&!Mt(e);)e=e.nextSibling;return!e||!rc.test(e.className)}(e.nextSibling);if(n.push(e),r){var o=dc(n),i=e.nextSibling;i?function(e,t){t.parentNode&&t.parentNode.insertBefore(e,t)}(o,i):function(e,t){(t=b(t)?Ee(t):[t]).forEach(function(t){e.appendChild(t)})}(t,o),n=[]}St(e)}),""+(r.length?"<p></p>":"")+t.innerHTML}var hc="\x3c!--StartFragment--\x3e",fc="\x3c!--EndFragment--\x3e";function mc(e){return function(e){return oc.test(e)}(e=function(e){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e="<tr>"+e+"</tr>"),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e="<table>"+e+"</table>"),e}(e=function(e){var t=e.indexOf(hc),n=e.lastIndexOf(fc);return t>-1&&n>-1&&(e=e.slice(t+hc.length,n)),e.replace(/<br[^>]*>/g,wt)}(e)))&&(e=pc(e)),e}function gc(e,t,n){for(var r=[],o=e.childCount,i=0;i<o;i+=1)if(!e.child(i).attrs.extended){var s=i<o?n.create(e.child(i).attrs,e.child(i).content):n.createAndFill();r.push(s)}return r}function vc(e,t,n){var r=n.nodes,o=r.tableRow,i=gc(e,0,r.tableHeadCell);return o.create(null,i)}function yc(e,t,n){var r=n.nodes,o=r.tableRow,i=gc(e,0,r.tableBodyCell);return o.create(null,i)}function bc(e){var t=[],n=[];"tableHead"===e.firstChild.type.name&&e.firstChild.forEach(function(e){return t.push(e)});"tableBody"===e.lastChild.type.name&&e.lastChild.forEach(function(e){return n.push(e)});return f(f([],t),n)}function wc(e,t,n){var r=e.map(function(e){return yc(e,0,n)});if(!e.length){var o=function(e,t){for(var n=t.nodes,r=n.tableRow,o=n.tableBodyCell,i=[],s=0;s<e;s+=1){var a=o.createAndFill();i.push(a)}return r.create({dummyRowForPasting:!0},i)}(t,n);r.push(o)}return n.nodes.tableBody.create(null,r)}function kc(e,t,n,r){var o=function(e){return e.reduce(function(e,t){return e.childCount>t.childCount?e:t}).childCount}(e);if(n&&r)return t.nodes.table.create(null,[wc(e,o,t)]);var i=e[0],s=e.slice(1),a=[function(e,t,n){var r=vc(e,0,n);return n.nodes.tableHead.create(null,r)}(i,0,t)];return s.length&&a.push(wc(s,o,t)),t.nodes.table.create(null,a)}var xc=4,Cc=2;function Tc(e){return e*xc}function Mc(e,t){var n=e.state,o=n.selection,i=n.schema,s=n.tr,a=Bl(o),l=a.anchor,c=a.head;if(l&&c){var u=Fl(t);if(!u)return!1;var d=Nl.create(l),p=d.getRectOffsets(l,c),h=function(e,t,n){var r=[],o=bc(e),i=(o[0].childCount,o.length),s=0===t.startRowIdx,a=o.slice(0,i);if(s){var l=a.shift();if(l){var c=vc(l,0,n).content;r.push(c)}}return a.forEach(function(e){if(!e.attrs.dummyRowForPasting){var t=yc(e,0,n).content;r.push(t)}}),r}(u,p,i),f=function(e,t,n){for(var r=t.startRowIdx,o=t.startColIdx,i=n.length,s=0,a=function(e){var t=n[e].childCount;n[e].forEach(function(e){var n=e.attrs.colspan;n>1&&(t+=n-1)}),s=Math.max(s,t)},l=0;l<i;l+=1)a(l);var c=r+i-1,u=o+s-1;return{startRowIdx:r,startColIdx:o,endRowIdx:c,endColIdx:u,addedRowCount:Math.max(c+1-e.totalRowCount,0),addedColumnCount:Math.max(u+1-e.totalColumnCount,0)}}(d,p,h),m=[];return function(e,t){var n=Hl(e.getSpannedOffsets(t)),r=n.rowCount,o=n.columnCount,i=Hl(t),s=i.rowCount,a=i.columnCount;return r===s&&o===a}(d,f)&&(function(e,t){for(var n=e.startRowIdx,r=e.startColIdx,o=e.endRowIdx,i=e.endColIdx,s=e.addedRowCount,a=e.addedColumnCount,l=n;l<=o-s;l+=1)t.push({rowIdx:l,startColIdx:r,endColIdx:i-a})}(f,m),f.addedColumnCount&&function(e,t,n,r,o){for(var i=r.startRowIdx,s=r.startColIdx,a=r.endRowIdx,l=r.endColIdx,c=r.addedRowCount,u=r.addedColumnCount,d=n.totalRowCount,p=0,h=0;h<d;h+=1){var f=n.getCellInfo(h,l-u),m=f.offset,g=f.nodeSize,v=e.mapping.map(m+g),y=Il(u,h,t);if(e.insert(v,y),h>=i&&h<=a-c){var b=n.getCellInfo(h,l-u),w=e.mapping.map(b.offset),k=v+Tc(u);o[p]={rowIdx:h,startColIdx:s,endColIdx:l,dummyOffsets:[w,k]},p+=1}}}(s,i,d,f,m),f.addedRowCount&&function(e,t,n,r,o){var i=r.addedRowCount,s=r.addedColumnCount,a=r.startColIdx,l=r.endColIdx,c=e.mapping.maps.length,u=n.tableEndOffset-2,d=Ll(i,n.totalColumnCount+s,t),p=u;e.insert(e.mapping.slice(c).map(p),d);for(var h=0;h<i;h+=1){var f=p+Tc(a)+1,m=p+Tc(l+1)+1,g=p+Tc(n.totalColumnCount+s)+Cc;o.push({rowIdx:h+n.totalRowCount,startColIdx:a,endColIdx:l,dummyOffsets:[f,m]}),p=g}}(s,i,d,f,m),function(e,t,n,o){var i=e.mapping.maps.length;n.forEach(function(n,s){var a=n.rowIdx,l=n.startColIdx,c=n.endColIdx,u=n.dummyOffsets,d=e.mapping.slice(i),p=new r.j(t[s],0,0),h=u?u[0]:o.getCellStartOffset(a,l),f=u?u[1]:o.getCellEndOffset(a,c);e.replace(d.map(h),d.map(f),p)})}(s,h,m,d),e.dispatch(s),function(e,t,n){var r=e.state,o=r.tr,i=r.doc,s=Nl.create(i.resolve(n)),a=t[0],l=a.rowIdx,c=a.startColIdx,u=be(t),d=u.rowIdx,p=u.endColIdx,h=s.getCellInfo(l,c).offset,f=s.getCellInfo(d,p).offset;e.dispatch(o.setSelection(new Al(i.resolve(h),i.resolve(f))))}(e,m,d.getCellInfo(0,0).offset)),!0}return!1}var Sc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),t}(Ht),Ec=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"inline*",group:"block",attrs:h({},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"p"}],toDOM:function(e){return["p",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(Ht),Nc=/\s{1,4}$/,Oc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),t.prototype.addSpaces=function(){return function(e,t){var n=e.selection,r=e.tr,o=n.$from,i=n.$to;return!(!o.blockRange(i)||hl(o)||fl(o))&&(t(r.insertText(" ",o.pos,i.pos)),!0)}},t.prototype.removeSpaces=function(){return function(e,t){var n=e.selection,r=e.tr,o=n.$from,i=n.$to,s=n.from;if(o.blockRange(i)&&!hl(o)&&!fl(o)){var a=o.nodeBefore;if(a&&a.isText){var l=a.text,c=l.replace(Nc,""),u=l.length-c.length;return t(r.delete(s-u,s)),!0}}return!1}},t.prototype.keymaps=function(){return{Tab:this.addSpaces(),"Shift-Tab":this.removeSpaces()}},t}(Ht),Dc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"levels",{get:function(){return[1,2,3,4,5,6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=this.levels.map(function(e){return{tag:"h"+e,getAttrs:function(t){var n=t.getAttribute("data-raw-html");return h({level:e},n&&{rawHTML:n})}}});return{attrs:h({level:{default:1},headingType:{default:"atx"},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"inline*",group:"block",defining:!0,parseDOM:e,toDOM:function(e){var t=e.attrs;return["h"+t.level,bl(t),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){var r=t.schema.nodes[e.level?"heading":"paragraph"];return Object(l.h)(r,e)(t,n)}}},t}(Ht),Ac=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:h({language:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),code:!0,defining:!0,marks:"",parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(e){var t=e.getAttribute("data-raw-html"),n=e.firstElementChild;return h({language:(null===n||void 0===n?void 0:n.getAttribute("data-language"))||null},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"pre",["code",h({"data-language":t.language},bl(t)),0]]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Object(l.h)(e.schema.nodes.codeBlock)(e,t)}}},t.prototype.moveCursor=function(e){var t=this;return function(n,r){var o=n.tr,i=n.doc,s=n.schema,a=n.selection.$from;if(t.context.view.endOfTextblock(e)&&"codeBlock"===a.node().type.name){var l=a.parent.textContent.split("\n"),c="up"===e?a.start():a.end(),u="up"===e?[c,l[0].length+c]:[c-be(l).length,c],d=i.resolve("up"===e?a.before():a.after()),p="up"===e?d.nodeBefore:d.nodeAfter;if(function(e,t,n){return e>=t&&e<=n}(a.pos,u[0],u[1])&&!p){var h=Ae(o,d,s);if(h)return r(h),!0}}return!1}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-p":e,"Shift-Mod-P":e,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},t}(Ht),Lc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[gl("ul")],toDOM:function(e){return["ul",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.changeList=function(){return function(e,t){return xl(e.schema.nodes.bulletList)(e,t)}},t.prototype.commands=function(){return{bulletList:this.changeList,taskList:Cl}},t.prototype.keymaps=function(){var e=this.changeList(),t=Sl(),n=t.indent,r=t.outdent;return{"Mod-u":e,"Mod-U":e,Tab:n(),"Shift-Tab":r()}},t}(Ht),Ic=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:h({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(e){var t=e.getAttribute("start"),n=e.getAttribute("data-raw-html");return h({order:e.hasAttribute("start")?Number(t):1},n&&{rawHTML:n})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"ol",h({start:1===t.order?null:t.order},bl(t)),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return xl(e.schema.nodes.orderedList)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()(),t=Sl(),n=t.indent,r=t.outdent;return{"Mod-o":e,"Mod-O":e,Tab:n(),"Shift-Tab":r()}},t}(Ht),Rc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"paragraph block*",selectable:!1,attrs:{task:{default:!1},checked:{default:!1},rawHTML:{default:null}},defining:!0,parseDOM:[{tag:"li",getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({task:e.hasAttribute("data-task"),checked:e.hasAttribute("data-task-checked")},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs,n=t.task,r=t.checked;if(!n)return[t.rawHTML||"li",0];var o=["task-list-item"];return r&&o.push("checked"),[t.rawHTML||"li",h({class:o.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),t.prototype.liftToPrevListItem=function(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from,s=n.empty,a=o.nodes.listItem,l=i.parent,c=i.node(-1);if(s&&!l.childCount&&c.type===a){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),t(r),!0;if(i.node(-3).type===a)return r.delete(i.start(-2)-1,i.end(-1)),t(r),!0}return!1}},t.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(e,t){return function(e){return function(t,n){var o=t.tr,a=t.selection,l=a.$from,c=a.$to;if(l.depth<2||!l.sameParent(c))return!1;var u=l.node(-1);if(u.type!==e)return!1;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==e||l.index(-2)!==l.node(-2).childCount-1)return!1;for(var d=l.index(-1)>0,p=r.c.empty,h=l.depth-(d?1:2);h>=l.depth-3;h-=1)p=r.c.from(l.node(h).copy(p));return p=p.append(r.c.from(e.createAndFill())),o.replace(d?l.before():l.before(-1),l.after(-3),new r.j(p,d?3:2,2)),o.setSelection(s.f.near(o.doc.resolve(l.pos+(d?3:2)))),n(o),!0}var f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,m=f&&[null,{type:f}];return o.delete(l.pos,c.pos),!!Object(i.g)(o.doc,l.pos,2,m)&&(o.split(l.pos,2,m),n(o),!0)}}(e.schema.nodes.listItem)(e,t)}}},t}(Ht),Pc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[gl("blockquote")],toDOM:function(e){return["blockquote",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Object(l.j)(e.schema.nodes.blockQuote)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Alt-q":e,"Alt-Q":e}},t}(Ht),Bc={left:function(e,t){var n=e[0],r=e[1],o=t.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var s=t.getCellInfo(n,r),a=s.offset,l=s.nodeSize;return a+l-2}return null},right:function(e,t){var n=e[0],r=e[1],o=t.totalRowCount,i=t.totalColumnCount,s=r===i-1;if(n!==o-1||!s){var a=r+1,l=t.getColspanStartInfo(n,r);(null===l||void 0===l?void 0:l.count)>1&&(a+=l.count-1),(s||a===i)&&(n+=1,a=0);var c=t.getCellInfo(n,a).offset;return c+2}return null},up:function(e,t){var n=e[0],r=e[1];if(n>0){var o=t.getCellInfo(n-1,r),i=o.offset,s=o.nodeSize;return i+s-2}return null},down:function(e,t){var n=e[0],r=e[1],o=t.totalRowCount;if(n<o-1){var i=n+1,s=t.getRowspanStartInfo(n,r);(null===s||void 0===s?void 0:s.count)>1&&(i+=s.count-1);var a=t.getCellInfo(i,r).offset;return a+2}return null}};function Fc(e,t,n){var r=n[0],o=n[1],i=t.getRowspanStartInfo(r,o),s="up"===e&&0===r,a="down"===e&&((null===i||void 0===i?void 0:i.count)>1?r+i.count-1:r)===t.totalRowCount-1;return s||a}function Hc(e,t,n,r){void 0===r&&(r=!1);var o=e.doc.resolve(t.tableEndOffset);return r||!o.nodeAfter?Ae(e,o,n):e.setSelection(s.f.near(o,1))}function jc(e,t,n,r){var o=(0,Bc[e])(n,r);if(o){var i="right"===e||"down"===e?1:-1;return t.setSelection(s.f.near(t.doc.resolve(o),i))}return null}function zc(e,t,n){var r=e.getCellInfo(t,0).offset,o=e.getCellInfo(t,n-1);return{from:r,to:o.offset+o.nodeSize}}var qc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[gl("table")],toDOM:function(e){return["table",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t.prototype.addTable=function(){return function(e){return void 0===e&&(e={rowCount:2,columnCount:1,data:[]}),function(t,n){var r=e.rowCount,o=e.columnCount,i=e.data,s=t.schema,a=t.selection,l=t.tr,c=a.from,u=a.to,d=a.$from;if(c===u&&!fl(d)){var p=s.nodes,h=p.tableHead,f=p.tableBody,m=null===i||void 0===i?void 0:i.slice(0,o),g=null===i||void 0===i?void 0:i.slice(o,i.length),v=function(e,t,n){for(var r=t.nodes,o=r.tableRow,i=r.tableHeadCell,s=r.paragraph,a=[],l=0;l<e;l+=1){var c=n&&n[l],u=s.create(null,c?t.text(c):[]);a.push(i.create(null,u))}return[o.create(null,a)]}(o,s,m),y=Ll(r-1,o,s,g),b=s.nodes.table.create(null,[h.create(null,v),f.create(null,y)]);return n(l.replaceSelectionWith(b)),!0}return!1}}},t.prototype.removeTable=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Nl.create(n.$anchor);if(o){var i=o.tableStartOffset,s=o.tableEndOffset,a=i-1,l=De(r.delete(a,s),a);return t(r.setSelection(l)),!0}return!1}}},t.prototype.addColumn=function(e){return function(){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=Bl(r),a=s.anchor,l=s.head;if(a&&l){for(var c=Nl.create(a),u=c.getRectOffsets(a,l),d="left"===e?u.startColIdx:u.endColIdx+1,p=Hl(u).columnCount,h=c.totalRowCount,f=0;f<h;f+=1){var m=Il(p,f,i);o.insert(o.mapping.map(c.posAt(f,d)),m)}return n(o),!0}return!1}}},t.prototype.removeColumn=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Bl(n),i=o.anchor,s=o.head;if(i&&s){var a=Nl.create(i),l=a.getRectOffsets(i,s),c=a.totalColumnCount,u=a.totalRowCount;if(Hl(l).columnCount===c)return!1;for(var d=l.startColIdx,p=l.endColIdx,h=r.mapping.maps.length,f=0;f<u;f+=1)for(var m=p;m>=d;m-=1){var g=a.getCellInfo(f,m),v=g.offset,y=g.nodeSize,b=r.mapping.slice(h).map(v),w=b+y;r.delete(b,w)}return t(r),!0}return!1}}},t.prototype.addRow=function(e){return function(){return function(t,n){var r=t.selection,o=t.schema,i=t.tr,s=Bl(r),a=s.anchor,l=s.head;if(a&&l){var c=Nl.create(a),u=c.totalColumnCount,d=c.getRectOffsets(a,l),p=Hl(d).rowCount,h=function(e,t,n){var r,o,i;return"up"===e?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=t.totalColumnCount-1,i=t.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(e,c,d),f=h.targetRowIdx,m=h.insertColIdx,g=h.nodeSize;if(!(0===f)){for(var v=[],y=i.mapping.map(c.posAt(f,m))+g,b=[],w=0;w<u;w+=1)b=b.concat(Il(1,f,o));for(var k=0;k<p;k+=1)v.push(o.nodes.tableRow.create(null,b));return n(i.insert(y,v)),!0}}return!1}}},t.prototype.removeRow=function(){return function(){return function(e,t){var n=e.selection,r=e.tr,o=Bl(n),i=o.anchor,s=o.head;if(i&&s){var a=Nl.create(i),l=a.totalRowCount,c=a.totalColumnCount,u=a.getRectOffsets(i,s),d=Hl(u).rowCount,p=u.startRowIdx,h=u.endRowIdx;if(d===l-1||0===p)return!1;for(var f=h;f>=p;f-=1){var m=zc(a,f,c),g=m.from,v=m.to;r.delete(g-1,v+1)}return t(r),!0}return!1}}},t.prototype.alignColumn=function(){return function(e){return void 0===e&&(e={align:"center"}),function(t,n){var r=e.align,o=t.selection,i=t.tr,s=Bl(o),a=s.anchor,l=s.head;if(a&&l){for(var c=Nl.create(a),u=c.totalRowCount,d=c.getRectOffsets(a,l),p=d.startColIdx,h=d.endColIdx,f=0;f<u;f+=1)for(var m=p;m<=h;m+=1)if(!c.extendedRowspan(f,m)&&!c.extendedColspan(f,m)){var g=c.getNodeAndPos(f,m),v=g.node,y=g.pos,b=jl(v,{align:r});i.setNodeMarkup(y,null,b)}return n(i),!0}return!1}}},t.prototype.moveToCell=function(e){return function(t,n){var r=t.selection,o=t.tr,i=t.schema,s=Bl(r),a=s.anchor,l=s.head;if(a&&l){var c=Nl.create(a),u=c.getCellIndex(a),d=void 0;if(d=Fc(e,c,u)?Hc(o,c,i):jc(e,o,u,c))return n(d),!0}return!1}},t.prototype.moveInCell=function(e){var t=this;return function(n,r){var o=n.selection,i=n.tr,a=n.doc,l=n.schema,c=o.$from;if(!t.context.view.endOfTextblock(e))return!1;var u=pl(c,function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name});if(u){var d=pl(c,function(e){return"paragraph"===e.type.name}),p=u.depth;if(d&&function(e,t,n,r){var o=t[0],i=t[1],s=o+3,a=i>=s,l=a?o+1:i,c=function(e,t,n,r,o){var i=t[0],s=t[1],a=t[2];if("left"===e||"up"===e){if(o&&!function(e,t,n){var r=n[0],o=n[1],i=t.resolve(e.before(r-1));return o===r&&!i.nodeBefore}(n,r,[i,s]))return!1;var l=n.before(a);if(r.resolve(l).nodeBefore)return!1}return!0}(e,[i,s,l],n,r,a),u=function(e,t,n,r,o){if("right"===e||"down"===e){if(o&&!function(e){for(var t,n,r=e.depth;r&&"tableBodyCell"!==(n=e.node(r)).type.name;){if("listItem"===n.type.name){var o=e.node(r-1).lastChild===n,i="paragraph"!==(null===(t=n.lastChild)||void 0===t?void 0:t.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(t);if(r.resolve(i).nodeAfter)return!1}return!0}(e,l,n,r,a);return c&&u}(e,[p,d.depth],c,a)){var h=Bl(o).anchor,f=Nl.create(h),m=f.getCellIndex(h),g=void 0;if(!function(e,t,n){var r=n[0],o=n[1];if("up"===e||"down"===e)return!1;var i=t.tableStartOffset,s=t.tableEndOffset,a=t.getCellInfo(r,o),l=a.offset,c=a.nodeSize;return("left"===e?i:s)===("left"===e?l-2:l+c+3)}(e,f,m)?Fc(e,f,m)?"up"===e?g=function(e,t,n){var r=e.doc.resolve(t.tableStartOffset-1);return r.nodeBefore?e.setSelection(s.f.near(r,-1)):Ae(e,r,n)}(i,f,l):"down"===e&&(g=Hc(i,f,l)):g=jc(e,i,m,f):g=function(e,t,n){var r=e.doc.resolve(t.before(n-3));return e.setSelection(new s.c(r))}(i,c,p),g)return r(g),!0}}return!1}},t.prototype.deleteCells=function(){return function(e,t){var n=e.schema,r=e.selection,o=e.tr,i=Bl(r),a=i.anchor,l=i.head,c=r instanceof s.h;if(a&&l&&!c){for(var u=Nl.create(a),d=u.getRectOffsets(a,l),p=d.startRowIdx,h=d.startColIdx,f=d.endRowIdx,m=d.endColIdx,g=p;g<=f;g+=1)for(var v=h;v<=m;v+=1)if(!u.extendedRowspan(g,v)&&!u.extendedColspan(g,v)){var y=u.getNodeAndPos(g,v),b=y.node,w=y.pos,k=Il(1,g,n,b.attrs);o.replaceWith(o.mapping.map(w),o.mapping.map(w+b.nodeSize),k)}return t(o),!0}return!1}},t.prototype.exitTable=function(){return function(e,t){var n=e.selection,r=e.tr,o=e.schema,i=n.$from;if(pl(i,function(e){var t=e.type;return"tableHeadCell"===t.name||"tableBodyCell"===t.name})&&pl(i,function(e){return"paragraph"===e.type.name})){var s=Bl(n).anchor;return t(Hc(r,Nl.create(s),o,!0)),!0}return!1}},t.prototype.commands=function(){return{addTable:this.addTable(),removeTable:this.removeTable(),addColumnToLeft:this.addColumn("left"),addColumnToRight:this.addColumn("right"),removeColumn:this.removeColumn(),addRowToUp:this.addRow("up"),addRowToDown:this.addRow("down"),removeRow:this.removeRow(),alignColumn:this.alignColumn()}},t.prototype.keymaps=function(){var e=this.deleteCells();return{Tab:this.moveToCell("right"),"Shift-Tab":this.moveToCell("left"),ArrowUp:this.moveInCell("up"),ArrowDown:this.moveInCell("down"),ArrowLeft:this.moveInCell("left"),ArrowRight:this.moveInCell("right"),Backspace:e,"Mod-Backspace":e,Delete:e,"Mod-Delete":e,"Mod-Enter":this.exitTable()}},t}(Ht),Vc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableHead"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableRow{1}",attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[gl("thead")],toDOM:function(e){return["thead",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(Ht),$c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableBody"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"tableRow+",attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tbody",getAttrs:function(e){var t=e.querySelectorAll("tr")[0].children.length,n=e.getAttribute("data-raw-html");return!!t&&h({},n&&{rawHTML:n})}}],toDOM:function(e){return["tbody",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(Ht),_c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableRow"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"(tableHeadCell | tableBodyCell)*",attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tr",getAttrs:function(e){var t=e.children.length,n=e.getAttribute("data-raw-html");return!!t&&h({},n&&{rawHTML:n})}}],toDOM:function(e){return["tr",bl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(Ht),Uc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableHeadCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"paragraph+",attrs:h({align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},extended:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),isolating:!0,parseDOM:[yl("th")],toDOM:function(e){var t=e.attrs,n=vl(t);return["th",h(h({},n),bl(t)),0]}}},enumerable:!1,configurable:!0}),t}(Ht),Wc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"tableBodyCell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"(paragraph | bulletList | orderedList)+",attrs:{align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},rowspan:{default:null},extended:{default:null}},isolating:!0,parseDOM:[yl("td")],toDOM:function(e){return["td",vl(e.attrs),0]}}},enumerable:!1,configurable:!0}),t}(Ht),Jc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"image"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{inline:!0,attrs:h({imageUrl:{default:""},altText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"img[src]",getAttrs:function(e){var t=Ua(e,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=t.getAttribute("src")||"",r=t.getAttribute("data-raw-html"),o=t.getAttribute("alt");return h({imageUrl:n,altText:o},r&&{rawHTML:r})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"img",h(h({src:ce(t.imageUrl)},t.altText&&{alt:t.altText}),bl(t))]}}},enumerable:!1,configurable:!0}),t.prototype.addImage=function(){return function(e){return function(t,n){var r=t.schema,o=t.tr,i=e,s=i.imageUrl,a=i.altText;if(!s)return!1;var l=r.nodes.image.createAndFill(h({imageUrl:s},a&&{altText:a}));return n(o.replaceSelectionWith(l).scrollIntoView()),!0}}},t.prototype.commands=function(){return{addImage:this.addImage()}},t}(Ht),Kc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"block",parseDOM:[{tag:"hr"}],selectable:!1,toDOM:function(e){var t=e.attrs;return["div",bl(t),[t.rawHTML||"hr"]]}}},enumerable:!1,configurable:!0}),t.prototype.hr=function(){var e=this;return function(){return function(t,n){var r,o=t.selection,i=o.$from;if(i===o.$to){var s=t.doc,a=t.schema.nodes,l=a.thematicBreak,c=a.paragraph,u=[l.create()],d=i.node(1),p=s.child(s.childCount-1)===d,h=s.resolve(i.after(1)),f=(null===(r=i.nodeAfter)||void 0===r?void 0:r.type.name)===e.name;return(p||f)&&u.push(c.create()),n(t.tr.insert(h.pos,u).scrollIntoView()),!0}return!1}}},t.prototype.commands=function(){return{hr:this.hr()}},t.prototype.keymaps=function(){var e=this.hr()();return{"Mod-l":e,"Mod-L":e}},t}(Ht),Gc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["b","strong"].map(function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({},t&&{rawHTML:t})}}});return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"strong",bl(t)]}}},enumerable:!1,configurable:!0}),t.prototype.bold=function(){return function(){return function(e,t){return Object(l.i)(e.schema.marks.strong)(e,t)}}},t.prototype.commands=function(){return{bold:this.bold()}},t.prototype.keymaps=function(){var e=this.bold()();return{"Mod-b":e,"Mod-B":e}},t}(On),Zc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["i","em"].map(function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({},t&&{rawHTML:t})}}});return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"em",bl(t)]}}},enumerable:!1,configurable:!0}),t.prototype.italic=function(){return function(){return function(e,t){return Object(l.i)(e.schema.marks.emph)(e,t)}}},t.prototype.commands=function(){return{italic:this.italic()}},t.prototype.keymaps=function(){var e=this.italic()();return{"Mod-i":e,"Mod-I":e}},t}(On),Xc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=["s","del"].map(function(e){return{tag:e,getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({},t&&{rawHTML:t})}}});return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:e,toDOM:function(e){var t=e.attrs;return[t.rawHTML||"del",bl(t)]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Object(l.i)(e.schema.marks.strike)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Mod-s":e,"Mod-S":e}},t}(On),Qc=function(e){function t(t){var n=e.call(this)||this;return n.linkAttributes=t,n}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){var e=this;return{attrs:h({linkUrl:{default:""},title:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(e){var t=Ua(e,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=t.getAttribute("href")||"",r=t.getAttribute("title")||"",o=t.getAttribute("data-raw-html");return h({linkUrl:n,title:r},o&&{rawHTML:o})}}],toDOM:function(t){var n=t.attrs;return[n.rawHTML||"a",h(h({href:ce(n.linkUrl)},e.linkAttributes),bl(n))]}}},enumerable:!1,configurable:!0}),t.prototype.addLink=function(){return function(e){return function(t,n){var r=e,o=r.linkUrl,i=r.linkText,s=void 0===i?"":i,a=t.schema,l=t.tr,c=t.selection,u=c.empty,d=c.from,p=c.to;if(d&&p&&o){var h={linkUrl:o},f=a.mark("link",h);if(u&&s){var m=Oe(a,s,f);l.replaceRangeWith(d,p,m)}else l.addMark(d,p,f);return n(l.scrollIntoView()),!0}return!1}}},t.prototype.toggleLink=function(){return function(e){return function(t,n){return Object(l.i)(t.schema.marks.link,e)(t,n)}}},t.prototype.commands=function(){return{addLink:this.addLink(),toggleLink:this.toggleLink()}},t}(On),Yc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{attrs:h({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"code",getAttrs:function(e){var t=e.getAttribute("data-raw-html");return h({},t&&{rawHTML:t})}}],toDOM:function(e){var t=e.attrs;return[t.rawHTML||"code",bl(t)]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t){return Object(l.i)(e.schema.marks.code)(e,t)}}},t.prototype.keymaps=function(){var e=this.commands()();return{"Shift-Mod-c":e,"Shift-Mod-C":e}},t}(On),eu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:{info:{default:null}},atom:!0,code:!0,defining:!0,parseDOM:[{tag:"div[data-custom-info]",getAttrs:function(e){return{info:e.getAttribute("data-custom-info")}}}],toDOM:function(e){return["div",{"data-custom-info":e.attrs.info||null},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(e){return function(t,n){return!(null===e||void 0===e||!e.info)&&Object(l.h)(t.schema.nodes.customBlock,e)(t,n)}}},t}(Ht),tu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"frontMatter"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-front-matter]"}],toDOM:function(){return["div",{"data-front-matter":"true"},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t,n){var r=e.selection.$from;return!(!n.endOfTextblock("down")||"frontMatter"!==r.node().type.name)&&Object(l.d)(e,t)}}},t.prototype.keymaps=function(){return{Enter:this.commands()()}},t}(Ht),nu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"htmlComment"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-html-comment]"}],toDOM:function(){return["div",{"data-html-comment":"true"},0]}}},enumerable:!1,configurable:!0}),t.prototype.commands=function(){return function(){return function(e,t,n){var r=e.selection.$from;return!(!n.endOfTextblock("down")||"htmlComment"!==r.node().type.name)&&Object(l.d)(e,t)}}},t.prototype.keymaps=function(){return{Enter:this.commands()()}},t}(Ht);var ru=Ct("contents"),ou=function(e){function t(t,n){var r=e.call(this,t)||this,o=n.toDOMAdaptor,i=n.htmlSchemaMap,s=void 0===i?{}:i,a=n.linkAttributes,l=void 0===a?{}:a,c=n.useCommandShortcut,u=void 0===c||c,d=n.wwPlugins,p=void 0===d?[]:d,f=n.wwNodeViews,m=void 0===f?{}:f;return r.editorType="wysiwyg",r.el.classList.add("ww-mode"),r.toDOMAdaptor=o,r.linkAttributes=l,r.extraPlugins=p,r.pluginNodeViews=m,r.specs=r.createSpecs(),r.schema=r.createSchema(s),r.context=r.createContext(),r.keymaps=r.createKeymaps(u),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(h(h({},r.context),{view:r.view})),r.initEvent(),r}return p(t,e),t.prototype.createSpecs=function(){return function(e){return new Wt([new Sc,new Ec,new Oc,new Dc,new Ac,new Lc,new Ic,new Rc,new Pc,new qc,new Vc,new $c,new _c,new Uc,new Wc,new Jc,new Kc,new Gc,new Zc,new Xc,new Qc(e),new Yc,new eu,new tu,new qt,new nu])}(this.linkAttributes)},t.prototype.createContext=function(){return{schema:this.schema,eventEmitter:this.eventEmitter}},t.prototype.createSchema=function(e){return new r.i({nodes:h(h({},this.specs.nodes),e.nodes),marks:h(h({},this.specs.marks),e.marks)})},t.prototype.createPlugins=function(){return f([new s.d({key:zl,state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(zl);if(n)return-1===n?null:n;if(J(t)||!e.docChanged)return t;var r=e.mapping.mapResult(t),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:$l,createSelectionBetween:function(e){var t=e.state;return J(zl.getState(t))?null:t.selection}},view:function(e){return new ql(e)}}),Kl(this.eventEmitter),new s.d({props:{handleDOMEvents:{mousedown:function(e,t){var n=t,r=n.clientX,o=n.clientY,i=e.posAtCoords({left:r,top:o});if(i){var s=e.state,a=s.doc,l=s.tr,c=a.resolve(i.pos),u=ml(c),d=t.target,p=getComputedStyle(d,":before"),f=t,m=f.offsetX,g=f.offsetY;if(!u||!kt(p,m,g))return!1;t.preventDefault();var v=c.before(u.depth),y=u.node.attrs;return l.setNodeMarkup(v,null,h(h({},y),{checked:!y.checked})),e.dispatch(l),!0}return!1}}}}),function(e){return new s.d({view:function(){return{update:function(t){var n=t.state,r=n.selection,o=n.doc,i=n.schema;e.emit("changeToolbarState",{toolbarState:Ql(r,o,i)})}}}})}(this.eventEmitter)],this.createPluginProps()).concat(this.defaultPlugins)},t.prototype.createPluginNodeViews=function(){var e=this.eventEmitter,t=this.pluginNodeViews,n={};return t&&Object.keys(t).forEach(function(r){n[r]=function(n,o,i){return t[r](n,o,i,e)}}),n},t.prototype.createView=function(){var e=this,t=this.toDOMAdaptor,n=this.eventEmitter;return new o.c(this.el,{state:this.createState(),attributes:{class:ru},nodeViews:h({customBlock:function(e,n,r){return new Yl(e,n,r,t)},image:function(e,t,r){return new tc(e,t,r,n)},codeBlock:function(e,t,r){return new nc(e,t,r,n)},widget:jt},this.createPluginNodeViews()),dispatchTransaction:function(t){var n=e.view.state.applyTransaction(t).state;e.view.updateState(n),e.emitChangeEvent(t.scrollIntoView()),e.eventEmitter.emit("setFocusedNode",n.selection.$from.node(1))},transformPastedHTML:mc,transformPasted:function(t){return function(e,t,n){var o=[],i=e.content,s=e.openStart,a=e.openEnd;return i.forEach(function(e){if("table"===e.type.name){var i=Fl(new r.j(r.c.from(e),0,0));if(i){var s=bc(i),a="tableBody"===i.firstChild.type.name,l=kc(s,t,a,n);o.push(l)}}else o.push(e)}),new r.j(r.c.from(o),s,a)}(t,e.schema,fl(e.view.state.selection.$from))},handlePaste:function(e,t,n){return Mc(e,n)},handleKeyDown:function(t,n){return e.eventEmitter.emit("keydown",e.editorType,n),!1},handleDOMEvents:{paste:function(t,n){var r=n.clipboardData||window.clipboardData,o=null===r||void 0===r?void 0:r.items;if(o&&!Ee(o).some(function(e){return"string"===e.kind&&"text/rtf"===e.type})){var i=Ft(o);i&&(n.preventDefault(),Bt(e.eventEmitter,i,n.type))}return!1},keyup:function(t,n){return e.eventEmitter.emit("keyup",e.editorType,n),!1},scroll:function(){return e.eventEmitter.emit("scroll","editor"),!0}}})},t.prototype.createCommands=function(){return this.specs.commands(this.view,Sl())},t.prototype.getHTML=function(){return It(this.view.dom.innerHTML)},t.prototype.getModel=function(){return this.view.state.doc},t.prototype.getSelection=function(){var e=this.view.state.selection;return[e.from,e.to]},t.prototype.getSchema=function(){return this.view.state.schema},t.prototype.replaceSelection=function(e,t,n){var o=this.view.state,i=o.schema,s=o.tr,a=e.split("\n").map(function(e){return Ne(i,rt(e,i))}),l=new r.j(r.c.from(a),1,1),c=W(t)&&W(n)?s.replaceRange(t,n,l):s.replaceSelection(l);this.view.dispatch(c),this.focus()},t.prototype.deleteSelection=function(e,t){var n=this.view.state.tr,r=W(e)&&W(t)?n.deleteRange(e,t):n.deleteSelection();this.view.dispatch(r.scrollIntoView())},t.prototype.getSelectedText=function(e,t){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;return W(e)&&W(t)&&(i=e,s=t),r.textBetween(i,s,"\n")},t.prototype.setModel=function(e,t){void 0===t&&(t=!1);var n=this.view.state,r=n.tr,o=n.doc;this.view.dispatch(r.replaceWith(0,o.content.size,e)),t&&this.moveCursorToEnd(!0)},t.prototype.setSelection=function(e,t){void 0===t&&(t=e);var n=this.view.state.tr,r=De(n,e,t);this.view.dispatch(n.setSelection(r).scrollIntoView())},t.prototype.addWidget=function(e,t,n){var r=this.view,o=r.dispatch,i=r.state;o(i.tr.setMeta("widget",{pos:null!==n&&void 0!==n?n:i.selection.to,node:e,style:t}))},t.prototype.replaceWithWidget=function(e,t,n){var r=this.view.state,o=r.tr,i=rt(n,r.schema);this.view.dispatch(o.replaceWith(e,t,i))},t.prototype.getRangeInfoOfNode=function(e){var t=this.view.state,n=t.doc,r=t.selection,o=e?n.resolve(e):r.$from,i=o.marks(),s=o.node(),a=o.start(),l=o.end(),c=s.type.name;if(i.length||"paragraph"===c){var u=i[i.length-1];c=u?u.type.name:"text",s.forEach(function(e,t){var n=e.isText,r=e.nodeSize,i=e.marks,s=o.pos-a;n&&t<=s&&t+r>=s&&function(e){return!e.length||ue(e,u)}(i)&&(l=(a+=t)+r)})}return{range:[a,l],type:c}},t}(Vt),iu=D,su=J;var au=function(e){return!iu(e)&&!su(e)};var lu=function(e){return au(e)&&!1!==e};var cu=function(e){return!lu(e)},uu=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],du=function(){function e(){var e=this;this.events=new _l,this.eventTypes=uu.reduce(function(e,t){return h(h({},e),{type:t})},{}),this.hold=!1,uu.forEach(function(t){e.addEventType(t)})}return e.prototype.listen=function(e,t){var n=this.getTypeInfo(e),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(t.namespace=n.namespace),r.push(t),this.events.set(n.type,r)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this.getTypeInfo(e),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach(function(e){var n=e.apply(void 0,t);D(n)||i.push(n)}),i},e.prototype.emitReduce=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(e);return!this.hold&&o&&o.forEach(function(e){var r=e.apply(void 0,f([t],n));cu(r)||(t=r)}),t},e.prototype.getTypeInfo=function(e){var t=e.split(".");return{type:t[0],namespace:t[1]}},e.prototype.hasEventType=function(e){return!D(this.eventTypes[this.getTypeInfo(e).type])},e.prototype.addEventType=function(e){if(this.hasEventType(e))throw new Error("There is already have event type "+e);this.eventTypes[e]=e},e.prototype.removeEventHandler=function(e,t){var n=this,r=this.getTypeInfo(e),o=r.type,i=r.namespace;o&&t?this.removeEventHandlerWithHandler(o,t):o&&!i?this.events.delete(o):!o&&i?this.events.forEach(function(e,t){n.removeEventHandlerWithTypeInfo(t,i)}):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},e.prototype.removeEventHandlerWithHandler=function(e,t){var n=this.events.get(e);if(n){var r=n.indexOf(t);n.indexOf(t)>=0&&n.splice(r,1)}},e.prototype.removeEventHandlerWithTypeInfo=function(e,t){var n=[],r=this.events.get(e);r&&(r.map(function(e){return e.namespace!==t&&n.push(e),null}),this.events.set(e,n))},e.prototype.getEvents=function(){return this.events},e.prototype.holdEventInvoke=function(e){this.hold=!0,e(),this.hold=!1},e}(),pu=function(){function e(e,t,n,r){this.eventEmitter=e,this.mdCommands=t,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return e.prototype.initEvent=function(){var e=this;this.eventEmitter.listen("command",function(t,n){e.exec(t,n)})},e.prototype.addCommand=function(e,t,n){"markdown"===e?this.mdCommands[t]=n:this.wwCommands[t]=n},e.prototype.deleteCommand=function(e,t){"markdown"===e?delete this.mdCommands[t]:delete this.wwCommands[t]},e.prototype.exec=function(e,t){"markdown"===this.getEditorType()?this.mdCommands[e](t):this.wwCommands[e](t)},e}();function hu(e){return"\n"===e[e.length-1]?e.slice(0,e.length-1):e}function fu(e,t){var n=e.schema,r=t.literal.match(vt);if(r){var o=r[1],i=r[3],s=(o||i).toLowerCase();return"htmlInline"===t.type&&!(!n.marks[s]&&!n.nodes[s])}return!1}function mu(e){return ue(["text","strong","emph","strike","image","link","code"],e.type)}function gu(e){return"softbreak"===(null===e||void 0===e?void 0:e.type)}function vu(e){var t=e.type,n=e.literal,r="htmlInline"===t&&n.match(vt);if(r){var o=r[1],i=r[3],s=o||i;if(s)return ue(["ul","ol","li"],s.toLowerCase())}return!1}function yu(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=document.createElement("div");r.innerHTML=Ua(e);var o=r.firstChild;return t.map(function(e){return o.getAttribute(e)||""})}var bu=function(e){var t={};return Object.keys(e).forEach(function(n){n.split(", ").forEach(function(r){var o=r.toLowerCase();t[o]=e[n]})}),t}({"b, strong":function(e,t,n){var r=e.schema.marks.strong;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},"i, em":function(e,t,n){var r=e.schema.marks.emph;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},"s, del":function(e,t,n){var r=e.schema.marks.strike;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},code:function(e,t,n){var r=e.schema.marks.code;n?e.openMark(r.create({rawHTML:n})):e.closeMark(r)},a:function(e,t,n){var r=t.literal,o=e.schema.marks.link;if(n){var i=yu(r,"href")[0];e.openMark(o.create({linkUrl:i,rawHTML:n}))}else e.closeMark(o)},img:function(e,t,n){var r=t.literal;if(n){var o=yu(r,"src","alt"),i=o[0],s=o[1],a=e.schema.nodes.image;e.addNode(a,h({rawHTML:n,imageUrl:i},s&&{altText:s}))}},hr:function(e,t,n){e.addNode(e.schema.nodes.thematicBreak,{rawHTML:n})},br:function(e,t){var n=e.schema.nodes.paragraph,r=t.parent,o=t.prev,i=t.next;"paragraph"===(null===r||void 0===r?void 0:r.type)?(gu(o)&&e.openNode(n),gu(i)?e.closeNode():i&&(e.closeNode(),e.openNode(n))):"tableCell"===(null===r||void 0===r?void 0:r.type)&&(o&&(mu(o)||fu(e,o))&&e.closeNode(),i&&(mu(i)||fu(e,i))&&e.openNode(n))},pre:function(e,t,n){var r,o,i=document.createElement("div");i.innerHTML=t.literal;var s=null===(o=null===(r=i.firstChild)||void 0===r?void 0:r.firstChild)||void 0===o?void 0:o.textContent;e.openNode(e.schema.nodes.codeBlock,{rawHTML:n}),e.addText(hu(s)),e.closeNode()},"ul, ol":function(e,t,n){if("tableCell"===t.parent.type){var r=e.schema.nodes,o=r.bulletList,i=r.orderedList,s=r.paragraph,a="ul"===n?o:i;n?(t.prev&&!vu(t.prev)&&e.closeNode(),e.openNode(a,{rawHTML:n})):(e.closeNode(),t.next&&!vu(t.next)&&e.openNode(s))}},li:function(e,t,n){var r;if("tableCell"===(null===(r=t.parent)||void 0===r?void 0:r.type)){var o=e.schema.nodes,i=o.listItem,s=o.paragraph;if(n){var a=function(e){var t=e.literal;return{task:/data-task/.test(t),checked:/data-task-checked/.test(t)}}(t);t.prev&&!vu(t.prev)&&e.closeNode(),e.openNode(i,h({rawHTML:n},a)),t.next&&!vu(t.next)&&e.openNode(s)}else t.prev&&!vu(t.prev)&&e.closeNode(),e.closeNode()}}});function wu(e){return"htmlInline"===e.type&&yt.test(e.literal)}var ku={text:function(e,t){e.addText(t.literal||"")},paragraph:function(e,t,n,r){var o;if(n.entering){var i=e.schema.nodes.paragraph;"paragraph"===(null===(o=t.prev)||void 0===o?void 0:o.type)&&(e.openNode(i,r),e.closeNode()),e.openNode(i,r)}else e.closeNode()},heading:function(e,t,n,r){if(n.entering){var o=t,i=o.level,s=o.headingType;e.openNode(e.schema.nodes.heading,h({level:i,headingType:s},r))}else e.closeNode()},codeBlock:function(e,t,n){var r=e.schema.nodes.codeBlock,o=t,i=o.info,s=o.literal;e.openNode(r,h({language:i},n)),e.addText(hu(s||"")),e.closeNode()},list:function(e,t,n,r){if(n.entering){var o=e.schema.nodes,i=o.bulletList,s=o.orderedList,a=t.listData,l=a.type,c=a.start;"bullet"===l?e.openNode(i,r):e.openNode(s,h({order:c},r))}else e.closeNode()},item:function(e,t,n,r){var o=n.entering,i=e.schema.nodes.listItem,s=t.listData,a=s.task,l=s.checked;if(o){var c=h(h(h({},a&&{task:a}),l&&{checked:l}),r);e.openNode(i,c)}else e.closeNode()},blockQuote:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.blockQuote,r):e.closeNode()},image:function(e,t,n,r){var o=n.entering,i=n.skipChildren,s=e.schema.nodes.image,a=t,l=a.destination,c=a.firstChild;o&&i&&i(),e.addNode(s,h(h({imageUrl:l},c&&{altText:c.literal}),r))},thematicBreak:function(e,t,n,r){e.addNode(e.schema.nodes.thematicBreak,r)},strong:function(e,t,n,r){var o=n.entering,i=e.schema.marks.strong;o?e.openMark(i.create(r)):e.closeMark(i)},emph:function(e,t,n,r){var o=n.entering,i=e.schema.marks.emph;o?e.openMark(i.create(r)):e.closeMark(i)},link:function(e,t,n,r){var o=n.entering,i=e.schema.marks.link,s=t,a=s.destination,l=s.title;if(o){var c=h({linkUrl:a,title:l},r);e.openMark(i.create(c))}else e.closeMark(i)},softbreak:function(e,t){if("paragraph"===t.parent.type){var n=t.prev,r=t.next;n&&!wu(n)&&e.closeNode(),r&&!wu(r)&&e.openNode(e.schema.nodes.paragraph)}},table:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.table,r):e.closeNode()},tableHead:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableHead,r):e.closeNode()},tableBody:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableBody,r):e.closeNode()},tableRow:function(e,t,n,r){n.entering?e.openNode(e.schema.nodes.tableRow,r):e.closeNode()},tableCell:function(e,t,n){var r=n.entering;if(!t.ignored){var o=function(t){return t&&(mu(t)||fu(e,t))};if(r){var i=e.schema.nodes,s=i.tableHeadCell,a=i.tableBodyCell,l=i.paragraph,c=t.parent.parent,u="tableHead"===c.type?s:a,d=(c.parent.columns[t.startIdx]||{}).align,p=h({},t.attrs);d&&(p.align=d),e.openNode(u,p),o(t.firstChild)&&e.openNode(l)}else o(t.lastChild)&&e.closeNode(),e.closeNode()}},strike:function(e,t,n,r){var o=n.entering,i=e.schema.marks.strike;o?e.openMark(i.create(r)):e.closeMark(i)},code:function(e,t,n,r){var o=e.schema.marks.code;e.openMark(o.create(r)),e.addText(hu(t.literal||"")),e.closeMark(o)},customBlock:function(e,t){var n=e.schema.nodes,r=n.customBlock,o=n.paragraph,i=t,s=i.info,a=i.literal;e.openNode(r,{info:s}),e.addText(hu(a||"")),e.closeNode(),t.next||(e.openNode(o),e.closeNode())},frontMatter:function(e,t){e.openNode(e.schema.nodes.frontMatter),e.addText(t.literal),e.closeNode()},htmlInline:function(e,t){var n=t.literal,r=n.match(vt),o=r[1],i=r[3],s=(o||i).toLowerCase(),a=e.schema.marks[s],l=Ua(n);if(null===a||void 0===a?void 0:a.spec.attrs.htmlInline)if(o){var c=Ja(l);e.openMark(a.create({htmlAttrs:c}))}else e.closeMark(a);else{var u=bu[s];u&&u(e,t,o)}},htmlBlock:function(e,t){var n=t.literal,r=document.createElement("div");if(bt.test(n))e.openNode(e.schema.nodes.htmlComment),e.addText(t.literal),e.closeNode();else{var o=n.match(vt),i=o[1],s=o[3],a=(i||s).toLowerCase(),l=e.schema.nodes[a],c=Ua(n);if(null===l||void 0===l?void 0:l.spec.attrs.htmlBlock){var u=Ja(c),d=Wa(t,a);e.addNode(l,{htmlAttrs:u,childrenHTML:d})}else r.innerHTML=c,function e(t){Ee(t.childNodes).forEach(function(t){if(Mt(t)){var n=t.nodeName.toLowerCase();t.setAttribute("data-raw-html",n),t.childNodes&&e(t)}})}(r),e.convertByDOMParser(r)}},customInline:function(e,t,n){var r=n.entering,o=n.skipChildren,i=t,s=i.info,a=i.firstChild,l=e.schema;if(-1!==s.indexOf("widget")&&r){var c=ot(t);o(),e.addNode(l.nodes.widget,{info:s},[l.text(Qe(s,c))])}else{var u="$$";r&&(u+=a?s+" ":s),e.addText(u)}}};var xu=function(){function e(e,t){this.schema=e,this.convertors=t,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=r.d.none}return e.prototype.top=function(){return be(this.stack)},e.prototype.push=function(e){this.stack.length&&this.top().content.push(e)},e.prototype.addText=function(e){if(e){var t=this.top().content,n=be(t),o=this.schema.text(e,this.marks),i=n&&function(e,t){return!!(e.isText&&t.isText&&r.d.sameSet(e.marks,t.marks))&&e.withText(e.text+t.text)}(n,o);i?t[t.length-1]=i:t.push(o)}},e.prototype.openMark=function(e){this.marks=e.addToSet(this.marks)},e.prototype.closeMark=function(e){this.marks=e.removeFromSet(this.marks)},e.prototype.addNode=function(e,t,n){var r=e.createAndFill(t,n,this.marks);return r?(this.push(r),r):null},e.prototype.openNode=function(e,t){this.stack.push({type:e,attrs:t,content:[]})},e.prototype.closeNode=function(){this.marks.length&&(this.marks=r.d.none);var e=this.stack.pop(),t=e.type,n=e.attrs,o=e.content;return this.addNode(t,n,o)},e.prototype.convertByDOMParser=function(e){var t=this;r.a.fromSchema(this.schema).parse(e).content.forEach(function(e){return t.push(e)})},e.prototype.closeUnmatchedHTMLInline=function(e,t){var n;if(!t&&"htmlInline"!==e.type)for(var r=this.stack.length-1;r>=0;r-=1){var o=this.stack[r];if(null===(n=o.attrs)||void 0===n||!n.rawHTML)break;o.content.length?this.closeNode():this.stack.pop()}},e.prototype.convert=function(e,t){for(var n=e.walker(),r=n.next(),o=function(){var e=r.node,o=r.entering,s=i.convertors[e.type],a=!1;if(s){var l={entering:o,leaf:!function(e){switch(e.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}(e),getChildrenText:Je,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){a=!0}};if(i.closeUnmatchedHTMLInline(e,o),s(i,e,l),(null===t||void 0===t?void 0:t.node)===e){var c=i.stack.reduce(function(e,t){return e+t.content.reduce(function(e,t){return e+t.nodeSize},0)},0)+1;t.setMappedPos(c)}}a&&(n.resumeAt(e,!1),n.next()),r=n.next()},i=this;r;)o()},e.prototype.convertNode=function(e,t){return this.convert(e,t),this.stack.length?this.closeNode():null},e}();var Cu={text:function(e,t){var n,r=t.node,o=null!==(n=r.text)&&void 0!==n?n:"";(r.marks||[]).some(function(e){return"link"===e.type.name})?e.text(me(o),!1):e.text(o)},paragraph:function(e,t){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o;if(e.stopNewline)e.convertInline(n);else{var s=0===i,a=!s&&r.child(i-1),l=a&&0===a.childCount,c=i<r.childCount-1&&r.child(i+1),u=c&&"paragraph"===c.type.name,d=0===n.childCount;if(d&&l)e.write("<br>\n");else if(!d||l||s)e.convertInline(n),u?e.write("\n"):e.closeBlock(n);else{if("listItem"===(null===r||void 0===r?void 0:r.type.name)){var p=e.getDelim();e.setDelim(""),e.write("<br>"),e.setDelim(p)}e.write("\n")}}},heading:function(e,t,n){var r=t.node,o=n.delim;"atx"===r.attrs.headingType?(e.write(o+" "),e.convertInline(r),e.closeBlock(r)):(e.convertInline(r),e.ensureNewLine(),e.write(o),e.closeBlock(r))},codeBlock:function(e,t,n){var r=t.node,o=n.delim,i=n.text,s=o,a=s[0],l=s[1];e.write(a),e.ensureNewLine(),e.text(i,!1),e.ensureNewLine(),e.write(l),e.closeBlock(r)},blockQuote:function(e,t,n){var r=t.node,o=t.parent,i=n.delim;(null===o||void 0===o?void 0:o.type.name)===r.type.name&&e.flushClose(1),e.wrapBlock(i,null,r,function(){return e.convertNode(r)})},bulletList:function(e,t,n){var r=t.node,o=n.delim;e.convertList(r,fe(" ",4),function(){return o+" "})},orderedList:function(e,t){var n=t.node,r=n.attrs.order||1;e.convertList(n,fe(" ",4),function(e){return String(r+e)+". "})},listItem:function(e,t){var n=t.node,r=n.attrs,o=r.task,i=r.checked;o&&e.write("["+(i?"x":" ")+"] "),e.convertNode(n)},image:function(e,t,n){var r=n.attrs;e.write("!["+(null===r||void 0===r?void 0:r.altText)+"]("+(null===r||void 0===r?void 0:r.imageUrl)+")")},thematicBreak:function(e,t,n){var r=t.node,o=n.delim;e.write(o),e.closeBlock(r)},table:function(e,t){var n=t.node;e.convertNode(n),e.closeBlock(n)},tableHead:function(e,t,n){var r=t.node,o=n.delim,i=r.firstChild;e.convertNode(r);var s=null!==o&&void 0!==o?o:"";!o&&i&&i.forEach(function(e){var t=function(e,t){var n=e.length,r="",o="";return"left"===t?(r=":",n-=1):"right"===t?(o=":",n-=1):"center"===t&&(r=":",o=":",n-=2),""+r+fe("-",Math.max(n,3))+o}(e.textContent,e.attrs.align);s+="| "+t+" "}),e.write(s+"|"),e.ensureNewLine()},tableBody:function(e,t){var n=t.node;e.convertNode(n)},tableRow:function(e,t){var n=t.node;e.convertNode(n),e.write("|"),e.ensureNewLine()},tableHeadCell:function(e,t,n){var r=t.node,o=n.delim,i=void 0===o?"| ":o;e.write(i),e.convertTableCell(r),e.write(" ")},tableBodyCell:function(e,t,n){var r=t.node,o=n.delim,i=void 0===o?"| ":o;e.write(i),e.convertTableCell(r),e.write(" ")},customBlock:function(e,t,n){var r=t.node,o=n.delim,i=n.text,s=o,a=s[0],l=s[1];e.write(a),e.ensureNewLine(),e.text(i,!1),e.ensureNewLine(),e.write(l),e.closeBlock(r)},frontMatter:function(e,t,n){var r=t.node,o=n.text;e.text(o,!1),e.closeBlock(r)},widget:function(e,t,n){var r=n.text;e.write(r)},html:function(e,t,n){var r=t.node,o=n.text;e.write(o),r.attrs.htmlBlock&&e.closeBlock(r)},htmlComment:function(e,t,n){var r=t.node,o=n.text;e.write(o),e.closeBlock(r)}};function Tu(e,t){var n=e.text,r=/`+/g,o=0;if(e.isText&&n)for(var i=r.exec(n);i;)o=Math.max(o,i[0].length),i=r.exec(n);for(var s=o>0&&t>0?" `":"`",a=0;a<o;a+=1)s+="`";return o>0&&t<0&&(s+=" "),s}function Mu(e){return e?["<"+e+">","</"+e+">"]:null}function Su(e){return e?"<"+e+">":null}function Eu(e){return e?"</"+e+">":null}var Nu={heading:function(e){var t=e.node.attrs,n=t.level,r=fe("#",n);return"setext"===t.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:Mu(t.rawHTML)}},codeBlock:function(e){var t=e.node,n=t.attrs,r=t.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:Mu(n.rawHTML),text:r}},blockQuote:function(e){return{delim:"> ",rawHTML:Mu(e.node.attrs.rawHTML)}},bulletList:function(e,t){var n=e.node,r=t.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:Mu(o)}},orderedList:function(e,t){var n=e.node,r=t.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:Mu(o)}},listItem:function(e,t){var n=e.node,r=t.inTable,o=n.attrs,i=o.task,s=o.checked,a=n.attrs.rawHTML;return r&&(a=a||"li"),{rawHTML:a?["<"+a+(i?' class="task-list-item'+(s?" checked":"")+'"':"")+(i?" data-task"+(s?" data-task-checked":""):"")+">","</"+a+">"]:null}},table:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},tableHead:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},tableBody:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},tableRow:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},tableHeadCell:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},tableBodyCell:function(e){return{rawHTML:Mu(e.node.attrs.rawHTML)}},image:function(e){var t=e.node.attrs,n=t.rawHTML,r=t.altText,o=t.imageUrl.replace(/&amp;/g,"&"),i=r?' alt="'+ce(r)+'"':"";return{rawHTML:n?"<"+n+' src="'+ce(o)+'"'+i+">":null,attrs:{altText:me(r||""),imageUrl:o}}},thematicBreak:function(e){return{delim:"***",rawHTML:Su(e.node.attrs.rawHTML)}},customBlock:function(e){var t=e.node,n=t.attrs,r=t.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(e){return{text:e.node.textContent}},widget:function(e){return{text:e.node.textContent}},strong:function(e,t,n){var r=e.node,o=t.entering,i=r.attrs.rawHTML,s="**";return n||(s=o?"<strong>":"</strong>"),{delim:s,rawHTML:o?Su(i):Eu(i)}},emph:function(e,t,n){var r=e.node,o=t.entering,i=r.attrs.rawHTML,s="*";return n||(s=o?"<em>":"</em>"),{delim:s,rawHTML:o?Su(i):Eu(i)}},strike:function(e,t,n){var r=e.node,o=t.entering,i=r.attrs.rawHTML,s="~~";return n||(s=o?"<del>":"</del>"),{delim:s,rawHTML:o?Su(i):Eu(i)}},link:function(e,t){var n=e.node,r=t.entering,o=n.attrs,i=o.title,s=o.rawHTML,a=o.linkUrl.replace(/&amp;/g,"&"),l=i?' title="'+ce(i)+'"':"";return r?{delim:"[",rawHTML:s?"<"+s+' href="'+ce(a)+'"'+l+">":null}:{delim:"]("+a+(i?" "+function(e){var t;return(t=-1===e.indexOf('"')?'""':-1===e.indexOf("'")?"''":"()")[0]+e+t[1]}(me(i)):"")+")",rawHTML:Eu(s)}},code:function(e,t){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o,s=t.entering;return{delim:s?Tu(r.child(i),-1):Tu(r.child(i-1),1),rawHTML:s?Su(n.attrs.rawHTML):Eu(n.attrs.rawHTML)}},htmlComment:function(e){return{text:e.node.textContent}},html:function(e,t){var n=e.node,r=t.entering,o=n.type.name,i=n.attrs.htmlAttrs,s="<"+o,a="</"+o+">";return Object.keys(i).forEach(function(e){s+=" "+e+'="'+i[e].replace(/"/g,"'")+'"'}),s+=">",n.attrs.htmlInline?{rawHTML:r?s:a}:{text:""+s+n.attrs.childrenHTML+a}}},Ou={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Du(e){var t={};return Object.keys(Cu).forEach(function(n){t[n]=function(t,r){if(Cu[n]){var o=e[n],i=o?o(r,{inTable:t.inTable}):{};!function(e,t){var n=t.state,r=t.nodeInfo,o=t.params,i=o.rawHTML;i?O(e,["heading","codeBlock"])>-1?function(e,t,n){var r=n[0],o=n[1];e.write(r),e.convertInline(t),e.write(o)}(n,r.node,i):O(e,["image","thematicBreak"])>-1?n.write(i):function(e,t,n){var r=t.node,o=t.parent,i=n[0],s=n[1];e.stopNewline=!0,e.write(i),e.convertNode(r),e.write(s),"doc"===(null===o||void 0===o?void 0:o.type.name)&&(e.closeBlock(r),e.stopNewline=!1)}(n,r,i):Cu[e](n,r,o)}(n,{state:t,nodeInfo:r,params:i})}}}),t}function Au(e){return Object.keys(e).forEach(function(t){var n=Nu[t],r=e[t];Nu[t]=n?function(e,t){return t.origin=function(){return n(e,t)},r(e,t)}:r,delete e[t]}),{nodeTypeConvertors:Du(Nu),markTypeConvertors:function(e){var t={};return Object.keys(Ou).forEach(function(n){t[n]=function(t,r,o){var i=Ou[n],s=e[n],a=s&&t&&!D(r)?s(t,{entering:r},o):{};return h(h({},a),i)}}),t}(Nu)}}var Lu=function(){function e(e){var t=e.nodeTypeConvertors,n=e.markTypeConvertors;this.nodeTypeConvertors=t,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return e.prototype.getMarkConvertor=function(e){var t=e.attrs.htmlInline?"html":e.type.name;return this.markTypeConvertors[t]},e.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},e.prototype.isBetweenSpaces=function(e,t){var n,r,o=e.content,i=0===t||function(e){return/(\S*)\s$/g.test(e)}(null!==(n=o.child(t-1).text)&&void 0!==n?n:"a"),s=t>=o.childCount-1||function(e){return/^\s(\S*)/g.test(e)}(null!==(r=o.child(t+1).text)&&void 0!==r?r:"a");return i&&s},e.prototype.markText=function(e,t,n,r){var o=this.getMarkConvertor(e);if(o){var i=o({node:e,parent:n,index:r},t,this.isBetweenSpaces(n,t?r:r-1)),s=i.delim;return i.rawHTML||s}return""},e.prototype.setDelim=function(e){this.delim=e},e.prototype.getDelim=function(){return this.delim},e.prototype.flushClose=function(e){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),e||(e=2),e>1){var t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(var r=1;r<e;r+=1)this.result+=t+"\n"}this.closed=!1}},e.prototype.wrapBlock=function(e,t,n,r){var o=this.getDelim();this.write(t||e),this.setDelim(this.getDelim()+e),r(),this.setDelim(o),this.closeBlock(n)},e.prototype.ensureNewLine=function(){this.isInBlank()||(this.result+="\n")},e.prototype.write=function(e){void 0===e&&(e=""),this.flushClose(),this.delim&&this.isInBlank()&&(this.result+=this.delim),e&&(this.result+=e)},e.prototype.closeBlock=function(e){this.closed=e},e.prototype.text=function(e,t){void 0===t&&(t=!0);for(var n=e.split("\n"),r=0;r<n.length;r+=1)this.write(),this.result+=t?ge(n[r]):n[r],r!==n.length-1&&(this.result+="\n")},e.prototype.convertBlock=function(e,t,n){var r=e.type.name,o=this.nodeTypeConvertors[r],i={node:e,parent:t,index:n};e.attrs.htmlBlock?this.nodeTypeConvertors.html(this,i):o&&o(this,i)},e.prototype.convertInline=function(e){var t=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[],l=r;if(r="",o&&o.isText&&a.some(function(e){var n=t.getMarkConvertor(e),r=n&&n();return r&&r.removedEnclosingWhitespace})&&o&&o.text){var c=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=c[1],d=c[2],p=c[3];l+=u,r=p,(u||p)&&((o=d?o.withText(d):null)||(a=n))}for(var h=a.length&&be(a),f=h&&t.getMarkConvertor(h),m=f&&f(),g=m&&!1===m.escape,v=a.length-(g?1:0),y=0;y<v;y+=1){d=a[y];if(m&&!m.mixable)break;for(var b=0;b<n.length;b+=1){var w=n[b];if(m&&!m.mixable)break;if(d.eq(w)){y>b?a=a.slice(0,b).concat(d).concat(a.slice(b,y)).concat(a.slice(y+1,v)):b>y&&(a=a.slice(0,y).concat(a.slice(y+1,b)).concat(d).concat(a.slice(b,v)));break}}}for(var k=0;k<Math.min(n.length,v)&&a[k].eq(n[k]);)k+=1;for(;k<n.length;){var x=n.pop();x&&t.text(t.markText(x,!1,e,s),!1)}if(l&&t.text(l),o){for(;n.length<v;){d=a[n.length];n.push(d),t.text(t.markText(d,!0,e,s),!1)}g&&o.isText?t.text(t.markText(h,!0,e,s)+o.text+t.markText(h,!1,e,s+1),!1):t.convertBlock(o,e,s)}};e.forEach(o),o(null,0,e.childCount)},e.prototype.convertList=function(e,t,n){var r,o=this;this.closed&&this.closed.type===e.type?this.flushClose(3):this.tightList&&this.flushClose(1);var i=null===(r=e.attrs.tight)||void 0===r||r,s=this.tightList;this.tightList=i,e.forEach(function(r,s,a){a&&i&&o.flushClose(1),o.wrapBlock(t,n(a),e,function(){return o.convertBlock(r,e,a)})}),this.tightList=s},e.prototype.convertTableCell=function(e){var t=this;this.stopNewline=!0,this.inTable=!0,e.forEach(function(n,r,o){ue(["bulletList","orderedList"],n.type.name)?(t.convertBlock(n,e,o),t.closed=!1):(t.convertInline(n),o<e.childCount-1&&"paragraph"===e.child(o+1).type.name&&t.write("<br>"))}),this.stopNewline=!1,this.inTable=!1},e.prototype.convertNode=function(e,t){var n=this;return e.forEach(function(r,o,i){if(n.convertBlock(r,e,i),(null===t||void 0===t?void 0:t.node)===r){var s=n.result.split("\n");t.setMappedPos([s.length,be(s).length+1])}}),this.result},e}(),Iu=function(){function e(e,t,n,r){var o=this;this.setMappedPos=function(e){o.mappedPosWhenConverting=e},this.schema=e,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(e){var t=Object.keys(e),n=h({},ku),r=new Js({gfm:!0,nodeId:!0,convertors:e}).getConvertors();return t.forEach(function(t){var o=ku[t];o&&!ue(["htmlBlock","htmlInline"],t)&&(n[t]=function(n,i,s){s.origin=function(){return r[t](i,s,r)};var a,l=e[t](i,s);if(l){var c=Array.isArray(l)?l[0]:l;a={htmlAttrs:c.attributes,classNames:c.classNames}}o(n,i,s,a)})}),n}(n),this.toMdConvertors=Au(t||{}),this.eventEmitter.listen("setFocusedNode",function(e){return o.focusedNode=e})}return e.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},e.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},e.prototype.toWysiwygModel=function(e){return new xu(this.schema,this.toWwConvertors).convertNode(e,this.getInfoForPosSync())},e.prototype.toMarkdownText=function(e){var t=new Lu(this.toMdConvertors).convertNode(e,this.getInfoForPosSync());return t=this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",t)},e}();function Ru(e){var t=e.plugins,n=e.eventEmitter,i=e.usageStatistics,l=e.instance;return n.listen("mixinTableOffsetMapPrototype",Dl),(null!==t&&void 0!==t?t:[]).reduce(function(e,t){var u=function(e){var t=e.plugin,n={eventEmitter:e.eventEmitter,usageStatistics:e.usageStatistics,instance:e.instance,pmState:{Plugin:s.d,PluginKey:s.e,Selection:s.f,TextSelection:s.h},pmView:{Decoration:o.a,DecorationSet:o.b},pmModel:{Fragment:r.c},pmRules:{InputRule:c.a,inputRules:c.b,undoInputRule:c.c},pmKeymap:{keymap:a.a},i18n:Wl};if(b(t)){var i=t[0],l=t[1];return i(n,void 0===l?{}:l)}return t(n)}({plugin:t,eventEmitter:n,usageStatistics:i,instance:l});if(!u)throw new Error("The return value of the executed plugin is empty.");var d=u.markdownParsers,p=u.toHTMLRenderers,f=u.toMarkdownRenderers,m=u.markdownPlugins,g=u.wysiwygPlugins,v=u.wysiwygNodeViews,y=u.markdownCommands,w=u.wysiwygCommands,k=u.toolbarItems;return p&&(e.toHTMLRenderers=ke(e.toHTMLRenderers,p)),f&&(e.toMarkdownRenderers=ke(e.toMarkdownRenderers,f)),m&&(e.mdPlugins=e.mdPlugins.concat(m)),g&&(e.wwPlugins=e.wwPlugins.concat(g)),v&&(e.wwNodeViews=h(h({},e.wwNodeViews),v)),y&&(e.mdCommands=h(h({},e.mdCommands),y)),w&&(e.wwCommands=h(h({},e.wwCommands),w)),k&&(e.toolbarItems=e.toolbarItems.concat(k)),d&&(e.markdownParsers=h(h({},e.markdownParsers),d)),e},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Pu=function(){function e(e){var t=this;this.options=v({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},e),this.eventEmitter=new du;var n=he(this.options.linkAttributes),r=Ru({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this})||{},o=r.toHTMLRenderers,i=r.markdownParsers,s=this.options,a=s.customHTMLRenderer,l=s.extendedAutolinks,c=s.referenceDefinition,u=s.frontMatter,d=s.customHTMLSanitizer,p={linkAttributes:n,customHTMLRenderer:h(h({},o),a),extendedAutolinks:l,referenceDefinition:c,frontMatter:u,sanitizer:d||Ua};!function(e){["htmlBlock","htmlInline"].forEach(function(t){e[t]&&Object.keys(e[t]).forEach(function(e){return _a(e)})})}(p.customHTMLRenderer),this.options.events&&g(this.options.events,function(e,n){t.on(n,e)});var f=this.options,m=f.el,y=f.initialValue,b=f.theme,w=m.innerHTML;"light"!==b&&m.classList.add(Ct(b)),m.innerHTML="",this.toastMark=new zs("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:l,referenceDefinition:c,disallowDeepHeading:!0,frontMatter:u,customParser:i}),this.preview=new dl(this.eventEmitter,h(h({},p),{isViewer:!0})),$r(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),y?this.setMarkdown(y):w&&this.preview.setHTML(w),m.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return e.prototype.toggleTask=function(e){var t=e.target,n=getComputedStyle(t,":before");!t.hasAttribute("data-task-disabled")&&t.hasAttribute("data-task")&&kt(n,e.offsetX,e.offsetY)&&(Et(t,"checked"),this.eventEmitter.emit("change",{source:"viewer",date:e}))},e.prototype.setMarkdown=function(e){var t=this.toastMark.getLineTexts(),n=[t.length,be(t).length+1],r=this.toastMark.editMarkdown([1,1],n,e||"");this.eventEmitter.emit("updatePreview",r)},e.prototype.on=function(e,t){this.eventEmitter.listen(e,t)},e.prototype.off=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.addHook=function(e,t){this.eventEmitter.removeEventHandler(e),this.eventEmitter.listen(e,t)},e.prototype.destroy=function(){Hr(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},e.prototype.isViewer=function(){return!0},e.prototype.isMarkdownMode=function(){return!1},e.prototype.isWysiwygMode=function(){return!1},e}();function Bu(e){return e instanceof r.f}function Fu(e){return ue(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],e)}var Hu={openTag:function(e,t){var n=e,r=n.tagName,o=n.classNames,i=n.attributes,s=document.createElement(r),a={};o&&(s.className=o.join(" ")),i&&(a=h(h({},a),i)),Lt(a,s),t.push(s)},closeTag:function(e,t){if(t.length>1){var n=t.pop();be(t).appendChild(n)}},html:function(e,t){be(t).insertAdjacentHTML("beforeend",e.content)},text:function(e,t){var n=document.createTextNode(e.content);be(t).appendChild(n)}},ju=function(){function e(e,t){var n=Ya(e,t),r=h(h({},t.htmlBlock),t.htmlInline);this.customConvertorKeys=Object.keys(t).concat(Object.keys(r)),this.renderer=new Js({gfm:!0,convertors:h(h({},n),r)}),this.convertors=this.renderer.getConvertors()}return e.prototype.generateTokens=function(e){var t=function(e){var t=e.attrs,n=e.type.name,r={type:n,wysiwygNode:!0,literal:!Fu(n)&&Bu(e)?e.textContent:null},o={heading:{level:t.level},link:{destination:t.linkUrl,title:t.title},image:{destination:t.imageUrl},codeBlock:{info:t.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:t.order}},listItem:{type:"item",listData:{task:t.task,checked:t.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:t.align},tableBodyCell:{type:"tableCell",cellType:"body",align:t.align},customBlock:{info:t.info}}[n],i=h(h({},r),o),s=e.attrs,a=s.htmlAttrs,l=s.childrenHTML;return a?h(h({},i),{attrs:a,childrenHTML:l}):i}(e),n={entering:!0,leaf:!!Bu(e)&&e.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Bu(e)?e.textContent:""},skipChildren:function(){return!1}},r=this.convertors[e.type.name],o=r(t,n,this.convertors),i=b(o)?o:[o];return(Fu(e.type.name)||e.attrs.htmlInline)&&(n.entering=!1,i.push({type:"text",content:Bu(e)?e.textContent:""}),i=i.concat(r(t,n,this.convertors))),i},e.prototype.toDOMNode=function(e){var t=[];return this.generateTokens(e).forEach(function(e){return Hu[e.type](e,t)}),t[0]},e.prototype.getToDOMNode=function(e){return ue(this.customConvertorKeys,e)?this.toDOMNode.bind(this):null},e}(),zu=100,qu=15,Vu=null,$u=null;function _u(e,t){var n=t.syncScrollTop,r=t.releaseEventBlock;$u&&clearTimeout($u),n(e),$u=setTimeout(function(){r()},qu)}var Uu=function(){function e(e,t,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0,this.timer=null;var r=t.previewContent,o=t.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=e,this.editorView=e.view,this.toastMark=e.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return e.prototype.addScrollSyncEvent=function(){var e=this;this.eventEmitter.listen("afterPreviewRender",function(){e.clearTimer(),e.timer=setTimeout(function(){e.syncPreviewScrollTop(!0)},200)}),this.eventEmitter.listen("scroll",function(t,n){e.active&&("editor"===t&&"editor"!==e.blockedScroll?e.syncPreviewScrollTop():"preview"===t&&"preview"!==e.blockedScroll&&e.syncEditorScrollTop(n))}),this.eventEmitter.listen("toggleScrollSync",function(t){e.active=t})},e.prototype.getMdNodeAtPos=function(e,t){var n=e.content.findIndex(t.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},e.prototype.getScrollTopByCaretPos=function(){var e=this.mdEditor.getSelection(),t=this.toastMark.findFirstNodeAtLine(e[0][0]),n=this.previewEl.clientHeight,r=sl(this.previewRoot,t).el,o=(ol(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().top<n?null:o},e.prototype.syncPreviewScrollTop=function(e){void 0===e&&(e=!1);var t=this.editorView,n=this.previewEl,r=this.previewRoot,o=t.dom.getBoundingClientRect(),i=o.left,s=o.top,a=t.posAtCoords({left:i,top:s}),l=t.state.doc,c=this.getMdNodeAtPos(l,a);if(c&&!function(e){var t=e.type;return"htmlBlock"===t||"htmlInline"===t}(c)){var u=n.scrollTop,d=t.dom,p=d.scrollTop,h=d.scrollHeight,f=d.clientHeight,m=d.children,g=h-p<=f+18,v=g?n.scrollHeight:0;if(p&&!g){if(e){var y=this.getScrollTopByCaretPos();if(!y)return;v=y}else{var b=sl(this.previewRoot,c),w=b.el,k=rl(l,b.mdNode,m),x=k.height,C=k.rect;v=(ol(w,r)||w.offsetTop)+w.clientHeight*(s>C.top?Math.min((s-C.top)/x,1):0)}v=this.getResolvedScrollTop("editor",p,v,u),this.latestEditorScrollTop=p}v!==u&&this.run("editor",v,u)}},e.prototype.syncEditorScrollTop=function(e){var t=this.toastMark,n=this.editorView,r=this.previewRoot,o=this.previewEl,i=n.dom,s=n.state,a=o.scrollTop,l=o.clientHeight,c=o.scrollHeight-a<=l,u=i.scrollTop,d=c?i.scrollHeight:0;if(a&&e&&!c){if(!(e=function(e,t){for(;!e.getAttribute("data-nodeid")&&e.parentElement!==t;)e=e.parentElement;return e}(e,r)).getAttribute("data-nodeid"))return;var p=i.children,h=Number(e.getAttribute("data-nodeid")),f=sl(this.previewRoot,t.findNodeById(h)),m=f.mdNode,g=f.el;d=p[Re(m)-1].offsetTop;var v=rl(s.doc,m,p).height,y=cl(g,r,h),b=y.nodeHeight;d+=function(e,t,n,r){return Math.min((e-t)/n,1)*r}(a,y.offsetTop,b,v),d=this.getResolvedScrollTop("preview",a,d,u),this.latestPreviewScrollTop=a}d!==u&&this.run("preview",d,u)},e.prototype.getResolvedScrollTop=function(e,t,n,r){var o="editor"===e?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o<t?Math.max(n,r):Math.min(n,r)},e.prototype.run=function(e,t,n){var r,o=this;"editor"===e?(r=this.previewEl,this.blockedScroll="preview"):(r=this.editorView.dom,this.blockedScroll="editor"),function(e,t,n){var r=t-e,o=Date.now(),i=function(){var s,a=(Date.now()-o)/zu;Vu&&clearTimeout(Vu),a<1?(s=e+r*Math.cos((1-a)*Math.PI/2),_u(Math.ceil(s),n),Vu=setTimeout(i,1)):(_u(t,n),Vu=null)};i()}(n,t,{syncScrollTop:function(e){return r.scrollTop=e},releaseEventBlock:function(){return o.blockedScroll=null}})},e.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.destroy=function(){this.clearTimer(),this.eventEmitter.removeEventHandler("scroll"),this.eventEmitter.removeEventHandler("afterPreviewRender")},e}(),Wu={getPopupInitialValues:function(e,t){return"link"===t.popupName?{linkText:e.getSelectedText()}:{}}};var Ju=function(){function e(e){var t=this;this.initialHTML=e.el.innerHTML,e.el.innerHTML="",this.options=v({previewStyle:"tab",previewHighlight:!0,initialEditType:"markdown",height:"300px",minHeight:"200px",language:"en-US",useCommandShortcut:!0,usageStatistics:!0,toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","image","link"],["code","codeblock"],["scrollSync"]],hideModeSwitch:!1,linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,customMarkdownRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,widgetRules:[],theme:"light",autofocus:!0},e);var n=this.options,r=n.customHTMLRenderer,o=n.extendedAutolinks,i=n.referenceDefinition,s=n.frontMatter,a=n.customMarkdownRenderer,l=n.useCommandShortcut,c=n.initialEditType,u=n.widgetRules,d=n.customHTMLSanitizer;this.mode=c||"markdown",this.mdPreviewStyle=this.options.previewStyle,this.i18n=Wl,this.i18n.setCode(this.options.language),this.eventEmitter=new du,tt(u);var p=he(this.options.linkAttributes);this.pluginInfo=Ru({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this});var f=this.pluginInfo,m=f.toHTMLRenderers,y=f.toMarkdownRenderers,b=f.mdPlugins,w=f.wwPlugins,k=f.wwNodeViews,x=f.mdCommands,C=f.wwCommands,T=f.markdownParsers,M={linkAttributes:p,customHTMLRenderer:ke(m,r),extendedAutolinks:o,referenceDefinition:i,frontMatter:s,sanitizer:d||Ua},S=new ju(p,M.customHTMLRenderer),E=function(e,t,n){var r={nodes:{},marks:{}};return["htmlBlock","htmlInline"].forEach(function(o){e[o]&&Object.keys(e[o]).forEach(function(e){var i="htmlBlock"===o?"nodes":"marks";_a(e),r[i][e]=Za[o](e,t,n)})}),r}(M.customHTMLRenderer,M.sanitizer,S);this.toastMark=new zs("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:o,referenceDefinition:i,disallowDeepHeading:!0,frontMatter:s,customParser:T}),this.mdEditor=new Dr(this.eventEmitter,{toastMark:this.toastMark,useCommandShortcut:l,mdPlugins:b}),this.preview=new dl(this.eventEmitter,h(h({},M),{isViewer:!1,highlight:this.options.previewHighlight})),this.wwEditor=new ou(this.eventEmitter,{toDOMAdaptor:S,useCommandShortcut:l,htmlSchemaMap:E,linkAttributes:p,wwPlugins:w,wwNodeViews:k}),this.convertor=new Iu(this.wwEditor.getSchema(),h(h({},y),a),Ya(p,M.customHTMLRenderer),this.eventEmitter),this.setMinHeight(this.options.minHeight),this.setHeight(this.options.height),this.setMarkdown(this.options.initialValue,!1),this.options.placeholder&&this.setPlaceholder(this.options.placeholder),this.options.initialValue||this.setHTML(this.initialHTML,!1),this.commandManager=new pu(this.eventEmitter,this.mdEditor.commands,this.wwEditor.commands,function(){return t.mode}),this.options.usageStatistics&&Q("editor","UA-129966929-1"),this.scrollSync=new Uu(this.mdEditor,this.preview,this.eventEmitter),this.addInitEvent(),this.addInitCommand(x,C),function(e){e.eventEmitter.listen("query",function(t,n){return Wu[t](e,n)})}(this),this.options.hooks&&g(this.options.hooks,function(e,n){return t.addHook(n,e)}),this.options.events&&g(this.options.events,function(e,n){return t.on(n,e)}),this.eventEmitter.emit("load",this),this.moveCursorToStart(this.options.autofocus)}return e.prototype.addInitEvent=function(){var e=this;this.on("needChangeMode",this.changeMode.bind(this)),this.on("loadUI",function(){if("auto"!==e.height){var t=Math.min(parseInt(e.minHeight,10),parseInt(e.height,10)-75)+"px";e.setMinHeight(t)}}),function(e){e.listen("addImageBlobHook",function(e,t){var n=new FileReader;n.onload=function(e){var n=e.target;return t(n.result)},n.readAsDataURL(e)})}(this.eventEmitter)},e.prototype.addInitCommand=function(e,t){var n=this,r=function(e,t){Object.keys(t).forEach(function(r){n.addCommand(e,r,t[r])})};this.addCommand("markdown","toggleScrollSync",function(e){return n.eventEmitter.emit("toggleScrollSync",e.active),!0}),r("markdown",e),r("wysiwyg",t)},e.prototype.getCurrentModeEditor=function(){return this.isMarkdownMode()?this.mdEditor:this.wwEditor},e.factory=function(t){return t.viewer?new Pu(t):new e(t)},e.setLanguage=function(e,t){Wl.setLanguage(e,t)},e.prototype.changePreviewStyle=function(e){this.mdPreviewStyle!==e&&(this.mdPreviewStyle=e,this.eventEmitter.emit("changePreviewStyle",e))},e.prototype.exec=function(e,t){this.commandManager.exec(e,t)},e.prototype.addCommand=function(e,t,n){var r=this;this.commandManager.addCommand(e,t,function(t){void 0===t&&(t={});var o=("markdown"===e?r.mdEditor:r.wwEditor).view;n(t,o.state,o.dispatch,o)})},e.prototype.on=function(e,t){this.eventEmitter.listen(e,t)},e.prototype.off=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.addHook=function(e,t){this.eventEmitter.removeEventHandler(e),this.eventEmitter.listen(e,t)},e.prototype.removeHook=function(e){this.eventEmitter.removeEventHandler(e)},e.prototype.focus=function(){this.getCurrentModeEditor().focus()},e.prototype.blur=function(){this.getCurrentModeEditor().blur()},e.prototype.moveCursorToEnd=function(e){void 0===e&&(e=!0),this.getCurrentModeEditor().moveCursorToEnd(e)},e.prototype.moveCursorToStart=function(e){void 0===e&&(e=!0),this.getCurrentModeEditor().moveCursorToStart(e)},e.prototype.setMarkdown=function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=!0),this.mdEditor.setMarkdown(e,t),this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r,t)}},e.prototype.setHTML=function(e,t){void 0===e&&(e=""),void 0===t&&(t=!0);var n=document.createElement("div");n.innerHTML=function(e){var t=e.replace(/<p><br\s*\/*><\/p>/gi,"<p></p>"),n=new RegExp(gt,"ig"),r=t.match(n);return null===r||void 0===r||r.forEach(function(e,n){if(yt.test(e)){var o=wt;if(n){var i=r[n-1].match(mt);if(i&&!/br/i.test(i[1])){var s=i[1];o="</"+s+"><"+s+">"}}t=t.replace(yt,o)}}),t}(e);var o=r.a.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(o),t):this.wwEditor.setModel(o,t)},e.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},e.prototype.getHTML=function(){var e=this;this.eventEmitter.holdEventInvoke(function(){if(e.isMarkdownMode()){var t=e.toastMark.getRootNode(),n=e.convertor.toWysiwygModel(t);e.wwEditor.setModel(n)}});var t=It(this.wwEditor.view.dom.innerHTML);if(this.placeholder){var n=new RegExp('<span class="placeholder[^>]+>'+this.placeholder+"</span>","i");return t.replace(n,"")}return t},e.prototype.insertText=function(e){this.getCurrentModeEditor().replaceSelection(e)},e.prototype.setSelection=function(e,t){this.getCurrentModeEditor().setSelection(e,t)},e.prototype.replaceSelection=function(e,t,n){this.getCurrentModeEditor().replaceSelection(e,t,n)},e.prototype.deleteSelection=function(e,t){this.getCurrentModeEditor().deleteSelection(e,t)},e.prototype.getSelectedText=function(e,t){return this.getCurrentModeEditor().getSelectedText(e,t)},e.prototype.getRangeInfoOfNode=function(e){return this.getCurrentModeEditor().getRangeInfoOfNode(e)},e.prototype.addWidget=function(e,t,n){this.getCurrentModeEditor().addWidget(e,t,n)},e.prototype.replaceWithWidget=function(e,t,n){this.getCurrentModeEditor().replaceWithWidget(e,t,n)},e.prototype.setHeight=function(e){var t=this.options.el;y(e)&&("auto"===e?z(t,"auto-height"):U(t,"auto-height"),this.setMinHeight(this.getMinHeight())),E(t,{height:e}),this.height=e},e.prototype.getHeight=function(){return this.height},e.prototype.setMinHeight=function(e){if(e!==this.minHeight){var t=this.height||this.options.height;"auto"!==t&&this.options.el.querySelector("."+Ct("main"))&&(e=Math.min(parseInt(e,10),parseInt(t,10)-75)+"px");var n=parseInt(e,10);this.minHeight=e,this.wwEditor.setMinHeight(n),this.mdEditor.setMinHeight(n),this.preview.setMinHeight(n)}},e.prototype.getMinHeight=function(){return this.minHeight},e.prototype.isMarkdownMode=function(){return"markdown"===this.mode},e.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},e.prototype.isViewer=function(){return!1},e.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},e.prototype.changeMode=function(e,t){if(this.mode!==e){if(this.mode=e,this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r)}else{r=this.wwEditor.getModel();this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),!t)}if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",e),!t){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&W(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},e.prototype.destroy=function(){var e=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach(function(t,n){return e.off(n)})},e.prototype.hide=function(){this.eventEmitter.emit("hide")},e.prototype.show=function(){this.eventEmitter.emit("show")},e.prototype.setScrollTop=function(e){this.getCurrentModeEditor().setScrollTop(e)},e.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},e.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},e.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},e.prototype.setPlaceholder=function(e){this.placeholder=e,this.mdEditor.setPlaceholder(e),this.wwEditor.setPlaceholder(e)},e.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},e.prototype.convertPosToMatchEditorMode=function(e,t,n){var r,o;void 0===t&&(t=e),void 0===n&&(n=this.mode);var i=this.mdEditor.view.state.doc,s=Array.isArray(e),a=Array.isArray(t),l=e,c=t;if(s!==a)throw new Error("Types of arguments must be same");return"markdown"!==n||s||a?"wysiwyg"===n&&s&&a&&(l=(o=Qt(i,e,t))[0],c=o[1]):(l=(r=Zt(i,e,t))[0],c=r[1]),[l,c]},e}();var Ku=function(e){return"boolean"==typeof e||e instanceof Boolean},Gu=function(){function e(e){this.current=e,this.root=e,this.entering=!0}return e.prototype.walk=function(){var e=this.entering,t=this.current;return t?(e?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:t.next?(this.current=t.next,this.entering=!0):(this.current=t.parent,this.entering=!1),{vnode:t,entering:e}):null},e}(),Zu=function(){function e(e,t,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=e,this.props=t,this.children=n,this.props.children=n,t.ref&&(this.ref=t.ref,delete t.ref),t.key&&(this.key=t.key,delete t.key)}return e.prototype.walker=function(){return new Gu(this)},e.removalNodes=[],e}();function Xu(e,t){var n=e;Ku(e)||null==e?n=null:(y(e)||W(e))&&(n=function(e){return new Zu("TEXT_NODE",{nodeValue:e},[])}(String(e))),n&&t.push(n)}var Qu=function(e){for(var t,n,r=arguments,o=1,i="",s="",a=[0],l=function(e){1===o&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(e?r[e]:i):3===o&&(e||i)?(a[1]=e?r[e]:i,o=2):2===o&&"..."===i&&e?a[2]=Te(a[2]||{},r[e]):2===o&&i&&!e?(a[2]=a[2]||{})[i]=!0:o>=5&&(5===o?((a[2]=a[2]||{})[n]=e?i?i+r[e]:r[e]:i,o=6):(e||i)&&(a[2][n]+=e?i+r[e]:i)),i=""},c=0;c<e.length;c++){c&&(1===o&&l(),l(c));for(let r=0;r<e[c].length;r++)t=e[c][r],1===o?"<"===t?(l(),a=[a,"",null],o=3):i+=t:4===o?"--"===i&&">"===t?(o=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(l(),o=1):o&&("="===t?(o=5,n=i,i=""):"/"===t&&(o<5||">"===e[c][r+1])?(l(),3===o&&(a=a[0]),o=a,(a=a[0]).push(this.apply(null,o.slice(1))),o=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(l(),o=2):i+=t),3===o&&"!--"===i&&(o=4,a=a[0])}return l(),a.length>2?a.slice(1):a[1]}.bind(function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=[];return n.forEach(function(e){Array.isArray(e)?e.forEach(function(e){Xu(e,o)}):Xu(e,o)}),new Zu(e,t||{},o)});var Yu=function(e){return e===Object(e)};function ed(e){var t;return"TEXT_NODE"===e.type?t=document.createTextNode(e.props.nodeValue):od(t=document.createElement(e.type),{},e.props),t}function td(e,t){e.node?t.removeChild(e.node):td(e.firstChild,t)}function nd(e,t,n){Object.keys(t).forEach(function(r){if(/^on/.test(r)){if(!n[r]||t[r]!==n[r]){var o=r.slice(2).toLowerCase();e.removeEventListener(o,t[r])}}else"children"===r||n[r]||function(e){return(null===e||void 0===e?void 0:e.nodeType)===Node.TEXT_NODE}(e)||e.removeAttribute(r)}),od(e,t,n,function(e){return!ye(t[e],n[e])})}var rd=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function od(e,t,n,r){Object.keys(n).forEach(function(o){if(!r||r(o))if(/^on/.test(o)){var i=o.slice(2).toLowerCase();e.addEventListener(i,n[o])}else"nodeValue"===o?e[o]=n[o]:"style"===o&&Yu(n[o])?function(e,t,n){t&&Object.keys(t).forEach(function(t){e.style[t]=""});Object.keys(n).forEach(function(t){var r=n[t];e.style[t]=W(r)&&!rd.test(t)?r+"px":r})}(e,t[o],n[o]):"children"!==o&&(!1===n[o]?e.removeAttribute(o):e.setAttribute(o,n[o]))})}function id(e){if(Zu.removalNodes.forEach(function(e){return ad(e)}),e)for(var t=void 0,n=e.walker();t=n.walk();)if(e=t.vnode,t.entering)ad(e);else if($t(e.type)){var r=e.component;if(!e.old&&r.mounted&&r.mounted(),e.old&&r.updated){var o=r.prevProps||{};r.updated(o)}}}function sd(e){for(var t=e.parent;!t.node;)t=t.parent;return t.node}function ad(e){if(e&&e.parent){if(e.node){var t=sd(e);"A"===e.effect?t.appendChild(e.node):"U"===e.effect&&nd(e.node,e.old.props,e.props)}if("D"===e.effect)for(var n=void 0,r=e.walker();n=r.walk();)if(e=n.vnode,!n.entering)if($t(e.type)){var o=e.component;o.beforeDestroy&&o.beforeDestroy()}else{td(e,t=sd(e))}e.ref&&(e.component?e.ref(e.component):e.node&&e.ref(e.node))}}function ld(e,t){var n=t.props,r=t.component;return r?(r.prevProps=r.props,r.props=t.props,r):new e(n)}function cd(e){for(var t=e;e&&!e.skip;){if($t(e.type)){var n=ld(e.type,e);n.vnode=e,e.component=n,e.props.children=e.children=[n.render()],ud(e)}else e.node||(e.node=ed(e)),ud(e);if(e.firstChild)e=e.firstChild;else{for(;e&&e.parent&&!e.next&&(e=e.parent)!==t;);e=e.next}}}function ud(e){var t=e.children,n=e.old?e.old.firstChild:null,r=null;t.forEach(function(t,o){var i=function(e,t){return e&&t&&t.type===e.type&&(!t.key||t.key===e.key)}(n,t);i&&(t.old=n,t.parent=e,t.node=n.node,t.component=n.component,t.effect="U"),t&&!i&&(t.old=null,t.parent=e,t.node=null,t.effect="A"),n&&!i&&(Zu.removalNodes.push(n),n.effect="D"),n&&(n=n.next),0===o?e.firstChild=t:t&&(r.next=t),r=t});var o=be(t);if(!t.length)for(;n;)Zu.removalNodes.push(n),n.effect="D",n=n.next;for(;n&&o;)n&&o.old!==n&&(Zu.removalNodes.push(n),n.effect="D",n=n.next)}function dd(e,t){var n=new Zu(e.tagName.toLowerCase(),{},[t]);return n.node=e,Zu.removalNodes=[],cd(n),id(n),function(){return function(e){e.effect="D",Zu.removalNodes=[e],id(),Zu.removalNodes=[]}(n.firstChild)}}var pd,hd=function(){function e(e){this.props=e,this.state={},this.refs={}}return e.prototype.setState=function(e){var t=h(h({},this.state),e);ye(this.state,t)||(this.state=t,function(e){var t=e.vnode;t.effect="U",t.old=t,t.next&&(t.next.skip=!0),Zu.removalNodes=[],cd(t),id(t),t.next&&(t.next.skip=!1)}(this))},e}(),fd=function(e){function t(t){var n=e.call(this,t)||this;return n.state={hide:!1},n}return p(t,e),t.prototype.show=function(){this.setState({hide:!1})},t.prototype.hide=function(){this.setState({hide:!0})},t.prototype.render=function(){var e=this.props,t=e.editorType,n=e.eventEmitter;return Qu(pd||(pd=m(['\n <div class="','" style="display: ','">\n <div\n class="tab-item','"\n onClick=',"\n >\n ",'\n </div>\n <div\n class="tab-item','"\n onClick=',"\n >\n ","\n </div>\n </div>\n "],['\n <div class="','" style="display: ','">\n <div\n class="tab-item','"\n onClick=',"\n >\n ",'\n </div>\n <div\n class="tab-item','"\n onClick=',"\n >\n ","\n </div>\n </div>\n "])),Ct("mode-switch"),this.state.hide?"none":"block","markdown"===t?" active":"",function(){n.emit("needChangeMode","markdown")},Wl.get("Markdown"),"wysiwyg"===t?" active":"",function(){n.emit("needChangeMode","wysiwyg")},Wl.get("WYSIWYG"))},t}(hd);var md=function(e,t){var n,r;return t=t||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout(function(){e.apply(null,r)},t)}};var gd=function(e,t){var n,r,o,i,s=!0,a=function(t){e.apply(null,t),n=null};function l(){if(i=Array.prototype.slice.call(arguments),s)return a(i),void(s=!1);o=Number(new Date),n=n||o,r(i),o-n>=t&&a(i)}return r=md(a,t=t||0),l.reset=function(){s=!0,n=null},l},vd=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];e.call(t,o[1],o[0])}},t}()}(),yd="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,bd=void 0!==e&&e.Math===Math?e:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),wd="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(bd):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},kd=2;var xd=20,Cd=["top","right","bottom","left","width","height","size","weight"],Td="undefined"!=typeof MutationObserver,Md=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&a()}function s(){wd(i)}function a(){var e=Date.now();if(n){if(e-o<kd)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=e}return a}(this.refresh.bind(this),xd)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){yd&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Td?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){yd&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;Cd.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Sd=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},Ed=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||bd},Nd=Rd(0,0,0,0);function Od(e){return parseFloat(e)||0}function Dd(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(t,n){return t+Od(e["border-"+n+"-width"])},0)}function Ad(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Nd;var r=Ed(e).getComputedStyle(e),o=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],i=e["padding-"+o];t[o]=Od(i)}return t}(r),i=o.left+o.right,s=o.top+o.bottom,a=Od(r.width),l=Od(r.height);if("border-box"===r.boxSizing&&(Math.round(a+i)!==t&&(a-=Dd(r,"left","right")+i),Math.round(l+s)!==n&&(l-=Dd(r,"top","bottom")+s)),!function(e){return e===Ed(e).document.documentElement}(e)){var c=Math.round(a+i)-t,u=Math.round(l+s)-n;1!==Math.abs(c)&&(a-=c),1!==Math.abs(u)&&(l-=u)}return Rd(o.left,o.top,a,l)}var Ld="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof Ed(e).SVGGraphicsElement}:function(e){return e instanceof Ed(e).SVGElement&&"function"==typeof e.getBBox};function Id(e){return yd?Ld(e)?function(e){var t=e.getBBox();return Rd(0,0,t.width,t.height)}(e):Ad(e):Nd}function Rd(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Pd=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Rd(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=Id(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),Bd=function(){return function(e,t){var n=function(e){var t=e.x,n=e.y,r=e.width,o=e.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(i.prototype);return Sd(s,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),s}(t);Sd(this,{target:e,contentRect:n})}}(),Fd=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new vd,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Ed(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new Pd(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Ed(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new Bd(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Hd="undefined"!=typeof WeakMap?new WeakMap:new vd,jd=function(){return function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Md.getInstance(),r=new Fd(t,n,this);Hd.set(this,r)}}();["observe","unobserve","disconnect"].forEach(function(e){jd.prototype[e]=function(){var t;return(t=Hd.get(this))[e].apply(t,arguments)}});var zd,qd,Vd,$d,_d,Ud,Wd,Jd,Kd,Gd,Zd,Xd,Qd,Yd,ep,tp,np=void 0!==bd.ResizeObserver?bd.ResizeObserver:jd,rp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.execCommand=function(e){var t=Dt(e.target,"li");this.props.execCommand("heading",{level:Number(t.getAttribute("data-level"))})},t.prototype.render=function(){var e=this;return Qu(qd||(qd=m(["\n <ul\n onClick=",'\n aria-role="menu"\n aria-label="','"\n >\n ','\n <li data-type="Paragraph" aria-role="menuitem">\n <div>',"</div>\n </li>\n </ul>\n "],["\n <ul\n onClick=",'\n aria-role="menu"\n aria-label="','"\n >\n ','\n <li data-type="Paragraph" aria-role="menuitem">\n <div>',"</div>\n </li>\n </ul>\n "])),function(t){return e.execCommand(t)},Wl.get("Headings"),[1,2,3,4,5,6].map(function(e){return Qu(zd||(zd=m(['\n <li data-level="','" data-type="Heading" aria-role="menuitem">\n <',">"," ","</$>\n </li>\n "],['\n <li data-level="','" data-type="Heading" aria-role="menuitem">\n <',">"," ","</$>\n </li>\n "])),e,"h"+e,Wl.get("Heading"),e)}),Wl.get("Paragraph"))},t}(hd),op=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.toggleTab=function(e,t){this.props.onClick(e,t)},t.prototype.render=function(){var e=this;return Qu($d||($d=m(['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "],['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "])),Ct("tabs"),this.props.tabs.map(function(t){var n=t.name,r=t.text,o=e.props.activeTab===n;return Qu(Vd||(Vd=m(['\n <div\n class="tab-item','"\n onClick=','\n aria-role="tab"\n aria-label="','"\n aria-selected="','"\n tabindex="','"\n >\n ',"\n </div>\n "],['\n <div\n class="tab-item','"\n onClick=','\n aria-role="tab"\n aria-label="','"\n aria-selected="','"\n tabindex="','"\n >\n ',"\n </div>\n "])),o?" active":"",function(t){return e.toggleTab(t,n)},Wl.get(r),o?"true":"false",o?"0":"-1",Wl.get(r))}))},t}(hd),ip=function(e){function t(t){var n=e.call(this,t)||this;return n.initialize=function(e){void 0===e&&(e="file");var t=n.refs.url;t.value="",n.refs.altText.value="",n.refs.file.value="",U(t,"wrong"),n.setState({activeTab:e,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(e,t){t!==n.state.activeTab&&n.initialize(t)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(e){var t=e.target.files;(null===t||void 0===t?void 0:t.length)&&n.setState({file:t[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return p(t,e),t.prototype.emitAddImageBlob=function(){var e=this,t=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null===t||void 0===t?void 0:t.length){r="";var o=t.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,function(t,r){return e.props.execCommand("addImage",{imageUrl:t,altText:r||n.value})},"ui")}this.setState({fileNameElClassName:r})},t.prototype.emitAddImage=function(){var e=this.refs.url,t=this.refs.altText,n=e.value,r=t.value||"image";U(e,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):z(e,"wrong")},t.prototype.preventSelectStart=function(e){e.preventDefault()},t.prototype.updated=function(){this.props.show||this.initialize()},t.prototype.render=function(){var e=this,t=this.state,n=t.activeTab,r=t.file,o=t.fileNameElClassName;return Qu(_d||(_d=m(['\n <div aria-label="','">\n <'," tabs="," activeTab="," onClick=",' />\n <div style="display:','">\n <label for="toastuiImageUrlInput">','</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=','\n />\n </div>\n <div style="display:',';position: relative;">\n <label for="toastuiImageFileInput">','</label>\n <span\n class="',"",'"\n onClick=',"\n onSelectstart=","\n >\n ",'\n </span>\n <button\n type="button"\n class="','"\n onClick=',"\n >\n ",'\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=',"\n ref=",'\n />\n </div>\n <label for="toastuiAltTextInput">','</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "],['\n <div aria-label="','">\n <'," tabs="," activeTab="," onClick=",' />\n <div style="display:','">\n <label for="toastuiImageUrlInput">','</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=','\n />\n </div>\n <div style="display:',';position: relative;">\n <label for="toastuiImageFileInput">','</label>\n <span\n class="',"",'"\n onClick=',"\n onSelectstart=","\n >\n ",'\n </span>\n <button\n type="button"\n class="','"\n onClick=',"\n >\n ",'\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=',"\n ref=",'\n />\n </div>\n <label for="toastuiAltTextInput">','</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "])),Wl.get("Insert image"),op,this.tabs,n,this.toggleTab,"url"===n?"block":"none",Wl.get("Image URL"),function(t){return e.refs.url=t},"file"===n?"block":"none",Wl.get("Select image file"),Ct("file-name"),r?" has-file":o,this.showFileSelectBox,this.preventSelectStart,r?r.name:Wl.get("No file"),Ct("file-select-button"),this.showFileSelectBox,Wl.get("Choose a file"),this.changeFile,function(t){return e.refs.file=t},Wl.get("Description"),function(t){return e.refs.altText=t},Ct("button-container"),Ct("close-button"),this.props.hidePopup,Wl.get("Cancel"),Ct("ok-button"),this.execCommand,Wl.get("OK"))},t}(hd),sp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.execCommand=function(){var e=t.refs.url,n=t.refs.text;(U(e,"wrong"),U(n,"wrong"),e.value.length<1)?z(e,"wrong"):D(t.props.initialValues.linkUrl)&&n.value.length<1?z(n,"wrong"):t.props.execCommand("addLink",{linkUrl:e.value,linkText:n.value})},t}return p(t,e),t.prototype.initialize=function(){var e=this.props.initialValues,t=e.linkUrl,n=e.linkText,r=this.refs.url,o=this.refs.text;U(r,"wrong"),U(o,"wrong","disabled"),o.removeAttribute("disabled"),t&&(z(o,"disabled"),o.setAttribute("disabled","disabled")),r.value=t||"",o.value=n||""},t.prototype.mounted=function(){this.initialize()},t.prototype.updated=function(e){!e.show&&this.props.show&&this.initialize()},t.prototype.render=function(){var e=this;return Qu(Ud||(Ud=m(['\n <div aria-label="','">\n <label for="toastuiLinkUrlInput">','</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=','\n />\n <label for="toastuiLinkTextInput">','</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "],['\n <div aria-label="','">\n <label for="toastuiLinkUrlInput">','</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=','\n />\n <label for="toastuiLinkTextInput">','</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "])),Wl.get("Insert link"),Wl.get("URL"),function(t){return e.refs.url=t},Wl.get("Link text"),function(t){return e.refs.text=t},Ct("button-container"),Ct("close-button"),this.props.hidePopup,Wl.get("Cancel"),Ct("ok-button"),this.execCommand,Wl.get("OK"))},t}(hd),ap=function(e){function t(t){var n=e.call(this,t)||this;return n.extendSelectionRange=function(e){var t=e.pageX,r=e.pageY,o=t-n.offsetRect.left,i=r-n.offsetRect.top,s=n.getSelectionRangeByOffset(o,i);n.setState(h({},s))},n.execCommand=function(){n.props.execCommand("addTable",{rowCount:n.state.rowIdx+1,columnCount:n.state.colIdx+1})},n.state={rowIdx:-1,colIdx:-1},n}return p(t,e),t.prototype.getDescription=function(){return-1===this.state.colIdx?"":this.state.colIdx+1+" x "+(this.state.rowIdx+1)},t.prototype.getBoundByRange=function(e,t){return{width:20*(e+1),height:20*(t+1)}},t.prototype.getRangeByOffset=function(e,t){return{colIdx:Math.floor(e/20),rowIdx:Math.floor(t/20)}},t.prototype.getTableRange=function(){var e=this.state,t=e.colIdx,n=e.rowIdx,r=Math.max(t,5),o=Math.max(n,5);return t>=5&&r<9&&(r+=1),n>=5&&o<14&&(o+=1),{colIdx:r+1,rowIdx:o+1}},t.prototype.getSelectionAreaBound=function(){var e=this.getBoundByRange(this.state.colIdx,this.state.rowIdx),t=e.width,n=e.height;return t||n?{width:t-1,height:n-1,display:"block"}:{display:"none"}},t.prototype.getSelectionRangeByOffset=function(e,t){var n=this.getRangeByOffset(e,t);return n.rowIdx=Math.min(Math.max(n.rowIdx,1),14),n.colIdx=Math.min(Math.max(n.colIdx,1),9),n},t.prototype.updated=function(){if(this.props.show){if(-1===this.state.colIdx&&-1===this.state.rowIdx){var e=this.refs.tableEl.getBoundingClientRect(),t=e.left,n=e.top;this.offsetRect={left:window.pageXOffset+t,top:window.pageYOffset+n}}}else this.setState({colIdx:-1,rowIdx:-1})},t.prototype.createTableArea=function(e){for(var t=e.colIdx,n=e.rowIdx,r=[],o=0;o<n;o+=1){for(var i=[],s=0;s<t;s+=1){var a=Ct("table-cell")+(o>0?"":" header");i.push(Qu(Wd||(Wd=m(['<div class="','"></div>'],['<div class="','"></div>'])),a))}r.push(Qu(Jd||(Jd=m(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Ct("table-row"),i))}return Qu(Kd||(Kd=m(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Ct("table"),r)},t.prototype.render=function(){var e=this,t=this.getTableRange(),n=this.getSelectionAreaBound();return Qu(Gd||(Gd=m(['\n <div aria-label="','">\n <div\n class="','"\n ref=',"\n onMousemove=","\n onClick=","\n >\n ",'\n <div class="','" style=','></div>\n </div>\n <p class="','">',"</p>\n </div>\n "],['\n <div aria-label="','">\n <div\n class="','"\n ref=',"\n onMousemove=","\n onClick=","\n >\n ",'\n <div class="','" style=','></div>\n </div>\n <p class="','">',"</p>\n </div>\n "])),Wl.get("Insert table"),Ct("table-selection"),function(t){return e.refs.tableEl=t},this.extendSelectionRange,this.execCommand,this.createTableArea(t),Ct("table-selection-layer"),n,Ct("table-description"),this.getDescription())},t}(hd),lp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},t.prototype.updated=function(e){this.refs.el.replaceChild(this.props.body,e.body)},t.prototype.render=function(){var e=this;return Qu(Zd||(Zd=m(["<div ref=","></div>"],["<div ref=","></div>"])),function(t){return e.refs.el=t})},t}(hd);function cp(e){return y(e)?function(e){var t;switch(e){case"heading":t={name:"heading",className:"heading",tooltip:Wl.get("Headings"),state:"heading"};break;case"bold":t={name:"bold",className:"bold",command:"bold",tooltip:Wl.get("Bold"),state:"strong"};break;case"italic":t={name:"italic",className:"italic",command:"italic",tooltip:Wl.get("Italic"),state:"emph"};break;case"strike":t={name:"strike",className:"strike",command:"strike",tooltip:Wl.get("Strike"),state:"strike"};break;case"hr":t={name:"hr",className:"hrline",command:"hr",tooltip:Wl.get("Line"),state:"thematicBreak"};break;case"quote":t={name:"quote",className:"quote",command:"blockQuote",tooltip:Wl.get("Blockquote"),state:"blockQuote"};break;case"ul":t={name:"ul",className:"bullet-list",command:"bulletList",tooltip:Wl.get("Unordered list"),state:"bulletList"};break;case"ol":t={name:"ol",className:"ordered-list",command:"orderedList",tooltip:Wl.get("Ordered list"),state:"orderedList"};break;case"task":t={name:"task",className:"task-list",command:"taskList",tooltip:Wl.get("Task"),state:"taskList"};break;case"table":t={name:"table",className:"table",tooltip:Wl.get("Insert table"),state:"table"};break;case"image":t={name:"image",className:"image",tooltip:Wl.get("Insert image")};break;case"link":t={name:"link",className:"link",tooltip:Wl.get("Insert link")};break;case"code":t={name:"code",className:"code",command:"code",tooltip:Wl.get("Code"),state:"code"};break;case"codeblock":t={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:Wl.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":t={name:"indent",className:"indent",command:"indent",tooltip:Wl.get("Indent"),state:"indent"};break;case"outdent":t={name:"outdent",className:"outdent",command:"outdent",tooltip:Wl.get("Outdent"),state:"outdent"};break;case"scrollSync":t=function(){var e=document.createElement("label"),t=document.createElement("input"),n=document.createElement("span");e.className="scroll-sync active",t.type="checkbox",t.checked=!0,n.className="switch";return e.appendChild(t),e.appendChild(n),{name:"scrollSync",el:e,onMounted:function(n){return t.addEventListener("change",function(t){var r=t.target.checked;r?z(e,"active"):U(e,"active"),n("toggleScrollSync",{active:r})})}}}();break;case"more":t={name:"more",className:"more",tooltip:Wl.get("More")}}"scrollSync"!==t.name&&(t.className+=" "+Ct("toolbar-icons"));return t}(e):e}function up(e,t){var n=t.el,r=t.pos,o=t.popup,i=t.initialValues;switch(e){case"heading":return{render:function(e){return Qu(Xd||(Xd=m(["<"," ..."," />"],["<"," ..."," />"])),rp,e)},className:Ct("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(e){return Qu(Qd||(Qd=m(["<"," ..."," />"],["<"," ..."," />"])),sp,e)},className:Ct("popup-add-link"),fromEl:n,pos:r,initialValues:i};case"image":return{render:function(e){return Qu(Yd||(Yd=m(["<"," ..."," />"],["<"," ..."," />"])),ip,e)},className:Ct("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(e){return Qu(ep||(ep=m(["<"," ..."," />"],["<"," ..."," />"])),ap,e)},className:Ct("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return o?h({render:function(e){return Qu(tp||(tp=m(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),lp,e,o.body)},fromEl:n,pos:r},o):null;default:return null}}function dp(e){e.hidden=e.length===e.filter(function(e){return e.hidden}).length}function pp(e,t){return e.reduce(function(e,n){e.push(n.map(function(e){return function(e){return e.hidden="scrollSync"===e.name&&t,e}(cp(e))}));var r=e[(e.length||1)-1];return r&&dp(r),e},[])}var hp,fp,mp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handleMousedown=function(e){Dt(e.target,"."+Ct("popup"))||Dt(e.target,t.props.info.fromEl)||t.props.hidePopup()},t}return p(t,e),t.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},t.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},t.prototype.updated=function(e){var t=this.props,n=t.show,r=t.info;if(n&&r.pos&&e.show!==n){var o=h({},r.pos),i=this.refs.el.offsetWidth,s=Dt(this.refs.el,"."+Ct("toolbar")).offsetWidth;o.left+i>=s&&(o.left=s-i-20),ye(this.state.popupPos,o)||this.setState({popupPos:o})}},t.prototype.render=function(){var e=this,t=this.props,n=t.info,r=t.show,o=t.hidePopup,i=t.eventEmitter,s=t.execCommand,a=n||{},l=a.className,c=void 0===l?"":l,u=a.style,d=a.render,p=a.initialValues,f=void 0===p?{}:p,g=h(h({display:r?"block":"none"},u),this.state.popupPos);return Qu(hp||(hp=m(['\n <div\n class="'," ",'"\n style=',"\n ref=",'\n aria-role="dialog"\n >\n <div class="','">\n ',"\n </div>\n </div>\n "],['\n <div\n class="'," ",'"\n style=',"\n ref=",'\n aria-role="dialog"\n >\n <div class="','">\n ',"\n </div>\n </div>\n "])),Ct("popup"),c,g,function(t){return e.refs.el=t},Ct("popup-body"),d&&d({eventEmitter:i,show:r,hidePopup:o,execCommand:s,initialValues:f}))},t}(hd),gp=6;function vp(e){return function(t){function n(e){var n=t.call(this,e)||this;return n.showTooltip=function(e){var t=n.props.item.tooltip;if(!n.props.disabled&&t){var r=n.getBound(e),o=r.left+gp+"px",i=r.top+gp+"px";E(n.props.tooltipRef.current,{display:"block",left:o,top:i}),n.props.tooltipRef.current.querySelector(".text").textContent=t}},n.hideTooltip=function(){E(n.props.tooltipRef.current,"display","none")},n.state={active:!1,disabled:e.disabled},n.addEvent(),n}return p(n,t),n.prototype.addEvent=function(){var e=this,t=this.props,n=t.item,r=t.eventEmitter;n.state&&r.listen("changeToolbarState",function(t){var r,o=null!==(r=t.toolbarState[n.state])&&void 0!==r?r:{},i=o.active,s=o.disabled;e.setState({active:!!i,disabled:null!==s&&void 0!==s?s:e.props.disabled})})},n.prototype.getBound=function(e){var t=At(e,Dt(e,"."+Ct("toolbar"))),n=t.offsetLeft,r=t.offsetTop;return{left:n,top:e.offsetHeight+r}},n.prototype.render=function(){return Qu(fp||(fp=m(["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n disabled=","\n />\n "],["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n disabled=","\n />\n "])),e,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound,this.state.disabled||this.props.disabled)},n}(hd)}var yp,bp,wp,kp,xp,Cp,Tp,Mp,Sp,Ep,Np,Op,Dp,Ap,Lp=vp(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.showTooltip=function(){t.props.showTooltip(t.refs.el)},t.execCommand=function(){var e=t.props,n=e.item,r=e.execCommand,o=e.setPopupInfo,i=e.getBound,s=e.eventEmitter,a=n.command,l=n.name,c=n.popup;if(a)r(a);else{var u=c?"customPopupBody":l,d=s.emit("query","getPopupInitialValues",{popupName:u})[0],p=up(u,{el:t.refs.el,pos:i(t.refs.el),popup:c,initialValues:d});p&&o(p)}},t}return p(t,e),t.prototype.mounted=function(){this.setItemWidth()},t.prototype.updated=function(e){e.item.name!==this.props.item.name&&this.setItemWidth()},t.prototype.setItemWidth=function(){var e=this.props,t=e.setItemWidth,n=e.item;t&&t(n.name,Ot(this.refs.el)+(n.hidden?80:0))},t.prototype.render=function(){var e=this,t=this.props,n=t.hideTooltip,r=t.disabled,o=t.item,i=t.active,s=h({display:o.hidden?"none":null},o.style),a=(o.className||"")+(i?" active":"");return Qu(yp||(yp=m(["\n <button\n ref=",'\n type="button"\n style=',"\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=","\n aria-label=","\n >\n ","\n </button>\n "],["\n <button\n ref=",'\n type="button"\n style=',"\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=","\n aria-label=","\n >\n ","\n </button>\n "])),function(t){return e.refs.el=t},s,a,this.execCommand,this.showTooltip,n,!!r,o.text||o.tooltip||"",o.text||"")},t}(hd)),Ip=vp(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.showTooltip=function(){t.props.showTooltip(t.refs.el)},t.showPopup=function(){var e=up("customPopupBody",{el:t.refs.el,pos:t.props.getBound(t.refs.el),popup:t.props.item.popup});e&&t.props.setPopupInfo(e)},t}return p(t,e),t.prototype.mounted=function(){var e=this.props,t=e.setItemWidth,n=e.item;this.refs.el.appendChild(n.el),t&&t(n.name,Ot(this.refs.el)),n.onMounted&&n.onMounted(this.props.execCommand)},t.prototype.updated=function(e){var t,n=this.props,r=n.item,o=n.active,i=n.disabled;e.active===o&&e.disabled===i||null===(t=r.onUpdated)||void 0===t||t.call(r,{active:o,disabled:i})},t.prototype.render=function(){var e=this,t=this.props,n=t.disabled,r={display:t.item.hidden?"none":"inline-block"},o=function(e){return n?null:e};return Qu(bp||(bp=m(["\n <div\n ref=","\n style=","\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n ></div>\n "],["\n <div\n ref=","\n style=","\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n ></div>\n "])),function(t){return e.refs.el=t},r,Ct("toolbar-item-wrapper"),o(this.showPopup),o(this.showTooltip),o(this.props.hideTooltip))},t}(hd)),Rp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.group,r=t.hiddenDivider,o=n.hidden?{display:"none"}:null,i=r?{display:"none"}:null;return Qu(kp||(kp=m(['\n <div class="','" style=',">\n ",'\n <div class="','" style=',"></div>\n </div>\n "],['\n <div class="','" style=',">\n ",'\n <div class="','" style=',"></div>\n </div>\n "])),Ct("toolbar-group"),o,n.map(function(t){var n=t.el?Ip:Lp;return Qu(wp||(wp=m(["<"," key="," ..."," item="," />"],["<"," key="," ..."," item="," />"])),n,t.name,e.props,t)}),Ct("toolbar-divider"),i)},t}(hd),Pp=vp(function(e){function t(t){var n=e.call(this,t)||this;return n.handleClickDocument=function(e){var t=e.target;Dt(t,"."+Ct("dropdown-toolbar"))||Dt(t,".more")||n.setState({showDropdown:!1,dropdownPos:null})},n.showTooltip=function(){n.props.showTooltip(n.refs.el)},n.state={showDropdown:!1,dropdownPos:null},n}return p(t,e),t.prototype.getBound=function(){var e=this.props.getBound(this.refs.el);return e.top+=4,h(h({},e),{left:null,right:10})},t.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},t.prototype.updated=function(){this.state.showDropdown&&!this.state.dropdownPos&&this.setState({dropdownPos:this.getBound()})},t.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},t.prototype.render=function(){var e=this,t=this.state,n=t.showDropdown,r=t.dropdownPos,o=this.props,i=o.disabled,s=o.item,a=o.items,l=o.hideTooltip,c=a.filter(function(e){return!e.hidden}),u=c.length?null:{display:"none"},d=n?null:{display:"none"};return Qu(Cp||(Cp=m(['\n <div class="','" style=',">\n <button\n ref=",'\n type="button"\n class=',"\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=",'\n ></button>\n <div\n class="','"\n style=',"\n ref=","\n >\n ","\n </div>\n </div>\n "],['\n <div class="','" style=',">\n <button\n ref=",'\n type="button"\n class=',"\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=",'\n ></button>\n <div\n class="','"\n style=',"\n ref=","\n >\n ","\n </div>\n </div>\n "])),Ct("toolbar-group"),u,function(t){return e.refs.el=t},s.className,function(){return e.setState({showDropdown:!0})},this.showTooltip,l,i,Ct("dropdown-toolbar"),h(h({},d),r),function(t){return e.refs.dropdownEl=t},c.length?c.map(function(t,n){var r;return Qu(xp||(xp=m(["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "])),Rp,t,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),e.props)}):null)},t}(hd)),Bp=function(e){function t(t){var n=e.call(this,t)||this;return n.toggleTab=function(e,t){var r=n.props.eventEmitter;if(n.state.activeTab!==t){var o="write"===t?"changePreviewTabWrite":"changePreviewTabPreview";r.emit(o),n.setState({activeTab:t})}},n.setItemWidth=function(e,t){n.itemWidthMap[e]=t},n.setPopupInfo=function(e){n.setState({showPopup:!0,popupInfo:e})},n.openPopup=function(e,t){void 0===t&&(t={});var r=n.refs.el.querySelector("."+Ct("toolbar-group")+" ."+e);if(r){var o=At(r,Dt(r,"."+Ct("toolbar"))),i=o.offsetLeft,s=o.offsetTop,a=up(e,{el:r,pos:{left:i,top:r.offsetHeight+s},initialValues:t});a&&n.setPopupInfo(a)}},n.hidePopup=function(){n.state.showPopup&&n.setState({showPopup:!1})},n.execCommand=function(e,t){n.props.eventEmitter.emit("command",e,t),n.hidePopup()},n.tabs=[{name:"write",text:"Write"},{name:"preview",text:"Preview"}],n.itemWidthMap={},n.initialItems=pp(t.toolbarItems||[],n.hiddenScrollSync()),n.state={items:n.initialItems,dropdownItems:[],showPopup:!1,popupInfo:{},activeTab:"write"},n.tooltipRef={current:null},n.resizeObserver=new np(function(){return n.handleResize()}),n.addEvent(),n}return p(t,e),t.prototype.insertToolbarItem=function(e,t){var n=e.groupIndex,r=e.itemIndex,o=this.initialItems[n];t=cp(t),o?o.splice(r,0,t):this.initialItems.push([t]),this.setState(this.classifyToolbarItems())},t.prototype.removeToolbarItem=function(e){var t=this;w(this.initialItems,function(n){var r=!1;return w(n,function(o,i){return o.name!==e||(r=!0,n.splice(i,1),t.setState(t.classifyToolbarItems()),!1)}),!r})},t.prototype.addEvent=function(){var e=this,t=this.props.eventEmitter;this.handleResize=gd(function(){e.setState({items:e.initialItems,dropdownItems:[]}),e.setState(e.classifyToolbarItems())},200),t.listen("openPopup",this.openPopup)},t.prototype.appendTooltipToRoot=function(){var e='<div class="'+Ct("tooltip")+'" style="display:none">\n <div class="arrow"></div>\n <span class="text"></span>\n </div>';this.tooltipRef.current=Nt(e,this.refs.el)},t.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},t.prototype.movePrevItemToDropdownToolbar=function(e,t,n,r){var o=function(e){var t=e.pop();t&&r.push(t)};if(e>1)o(n);else{var i=be(t);i&&o(i)}},t.prototype.classifyToolbarItems=function(){var e=this,t=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+Ct("toolbar-divider")),o=r?Ot(r):0,i=[],s=[],a=!1;return this.initialItems.forEach(function(r,l){var c=[],u=[];r.forEach(function(r,o){r.hidden||((t+=e.itemWidthMap[r.name])>n-50?(a||(e.movePrevItemToDropdownToolbar(o,i,c,u),a=!0),u.push(r)):c.push(r))}),c.length&&(dp(c),i.push(c)),u.length&&(dp(u),s.push(u)),l<e.state.items.length-1&&(t+=o)}),{items:i,dropdownItems:s}},t.prototype.mounted=function(){"tab"===this.props.previewStyle&&this.props.eventEmitter.emit("changePreviewTabWrite",!0),this.setState(this.classifyToolbarItems()),this.appendTooltipToRoot(),this.resizeObserver.observe(this.refs.el)},t.prototype.updated=function(e){var t=this.props,n=t.editorType,r=t.previewStyle,o=t.eventEmitter,i=r!==e.previewStyle,s=n!==e.editorType;if(i||s){!function(e,t){e.forEach(function(e){e.forEach(function(e){return e.hidden="scrollSync"===e.name&&t}),dp(e)})}(this.initialItems,this.hiddenScrollSync());var a=this.classifyToolbarItems();(i||"tab"===r&&"markdown"===n)&&(o.emit("changePreviewTabWrite"),a.activeTab="write"),this.setState(a)}},t.prototype.beforeDestroy=function(){window.removeEventListener("resize",this.handleResize),this.resizeObserver.disconnect(),St(this.tooltipRef.current)},t.prototype.render=function(){var e=this,t=this.props,n=t.previewStyle,r=t.eventEmitter,o=t.editorType,i=this.state,s=i.popupInfo,a=i.showPopup,l=i.activeTab,c=i.items,u=i.dropdownItems,d={eventEmitter:r,tooltipRef:this.tooltipRef,disabled:"markdown"===o&&"tab"===n&&"preview"===l,execCommand:this.execCommand,setPopupInfo:this.setPopupInfo},p="tab"===n?{borderTopLeftRadius:0}:null;return Qu(Mp||(Mp=m(['\n <div class="','">\n <div\n class="','"\n style="display: ','"\n >\n <'," tabs="," activeTab="," onClick=",' />\n </div>\n <div\n class="','"\n ref=',"\n style=","\n >\n ","\n <","\n item=","\n items=","\n ...","\n />\n </div>\n <","\n info=","\n show=","\n eventEmitter=","\n hidePopup=","\n execCommand=","\n />\n </div>\n "],['\n <div class="','">\n <div\n class="','"\n style="display: ','"\n >\n <'," tabs="," activeTab="," onClick=",' />\n </div>\n <div\n class="','"\n ref=',"\n style=","\n >\n ","\n <","\n item=","\n items=","\n ...","\n />\n </div>\n <","\n info=","\n show=","\n eventEmitter=","\n hidePopup=","\n execCommand=","\n />\n </div>\n "])),Ct("toolbar"),Ct("md-tab-container"),"wysiwyg"===o||"vertical"===n?"none":"block",op,this.tabs,l,this.toggleTab,Ct("defaultUI-toolbar"),function(t){return e.refs.el=t},p,c.map(function(t,n){var r;return Qu(Tp||(Tp=m(["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "])),Rp,t,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),e.setItemWidth,d)}),Pp,cp("more"),u,d,mp,s,a,r,this.hidePopup,this.execCommand)},t}(hd),Fp=function(e){function t(t){var n=e.call(this,t)||this;return n.handleClickDocument=function(e){Dt(e.target,"."+Ct("context-menu"))||n.setState({pos:null})},n.state={pos:null,menuGroups:[]},n.addEvent(),n}return p(t,e),t.prototype.addEvent=function(){var e=this;this.props.eventEmitter.listen("contextmenu",function(t){var n=t.pos,r=t.menuGroups;e.setState({pos:n,menuGroups:r})})},t.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},t.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},t.prototype.getMenuGroupElements=function(){var e=this,t=this.state,n=t.pos,r=t.menuGroups;return n?r.reduce(function(t,n){var r=[];return n.forEach(function(t){var n=t.label,o=t.className,i=void 0!==o&&o,s=t.disabled,a=t.onClick;r.push(Qu(Sp||(Sp=m(["\n <li\n onClick=",'\n class="menu-item','"\n aria-role="menuitem"\n >\n <span class="','">',"</span>\n </li>\n "],["\n <li\n onClick=",'\n class="menu-item','"\n aria-role="menuitem"\n >\n <span class="','">',"</span>\n </li>\n "])),function(){s||(a(),e.setState({pos:null}))},s?" disabled":"",i,n))}),t.push(Qu(Ep||(Ep=m(['<ul class="menu-group">\n ',"\n </ul>"],['<ul class="menu-group">\n ',"\n </ul>"])),r)),t},[]):[]},t.prototype.render=function(){var e=h({display:this.state.pos?"block":"none"},this.state.pos);return Qu(Np||(Np=m(['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"],['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"])),Ct("context-menu"),e,this.getMenuGroupElements())},t}(hd),Hp=function(e){function t(t){var n=e.call(this,t)||this;n.changeMode=function(e){e!==n.state.editorType&&n.setState({editorType:e})},n.changePreviewStyle=function(e){e!==n.state.previewStyle&&n.setState({previewStyle:e})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=t.editorType,o=t.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return p(t,e),t.prototype.mounted=function(){var e=this.props.slots,t=e.wwEditor,n=e.mdEditor,r=e.mdPreview;this.refs.wwContainer.appendChild(t),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},t.prototype.insertToolbarItem=function(e,t){this.toolbar.insertToolbarItem(e,t)},t.prototype.removeToolbarItem=function(e){this.toolbar.removeToolbarItem(e)},t.prototype.render=function(){var e=this,t=this.props,n=t.eventEmitter,r=t.hideModeSwitch,o=t.toolbarItems,i=t.theme,s=this.state,a=s.hide,l=s.previewStyle,c=s.editorType,u=a?" hidden":"",d=Ct("markdown"===c?"md-mode":"ww-mode"),p=Ct("md")+"-"+l+"-style",h=Ct(["light"!==i,i+" "]);return Qu(Dp||(Dp=m(['\n <div\n class="',"","",'"\n ref=',"\n >\n <","\n ref=","\n eventEmitter=","\n previewStyle=","\n toolbarItems=","\n editorType=",'\n />\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','">\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','"></div>\n </div>\n <div\n class="','"\n ref=',"\n />\n </div>\n </div>\n ","\n <"," eventEmitter="," />\n </div>\n "],['\n <div\n class="',"","",'"\n ref=',"\n >\n <","\n ref=","\n eventEmitter=","\n previewStyle=","\n toolbarItems=","\n editorType=",'\n />\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','">\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','"></div>\n </div>\n <div\n class="','"\n ref=',"\n />\n </div>\n </div>\n ","\n <"," eventEmitter="," />\n </div>\n "])),h,Ct("defaultUI"),u,function(t){return e.refs.el=t},Bp,function(t){return e.toolbar=t},n,l,o,c,Ct("main"),d,function(t){return e.refs.editorSection=t},Ct("main-container"),Ct("md-container"),p,function(t){return e.refs.mdContainer=t},Ct("md-splitter"),Ct("ww-container"),function(t){return e.refs.wwContainer=t},!r&&Qu(Op||(Op=m(["<"," eventEmitter="," editorType="," />"],["<"," eventEmitter="," editorType="," />"])),fd,n,c),Fp,n)},t.prototype.addEvent=function(){var e=this.props.eventEmitter;e.listen("hide",this.hide),e.listen("show",this.show),e.listen("changeMode",this.changeMode),e.listen("changePreviewStyle",this.changePreviewStyle)},t}(hd),jp=function(e){function t(t){var n,r,o=e.call(this,t)||this,i=dd(o.options.el,Qu(Ap||(Ap=m(["\n <","\n ref=","\n eventEmitter=","\n slots=","\n hideModeSwitch=","\n toolbarItems=","\n previewStyle=","\n editorType=","\n theme=","\n />\n "],["\n <","\n ref=","\n eventEmitter=","\n slots=","\n hideModeSwitch=","\n toolbarItems=","\n previewStyle=","\n editorType=","\n theme=","\n />\n "])),Hp,function(e){return r=e},o.eventEmitter,o.getEditorElements(),o.options.hideModeSwitch,o.options.toolbarItems,o.options.previewStyle,o.options.initialEditType,o.options.theme));return o.setMinHeight(o.options.minHeight),o.setHeight(o.options.height),o.defaultUI={insertToolbarItem:r.insertToolbarItem.bind(r),removeToolbarItem:r.removeToolbarItem.bind(r),destroy:i},null===(n=o.pluginInfo.toolbarItems)||void 0===n||n.forEach(function(e){var t=e.groupIndex,n=e.itemIndex,r=e.item;o.defaultUI.insertToolbarItem({groupIndex:t,itemIndex:n},r)}),o.eventEmitter.emit("loadUI",o),o}return p(t,e),t.factory=function(e){return e.viewer?new Pu(e):new t(e)},t.prototype.insertToolbarItem=function(e,t){this.defaultUI.insertToolbarItem(e,t)},t.prototype.removeToolbarItem=function(e){this.defaultUI.removeToolbarItem(e)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.defaultUI.destroy()},t}(Ju);Ju.setLanguage(["en","en-US"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Write",Preview:"Preview",Headings:"Headings",Paragraph:"Paragraph",Bold:"Bold",Italic:"Italic",Strike:"Strike",Code:"Inline code",Line:"Line",Blockquote:"Blockquote","Unordered list":"Unordered list","Ordered list":"Ordered list",Task:"Task",Indent:"Indent",Outdent:"Outdent","Insert link":"Insert link","Insert CodeBlock":"Insert codeBlock","Insert table":"Insert table","Insert image":"Insert image",Heading:"Heading","Image URL":"Image URL","Select image file":"Select image file","Choose a file":"Choose a file","No file":"No file",Description:"Description",OK:"OK",More:"More",Cancel:"Cancel",File:"File",URL:"URL","Link text":"Link text","Add row to up":"Add row to up","Add row to down":"Add row to down","Add column to left":"Add column to left","Add column to right":"Add column to right","Remove row":"Remove row","Remove column":"Remove column","Align column to left":"Align column to left","Align column to center":"Align column to center","Align column to right":"Align column to right","Remove table":"Remove table","Would you like to paste as table?":"Would you like to paste as table?","Text color":"Text color","Auto scroll enabled":"Auto scroll enabled","Auto scroll disabled":"Auto scroll disabled","Choose language":"Choose language"})}).call(this,n("yLpj"))},"b/sn":function(e,t,n){"use strict";n.d(t,"a",function(){return f}),n.d(t,"b",function(){return S}),n.d(t,"c",function(){return p}),n.d(t,"d",function(){return E}),n.d(t,"e",function(){return D}),n.d(t,"f",function(){return s}),n.d(t,"g",function(){return a}),n.d(t,"h",function(){return u});var r=n("byeC"),o=n("uSMm");const i=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new a(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=r.j.empty){let n=t.content.lastChild,o=null;for(let r=0;r<t.openEnd;r++)o=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?r.j.empty:t),0==a&&v(e,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),v(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new u(e):g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?g(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):g(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return u.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(e,t){this.$from=e,this.$to=t}}let l=!1;function c(e){l||e.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class u extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new u(r.parent.inlineContent?r:n,n)}replace(e,t=r.j.empty){if(super.replace(e,t),t==r.j.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof u&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new d(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new u(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new u(e,t)}}s.jsonID("text",u);class d{constructor(e,t){this.anchor=e,this.head=t}map(e){return new d(e.map(this.anchor),e.map(this.head))}resolve(e){return u.between(e.resolve(this.anchor),e.resolve(this.head))}}class p extends s{constructor(e){let t=e.nodeAfter;super(e,e.node(0).resolve(e.pos+t.nodeSize)),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?s.near(o):new p(o)}content(){return new r.j(r.c.from(this.node),0,0)}eq(e){return e instanceof p&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new h(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new p(e.resolve(t.anchor))}static create(e,t){return new p(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}p.prototype.visible=!1,s.jsonID("node",p);class h{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new d(n,n):new h(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&p.isSelectable(n)?new p(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r.j.empty){if(t==r.j.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve:e=>new f(e)};function g(e,t,n,r,o,i=!1){if(t.inlineContent)return u.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&p.isSelectable(r))return p.create(e,n-(o<0?r.nodeSize:0))}else{let t=g(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function v(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,a=e.steps[r];(a instanceof o.c||a instanceof o.b)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==i&&(i=r)}),e.setSelection(s.near(e.doc.resolve(i),n)))}const y=1,b=2,w=4;class k extends o.e{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|y)&~b,this.storedMarks=null,this}get selectionSet(){return(this.updated&y)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=b,this}ensureMarks(e){return r.d.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&b)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~b,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.d.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=w,this}get scrolledIntoView(){return(this.updated&w)>0}}function x(e,t){return t&&e?e.bind(t):e}class C{constructor(e,t,n){this.name=e,this.init=x(t.init,n),this.apply=x(t.apply,n)}}const T=[new C("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new C("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new C("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new C("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class M{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=T.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new C(e.key,e.spec.state,e))})}}class S{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new S(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new k(this)}static create(e){let t=new M(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new S(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new M(this.schema,e.plugins),n=t.fields,r=new S(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new M(e.schema,e.plugins),i=new S(o);return o.fields.forEach(o=>{if("doc"==o.name)i.doc=r.f.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,r))return void(i[o.name]=a.fromJSON.call(s,e,t[r],i))}i[o.name]=o.init(e,i)}}),i}}class E{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let o in t){let i=t[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=e(i,n,{})),r[o]=i}return r}(e.props,this,this.props),this.key=e.key?e.key.key:O("plugin")}getState(e){return e[this.key]}}const N=Object.create(null);function O(e){return e in N?e+"$"+ ++N[e]:(N[e]=0,e+"$")}class D{constructor(e="key"){this.key=O(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},byeC:function(e,t,n){"use strict";function r(e){this.content=e}r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};var o=r;n.d(t,"a",function(){return U}),n.d(t,"b",function(){return oe}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return c}),n.d(t,"e",function(){return V}),n.d(t,"f",function(){return M}),n.d(t,"g",function(){return C}),n.d(t,"h",function(){return u}),n.d(t,"i",function(){return $}),n.d(t,"j",function(){return d});class i{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{s.isText?(o+=s.text.slice(Math.max(e,a)-a,t-a),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let o=0;;o++){if(o==t.childCount||o==n.childCount)return t.childCount==n.childCount?null:r;let i=t.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(let e=0;i.text[e]==s.text[e];e++)r++;return r}if(i.content.size||s.content.size){let t=e(i.content,s.content,r+1);if(null!=t)return t}r+=i.nodeSize}else r+=i.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,o){for(let i=t.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};let a=t.child(--i),l=n.child(--s),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:r,b:o};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,o--;return{a:r,b:o}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,o-1);if(t)return t}r-=c,o-=c}else r-=c,o-=c}}(this,e,t,n)}findIndex(e,t=-1){if(0==e)return a(0,e);if(e==this.size)return a(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?a(n+1,o):a(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);const s={index:0,offset:0};function a(e,t){return s.index=e,s.offset=t,s}function l(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!l(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t&&l(e[n],t[n])))return!1;for(let n in t)if(!(n in e))return!1}return!0}class c{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&l(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return c.none;if(e instanceof c)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}c.none=[];class u extends Error{}class d{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,o){let{index:i,offset:s}=t.findIndex(n),a=t.maybeChild(i);if(s==n||a.isText)return o&&!o.canReplace(i,i,r)?null:t.cut(0,n).append(r).append(t.cut(n));let l=e(a.content,n-s-1,r);return l&&t.replaceChild(i,a.copy(l))}(this.content,e+this.openStart,t);return n&&new d(n,this.openStart,this.openEnd)}removeBetween(e,t){return new d(function e(t,n,r){let{index:o,offset:i}=t.findIndex(n),s=t.maybeChild(o);let{index:a,offset:l}=t.findIndex(r);if(i==n||s.isText){if(l!=r&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(o!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(e(s.content,n-i-1,r-i-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return d.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new d(i.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new d(e,n,r)}}function p(e,t,n){if(n.openStart>e.depth)throw new u("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new u("Inconsistent open depths");return function e(t,n,r,o){let s=t.index(o),a=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){let i=e(t,n,r,o+1);return a.copy(a.content.replaceChild(s,i))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){let{start:e,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)r=t.node(o).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return v(a,function e(t,n,r,o,s){let a=t.depth>s&&f(t,n,s+1);let l=o.depth>s&&f(r,o,s+1);let c=[];g(null,t,s,c);a&&l&&n.index(s)==r.index(s)?(h(a,l),m(v(a,e(t,n,r,o,s+1)),c)):(a&&m(v(a,y(t,n,s+1)),c),g(n,r,s,c),l&&m(v(l,y(r,o,s+1)),c));g(o,null,s,c);return new i(c)}(t,e,s,n,o))}{let e=t.parent,o=e.content;return v(e,o.cut(0,t.parentOffset).append(r.content).append(o.cut(n.parentOffset)))}}return v(a,y(t,n,o))}(e,t,n,0)}function h(e,t){if(!t.type.compatibleContent(e.type))throw new u("Cannot join "+t.type.name+" onto "+e.type.name)}function f(e,t,n){let r=e.node(n);return h(r,t.node(n)),r}function m(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function g(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(m(e.nodeAfter,r),i++));for(let a=i;a<s;a++)m(o.child(a),r);t&&t.depth==n&&t.textOffset&&m(t.nodeBefore,r)}function v(e,t){return e.type.checkContent(t),e.copy(t)}function y(e,t,n){let r=[];if(g(null,e,n,r),e.depth>n){m(v(f(e,t,n+1),y(e,t,n+1)),r)}return g(t,null,n,r),new i(r)}d.empty=new d(i.empty,0,0);class b{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return c.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new C(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),s=o-t;if(n.push(i,e,r+t),!s)break;if((i=i.child(e)).isText)break;o=s-1,r+=t+1}return new b(t,n,o)}static resolveCached(e,t){for(let r=0;r<w.length;r++){let n=w[r];if(n.pos==t&&n.doc==e)return n}let n=w[k]=b.resolve(e,t);return k=(k+1)%x,n}}let w=[],k=0,x=12;class C{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const T=Object.create(null);class M{constructor(e,t,n,r=c.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&l(this.attrs,t||e.defaultAttrs||T)&&c.sameSet(this.marks,n||c.none)}copy(e=null){return e==this.content?this:new M(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new M(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return d.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new d(a,r.depth-i,o.depth-i)}replace(e,t,n){return p(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return b.resolveCached(this,e)}resolveNoCache(e){return b.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),E(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=i.empty,r=0,o=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let i=r;i<o;i++)if(!this.type.allowsMarks(n.child(i).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=c.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!c.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}M.prototype.text=void 0;class S extends M{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):E(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new S(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new S(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function E(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class N{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new O(e,t);if(null==n.next)return N.empty;let r=D(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);B(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new N(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(P);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(B(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(s,a){let l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return i.from(a.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,a.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}N.empty=new N(!0);class O{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function D(e){let t=[];do{t.push(A(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function A(e){let t=[];do{t.push(L(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function L(e){let t=function(e){if(e.eat("(")){let t=D(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.groups.indexOf(t)>-1&&o.push(e)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=R(e,t)}return t}function I(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function R(e,t){let n=I(e),r=n;return e.eat(",")&&(r="}"!=e.next?I(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function P(e,t){return t-e}function B(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(P)}function F(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function H(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function j(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new q(e[n]);return t}class z{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=j(n.attrs),this.defaultAttrs=F(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==N.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:H(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new M(this,this.computeAttrs(e),i.from(t),c.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new M(this,this.computeAttrs(e),t,c.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(i.empty,!0);return o?new M(this,e,t.append(o),c.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:c.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new z(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class q{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class V{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=j(r.attrs),this.excluded=null;let o=F(this.attrs);this.instance=o?new c(this,o):null}create(e=null){return!e&&this.instance?this.instance:new c(this,H(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new V(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class ${constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=z.compile(this.spec.nodes,this),this.marks=V.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;e.contentMatch=n[t]||(n[t]=N.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==o?null:o?_(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:_(this,t.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof z))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new S(n,n.defaultAttrs,e,c.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return M.fromJSON(this,e)}markFromJSON(e){return c.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function _(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class U{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ee(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ee(this,t,!0);return n.addAll(e,t.from,t.to),d.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(te(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=ne(e)),e.mark=r})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach(e=>{n(e=ne(e)),e.node=r})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new U(e,U.schemaRules(e)))}}const W={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},J={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},K={ol:!0,ul:!0},G=1,Z=2,X=4;function Q(e,t,n){return null!=t?(t?G:0)|("full"===t?Z:0):e&&"pre"==e.whitespace?G|Z:n&~X}class Y{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=c.none,this.stashMarks=[],this.match=i||(s&X?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&G)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):re(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!W.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ee{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=Q(null,t.preserveWhitespace,0)|(n?X:0);r=o?new Y(o.type,o.attrs,c.none,c.none,!0,t.topMatch||o.type.contentMatch,i):new Y(n?null:e.schema.topNodeType,null,c.none,c.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){let t=e.getAttribute("style"),n=t?this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t)):null,r=this.top;if(null!=n)for(let e=0;e<n.length;e++)this.addPendingMark(n[e]);if(this.addElement(e),null!=n)for(let e=0;e<n.length;e++)this.removePendingMark(n[e],r)}}addTextNode(e){let t=e.nodeValue,n=this.top;if(n.options&Z||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(n.options&G)t=n.options&Z?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();K.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&K.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:J.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(W.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),t&&this.sync(n),this.needsBlock=i}else this.addElementByRule(e,o,!1===o.consuming?n:void 0)}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=c.none;e:for(let n=0;n<e.length;n+=2)for(let r=void 0;;){let o=this.parser.matchStyle(e[n],e[n+1],this,r);if(!o)continue e;if(o.ignore)return null;if(t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),!1!==o.consuming)break;r=o}return t}addElementByRule(e,t,n){let r,o,i;if(t.node)(o=this.parser.schema.nodes[t.node]).isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace);else{i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i)}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let r=0;r<t.length;r++)this.enterInner(t[r],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=Q(e,r,o.options);o.options&X&&0==o.content.length&&(i|=X),this.nodes.push(new Y(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function te(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ne(e){let t={};for(let n in e)t[n]=e[n];return t}function re(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class oe{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=se(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=oe.renderSpec(se(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&oe.renderSpec(se(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):s.setAttribute(e,a[e])}}for(let c=l;c<t.length;c++){let o=t[c];if(0===o){if(c<t.length-1||c>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:i}=oe.renderSpec(e,o,n);if(s.appendChild(t),i){if(r)throw new RangeError("Multiple content holes");r=i}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new oe(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ie(e.nodes);return t.text||(t.text=(e=>e.text)),t}static marksFromSchema(e){return ie(e.marks)}}function ie(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function se(e){return e.document||window.document}},"cD+i":function(e,t,n){"use strict";n.d(t,"a",function(){return Pt}),n.d(t,"b",function(){return Ht}),n.d(t,"c",function(){return sn});var r=n("b/sn"),o=n("byeC"),i=n("uSMm");const s=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},a=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let l=null;const c=function(e,t,n){let r=l||(l=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},u=function(e,t,n,r){return n&&(p(e,t,n,r,-1)||p(e,t,n,r,1))},d=/^(img|br|input|textarea|hr)$/i;function p(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:h(e))){let n=e.parentNode;if(!n||1!=n.nodeType||f(e)||d.test(e.nodeName)||"false"==e.contentEditable)return!1;t=s(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?h(e):0}}}function h(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const m=function(e){return e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function g(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const v="undefined"!=typeof navigator?navigator:null,y="undefined"!=typeof document?document:null,b=v&&v.userAgent||"",w=/Edge\/(\d+)/.exec(b),k=/MSIE \d/.exec(b),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(b),C=!!(k||x||w),T=k?document.documentMode:x?+x[1]:w?+w[1]:0,M=!C&&/gecko\/(\d+)/i.test(b);M&&(/Firefox\/(\d+)/.exec(b)||[0,0])[1];const S=!C&&/Chrome\/(\d+)/.exec(b),E=!!S,N=S?+S[1]:0,O=!C&&!!v&&/Apple Computer/.test(v.vendor),D=O&&(/Mobile\/\w+/.test(b)||!!v&&v.maxTouchPoints>2),A=D||!!v&&/Mac/.test(v.platform),L=/Android \d/.test(b),I=!!y&&"webkitFontSmoothing"in y.documentElement.style,R=I?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function P(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function B(e,t){return"number"==typeof e?e:e[t]}function F(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function H(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=a(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,a=n?P(i):F(e),l=0,c=0;if(t.top<a.top+B(r,"top")?c=-(a.top-t.top+B(o,"top")):t.bottom>a.bottom-B(r,"bottom")&&(c=t.bottom-a.bottom+B(o,"bottom")),t.left<a.left+B(r,"left")?l=-(a.left-t.left+B(o,"left")):t.right>a.right-B(r,"right")&&(l=t.right-a.right+B(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n)break}}function j(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=a(r));return t}function z(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let q=null;function V(e,t){let n,r,o=2e8,i=0,s=t.top,a=t.top;for(let l=e.firstChild,u=0;l;l=l.nextSibling,u++){let e;if(1==l.nodeType)e=l.getClientRects();else{if(3!=l.nodeType)continue;e=c(l).getClientRects()}for(let c=0;c<e.length;c++){let d=e[c];if(d.top<=s&&d.bottom>=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);let e=d.left>t.left?d.left-t.left:d.right<t.left?t.left-d.right:0;if(e<o){n=l,o=e,r=e&&3==n.nodeType?{left:d.right<t.left?d.right:d.left,top:t.top}:t,1==l.nodeType&&e&&(i=u+(t.left>=(d.left+d.right)/2?1:0));continue}}!n&&(t.left>=d.right&&t.top>=d.top||t.left>=d.left&&t.top>=d.bottom)&&(i=u+1)}}return n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=U(r,1);if(n.top!=n.bottom&&$(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:e,offset:i}:V(n,r)}function $(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function _(e,t){let n,r=e.dom.ownerDocument,o=0;if(r.caretPositionFromPoint)try{let e=r.caretPositionFromPoint(t.left,t.top);e&&({offsetNode:n,offset:o}=e)}catch(e){}if(!n&&r.caretRangeFromPoint){let e=r.caretRangeFromPoint(t.left,t.top);e&&({startContainer:n,startOffset:o}=e)}let i,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let n=e.dom.getBoundingClientRect();if(!$(t,n))return null;if(!(s=function e(t,n,r){let o=t.childNodes.length;if(o&&r.top<r.bottom)for(let i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let o=0;o<t.length;o++){let i=t[o];if($(n,i))return e(r,n,i)}}if((s=(s+1)%o)==i)break}return t}(e.dom,t,n)))return null}if(O)for(let c=s;n&&c;c=a(c))c.draggable&&(n=void 0);if(s=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(M&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length))<n.childNodes.length){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(i=function(e,t,n,r){let o=-1;for(let i=t;i!=e.dom;){let t=e.docView.nearestDesc(i,!0);if(!t)return null;if(t.node.isBlock&&t.parent){let e=t.dom.getBoundingClientRect();if(e.left>r.left||e.top>r.top)o=t.posBefore;else{if(!(e.right<r.left||e.bottom<r.top))break;o=t.posAfter}}i=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,1)}(e,n,o,t))}null==i&&(i=function(e,t,n){let{node:r,offset:o}=V(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:i,inside:l?l.posAtStart-l.border:-1}}function U(e,t){let n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}const W=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function J(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=I||M;if(3==r.nodeType){if(!s||!W.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,K(U(c(r,e,t),1),i<0)}{let e=U(c(r,o,o),n);if(M&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=U(c(r,o-1,o-1),-1);if(t.top==e.top){let n=U(c(r,o,o+1),-1);if(n.top!=e.top)return K(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==h(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return G(e.getBoundingClientRect(),!1)}if(null==i&&o<h(r)){let e=r.childNodes[o];if(1==e.nodeType)return G(e.getBoundingClientRect(),!0)}return G(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==h(r))){let e=r.childNodes[o-1],t=3==e.nodeType?c(e,h(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return K(U(t,1),!1)}if(null==i&&o<h(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?c(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return K(U(t,-1),!0)}return K(U(3==r.nodeType?c(r):r,-n),n>=0)}function K(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function G(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Z(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const X=/[\u0590-\u08ac]/;let Q=null,Y=null,ee=!1;function te(e,t,n){return Q==t&&Y==n?ee:(Q=t,Y=n,ee="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Z(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.dom;break}t=n.dom.parentNode}let r=J(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=c(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return X.test(r.parent.textContent)&&a.modify?Z(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),p=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),p}):"left"==n||"backward"==n?i:s}(e,t,n))}const ne=0,re=1,oe=2,ie=3;class se{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=ne,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n,r=0,o=0;for(let i=0;r<this.children.length;r++){let t=this.children[r],n=i+t.size;if(n>e||t instanceof he){o=e-i;break}i=n}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof ae&&n.side>=0;r--);if(t<=0){let e,n=!0;for(;(e=r?this.children[r-1]:null)&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&t&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?s(e.dom)+1:0}}{let e,n=!0;for(;(e=r<this.children.length?this.children[r]:null)&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?s(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,a=0;;a++){let n=this.children[a],l=i+n.size;if(-1==r&&e<=l){let o=i+n.border;if(e>=o&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=a;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(let e=a+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,u=0;s<this.children.length;s++){let a=this.children[s],l=u+a.size;if(o>u&&i<l)return a.setSelection(e-u-a.border,t-u-a.border,n,r);u=l}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=n.getSelection(),d=!1;if((M||O)&&e==t){let{node:e,offset:t}=a;if(3==e.nodeType){if((d=!(!t||"\n"!=e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(a=l={node:n.parentNode,offset:s(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(M&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&O)&&u(a.node,a.offset,c.anchorNode,c.anchorOffset)&&u(l.node,l.offset,c.focusNode,c.focusOffset))return;let p=!1;if((c.extend||e==t)&&!d){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),p=!0}catch(e){}}if(!p){if(e>t){let e=a;a=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?oe:re,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=ie);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?ie:oe}n=i}this.dirty=oe}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?oe:re;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class ae extends se{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==ne&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class le extends se{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class ce extends se{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=o.b.renderSpec(document,t.type.spec.toDOM(t,n))),new ce(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&ie||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return this.dirty!=ie&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ne){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=ne}}slice(e,t,n){let r=ce.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Me(o,t,i,n)),e>0&&(o=Me(o,0,e,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}}class ue extends se{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s,i&&this.updateChildren(a,l)}static create(e,t,n,r,i,s){let a,l=i.nodeViews[t.type.name],c=l&&l(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,n,r),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else u||({dom:u,contentDOM:d}=o.b.renderSpec(document,t.type.spec.toDOM(t)));d||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=we(u,n,t),c?a=new fe(e,t,n,r,u,d||null,p,c,i,s+1):t.isText?new pe(e,t,n,r,u,p,i):new ue(e,t,n,r,u,d||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=(()=>o.c.empty))}else e.contentElement=this.contentDOM;else e.getContent=(()=>this.node.content);return e}matchesNode(e,t,n){return this.dirty==ne&&e.eq(this.node)&&ke(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Ce(this,s&&s.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){if(s<o.length&&o[s].to==i){let e,t=o[s++];for(;s<o.length&&o[s].to==i;)(e||(e=[t])).push(o[s++]);if(e){e.sort(Te);for(let t=0;t<e.length;t++)n(e[t],c,!!l)}else n(t,c,!!l)}let u,d;if(l)d=-1,u=l,l=null;else{if(!(c<e.childCount))break;d=c,u=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let p=i+u.nodeSize;if(u.isText){let e=p;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<p&&(l=u.cut(e-i),u=u.cut(0,e-i),p=e,d=-1)}let h=u.isInline&&!u.isLeaf?a.filter(e=>!e.inline):a.slice();r(u,h,t.forChild(i,u),d),i=p}}(this.node,this.innerDeco,(t,i,s)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?o.d.none:this.node.child(i).marks,n,e),l.placeWidget(t,e,r)},(t,o,s,c)=>{let u;l.syncToMarks(t.marks,n,e),l.findNodeMatch(t,o,s,c)||a&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,s,u,e)||l.updateNextNode(t,o,s,e,c)||l.addNode(t,o,s,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==oe)&&(s&&this.protectLocalComposition(e,s),function e(t,n,r){let o=t.firstChild,i=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=o;)o=xe(o),i=!0;o=o.nextSibling}else i=!0,t.insertBefore(l,o);if(a instanceof ce){let n=o?o.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),o=n?n.nextSibling:t.firstChild}}for(;o;)o=xe(o),i=!0;i&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),D&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof r.h)||n<t||o>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=h(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,r=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,o-t);return r<0?null:{node:s,pos:r,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new le(this,o,t,r);e.input.compositionNodes.push(i),this.children=Me(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(this.dirty==ie||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=ne}updateOuterDeco(e){if(ke(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ye(this.dom,this.nodeDOM,ve(this.outerDeco,this.node,t),ve(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function de(e,t,n,r,o){return we(r,t,e),new ue(void 0,e,t,n,r,r,r,o,0)}class pe extends ue{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(this.dirty==ie||this.dirty!=ne&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),this.dirty==ne&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=ne,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new pe(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=ie)}get domAtom(){return!1}}class he extends se{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ne&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class fe extends ue{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(this.dirty==ie)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}const me=function(e){e&&(this.nodeName=e)};me.prototype=Object.create(null);const ge=[new me];function ve(e,t,n){if(0==e.length)return ge;let r=n?ge[0]:new me,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new me(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new me(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ye(e,t,n,r){if(n==ge&&r==ge)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName?o=n:((n=document.createElement(t.nodeName)).pmIsDeco=!0,n.appendChild(o),s=ge[0],o=n)}be(o,s||ge[0],t)}return o}function be(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function we(e,t,n){return ye(e,e,ge,ve(t,n,1!=e.nodeType))}function ke(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function xe(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Ce{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof ce)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=ne,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++)if(this.top.children[t].matchesMark(e[o])){r=t;break}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=ce.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){let r=this.top.children[s];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return i.dirty==ie&&i.dom==i.contentDOM&&(i.dirty=oe),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o){for(let i=this.index;i<this.top.children.length;i++){let s=this.top.children[i];if(s instanceof ue){let a=this.preMatch.matched.get(s);if(null!=a&&a!=o)return!1;let l=s.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=ie&&ke(t,s.outerDeco)))&&s.update(e,t,n,r))return this.destroyBetween(this.index,i),s.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1}addNode(e,t,n,r,o){this.top.children.splice(this.index++,0,ue.create(this.top,e,t,n,r,o)),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ae(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ce;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof pe)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((O||E)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new he(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}}function Te(e,t){return e.type.side-t.type.side}function Me(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Se(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&0==i.size,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,u,d=o.resolve(l);if(m(n)){for(c=d;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&r.c.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==h(e);r||o;){if(e==n)return!0;let t=s(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==h(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new r.c(l==e?d:o.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;c=o.resolve(t)}if(!u){u=Pe(e,c,d,"pointer"==t||e.state.selection.head<d.pos&&!a?1:-1)}return u}function Ee(e){return e.editable?e.hasFocus():Fe(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ne(e,t=!1){let n=e.state.selection;if(Ie(e,n),Ee(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&E){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&u(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,s(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&C&&T<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let o,i,{anchor:s,head:a}=n;!Oe||n instanceof r.h||(n.$from.parent.inlineContent||(o=De(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=De(e,n.to))),e.docView.setSelection(s,a,e.root,t),Oe&&(o&&Le(o),i&&Le(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=(()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{Ee(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))}))}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Oe=O||E&&N<63;function De(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(O&&o&&"false"==o.contentEditable)return Ae(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Ae(o);if(i)return Ae(i)}}function Ae(e){return e.contentEditable="true",O&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Le(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Ie(e,t){if(t instanceof r.c){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Re(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Re(e)}function Re(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Pe(e,t,n,o){return e.someProp("createSelectionBetween",r=>r(e,t,n))||r.h.between(t,n,o)}function Be(e){return!(e.editable&&!e.hasFocus())&&Fe(e)}function Fe(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function He(e,t){let{$anchor:n,$head:o}=e.selection,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&r.f.findFrom(s,t)}function je(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function ze(e,t,n){let o=e.state.selection;if(!(o instanceof r.h)){if(o instanceof r.c&&o.node.isInline)return je(e,new r.h(t>0?o.$to:o.$from));{let n=He(e.state,t);return!!n&&je(e,n)}}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){let n=He(e.state,t);return!!(n&&n instanceof r.c)&&je(e,n)}if(!(A&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let a=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(a))&&!n.contentDOM)&&(r.c.isSelectable(s)?je(e,new r.c(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!I&&je(e,new r.h(e.state.doc.resolve(t<0?a:a+s.nodeSize))))}}function qe(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ve(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function $e(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=!1;for(M&&1==n.nodeType&&r<qe(n)&&Ve(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Ve(e))o=n,i=--r;else{if(3!=e.nodeType)break;r=(n=e).nodeValue.length}}}else{if(Ue(n))break;{let t=n.previousSibling;for(;t&&Ve(t);)o=n.parentNode,i=s(t),t=t.previousSibling;if(t)r=qe(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}}a?We(e,n,r):o&&We(e,o,i)}function _e(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=qe(n);for(;;)if(r<a){if(1!=n.nodeType)break;if(!Ve(n.childNodes[r]))break;o=n,i=++r}else{if(Ue(n))break;{let t=n.nextSibling;for(;t&&Ve(t);)o=t.parentNode,i=s(t)+1,t=t.nextSibling;if(t)r=0,a=qe(n=t);else{if((n=n.parentNode)==e.dom)break;r=a=0}}}o&&We(e,o,i)}function Ue(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function We(e,t,n){let r=e.domSelection();if(m(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&Ne(e)},50)}function Je(e,t,n){let o=e.state.selection;if(o instanceof r.h&&!o.empty||n.indexOf("s")>-1)return!1;if(A&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=He(e.state,t);if(n&&n instanceof r.c)return je(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,a=o instanceof r.a?r.f.near(n,t):r.f.findFrom(n,t);return!!a&&je(e,a)}return!1}function Ke(e,t){if(!(e.state.selection instanceof r.h))return!0;let{$head:n,$anchor:o,empty:i}=e.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function Ge(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ze(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||A&&72==n&&"c"==r?Ke(e,-1)||$e(e):46==n||A&&68==n&&"c"==r?Ke(e,1)||_e(e):13==n||27==n||(37==n||A&&66==n&&"c"==r?ze(e,-1,r)||$e(e):39==n||A&&70==n&&"c"==r?ze(e,1,r)||_e(e):38==n||A&&80==n&&"c"==r?Je(e,-1,r)||$e(e):40==n||A&&78==n&&"c"==r?function(e){if(!O||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Ge(e,n,"true"),setTimeout(()=>Ge(e,n,"false"),20)}return!1}(e)||Je(e,1,r)||_e(e):r==(A?"m":"c")&&(66==n||73==n||89==n||90==n))}function Xe(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let a=e.someProp("clipboardSerializer")||o.b.fromSchema(e.state.schema),l=at(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let u,d=c.firstChild,p=0;for(;d&&1==d.nodeType&&(u=it[d.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=l.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),p++}d=c.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${s}${p?` -${p}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n")}}function Qe(e,t,n,r,i){let s,a,l=i.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return t?new o.j(o.c.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.j.empty;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)a=n;else{let n=i.marks(),{schema:r}=e.state,a=o.b.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=at().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&it[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=e,n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),I&&function(e){let t=e.querySelectorAll(E?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let o=+d[3];o>0;o--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!a){let t=e.someProp("clipboardParser")||e.someProp("domParser")||o.a.fromSchema(e.state.schema);a=t.parseSlice(s,{preserveWhitespace:!(!c&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ye.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)a=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:a}=e;for(let l=n.length-2;l>=0;l-=2){let e=r.nodes[n[l]];if(!e||e.hasRequiredAttrs())break;i=o.c.from(e.create(n[l+1],i)),s++,a++}return new o.j(i,s,a)}(ot(a,+d[1],+d[2]),d[4]);else if((a=o.j.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n),s=i.contentMatchAt(t.index(n)),a=[];if(e.forEach(e=>{if(!a)return;let t,n=s.findWrapping(e.type);if(!n)return a=null;if(t=a.length&&r.length&&tt(n,r,e,a[a.length-1],0))a[a.length-1]=t;else{a.length&&(a[a.length-1]=nt(a[a.length-1],r.length));let t=et(e,n);a.push(t),s=s.matchType(t.type),r=n}}),a)return o.c.from(a)}return e}(a.content,i),!0)).openStart||a.openEnd){let e=0,t=0;for(let n=a.content.firstChild;e<a.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=a.content.lastChild;t<a.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);a=ot(a,e,t)}return e.someProp("transformPasted",t=>{a=t(a,e)}),a}const Ye=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function et(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,o.c.from(e));return e}function tt(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=tt(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(o.c.from(et(n,e,i+1))))}}function nt(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,nt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(o.c.empty,!0);return e.copy(n.append(r))}function rt(e,t,n,r,i,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=rt(l,t,n,r,i+1,s)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(o.c.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function ot(e,t,n){return t<e.openStart&&(e=new o.j(rt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.j(rt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const it={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let st=null;function at(){return st||(st=document.implementation.createHTMLDocument("title"))}const lt={},ct={},ut={touchstart:!0,touchmove:!0};class dt{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function pt(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ht(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=(t=>ft(e,t)))})}function ft(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function mt(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function gt(e){return{left:e.clientX,top:e.clientY}}function vt(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),o,!0):t(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function yt(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function bt(e,t,n,o,i){return vt(e,"handleClickOn",t,n,o)||e.someProp("handleClick",n=>n(e,t,o))||(i?function(e,t){if(-1==t)return!1;let n,o,i=e.state.selection;i instanceof r.c&&(n=i.node);let s=e.state.doc.resolve(t);for(let a=s.depth+1;a>0;a--){let e=a>s.depth?s.nodeAfter:s.node(a);if(r.c.isSelectable(e)){o=n&&i.$from.depth>0&&a>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(a);break}}return null!=o&&(yt(e,r.c.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.c.isSelectable(o))&&(yt(e,new r.c(n),"pointer"),!0)}(e,n))}function wt(e,t,n,o){return vt(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",n=>n(e,t,o))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(yt(e,r.h.create(o,0,o.content.size),"pointer"),!0);let i=o.resolve(t);for(let s=i.depth+1;s>0;s--){let t=s>i.depth?i.nodeAfter:i.node(s),n=i.before(s);if(t.inlineContent)yt(e,r.h.create(o,n+1,n+1+t.content.size),"pointer");else{if(!r.c.isSelectable(t))continue;yt(e,r.c.create(o,n),"pointer")}return!0}}(e,n,o)}function kt(e){return Et(e)}ct.keydown=((e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Ct(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!L||!E||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!D||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Ze(e,n)?n.preventDefault():pt(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))),e.input.lastIOSEnter=0)},200)}}),ct.keyup=((e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)}),ct.keypress=((e,t)=>{let n=t;if(Ct(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||A&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof r.h&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);e.someProp("handleTextInput",n=>n(e,o.$from.pos,o.$to.pos,t))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}});const xt=A?"metaKey":"ctrlKey";lt.mousedown=((e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let o=kt(e),i=Date.now(),s="singleClick";i-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[xt]&&("singleClick"==e.input.lastClick.type?s="doubleClick":"doubleClick"==e.input.lastClick.type&&(s="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let a=e.posAtCoords(gt(n));a&&("singleClick"==s?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new class{constructor(e,t,n,o){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[xt],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const a=o?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.c&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),pt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ne(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(gt(e))),this.updateAllowDefault(e),this.allowDefault||!t?pt(this.view,"pointer"):bt(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||O&&this.mightDrag&&!this.mightDrag.node.isAtom||E&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(yt(this.view,r.f.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):pt(this.view,"pointer")}move(e){this.updateAllowDefault(e),pt(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}(e,a,n,!!o)):("doubleClick"==s?function(e,t,n,r){return vt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:wt)(e,a.pos,a.inside,n)?n.preventDefault():pt(e,"pointer"))});function Ct(e,t){return!!e.composing||!!(O&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}lt.touchstart=(e=>{e.input.lastTouch=Date.now(),kt(e),pt(e,"pointer")}),lt.touchmove=(e=>{e.input.lastTouch=Date.now(),pt(e,"pointer")}),lt.contextmenu=(e=>kt(e));const Tt=L?5e3:-1;function Mt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Et(e),t))}function St(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Et(e,t=!1){if(!(L&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),St(e),t||e.docView&&e.docView.dirty){let t=Se(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}ct.compositionstart=ct.compositionupdate=(e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)))e.markCursor=e.state.storedMarks||n.marks(),Et(e,!0),e.markCursor=null;else if(Et(e),M&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Mt(e,Tt)}),ct.compositionend=((e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,Mt(e,20))});const Nt=C&&T<15||D&&R<604;function Ot(e,t,n,r){let i=Qe(e,t,n,e.input.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,r,i||o.j.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,e.input.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}lt.copy=ct.cut=((e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Nt?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Xe(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}),ct.paste=((e,t)=>{let n=t;if(e.composing&&!L)return;let r=Nt?null:n.clipboardData;r&&Ot(e,r.getData("text/plain"),r.getData("text/html"),n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ot(e,r.value,null,t):Ot(e,r.textContent,r.innerHTML,t)},50)}(e,n)});const Dt=A?"altKey":"ctrlKey";lt.dragstart=((e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(gt(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof r.c?i.to-1:i.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(r.c.create(e.state.doc,o.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(r.c.create(e.state.doc,t.posBefore)))}let a=e.state.selection.content(),{dom:l,text:c}=Xe(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Nt?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Nt||n.dataTransfer.setData("text/plain",c),e.dragging=new class{constructor(e,t){this.slice=e,this.move=t}}(a,!n[Dt])}),lt.dragend=(e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)}),ct.dragover=ct.dragenter=((e,t)=>t.preventDefault()),ct.drop=((e,t)=>{let n=t,s=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let a=e.posAtCoords(gt(n));if(!a)return;let l=e.state.doc.resolve(a.pos),c=s&&s.slice;c?e.someProp("transformPasted",t=>{c=t(c,e)}):c=Qe(e,n.dataTransfer.getData(Nt?"Text":"text/plain"),Nt?null:n.dataTransfer.getData("text/html"),!1,l);let u=!(!s||n[Dt]);if(e.someProp("handleDrop",t=>t(e,n,c||o.j.empty,u)))return void n.preventDefault();if(!c)return;n.preventDefault();let d=c?Object(i.h)(e.state.doc,l.pos,c):l.pos;null==d&&(d=l.pos);let p=e.state.tr;u&&p.deleteSelection();let h=p.mapping.map(d),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=p.doc;if(f?p.replaceRangeWith(h,h,c.content.firstChild):p.replaceRange(h,h,c),p.doc.eq(m))return;let g=p.doc.resolve(h);if(f&&r.c.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))p.setSelection(new r.c(g));else{let t=p.mapping.map(d);p.mapping.maps[p.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),p.setSelection(Pe(e,g,p.doc.resolve(t)))}e.focus(),e.dispatch(p.setMeta("uiEvent","drop"))}),lt.focus=(e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ne(e)},20))}),lt.blur=((e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)}),lt.beforeinput=((e,t)=>{if(E&&L&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,g(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}});for(let pn in ct)lt[pn]=ct[pn];function At(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Lt{constructor(e,t){this.toDOM=e,this.spec=t||Ft,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Pt(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Lt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&At(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class It{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Pt(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof It&&At(this.attrs,e.attrs)&&At(this.spec,e.spec)}static is(e){return e.type instanceof It}destroy(){}}class Rt{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Pt(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Rt&&At(this.attrs,e.attrs)&&At(this.spec,e.spec)}destroy(){}}class Pt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Pt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Pt(e,e,new Lt(t,n))}static inline(e,t,n,r){return new Pt(e,t,new It(n,r))}static node(e,t,n,r){return new Pt(e,t,new Rt(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof It}}const Bt=[],Ft={};class Ht{constructor(e,t){this.local=e.length?e:Bt,this.children=t.length?t:Bt}static create(e,t){return t.length?_t(t,e,0,Ft):jt}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==jt||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Ft)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,i)=>{let s=i-r-(n-t);for(let l=0;l<a.length;l+=3){let i=a[l+1];if(i<0||t>i+u-e)continue;let c=a[l]+u-e;n>=c?a[l+1]=t<=c?-2:-1:r>=o&&s&&(a[l]+=s,a[l+1]+=s)}e+=s}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(-2==a[c+1]){l=!0,a[c+1]=-1;continue}let t=n.map(e[c]+i),u=t-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[c+1]+i,-1),p=d-o,{index:h,offset:f}=r.content.findIndex(u),m=r.maybeChild(h);if(m&&f==u&&f+m.nodeSize==p){let r=a[c+2].mapInner(n,m,t+1,e[c]+i+1,s);r!=jt?(a[c]=u,a[c+1]=p,a[c+2]=r):(a[c+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t,n,o,i,s),c=_t(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Ht(t.sort(Ut),a)}(this.children,i||[],e,t,n,r,o):i?new Ht(i.sort(Ut),Bt):jt}add(e,t){return t.length?this==jt?Ht.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Vt(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,_t(s,e,a+1,Ft)),o+=3}});let i=qt(o?$t(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Ht(i.length?this.local.concat(i).sort(Ut):this.local,r||this.children)}remove(e){return 0==e.length||this==jt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[o+2].removeInner(r,i+1);a!=jt?n[o+2]=a:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Ht(r,n):jt}forChild(e,t){if(this==jt)return this;if(t.isLeaf)return Ht.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let o=e+1,i=o+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>o&&e.type instanceof It){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new Ht(r.sort(Ut),Bt);return n?new zt([e,n]):e}return n||jt}eq(e){if(this==e)return!0;if(!(e instanceof Ht)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Wt(this.localsInner(e))}localsInner(e){if(this==jt)return Bt;if(e.inlineContent||!this.local.some(It.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof It||t.push(this.local[n]);return t}}Ht.empty=new Ht([],[]),Ht.removeOverlap=Wt;const jt=Ht.empty;class zt{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Ft));return zt.from(n)}forChild(e,t){if(t.isLeaf)return Ht.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=jt&&(o instanceof zt?n=n.concat(o.members):n.push(o))}return zt.from(n)}eq(e){if(!(e instanceof zt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Wt(n?t:t.sort(Ut)):Bt}static from(e){switch(e.length){case 0:return jt;case 1:return e[0];default:return new zt(e.every(e=>e instanceof Ht)?e:e.reduce((e,t)=>e.concat(t instanceof Ht?t:t.members),[]))}}}function qt(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Pt(o.from+t,o.to+t,o.type))}return n}function Vt(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function $t(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function _t(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Vt(e,t,s+n);if(a){i=!0;let e=_t(a,t,n+s+1,r);e!=jt&&o.push(s,s+t.nodeSize,e)}});let s=qt(i?$t(e):e,-n).sort(Ut);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Ht(s,o):jt}function Ut(e,t){return e.from-t.from||e.to-t.to}function Wt(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Jt(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Jt(t,o+1,i.copy(r.to,i.to)))}}return t}function Jt(e,t,n){for(;t<e.length&&Ut(n,e[t])>0;)t++;e.splice(t,0,n)}function Kt(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=jt&&t.push(r)}),e.cursorWrapper&&t.push(Ht.create(e.state.doc,[e.cursorWrapper.deco])),zt.from(t)}const Gt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Zt=C&&T<=11;class Xt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Qt{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Xt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);C&&T<=11&&e.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),Zt&&(this.onCharData=(e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()})),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Gt)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Be(this.view)){if(this.suppressingSelectionUpdates)return Ne(this.view);if(C&&T<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&u(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=a(o))n.add(o);for(let o=e.anchorNode;o;o=a(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Be(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let r=0;r<t.length;r++){let e=this.registerMutation(t[r],l);e&&(i=i<0?e.from:Math.min(e.from,i),s=s<0?e.to:Math.max(e.to,s),e.typeOver&&(a=!0))}if(M&&l.length>1){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&e.input.lastTouch<Date.now()-300&&m(n)&&(c=Se(e))&&c.eq(r.f.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ne(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(Yt.has(e))return;if(Yt.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=M,en)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),en=!0}}(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Ne(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(C&&T<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?s(r)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?s(o):e.target.childNodes.length;return{from:a,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Yt=new WeakMap,en=!1;function tn(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(O&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||O&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}function nn(e,t,n,i,s){if(t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Se(e,t);if(n&&!e.state.selection.eq(n)){let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),e.dispatch(r)}return}let a=e.state.doc.resolve(t),l=a.sharedDepth(n);t=a.before(l+1),n=e.state.doc.resolve(n).after(l+1);let c,u,d=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:a,from:l,to:c}=e.docView.parseRange(t,n),u=e.domSelectionRange(),d=u.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:u.anchorOffset}],m(u)||r.push({node:u.focusNode,offset:u.focusOffset})),E&&8===e.input.lastKeyCode)for(let o=a;o>s;o--){let e=i.childNodes[o-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){a=o;break}if(!t||t.size)break}let p=e.state.doc,h=e.someProp("domParser")||o.a.fromSchema(e.state.schema),f=p.resolve(l),g=null,v=h.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:tn,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),g={anchor:e+l,head:t+l}}return{doc:v,sel:g,from:l,to:c}}(e,t,n),h=e.state.doc,f=h.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,u="end"):(c=e.state.selection.from,u="start"),e.input.lastKeyCode=null;let v=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){let e=Math.max(0,i-Math.min(s,a));r-=s+e-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;a=(i-=e)+(a-s),s=i}else if(a<i){let e=r<=i&&r>=a?i-r:0;s=(i-=e)+(s-a),a=i}return{start:i,endA:s,endB:a}}(f.content,p.doc.content,p.from,c,u);if((D&&e.input.lastIOSEnter>Date.now()-225||L)&&s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName||"LI"==e.nodeName)&&(!v||v.endA>=v.endB)&&e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!v){if(!(i&&d instanceof r.h&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let t=rn(e,e.state.doc,p.sel);t&&!t.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(t))}return}v={start:d.from,endA:d.to,endB:d.to}}if(E&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from&&p.sel.head==p.sel.anchor){let e=v.endB-v.start;p.sel={anchor:p.sel.anchor+e,head:p.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&v.start==v.endB&&e.state.selection instanceof r.h&&(v.start>e.state.selection.from&&v.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?v.start=e.state.selection.from:v.endA<e.state.selection.to&&v.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(v.endB+=e.state.selection.to-v.endA,v.endA=e.state.selection.to)),C&&T<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>p.from&&"  "==p.doc.textBetween(v.start-p.from-1,v.start-p.from+1)&&(v.start--,v.endA--,v.endB--);let y,b=p.doc.resolveNoCache(v.start-p.from),w=p.doc.resolveNoCache(v.endB-p.from),k=h.resolve(v.start),x=b.sameParent(w)&&b.parent.inlineContent&&k.end()>=v.endA;if((D&&e.input.lastIOSEnter>Date.now()-225&&(!x||s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!x&&b.pos<p.doc.content.size&&(y=r.f.findFrom(p.doc.resolve(b.pos+1),1,!0))&&y.head==w.pos)&&e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>v.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||on(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(on(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||on(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,v.start,v.endA,b,w)&&e.someProp("handleKeyDown",t=>t(e,g(8,"Backspace"))))return void(L&&E&&e.domObserver.suppressSelectionUpdates());E&&L&&v.endB==v.start&&(e.input.lastAndroidDelete=Date.now()),L&&!x&&b.start()!=w.start()&&0==w.parentOffset&&b.depth==w.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==v.endA&&(v.endB-=2,w=p.doc.resolveNoCache(v.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,g(13,"Enter"))})},20));let M,S,N,O=v.start,A=v.endA;if(x)if(b.pos==w.pos)C&&T<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ne(e),20)),M=e.state.tr.delete(O,A),S=h.resolve(v.start).marksAcross(h.resolve(v.endA));else if(v.endA==v.endB&&(N=function(e,t){let n,r,i,s=e.firstChild.marks,a=t.firstChild.marks,l=s,c=a;for(let o=0;o<a.length;o++)l=a[o].removeFromSet(l);for(let o=0;o<s.length;o++)c=s[o].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=(e=>e.mark(r.addToSet(e.marks)));else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=(e=>e.mark(r.removeFromSet(e.marks)))}let u=[];for(let o=0;o<t.childCount;o++)u.push(i(t.child(o)));if(o.c.from(u).eq(e))return{mark:r,type:n}}(b.parent.content.cut(b.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start()))))M=e.state.tr,"add"==N.type?M.addMark(O,A,N.mark):M.removeMark(O,A,N.mark);else if(b.parent.child(b.index()).isText&&b.index()==w.index()-(w.textOffset?0:1)){let t=b.parent.textBetween(b.parentOffset,w.parentOffset);if(e.someProp("handleTextInput",n=>n(e,O,A,t)))return;M=e.state.tr.insertText(t,O,A)}if(M||(M=e.state.tr.replace(O,A,p.doc.slice(v.start-p.from,v.endB-p.from))),p.sel){let t=rn(e,M.doc,p.sel);t&&!(E&&L&&e.composing&&t.empty&&(v.start!=v.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==O||t.head==M.mapping.map(A)-1)||C&&t.empty&&t.head==O)&&M.setSelection(t)}S&&M.ensureMarks(S),e.dispatch(M.scrollIntoView())}function rn(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Pe(e,t.resolve(n.anchor),t.resolve(n.head))}function on(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class sn{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new dt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(dn),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cn(this),ln(this),this.nodeViews=un(this),this.docView=de(this.state.doc,an(this),Kt(this),this.dom,this),this.domObserver=new Qt(this,(e,t,n,r)=>nn(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in lt){let n=lt[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=(t=>{!mt(e,t)||ft(e,t)||!e.editable&&t.type in ct||n(e,t)}),ut[t]?{passive:!0}:void 0)}O&&e.dom.addEventListener("input",()=>null),ht(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ht(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dn),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(St(this),o=!0),this.state=e;let i=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=un(this);(function(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&ht(this),this.editable=cn(this),ln(this);let s=Kt(this),a=an(this),l=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(e.doc,a,s);!c&&e.selection.eq(n.selection)||(o=!0);let d="preserve"==l&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:j(e.dom)}}(this);if(o){this.domObserver.stop();let t=c&&(C||E)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(n.selection,e.selection);if(c){let n=E?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,a,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=de(e.doc,a,s,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return u(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Ne(this,t):(Ie(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;z(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof r.c){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&H(this,t.getBoundingClientRect(),e)}else H(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(C){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(q)return e.focus(q);let t=j(e);e.focus(null==q?{get preventScroll(){return q={preventScroll:!0},!0}}:void 0),q||(q=!1,z(t,0))}(this.dom),Ne(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=(()=>t.ownerDocument.getSelection())),this._root=t;return e||document}posAtCoords(e){return _(this,e)}coordsAtPos(e,t=1){return J(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return te(this,t||this.state,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Kt(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){ft(e,t)||!lt[t.type]||!e.editable&&t.type in ct||lt[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return O&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,o=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return u(a.node,a.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function an(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),t.translate="no",e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e&&(t.class+=" "+n[e]),"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),[Pt.node(0,e.state.doc.content.size,t)]}function ln(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Pt.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function cn(e){return!e.someProp("editable",t=>!1===t(e.state))}function un(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function dn(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}},cqjR:function(e,t,n){"use strict";n.d(t,"a",function(){return o}),n.d(t,"b",function(){return s}),n.d(t,"c",function(){return l});var r=n("b/sn");n("uSMm");class o{constructor(e,t){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,o){let i=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);i+=n[0].slice(e+n[1].length);let t=(r+=e)-o;t>0&&(i=n[0].slice(e-t,e)+i,r=o)}return t.tr.insertText(i,r,o)}}(t):t}}const i=500;function s({rules:e}){let t=new r.d({state:{init:()=>null,apply(e,t){let n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>a(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&a(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function a(e,t,n,r,o,s){if(e.composing)return!1;let a=e.state,l=a.doc.resolve(t);if(l.parent.type.spec.code)return!1;let c=l.parent.textBetween(Math.max(0,l.parentOffset-i),l.parentOffset,null,"")+r;for(let i=0;i<o.length;i++){let l=o[i].match.exec(c),u=l&&o[i].handler(a,l,t-(l[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(s,{transform:u,from:t,to:n,text:r})),!0}return!1}const l=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};new o(/--$/,"—"),new o(/\.\.\.$/,"…"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new o(/"$/,"”"),new o(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new o(/'$/,"’")},"p77/":function(e,t,n){},uSMm:function(e,t,n){"use strict";n.d(t,"a",function(){return f}),n.d(t,"b",function(){return T}),n.d(t,"c",function(){return C}),n.d(t,"d",function(){return h}),n.d(t,"e",function(){return K}),n.d(t,"f",function(){return A}),n.d(t,"g",function(){return D}),n.d(t,"h",function(){return R}),n.d(t,"i",function(){return N}),n.d(t,"j",function(){return I}),n.d(t,"k",function(){return E}),n.d(t,"l",function(){return P});var r=n("byeC");const o=65535,i=Math.pow(2,16);function s(e,t){return e+t*i}function a(e){return e&o}const l=1,c=2,u=4,d=8;class p{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&d)>0}get deletedBefore(){return(this.delInfo&(l|u))>0}get deletedAfter(){return(this.delInfo&(c|u))>0}get deletedAcross(){return(this.delInfo&u)>0}}class h{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&h.empty)return h.empty}recover(e){let t=0,n=a(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(e&o))/i}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let h=this.ranges[a]-(this.inverted?r:0);if(h>e)break;let f=this.ranges[a+o],m=this.ranges[a+i],g=h+f;if(e<=g){let o=h+r+((f?e==h?-1:e==g?1:t:t)<0?0:m);if(n)return o;let i=e==(t<0?h:g)?null:s(a/3,e-h),v=e==h?c:e==g?l:u;return(t<0?e!=h:e!=g)&&(v|=d),new p(o,v,i)}r+=m-f}return n?e+r:new p(e+r,0,null)}touches(e,t){let n=0,r=a(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[s+o];if(e<=t+a&&s==3*r)return!0;n+=this.ranges[s+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new h(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?h.empty:new h(e<0?[0,-e,0]:[0,0,e])}}h.empty=new h([]);class f{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new f(this.maps,this.mirror,e,t)}copy(){return new f(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new f;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this.maps[o].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new p(e,r,null)}}const m=Object.create(null);class g{getMap(){return h.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=m[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in m)throw new RangeError("Duplicate use of step JSON ID "+e);return m[e]=t,t.prototype.jsonID=e,t}}class v{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new v(e,null)}static fail(e){return new v(null,e)}static fromReplace(e,t,n,o){try{return v.ok(e.replace(t,n,o))}catch(e){if(e instanceof r.h)return v.fail(e.message);throw e}}}function y(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(y(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return r.c.fromArray(o)}class b extends g{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.j(y(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,o),t.openStart,t.openEnd);return v.fromReplace(e,this.from,this.to,i)}invert(){return new w(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new b(t.pos,n.pos,this.mark)}merge(e){return e instanceof b&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new b(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new b(t.from,t.to,e.markFromJSON(t.mark))}}g.jsonID("addMark",b);class w extends g{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.j(y(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return v.fromReplace(e,this.from,this.to,n)}invert(){return new b(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new w(t.pos,n.pos,this.mark)}merge(e){return e instanceof w&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new w(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new w(t.from,t.to,e.markFromJSON(t.mark))}}g.jsonID("removeMark",w);class k extends g{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return v.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return v.fromReplace(e,this.pos,this.pos+1,new r.j(r.c.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new k(this.pos,t.marks[n]);return new k(this.pos,this.mark)}}return new x(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new k(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new k(t.pos,e.markFromJSON(t.mark))}}g.jsonID("addNodeMark",k);class x extends g{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return v.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return v.fromReplace(e,this.pos,this.pos+1,new r.j(r.c.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new k(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new x(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new x(t.pos,e.markFromJSON(t.mark))}}g.jsonID("removeNodeMark",x);class C extends g{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&M(e,this.from,this.to)?v.fail("Structure replace would overwrite content"):v.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new h([this.from,this.to-this.from,this.slice.size])}invert(e){return new C(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new C(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof C)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?r.j.empty:new r.j(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new C(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?r.j.empty:new r.j(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new C(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new C(t.from,t.to,r.j.fromJSON(e,t.slice),!!t.structure)}}g.jsonID("replace",C);class T extends g{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(M(e,this.from,this.gapFrom)||M(e,this.gapTo,this.to)))return v.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return v.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?v.fromReplace(e,this.from,this.to,n):v.fail("Content does not fit in gap")}getMap(){return new h([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new T(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new T(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new T(t.from,t.to,t.gapFrom,t.gapTo,r.j.fromJSON(e,t.slice),t.insert,!!t.structure)}}function M(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function S(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function E(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!S(r,o,i))break}return null}function N(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(O).concat({type:t,attrs:n}).concat(i.map(O)):null}function O(e){return{type:e,attrs:null}}function D(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[u]||e;if(i!=e&&(n=n.replaceChild(0,i.type.create(i.attrs))),!e.canReplace(t+1,e.childCount)||!i.type.validContent(n))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function A(e,t){let n=e.resolve(t),r=n.index();return L(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function L(e,t){return!(!e||!t||e.isLeaf||!e.canAppend(t))}function I(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let e,i,s=r.index(o);if(o==r.depth?(e=r.nodeBefore,i=r.nodeAfter):n>0?(e=r.node(o+1),s++,i=r.node(o).maybeChild(s)):(e=r.node(o).maybeChild(s-1),i=r.node(o+1)),e&&!e.isTextblock&&L(e,i)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function R(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),s=r.node(e),a=!1;if(1==i)a=s.canReplace(n,n,o);else{let e=s.contentMatchAt(n).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function P(e,t,n=t,o=r.j.empty){if(t==n&&!o.size)return null;let i=e.resolve(t),s=e.resolve(n);return B(i,s,o)?new C(t,n,o):new F(i,s,o).fit()}function B(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}g.jsonID("replaceAround",T);class F{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.c.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let o=e.depth;o>0;o--)this.placed=r.c.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let i=this.placed,s=n.depth,a=o.depth;for(;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;let l=new r.j(i,s,a);return e>-1?new T(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new C(n.pos,o.pos,l):null}findFittable(){for(let e=1;e<=2;e++)for(let t=this.unplaced.openStart;t>=0;t--){let n,o=null,i=(n=t?(o=z(this.unplaced.content,t-1).firstChild).content:this.unplaced.content).firstChild;for(let s=this.depth;s>=0;s--){let n,{type:a,match:l}=this.frontier[s],c=null;if(1==e&&(i?l.matchType(i.type)||(c=l.fillBefore(r.c.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:t,frontierDepth:s,parent:o,inject:c};if(2==e&&i&&(n=l.findWrapping(i.type)))return{sliceDepth:t,frontierDepth:s,parent:o,wrap:n};if(o&&l.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=z(e,t);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new r.j(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=z(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new r.j(H(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r.j(H(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let r=0;r<i.length;r++)this.openFrontierNode(i[r]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)u.push(o.child(e));d=d.matchFragment(o)}let h=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=d.matchType(e.type);if(!t)break;(++c>1||0==l||e.content.size)&&(d=t,u.push(q(e.mark(p.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?h:-1)))}let f=c==a.childCount;f||(h=-1),this.placed=j(this.placed,t,r.c.from(u)),this.frontier[t].match=d,f&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let r=0,m=a;r<h;r++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=f?0==e?r.j.empty:new r.j(H(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new r.j(H(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!V(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=V(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=V(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=j(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=j(this.placed,this.depth,r.c.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.c.empty,!0);e.childCount&&(this.placed=j(this.placed,this.frontier.length,e))}}function H(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(H(e.firstChild.content,t-1,n)))}function j(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(j(e.lastChild.content,t-1,n)))}function z(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function q(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,q(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.c.empty,!0)))),e.copy(o)}function V(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function $(e){return e.spec.defining||e.spec.definingForContent}function _(e,t,n,o,i){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(_(r.content,t+1,n,o,r)))}if(t>o){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.c.empty,!0))}return e}function U(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class W extends g{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return v.fail("No node at attribute step's position");let n=Object.create(null);for(let r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return v.fromReplace(e,this.pos,this.pos+1,new r.j(r.c.from(o),0,t.isLeaf?0:1))}getMap(){return h.empty}invert(e){return new W(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new W(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new W(t.pos,t.attr,t.value)}}g.jsonID("attr",W);let J=class extends Error{};(J=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),J.prototype.constructor=J,J.prototype.name="TransformError";class K{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new f}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new J(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.j.empty){let o=P(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new r.j(r.c.from(n),0,0))}delete(e,t){return this.replace(e,t,r.j.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(B(i,s,o))return e.step(new C(t,n,o));let a=U(i,e.doc.resolve(n));0==a[a.length-1]&&a.pop();let l=-(i.depth+1);a.unshift(l);for(let r=i.depth,h=i.pos-1;r>0;r--,h--){let e=i.node(r).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;a.indexOf(r)>-1?l=r:i.before(r)==h&&a.splice(1,0,-r)}let c=a.indexOf(l),u=[],d=o.openStart;for(let r=o.content,h=0;;h++){let e=r.firstChild;if(u.push(e),h==o.openStart)break;r=e.content}for(let r=d-1;r>=0;r--){let e=u[r].type,t=$(e);if(t&&i.node(c).type!=e)d=r;else if(t||!e.isTextblock)break}for(let h=o.openStart;h>=0;h--){let t=(h+d+1)%(o.openStart+1),l=u[t];if(l)for(let u=0;u<a.length;u++){let d=a[(u+c)%a.length],p=!0;d<0&&(p=!1,d=-d);let h=i.node(d-1),f=i.index(d-1);if(h.canReplaceWith(f,f,l.type,l.marks))return e.replace(i.before(d),p?s.after(d):n,new r.j(_(o.content,0,o.openStart,t),t,o.openEnd))}}let p=e.steps.length;for(let r=a.length-1;r>=0&&(e.replace(t,n,o),!(e.steps.length>p));r--){let e=a[r];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new r.j(r.c.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=U(r,o);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:i,depth:s}=t,a=o.before(s+1),l=i.after(s+1),c=a,u=l,d=r.c.empty,p=0;for(let m=s,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,d=r.c.from(o.node(m).copy(d)),p++):c--;let h=r.c.empty,f=0;for(let m=s,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=r.c.from(i.node(m).copy(h)),f++):u++;e.step(new T(c,u,a,l,new r.j(d.append(h),p,f),d.size-p,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=new C(t-n,t+n,r.j.empty,!0);e.step(o)}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=r.c.empty;for(let a=n.length-1;a>=0;a--){if(o.size){let e=n[a].type.contentMatch.matchFragment(o);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.c.from(n[a].type.create(n[a].attrs,o))}let i=t.start,s=t.end;e.step(new T(i,s,i,s,new r.j(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{if(t.isTextblock&&!t.hasMarkup(o,i)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(n),o)){e.clearIncompatible(e.mapping.slice(s).map(n,1),o);let a=e.mapping.slice(s),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new T(l,c,l+1,c-1,new r.j(r.c.from(o.create(i,null,t.marks)),0,0),1,!0)),!1}})}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o=[]){return function(e,t,n,o,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(o,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new T(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.j(r.c.from(a),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new W(e,t,n)),this}addNodeMark(e,t){return this.step(new k(e,t)),this}removeNodeMark(e,t){if(!(t instanceof r.d)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new x(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let i=e.doc.resolve(t),s=r.c.empty,a=r.c.empty;for(let l=i.depth,c=i.depth-n,u=n-1;l>c;l--,u--){s=r.c.from(i.node(l).copy(s));let e=o&&o[u];a=r.c.from(e?e.type.create(e.attrs,a):i.node(l).copy(a))}e.step(new C(t,t,new r.j(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),p=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new w(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new b(c,d,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let i=[],s=0;e.doc.nodesBetween(t,n,(e,a)=>{if(!e.isInline)return;s++;let l=null;if(o instanceof r.e){let t,n=e.marks;for(;t=o.isInSet(n);)(l||(l=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(l=[o]):l=e.marks;if(l&&l.length){let r=Math.min(a+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,o=l[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&o.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(a,t),to:r,step:s})}}}),i.forEach(t=>e.step(new w(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,o=n.contentMatch){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let t=i.child(l),c=a+t.nodeSize,u=o.matchType(t.type);if(u){o=u;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new w(a,c,t.marks[r]))}else s.push(new C(a,c,r.j.empty));a=c}if(!o.validEnd){let t=o.fillBefore(r.c.empty,!0);e.replace(a,a,new r.j(t,0,0))}for(let r=s.length-1;r>=0;r--)e.step(s[r])}(this,e,t,n),this}}}}]);