@abp/tui-editor 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/abp.resourcemapping.js +1 -1
- package/package.json +3 -6
- package/src/toastui-editor-all.min.js +24 -0
- package/src/toastui-editor-plugin-code-syntax-highlight-all.min.js +15 -0
- package/src/toastui-editor-plugin-code-syntax-highlight.min.css +171 -0
- package/src/toastui-editor.min.css +7 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @toast-ui/editor
|
|
3
|
+
* @version 3.1.2 | Mon Dec 27 2021
|
|
4
|
+
* @author NHN FE Development Lab <dl_javascript@nhn.com>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.toastui=e():(t.toastui=t.toastui||{},t.toastui.Editor=e())}(self,(function(){return function(){var t={368:function(t){
|
|
8
|
+
/*! @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 */
|
|
9
|
+
t.exports=function(){"use strict";function t(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var e=Object.hasOwnProperty,n=Object.setPrototypeOf,r=Object.isFrozen,o=Object.getPrototypeOf,i=Object.getOwnPropertyDescriptor,s=Object.freeze,a=Object.seal,c=Object.create,l="undefined"!=typeof Reflect&&Reflect,u=l.apply,p=l.construct;u||(u=function(t,e,n){return t.apply(e,n)}),s||(s=function(t){return t}),a||(a=function(t){return t}),p||(p=function(e,n){return new(Function.prototype.bind.apply(e,[null].concat(t(n))))});var d=x(Array.prototype.forEach),f=x(Array.prototype.pop),h=x(Array.prototype.push),m=x(String.prototype.toLowerCase),v=x(String.prototype.match),g=x(String.prototype.replace),y=x(String.prototype.indexOf),b=x(String.prototype.trim),w=x(RegExp.prototype.test),k=C(TypeError);function x(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return u(t,e,r)}}function C(t){return function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return p(t,n)}}function T(t,e){n&&n(t,null);for(var o=e.length;o--;){var i=e[o];if("string"==typeof i){var s=m(i);s!==i&&(r(e)||(e[o]=s),i=s)}t[i]=!0}return t}function M(t){var n=c(null),r=void 0;for(r in t)u(e,t,[r])&&(n[r]=t[r]);return n}function S(t,e){for(;null!==t;){var n=i(t,e);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}t=o(t)}function r(t){return console.warn("fallback value for",t),null}return r}var E=s(["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"]),N=s(["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"]),O=s(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),D=s(["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"]),A=s(["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"]),L=s(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),I=s(["#text"]),R=s(["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"]),P=s(["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"]),B=s(["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"]),F=s(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),H=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),z=a(/<%[\s\S]*|[\s\S]*%>/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]/),_=a(/^aria-[\-\w]+$/),q=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),$=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function W(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var J=function(){return"undefined"==typeof window?null:window},G=function(t,e){if("object"!==(void 0===t?"undefined":U(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function K(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:J(),e=function(t){return K(t)};if(e.version="2.3.3",e.removed=[],!t||!t.document||9!==t.document.nodeType)return e.isSupported=!1,e;var n=t.document,r=t.document,o=t.DocumentFragment,i=t.HTMLTemplateElement,a=t.Node,c=t.Element,l=t.NodeFilter,u=t.NamedNodeMap,p=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,x=t.Text,C=t.Comment,Z=t.DOMParser,X=t.trustedTypes,Q=c.prototype,Y=S(Q,"cloneNode"),tt=S(Q,"nextSibling"),et=S(Q,"childNodes"),nt=S(Q,"parentNode");if("function"==typeof i){var rt=r.createElement("template");rt.content&&rt.content.ownerDocument&&(r=rt.content.ownerDocument)}var ot=G(X,n),it=ot&&Ft?ot.createHTML(""):"",st=r,at=st.implementation,ct=st.createNodeIterator,lt=st.createDocumentFragment,ut=st.getElementsByTagName,pt=n.importNode,dt={};try{dt=M(r).documentMode?r.documentMode:{}}catch(t){}var ft={};e.isSupported="function"==typeof nt&&at&&void 0!==at.createHTMLDocument&&9!==dt;var ht=H,mt=z,vt=j,gt=_,yt=V,bt=$,wt=q,kt=null,xt=T({},[].concat(W(E),W(N),W(O),W(A),W(I))),Ct=null,Tt=T({},[].concat(W(R),W(P),W(B),W(F))),Mt=null,St=null,Et=!0,Nt=!0,Ot=!1,Dt=!1,At=!1,Lt=!1,It=!1,Rt=!1,Pt=!1,Bt=!0,Ft=!1,Ht=!0,zt=!0,jt=!1,_t={},qt=null,Vt=T({},["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"]),$t=null,Ut=T({},["audio","video","img","source","image","track"]),Wt=null,Jt=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Kt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml",Xt=Zt,Qt=!1,Yt=void 0,te=["application/xhtml+xml","text/html"],ee="text/html",ne=void 0,re=null,oe=r.createElement("form"),ie=function(t){re&&re===t||(t&&"object"===(void 0===t?"undefined":U(t))||(t={}),t=M(t),kt="ALLOWED_TAGS"in t?T({},t.ALLOWED_TAGS):xt,Ct="ALLOWED_ATTR"in t?T({},t.ALLOWED_ATTR):Tt,Wt="ADD_URI_SAFE_ATTR"in t?T(M(Jt),t.ADD_URI_SAFE_ATTR):Jt,$t="ADD_DATA_URI_TAGS"in t?T(M(Ut),t.ADD_DATA_URI_TAGS):Ut,qt="FORBID_CONTENTS"in t?T({},t.FORBID_CONTENTS):Vt,Mt="FORBID_TAGS"in t?T({},t.FORBID_TAGS):{},St="FORBID_ATTR"in t?T({},t.FORBID_ATTR):{},_t="USE_PROFILES"in t&&t.USE_PROFILES,Et=!1!==t.ALLOW_ARIA_ATTR,Nt=!1!==t.ALLOW_DATA_ATTR,Ot=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Dt=t.SAFE_FOR_TEMPLATES||!1,At=t.WHOLE_DOCUMENT||!1,Rt=t.RETURN_DOM||!1,Pt=t.RETURN_DOM_FRAGMENT||!1,Bt=!1!==t.RETURN_DOM_IMPORT,Ft=t.RETURN_TRUSTED_TYPE||!1,It=t.FORCE_BODY||!1,Ht=!1!==t.SANITIZE_DOM,zt=!1!==t.KEEP_CONTENT,jt=t.IN_PLACE||!1,wt=t.ALLOWED_URI_REGEXP||wt,Xt=t.NAMESPACE||Zt,Yt=Yt=-1===te.indexOf(t.PARSER_MEDIA_TYPE)?ee:t.PARSER_MEDIA_TYPE,ne="application/xhtml+xml"===Yt?function(t){return t}:m,Dt&&(Nt=!1),Pt&&(Rt=!0),_t&&(kt=T({},[].concat(W(I))),Ct=[],!0===_t.html&&(T(kt,E),T(Ct,R)),!0===_t.svg&&(T(kt,N),T(Ct,P),T(Ct,F)),!0===_t.svgFilters&&(T(kt,O),T(Ct,P),T(Ct,F)),!0===_t.mathMl&&(T(kt,A),T(Ct,B),T(Ct,F))),t.ADD_TAGS&&(kt===xt&&(kt=M(kt)),T(kt,t.ADD_TAGS)),t.ADD_ATTR&&(Ct===Tt&&(Ct=M(Ct)),T(Ct,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&T(Wt,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(qt===Vt&&(qt=M(qt)),T(qt,t.FORBID_CONTENTS)),zt&&(kt["#text"]=!0),At&&T(kt,["html","head","body"]),kt.table&&(T(kt,["tbody"]),delete Mt.tbody),s&&s(t),re=t)},se=T({},["mi","mo","mn","ms","mtext"]),ae=T({},["foreignobject","desc","title","annotation-xml"]),ce=T({},N);T(ce,O),T(ce,D);var le=T({},A);T(le,L);var ue=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:Zt,tagName:"template"});var n=m(t.tagName),r=m(e.tagName);if(t.namespaceURI===Kt)return e.namespaceURI===Zt?"svg"===n:e.namespaceURI===Gt?"svg"===n&&("annotation-xml"===r||se[r]):Boolean(ce[n]);if(t.namespaceURI===Gt)return e.namespaceURI===Zt?"math"===n:e.namespaceURI===Kt?"math"===n&&ae[r]:Boolean(le[n]);if(t.namespaceURI===Zt){if(e.namespaceURI===Kt&&!ae[r])return!1;if(e.namespaceURI===Gt&&!se[r])return!1;var o=T({},["title","style","font","a","script"]);return!le[n]&&(o[n]||!ce[n])}return!1},pe=function(t){h(e.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=it}catch(e){t.remove()}}},de=function(t,n){try{h(e.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){h(e.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t&&!Ct[t])if(Rt||Pt)try{pe(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},fe=function(t){var e=void 0,n=void 0;if(It)t="<remove></remove>"+t;else{var o=v(t,/^[\r\n\t ]+/);n=o&&o[0]}"application/xhtml+xml"===Yt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=ot?ot.createHTML(t):t;if(Xt===Zt)try{e=(new Z).parseFromString(i,Yt)}catch(t){}if(!e||!e.documentElement){e=at.createDocument(Xt,"template",null);try{e.documentElement.innerHTML=Qt?"":i}catch(t){}}var s=e.body||e.documentElement;return t&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),Xt===Zt?ut.call(e,At?"html":"body")[0]:At?e.documentElement:s},he=function(t){return ct.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},me=function(t){return!(t instanceof x||t instanceof C||"string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof p&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},ve=function(t){return"object"===(void 0===a?"undefined":U(a))?t instanceof a:t&&"object"===(void 0===t?"undefined":U(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},ge=function(t,n,r){ft[t]&&d(ft[t],(function(t){t.call(e,n,r,re)}))},ye=function(t){var n=void 0;if(ge("beforeSanitizeElements",t,null),me(t))return pe(t),!0;if(v(t.nodeName,/[\u0080-\uFFFF]/))return pe(t),!0;var r=ne(t.nodeName);if(ge("uponSanitizeElement",t,{tagName:r,allowedTags:kt}),!ve(t.firstElementChild)&&(!ve(t.content)||!ve(t.content.firstElementChild))&&w(/<[/\w]/g,t.innerHTML)&&w(/<[/\w]/g,t.textContent))return pe(t),!0;if("select"===r&&w(/<template/i,t.innerHTML))return pe(t),!0;if(!kt[r]||Mt[r]){if(zt&&!qt[r]){var o=nt(t)||t.parentNode,i=et(t)||t.childNodes;if(i&&o)for(var s=i.length-1;s>=0;--s)o.insertBefore(Y(i[s],!0),tt(t))}return pe(t),!0}return t instanceof c&&!ue(t)?(pe(t),!0):"noscript"!==r&&"noembed"!==r||!w(/<\/no(script|embed)/i,t.innerHTML)?(Dt&&3===t.nodeType&&(n=t.textContent,n=g(n,ht," "),n=g(n,mt," "),t.textContent!==n&&(h(e.removed,{element:t.cloneNode()}),t.textContent=n)),ge("afterSanitizeElements",t,null),!1):(pe(t),!0)},be=function(t,e,n){if(Ht&&("id"===e||"name"===e)&&(n in r||n in oe))return!1;if(Nt&&!St[e]&&w(vt,e));else if(Et&&w(gt,e));else{if(!Ct[e]||St[e])return!1;if(Wt[e]);else if(w(wt,g(n,bt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==y(n,"data:")||!$t[t])if(Ot&&!w(yt,g(n,bt,"")));else if(n)return!1}return!0},we=function(t){var n=void 0,r=void 0,o=void 0,i=void 0;ge("beforeSanitizeAttributes",t,null);var s=t.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ct};for(i=s.length;i--;){var c=n=s[i],l=c.name,u=c.namespaceURI;if(r=b(n.value),o=ne(l),a.attrName=o,a.attrValue=r,a.keepAttr=!0,a.forceKeepAttr=void 0,ge("uponSanitizeAttribute",t,a),r=a.attrValue,!a.forceKeepAttr&&(de(l,t),a.keepAttr))if(w(/\/>/i,r))de(l,t);else{Dt&&(r=g(r,ht," "),r=g(r,mt," "));var p=ne(t.nodeName);if(be(p,o,r))try{u?t.setAttributeNS(u,l,r):t.setAttribute(l,r),f(e.removed)}catch(t){}}}ge("afterSanitizeAttributes",t,null)}},ke=function t(e){var n=void 0,r=he(e);for(ge("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)ge("uponSanitizeShadowNode",n,null),ye(n)||(n.content instanceof o&&t(n.content),we(n));ge("afterSanitizeShadowDOM",e,null)};return e.sanitize=function(r,i){var s=void 0,c=void 0,l=void 0,u=void 0,p=void 0;if((Qt=!r)&&(r="\x3c!--\x3e"),"string"!=typeof r&&!ve(r)){if("function"!=typeof r.toString)throw k("toString is not a function");if("string"!=typeof(r=r.toString()))throw k("dirty is not a string, aborting")}if(!e.isSupported){if("object"===U(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof r)return t.toStaticHTML(r);if(ve(r))return t.toStaticHTML(r.outerHTML)}return r}if(Lt||ie(i),e.removed=[],"string"==typeof r&&(jt=!1),jt);else if(r instanceof a)1===(c=(s=fe("\x3c!----\x3e")).ownerDocument.importNode(r,!0)).nodeType&&"BODY"===c.nodeName||"HTML"===c.nodeName?s=c:s.appendChild(c);else{if(!Rt&&!Dt&&!At&&-1===r.indexOf("<"))return ot&&Ft?ot.createHTML(r):r;if(!(s=fe(r)))return Rt?null:it}s&&It&&pe(s.firstChild);for(var d=he(jt?r:s);l=d.nextNode();)3===l.nodeType&&l===u||ye(l)||(l.content instanceof o&&ke(l.content),we(l),u=l);if(u=null,jt)return r;if(Rt){if(Pt)for(p=lt.call(s.ownerDocument);s.firstChild;)p.appendChild(s.firstChild);else p=s;return Bt&&(p=pt.call(n,p,!0)),p}var f=At?s.outerHTML:s.innerHTML;return Dt&&(f=g(f,ht," "),f=g(f,mt," ")),ot&&Ft?ot.createHTML(f):f},e.setConfig=function(t){ie(t),Lt=!0},e.clearConfig=function(){re=null,Lt=!1},e.isValidAttribute=function(t,e,n){re||ie({});var r=ne(t),o=ne(e);return be(r,o,n)},e.addHook=function(t,e){"function"==typeof e&&(ft[t]=ft[t]||[],h(ft[t],e))},e.removeHook=function(t){ft[t]&&f(ft[t])},e.removeHooks=function(t){ft[t]&&(ft[t]=[])},e.removeAllHooks=function(){ft={}},e}return K()}()},928:function(t,e,n){"use strict";var r=n(322);t.exports=function(t,e,n){var o,i;if(n=n||0,!r(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(i=e.length,o=n;n>=0&&o<i;o+=1)if(e[o]===t)return o;return-1}},690:function(t,e,n){"use strict";var r=n(322),o=n(893),i=n(956);t.exports=function(t,e,n){r(t)?o(t,e,n):i(t,e,n)}},893:function(t){"use strict";t.exports=function(t,e,n){var r=0,o=t.length;for(n=n||null;r<o&&!1!==e.call(n,t[r],r,t);r+=1);}},956:function(t){"use strict";t.exports=function(t,e,n){var r;for(r in n=n||null,t)if(t.hasOwnProperty(r)&&!1===e.call(n,t[r],r,t))break}},990:function(t,e,n){"use strict";var r=n(893);t.exports=function(t){var e;try{e=Array.prototype.slice.call(t)}catch(n){e=[],r(t,(function(t){e.push(t)}))}return e}},755:function(t){"use strict";var e="_feEventKey";t.exports=function(t,n){var r,o=t[e];return o||(o=t[e]={}),(r=o[n])||(r=o[n]=[]),r}},349:function(t,e,n){"use strict";var r=n(758),o=n(690),i=n(755);function s(t,e,n){var r,s=i(t,e);n?(o(s,(function(o,i){return n!==o.handler||(a(t,e,o.wrappedHandler),r=i,!1)})),s.splice(r,1)):(o(s,(function(n){a(t,e,n.wrappedHandler)})),s.splice(0,s.length))}function a(t,e,n){"removeEventListener"in t?t.removeEventListener(e,n):"detachEvent"in t&&t.detachEvent("on"+e,n)}t.exports=function(t,e,n){r(e)?o(e.split(/\s+/g),(function(e){s(t,e,n)})):o(e,(function(e,n){s(t,n,e)}))}},348:function(t,e,n){"use strict";var r=n(758),o=n(690),i=n(755);function s(t,e,n,r){function s(e){n.call(r||t,e||window.event)}"addEventListener"in t?t.addEventListener(e,s):"attachEvent"in t&&t.attachEvent("on"+e,s),function(t,e,n,r){var s=i(t,e),a=!1;o(s,(function(t){return t.handler!==n||(a=!0,!1)})),a||s.push({handler:n,wrappedHandler:r})}(t,e,n,s)}t.exports=function(t,e,n,i){r(e)?o(e.split(/\s+/g),(function(e){s(t,e,n,i)})):o(e,(function(e,r){s(t,r,e,n)}))}},24:function(t,e,n){"use strict";var r=n(322),o=n(929);t.exports=function(t,e){e=(e=r(e)?e.join(" "):e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),o(t.className.baseVal)?t.className=e:t.className.baseVal=e}},204:function(t,e,n){"use strict";var r=n(690),o=n(928),i=n(902),s=n(24);t.exports=function(t){var e,n=Array.prototype.slice.call(arguments,1),a=t.classList,c=[];a?r(n,(function(e){t.classList.add(e)})):((e=i(t))&&(n=[].concat(e.split(/\s+/),n)),r(n,(function(t){o(t,c)<0&&c.push(t)})),s(t,c))}},522:function(t,e,n){"use strict";var r=n(758),o=n(690);t.exports=function(t,e,n){var i=t.style;r(e)?i[e]=n:o(e,(function(t,e){i[e]=t}))}},902:function(t,e,n){"use strict";var r=n(929);t.exports=function(t){return t&&t.className?r(t.className.baseVal)?t.className:t.className.baseVal:""}},714:function(t,e,n){"use strict";var r=n(928),o=n(902);t.exports=function(t,e){var n;return t.classList?t.classList.contains(e):(n=o(t).split(/\s+/),r(e,n)>-1)}},471:function(t,e,n){"use strict";var r=n(928),o=n(990),i=Element.prototype,s=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return r(this,o(e.querySelectorAll(t)))>-1};t.exports=function(t,e){return s.call(t,e)}},462:function(t,e,n){"use strict";var r=n(893),o=n(928),i=n(902),s=n(24);t.exports=function(t){var e,n,a=Array.prototype.slice.call(arguments,1),c=t.classList;c?r(a,(function(t){c.remove(t)})):(e=i(t).split(/\s+/),n=[],r(e,(function(t){o(t,a)<0&&n.push(t)})),s(t,n))}},969:function(t){"use strict";t.exports=function(t,e){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)&&(t[r]=n[r]);return t}},254:function(t,e,n){"use strict";var r=n(956);t.exports=function(t,e){var n=document.createElement("img"),o="";return r(e,(function(t,e){o+="&"+e+"="+t})),o=o.substring(1),n.src=t+"?"+o,n.style.display="none",document.body.appendChild(n),document.body.removeChild(n),n}},391:function(t,e,n){"use strict";var r=n(929),o=n(254);t.exports=function(t,e){var n=location.hostname,i="TOAST UI "+t+" for "+n+": Statistics",s=window.localStorage.getItem(i);(r(window.tui)||!1!==window.tui.usageStatistics)&&(s&&!function(t){return(new Date).getTime()-t>6048e5}(s)||(window.localStorage.setItem(i,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||o("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:n,dp:n,dh:t,el:t,ec:"use"})}),1e3)))}},516:function(t){"use strict";t.exports=function(t,e){var n,r;return e=e||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout((function(){t.apply(null,r)}),e)}}},423:function(t,e,n){"use strict";var r=n(516);t.exports=function(t,e){var n,o,i,s,a=!0,c=function(e){t.apply(null,e),n=null};function l(){if(s=Array.prototype.slice.call(arguments),a)return c(s),void(a=!1);i=Number(new Date),n=n||i,o(s),i-n>=e&&c(s)}return o=r(c,e=e||0),l.reset=function(){a=!0,n=null},l}},322:function(t){"use strict";t.exports=function(t){return t instanceof Array}},326:function(t){"use strict";t.exports=function(t){return"boolean"==typeof t||t instanceof Boolean}},65:function(t,e,n){"use strict";var r=n(929),o=n(934);t.exports=function(t){return!r(t)&&!o(t)}},404:function(t,e,n){"use strict";var r=n(790);t.exports=function(t){return!r(t)}},294:function(t){"use strict";t.exports=function(t){return t instanceof Function}},934:function(t){"use strict";t.exports=function(t){return null===t}},321:function(t){"use strict";t.exports=function(t){return"number"==typeof t||t instanceof Number}},73:function(t){"use strict";t.exports=function(t){return t===Object(t)}},758:function(t){"use strict";t.exports=function(t){return"string"==typeof t||t instanceof String}},790:function(t,e,n){"use strict";var r=n(65);t.exports=function(t){return r(t)&&!1!==t}},929:function(t){"use strict";t.exports=function(t){return void 0===t}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};return function(){"use strict";n.d(r,{default:function(){return Lg}});
|
|
10
|
+
/*! *****************************************************************************
|
|
11
|
+
Copyright (c) Microsoft Corporation.
|
|
12
|
+
|
|
13
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
14
|
+
purpose with or without fee is hereby granted.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
17
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
18
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
22
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
23
|
+
***************************************************************************** */
|
|
24
|
+
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.create;function i(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function s(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}Object.create;function a(t){this.content=t}a.prototype={constructor:a,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return-1==o?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new a(i)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new a(n)},addToStart:function(t,e){return new a([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new a(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(-1==i?o.length:i,0,e,n),new a(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=a.from(t)).size?new a(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=a.from(t)).size?new a(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=a.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},a.from=function(t){if(t instanceof a)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new a(e)};var c=a;function l(t,e,n){for(var r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;var o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var a=l(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function u(t,e,n,r){for(var o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var s=t.child(--o),a=e.child(--i),c=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var l=0,p=Math.min(s.text.length,a.text.length);l<p&&s.text[s.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){var d=u(s.content,a.content,n-1,r-1);if(d)return d}n-=c,r-=c}else n-=c,r-=c}}var p=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},d={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};p.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},p.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},p.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},p.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new p(r,this.size+t.size)},p.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,i=0;i<e;o++){var s=this.content[o],a=i+s.nodeSize;a>t&&((i<t||a>e)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new p(n,r)},p.prototype.cutByIndex=function(t,e){return t==e?p.empty:0==t&&e==this.content.length?this:new p(this.content.slice(t,e))},p.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new p(r,o)},p.prototype.addToStart=function(t){return new p([t].concat(this.content),this.size+t.nodeSize)},p.prototype.addToEnd=function(t){return new p(this.content.concat(t),this.size+t.nodeSize)},p.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},d.firstChild.get=function(){return this.content.length?this.content[0]:null},d.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},d.childCount.get=function(){return this.content.length},p.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},p.prototype.maybeChild=function(t){return this.content[t]},p.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},p.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),l(this,t,e)},p.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),u(this,t,e,n)},p.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return h(0,t);if(t==this.size)return h(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?h(n+1,o):h(n,r);r=o}},p.prototype.toString=function(){return"<"+this.toStringInner()+">"},p.prototype.toStringInner=function(){return this.content.join(", ")},p.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},p.fromJSON=function(t,e){if(!e)return p.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new p(e.map(t.nodeFromJSON))},p.fromArray=function(t){if(!t.length)return p.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new p(e||t,n)},p.from=function(t){if(!t)return p.empty;if(t instanceof p)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new p([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(p.prototype,d);var f={index:0,offset:0};function h(t,e){return f.index=t,f.offset=e,f}function m(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!m(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!m(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}p.empty=new p([],0);var v=function(t,e){this.type=t,this.attrs=e};function g(t){var e=Error.call(this,t);return e.__proto__=g.prototype,e}v.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},v.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},v.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},v.prototype.eq=function(t){return this==t||this.type==t.type&&m(this.attrs,t.attrs)},v.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},v.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},v.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},v.setFrom=function(t){if(!t||0==t.length)return v.none;if(t instanceof v)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},v.none=[],g.prototype=Object.create(Error.prototype),g.prototype.constructor=g,g.prototype.name="ReplaceError";var y=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},b={size:{configurable:!0}};function w(t,e,n){var r=t.findIndex(e),o=r.index,i=r.offset,s=t.maybeChild(o),a=t.findIndex(n),c=a.index,l=a.offset;if(i==e||s.isText){if(l!=n&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(w(s.content,e-i-1,n-i-1)))}function k(t,e,n,r){var o=t.findIndex(e),i=o.index,s=o.offset,a=t.maybeChild(i);if(s==e||a.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));var c=k(a.content,e-s-1,n);return c&&t.replaceChild(i,a.copy(c))}function x(t,e,n){if(n.openStart>t.depth)throw new g("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new g("Inconsistent open depths");return C(t,e,n,0)}function C(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){var s=C(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){var a=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(p.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return N(i,O(t,a.start,a.end,e,r))}var c=t.parent,l=c.content;return N(c,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}return N(i,D(t,e,r))}function T(t,e){if(!e.type.compatibleContent(t.type))throw new g("Cannot join "+e.type.name+" onto "+t.type.name)}function M(t,e,n){var r=t.node(n);return T(r,e.node(n)),r}function S(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function E(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(S(t.nodeAfter,r),i++));for(var a=i;a<s;a++)S(o.child(a),r);e&&e.depth==n&&e.textOffset&&S(e.nodeBefore,r)}function N(t,e){if(!t.type.validContent(e))throw new g("Invalid content for node "+t.type.name);return t.copy(e)}function O(t,e,n,r,o){var i=t.depth>o&&M(t,e,o+1),s=r.depth>o&&M(n,r,o+1),a=[];return E(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(T(i,s),S(N(i,O(t,e,n,r,o+1)),a)):(i&&S(N(i,D(t,e,o+1)),a),E(e,n,o,a),s&&S(N(s,D(n,r,o+1)),a)),E(r,null,o,a),new p(a)}function D(t,e,n){var r=[];(E(null,t,n,r),t.depth>n)&&S(N(M(t,e,n+1),D(t,e,n+1)),r);return E(e,null,n,r),new p(r)}b.size.get=function(){return this.content.size-this.openStart-this.openEnd},y.prototype.insertAt=function(t,e){var n=k(this.content,t+this.openStart,e,null);return n&&new y(n,this.openStart,this.openEnd)},y.prototype.removeBetween=function(t,e){return new y(w(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},y.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},y.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},y.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},y.fromJSON=function(t,e){if(!e)return y.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new y(p.fromJSON(t,e.content),n,r)},y.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new y(t,n,r)},Object.defineProperties(y.prototype,b),y.empty=new y(p.empty,0,0);var A=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},L={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};A.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},L.parent.get=function(){return this.node(this.depth)},L.doc.get=function(){return this.node(0)},A.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},A.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},A.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},A.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},A.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},A.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},A.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},L.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},L.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},L.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},A.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},A.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return v.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},A.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),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},A.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},A.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new B(this,t,n)},A.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},A.prototype.max=function(t){return t.pos>this.pos?t:this},A.prototype.min=function(t){return t.pos<this.pos?t:this},A.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},A.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new A(e,n,o)},A.resolveCached=function(t,e){for(var n=0;n<I.length;n++){var r=I[n];if(r.pos==e&&r.doc==t)return r}var o=I[R]=A.resolve(t,e);return R=(R+1)%P,o},Object.defineProperties(A.prototype,L);var I=[],R=0,P=12,B=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},F={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};F.start.get=function(){return this.$from.before(this.depth+1)},F.end.get=function(){return this.$to.after(this.depth+1)},F.parent.get=function(){return this.$from.node(this.depth)},F.startIndex.get=function(){return this.$from.index(this.depth)},F.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(B.prototype,F);var H=Object.create(null),z=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||p.empty,this.marks=r||v.none},j={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};j.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},j.childCount.get=function(){return this.content.childCount},z.prototype.child=function(t){return this.content.child(t)},z.prototype.maybeChild=function(t){return this.content.maybeChild(t)},z.prototype.forEach=function(t){this.content.forEach(t)},z.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},z.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},j.textContent.get=function(){return this.textBetween(0,this.content.size,"")},z.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},j.firstChild.get=function(){return this.content.firstChild},j.lastChild.get=function(){return this.content.lastChild},z.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},z.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},z.prototype.hasMarkup=function(t,e,n){return this.type==t&&m(this.attrs,e||t.defaultAttrs||H)&&v.sameSet(this.marks,n||v.none)},z.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},z.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},z.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},z.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return y.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new y(a,r.depth-i,o.depth-i)},z.prototype.replace=function(t,e,n){return x(this.resolve(t),this.resolve(e),n)},z.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},z.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},z.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},z.prototype.resolve=function(t){return A.resolveCached(this,t)},z.prototype.resolveNoCache=function(t){return A.resolve(this,t)},z.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},j.isBlock.get=function(){return this.type.isBlock},j.isTextblock.get=function(){return this.type.isTextblock},j.inlineContent.get=function(){return this.type.inlineContent},j.isInline.get=function(){return this.type.isInline},j.isText.get=function(){return this.type.isText},j.isLeaf.get=function(){return this.type.isLeaf},j.isAtom.get=function(){return this.type.isAtom},z.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),q(this.marks,t)},z.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},z.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=p.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var a=r;a<o;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0},z.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},z.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},z.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=v.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!v.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(t){return t.type.name})));this.content.forEach((function(t){return t.check()}))},z.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},z.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=p.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(z.prototype,j);var _=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):q(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(z);function q(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var V=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},$={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};V.parse=function(t,e){var n=new U(t,e);if(null==n.next)return V.empty;var r=J(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(Y(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];Y(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new V(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(Q);i.next.push(o[s],e[a.join(",")]||n(a))}return i}}(function(t){var e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}function i(t,e){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(i(n,e))}),[]);if("seq"==t.type)for(var s=0;;s++){var a=i(t.exprs[s],e);if(s==t.exprs.length-1)return a;o(a,e=n())}else{if("star"==t.type){var c=n();return r(e,c),o(i(t.expr,c),c),[r(c)]}if("plus"==t.type){var l=n();return o(i(t.expr,e),l),o(i(t.expr,l),l),[r(l)]}if("opt"==t.type)return[r(e)].concat(i(t.expr,e));if("range"==t.type){for(var u=e,p=0;p<t.min;p++){var d=n();o(i(t.expr,u),d),u=d}if(-1==t.max)o(i(t.expr,u),u);else for(var f=t.min;f<t.max;f++){var h=n();r(u,h),o(i(t.expr,u),h),u=h}return[r(u)]}if("name"==t.type)return[r(e,null,t.value)]}}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},V.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},V.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},$.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},$.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},V.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},V.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(i,s){var a=i.matchFragment(t,n);if(a&&(!e||a.validEnd))return p.from(s.map((function(t){return t.createAndFill()})));for(var c=0;c<i.next.length;c+=2){var l=i.next[c],u=i.next[c+1];if(!l.isText&&!l.hasRequiredAttrs()&&-1==r.indexOf(u)){r.push(u);var d=o(u,s.concat(l));if(d)return d}}}(this,[])},V.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},V.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},$.edgeCount.get=function(){return this.next.length>>1},V.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},V.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(V.prototype,$),V.empty=new V(!0);var U=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},W={next:{configurable:!0}};function J(t){var e=[];do{e.push(G(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function G(t){var e=[];do{e.push(K(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function K(t){for(var e=function(t){if(t.eat("(")){var e=J(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=X(t,e)}return e}function Z(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function X(t,e){var n=Z(t),r=n;return t.eat(",")&&(r="}"!=t.next?Z(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q(t,e){return e-t}function Y(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(Q)}function tt(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function et(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function nt(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new it(t[n]);return e}W.next.get=function(){return this.tokens[this.pos]},U.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},U.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(U.prototype,W);var rt=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=nt(n.attrs),this.defaultAttrs=tt(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},ot={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};ot.isInline.get=function(){return!this.isBlock},ot.isTextblock.get=function(){return this.isBlock&&this.inlineContent},ot.isLeaf.get=function(){return this.contentMatch==V.empty},ot.isAtom.get=function(){return this.isLeaf||this.spec.atom},rt.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},rt.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},rt.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:et(this.attrs,t)},rt.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new z(this,this.computeAttrs(t),p.from(e),v.setFrom(n))},rt.prototype.createChecked=function(t,e,n){if(e=p.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new z(this,this.computeAttrs(t),e,v.setFrom(n))},rt.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=p.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(p.empty,!0);return o?new z(this,t,e.append(o),v.setFrom(n)):null},rt.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},rt.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},rt.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},rt.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:v.empty:t},rt.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new rt(t,e,r)}));var r=e.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(var o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(rt.prototype,ot);var it=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},st={isRequired:{configurable:!0}};st.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(it.prototype,st);var at=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=nt(r.attrs),this.rank=e,this.excluded=null;var o=tt(this.attrs);this.instance=o&&new v(this,o)};at.prototype.create=function(t){return!t&&this.instance?this.instance:new v(this,et(this.attrs,t))},at.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new at(t,r++,e,o)})),n},at.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},at.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},at.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var ct=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=c.from(t.nodes),this.spec.marks=c.from(t.marks),this.nodes=rt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var o=this.nodes[r],i=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[i]||(n[i]=V.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?lt(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var a in this.marks){var l=this.marks[a],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:lt(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function lt(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}ct.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof rt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},ct.prototype.text=function(t,e){var n=this.nodes.text;return new _(n,n.defaultAttrs,t,v.setFrom(e))},ct.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},ct.prototype.nodeFromJSON=function(t){return z.fromJSON(this,t)},ct.prototype.markFromJSON=function(t){return v.fromJSON(this,t)},ct.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ut=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};ut.prototype.parse=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ut.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!0);return n.addAll(t,null,e.from,e.to),y.maxOpen(n.finish())},ut.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(yt(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},ut.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ut.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=bt(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=bt(t)),t.node=s}));return e},ut.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new ut(t,ut.schemaRules(t)))};var pt={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},dt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ft={ol:!0,ul:!0};function ht(t){return(t?1:0)|("full"===t?2:0)}var mt=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=v.none,this.pendingMarks=r,this.stashMarks=[]};mt.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(p.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},mt.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.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)))}var r=p.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(p.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},mt.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},mt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):wt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var vt=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=ht(e.preserveWhitespace)|(n?4:0);r=o?new mt(o.type,o.attrs,v.none,v.none,!0,e.topMatch||o.type.contentMatch,i):new mt(n?null:t.schema.topNodeType,null,v.none,v.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},gt={top:{configurable:!0},currentPos:{configurable:!0}};function yt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function bt(t){var e={};for(var n in t)e[n]=t[n];return e}function wt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],s=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,a=r.next;if(o==e)return!0;if(i.indexOf(a)<0&&s(a))return!0}};return s(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}gt.top.get=function(){return this.nodes[this.open]},vt.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},vt.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||(n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},vt.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();ft.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ft.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:dt.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,s=this.top,a=this.needsBlock;if(pt.hasOwnProperty(r))i=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(s),this.needsBlock=a}else this.addElementByRule(t,o,!1===o.consuming?n:null)},vt.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},vt.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},vt.prototype.readStyles=function(t){var e=v.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},vt.prototype.addElementByRule=function(t,e,n){var r,o,i,s=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return s.insertNode(t)}));else{var c=e.contentElement;"string"==typeof c?c=t.querySelector(c):"function"==typeof c&&(c=c(t)),c||(c=t),this.findAround(t,c,!0),this.addAll(c,r)}r&&(this.sync(a),this.open--),i&&this.removePendingMark(i,a)},vt.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&pt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},vt.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},vt.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},vt.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},vt.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:ht(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new mt(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},vt.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},vt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},vt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},gt.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},vt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},vt.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},vt.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},vt.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},vt.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},vt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},vt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},vt.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(vt.prototype,gt);var kt=function(t,e){this.nodes=t||{},this.marks=e||{}};function xt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ct(t){return t.document||window.document}kt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=Ct(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNode(t,e))})),n},kt.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=kt.renderSpec(Ct(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},kt.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},kt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&kt.renderSpec(Ct(n),r(t,e))},kt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var l in c=2,a)if(null!=a[l]){var u=l.indexOf(" ");u>0?s.setAttributeNS(l.slice(0,u),l.slice(u+1),a[l]):s.setAttribute(l,a[l])}for(var p=c;p<e.length;p++){var d=e[p];if(0===d){if(p<e.length-1||p>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=kt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},kt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new kt(this.nodesFromSchema(t),this.marksFromSchema(t)))},kt.nodesFromSchema=function(t){var e=xt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},kt.marksFromSchema=function(t){return xt(t.marks)};var Tt=n(956),Mt=n.n(Tt),St=n(969),Et=n.n(St),Nt=n(522),Ot=n.n(Nt),Dt=n(204),At=n.n(Dt),Lt=n(462),It=n.n(Lt),Rt=n(758),Pt=n.n(Rt),Bt=n(321),Ft=n.n(Bt),Ht=n(929),zt=n.n(Ht),jt=n(934),_t=n.n(jt),qt=n(391),Vt=n.n(qt),$t=(/Mac/.test(navigator.platform),/[\u0020]+/g),Ut=/[>(){}[\]+-.!#|]/g,Wt=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,Jt=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,Gt=/[*_~`]/g,Kt=new RegExp('[&<>"]',"g");function Zt(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function Xt(t){return Kt.test(t)?t.replace(Kt,Zt):t}function Qt(t,e){return-1!==t.indexOf(e)}var Yt=["rel","target","hreflang","type"],te={codeblock:/(^ {4}[^\n]+\n*)+/,thematicBreak:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,atxHeading:/^(#{1,6}) +[\s\S]+/,seTextheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,fencedCodeblock:/^((`|~){3,})/};function ee(t){if(!t)return null;var e={};return Yt.forEach((function(n){zt()(t[n])||(e[n]=t[n])})),e}function ne(t,e){for(var n="",r=0;r<e;r+=1)n+=t;return n}function re(t){var e=function(t){return"\\"+t},n=t.replace($t," ");return Jt.test(n)&&(n=n.replace(Jt,e)),n=n.replace(Gt,e),Wt.test(n)&&(n=n.replace(Wt,e)),function(t){var e=!1;return Mt()(te,(function(n){return n.test(t)&&(e=!0),!e})),e}(n)&&(n=n.replace(Ut,e)),n}function oe(t){return _t()(t)||zt()(t)}function ie(t,e){if(null===t&&t===e)return!0;if("object"!=typeof t||"object"!=typeof e||oe(t)||oe(e))return t===e;for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function se(t){return t[t.length-1]}function ae(t){return"object"==typeof t&&null!==t}function ce(t,e){var n=o({},t);return t&&e&&Object.keys(e).forEach((function(t){ae(n[t])?Array.isArray(e[t])?n[t]=le(e[t]):n.hasOwnProperty(t)?n[t]=ce(n[t],e[t]):n[t]=ue(e[t]):n[t]=e[t]})),n}function le(t){return t.map((function(t){return ae(t)?Array.isArray(t)?le(t):ue(t):t}))}function ue(t){var e=Object.keys(t);return e.length?e.reduce((function(e,n){return ae(t[n])?e[n]=Array.isArray(t[n])?le(t[n]):ue(t[n]):e[n]=t[n],e}),{}):t}function pe(t,e){return void 0===e&&(e={}),Object.keys(e).forEach((function(n){t.hasOwnProperty(n)&&"object"==typeof t[n]?Array.isArray(e[n])?t[n]=e[n]:pe(t[n],e[n]):t[n]=e[n]})),t}function de(t,e){return t>e?[e,t]:[t,e]}var fe=Math.pow(2,16);function he(t,e){return t+e*fe}function me(t){return 65535&t}var ve=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},ge=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};ge.prototype.recover=function(t){var e=0,n=me(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/fe}(t)},ge.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},ge.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},ge.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var d=t==(e<0?a:u)?null:he(s/3,t-a);return new ve(p,e<0?t!=a:t!=u,d)}r+=l-c}return n?t+r:new ve(t+r)},ge.prototype.touches=function(t,e){for(var n=0,r=me(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},ge.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},ge.prototype.invert=function(){return new ge(this.ranges,!this.inverted)},ge.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},ge.offset=function(t){return 0==t?ge.empty:new ge(t<0?[0,-t,0]:[0,0,t])},ge.empty=new ge([]);var ye=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function be(t){var e=Error.call(this,t);return e.__proto__=be.prototype,e}ye.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new ye(this.maps,this.mirror,t,e)},ye.prototype.copy=function(){return new ye(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},ye.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},ye.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},ye.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},ye.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},ye.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},ye.prototype.invert=function(){var t=new ye;return t.appendMappingInverted(this),t},ye.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},ye.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},ye.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var s=this.getMirror(o);if(null!=s&&s>o&&s<this.to){o=s,t=this.maps[s].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new ve(t,r)},be.prototype=Object.create(Error.prototype),be.prototype.constructor=be,be.prototype.name="TransformError";var we=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ye},ke={before:{configurable:!0},docChanged:{configurable:!0}};function xe(){throw new Error("Override me")}ke.before.get=function(){return this.docs.length?this.docs[0]:this.doc},we.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new be(e.failed);return this},we.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},ke.docChanged.get=function(){return this.steps.length>0},we.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(we.prototype,ke);var Ce=Object.create(null),Te=function(){};Te.prototype.apply=function(t){return xe()},Te.prototype.getMap=function(){return ge.empty},Te.prototype.invert=function(t){return xe()},Te.prototype.map=function(t){return xe()},Te.prototype.merge=function(t){return null},Te.prototype.toJSON=function(){return xe()},Te.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ce[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},Te.jsonID=function(t,e){if(t in Ce)throw new RangeError("Duplicate use of step JSON ID "+t);return Ce[t]=e,e.prototype.jsonID=t,e};var Me=function(t,e){this.doc=t,this.failed=e};Me.ok=function(t){return new Me(t,null)},Me.fail=function(t){return new Me(null,t)},Me.fromReplace=function(t,e,n,r){try{return Me.ok(t.replace(e,n,r))}catch(t){if(t instanceof g)return Me.fail(t.message);throw t}};var Se=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Ne(t,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new ge([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?y.empty:new y(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?y.empty:new y(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,y.fromJSON(t,n.slice),!!n.structure)},e}(Te);Te.jsonID("replace",Se);var Ee=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Ne(t,this.from,this.gapFrom)||Ne(t,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Me.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Me.fromReplace(t,this.from,this.to,n):Me.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new ge([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,y.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(Te);function Ne(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Oe(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function De(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Oe(r,o,i))break}}function Ae(t){return{type:t,attrs:null}}function Le(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),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(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),d=r&&r[c]||l;if(d!=l&&(p=p.replaceChild(0,d.type.create(d.attrs))),!l.canReplace(u+1,l.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Ie(t,e){var n=t.resolve(e),r=n.index();return Re(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Re(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Pe(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Pe(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return p.fromArray(r)}Te.jsonID("replaceAround",Ee),we.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,i=n.before(o+1),s=r.after(o+1),a=i,c=s,l=p.empty,u=0,d=o,f=!1;d>e;d--)f||n.index(d)>0?(f=!0,l=p.from(n.node(d).copy(l)),u++):a--;for(var h=p.empty,m=0,v=o,g=!1;v>e;v--)g||r.after(v+1)<r.end(v)?(g=!0,h=p.from(r.node(v).copy(h)),m++):c++;return this.step(new Ee(a,c,i,s,new y(l.append(h),u,m),l.size-u,!0))},we.prototype.wrap=function(t,e){for(var n=p.empty,r=e.length-1;r>=0;r--)n=p.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Ee(o,i,o,i,new y(n,0,0),e.length,!0))},we.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new Ee(a,c,a+1,c-1,new y(p.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},we.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Ee(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new y(p.from(i),0,0),1,!0))},we.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=p.empty,i=p.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=p.from(r.node(s).copy(o));var l=n&&n[c];i=p.from(l?l.type.create(l.attrs,i):r.node(s).copy(i))}return this.step(new Se(t,t,new y(o.append(i),e,e),!0))},we.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Se(t-e,t+e,y.empty,!0);return this.step(n)};var Be=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new y(Pe(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Fe(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);Te.jsonID("addMark",Be);var Fe=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new y(Pe(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Be(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);function He(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}Te.jsonID("removeMark",Fe),we.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),d=Math.min(c+r.nodeSize,e),f=n.addToSet(u),h=0;h<u.length;h++)u[h].isInSet(f)||(s&&s.to==p&&s.mark.eq(u[h])?s.to=d:o.push(s=new Fe(p,d,u[h])));a&&a.to==p?a.to=d:i.push(a=new Be(p,d,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},we.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof at)for(var c,l=r.marks;c=n.isInSet(l);)(a||(a=[])).push(c),l=c.removeFromSet(l);else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var u=Math.min(s+r.nodeSize,e),p=0;p<a.length;p++){for(var d=a[p],f=void 0,h=0;h<o.length;h++){var m=o[h];m.step==i-1&&d.eq(o[h].style)&&(f=m)}f?(f.to=u,f.step=i):o.push({style:d,from:Math.max(s,t),to:u,step:i})}}})),o.forEach((function(t){return r.step(new Fe(t.from,t.to,t.style))})),this},we.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],i=t+1,s=0;s<r.childCount;s++){var a=r.child(s),c=i+a.nodeSize,l=n.matchType(a.type,a.attrs);if(l){n=l;for(var u=0;u<a.marks.length;u++)e.allowsMarkType(a.marks[u].type)||this.step(new Fe(i,c,a.marks[u]))}else o.push(new Se(i,c,y.empty));i=c}if(!n.validEnd){var d=n.fillBefore(p.empty,!0);this.replace(i,i,new y(d,0,0))}for(var f=o.length-1;f>=0;f--)this.step(o[f]);return this},we.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=y.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=y.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return He(o,i,r)?new Se(e,n,r):new ze(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},we.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new y(p.from(n),0,0))},we.prototype.delete=function(t,e){return this.replace(t,e,y.empty)},we.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var ze=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=p.empty;for(var i=t.depth;i>0;i--)this.placed=p.from(t.node(i).copy(this.placed))},je={depth:{configurable:!0}};function _e(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(_e(t.firstChild.content,e-1,n)))}function qe(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qe(t.lastChild.content,e-1,n)))}function Ve(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function $e(t,e,n){if(e<=0)return t;var r=t.content;return e>1&&(r=r.replaceChild(0,$e(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(p.empty,!0)))),t.copy(r)}function Ue(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function We(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(We(i.content,e+1,n,r,i)))}if(e>r){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(p.empty,!0))}return t}function Je(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}je.depth.get=function(){return this.frontier.length-1},ze.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new y(i,s,a);return e>-1?new Ee(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Se(r.pos,o.pos,c):void 0},ze.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Ve(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,l=void 0;if(1==t&&(r?a.matchType(r.type)||(l=a.fillBefore(p.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},ze.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new y(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},ze.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new y(_e(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new y(_e(e,n,1),n,r)},ze.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var s=0;s<i.length;s++)this.openFrontierNode(i[s]);var a=this.unplaced,c=r?r.content:a.content,l=a.openStart-e,u=0,d=[],f=this.frontier[n],h=f.match,m=f.type;if(o){for(var v=0;v<o.childCount;v++)d.push(o.child(v));h=h.matchFragment(o)}for(var g=c.size+e-(a.content.size-a.openEnd);u<c.childCount;){var b=c.child(u),w=h.matchType(b.type);if(!w)break;(++u>1||0==l||b.content.size)&&(h=w,d.push($e(b.mark(m.allowedMarks(b.marks)),1==u?l:0,u==c.childCount?g:-1)))}var k=u==c.childCount;k||(g=-1),this.placed=qe(this.placed,n,p.from(d)),this.frontier[n].match=h,k&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x<g;x++){var T=C.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),C=T.content}this.unplaced=k?0==e?y.empty:new y(_e(a.content,e-1,1),e-1,g<0?a.openEnd:e-1):new y(_e(a.content,e,u),a.openStart,a.openEnd)},ze.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Ue(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},ze.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Ue(t,e,o,r,i);if(s){for(var a=e-1;a>=0;a--){var c=this.frontier[a],l=c.match,u=Ue(t,a,c.type,l,!0);if(!u||u.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},ze.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=qe(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},ze.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=qe(this.placed,this.depth,p.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},ze.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(p.empty,!0);t.childCount&&(this.placed=qe(this.placed,this.frontier.length,t))},Object.defineProperties(ze.prototype,je),we.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(He(r,o,n))return this.step(new Se(t,e,n));var i=Je(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=n.openStart,f=n.content,h=0;;h++){var m=f.firstChild;if(p.push(m),h==n.openStart)break;f=m.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var v=n.openStart;v>=0;v--){var g=(v+d+1)%(n.openStart+1),b=p[g];if(b)for(var w=0;w<i.length;w++){var k=i[(w+u)%i.length],x=!0;k<0&&(x=!1,k=-k);var C=r.node(k-1),T=r.index(k-1);if(C.canReplaceWith(T,T,b.type,b.marks))return this.replace(r.before(k),x?o.after(k):e,new y(We(n.content,0,n.openStart,g),g,n.openEnd))}}for(var M=this.steps.length,S=i.length-1;S>=0&&(this.replace(t,e,n),!(this.steps.length>M));S--){var E=i[S];S<0||(t=r.before(E),e=o.after(E))}return this},we.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new y(p.from(n),0,0))},we.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Je(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Ge=Object.create(null),Ke=function(t,e,n){this.ranges=n||[new Xe(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ze={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ze.anchor.get=function(){return this.$anchor.pos},Ze.head.get=function(){return this.$head.pos},Ze.from.get=function(){return this.$from.pos},Ze.to.get=function(){return this.$to.pos},Ze.$from.get=function(){return this.ranges[0].$from},Ze.$to.get=function(){return this.ranges[0].$to},Ze.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},Ke.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Ke.prototype.replace=function(t,e){void 0===e&&(e=y.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],l=c.$from,u=c.$to,p=t.mapping.slice(i);t.replaceRange(p.map(l.pos),p.map(u.pos),a?y.empty:e),0==a&&sn(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Ke.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),sn(t,n,e.isInline?-1:1))}},Ke.findFrom=function(t,e,n){var r=t.parent.inlineContent?new Qe(t):on(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?on(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):on(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Ke.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new nn(t.node(0))},Ke.atStart=function(t){return on(t,t,0,0,1)||new nn(t)},Ke.atEnd=function(t){return on(t,t,t.content.size,t.childCount,-1)||new nn(t)},Ke.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ge[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Ke.jsonID=function(t,e){if(t in Ge)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ge[t]=e,e.prototype.jsonID=t,e},Ke.prototype.getBookmark=function(){return Qe.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Ke.prototype,Ze),Ke.prototype.visible=!0;var Xe=function(t,e){this.$from=t,this.$to=e},Qe=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=y.empty),t.prototype.replace.call(this,e,n),n==y.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new Ye(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(Ke);Ke.jsonID("text",Qe);var Ye=function(t,e){this.anchor=t,this.head=e};Ye.prototype.map=function(t){return new Ye(t.map(this.anchor),t.map(this.head))},Ye.prototype.resolve=function(t){return Qe.between(t.resolve(this.anchor),t.resolve(this.head))};var tn=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new y(p.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new en(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(Ke);tn.prototype.visible=!1,Ke.jsonID("node",tn);var en=function(t){this.anchor=t};en.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new Ye(r,r):new en(r)},en.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&tn.isSelectable(n)?new tn(e):Ke.near(e)};var nn=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replace=function(e,n){if(void 0===n&&(n=y.empty),n==y.empty){e.delete(0,e.doc.content.size);var r=t.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else t.prototype.replace.call(this,e,n)},e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return rn},e}(Ke);Ke.jsonID("all",nn);var rn={map:function(){return this},resolve:function(t){return new nn(t)}};function on(t,e,n,r,o,i){if(e.inlineContent)return Qe.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&tn.isSelectable(a))return tn.create(t,n-(o<0?a.nodeSize:0))}else{var c=on(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function sn(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Se||i instanceof Ee)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(Ke.near(t.doc.resolve(o),n))}}var an=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){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},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return v.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||v.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Ke.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(we);function cn(t,e){return e&&t?t.bind(e):t}var ln=function(t,e,n){this.name=t,this.init=cn(e.init,n),this.apply=cn(e.apply,n)},un=[new ln("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ln("selection",{init:function(t,e){return t.selection||Ke.atStart(e.doc)},apply:function(t){return t.selection}}),new ln("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ln("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],pn=function(t,e){var n=this;this.schema=t,this.fields=un.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new ln(t.key,t.spec.state,t))}))},dn=function(t){this.config=t},fn={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};fn.schema.get=function(){return this.config.schema},fn.plugins.get=function(){return this.config.plugins},dn.prototype.apply=function(t){return this.applyTransaction(t).state},dn.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},dn.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},dn.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new dn(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<hn.length;i++)hn[i](this,t,e);return e},fn.tr.get=function(){return new an(this)},dn.create=function(t){for(var e=new pn(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new dn(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},dn.prototype.reconfigure=function(t){for(var e=new pn(this.schema,t.plugins),n=e.fields,r=new dn(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},dn.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==typeof t)for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},dn.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new pn(t.schema,t.plugins),o=new dn(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=z.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=Ke.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},dn.addApplyListener=function(t){hn.push(t)},dn.removeApplyListener=function(t){var e=hn.indexOf(t);e>-1&&hn.splice(e,1)},Object.defineProperties(dn.prototype,fn);var hn=[];function mn(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=mn(o,e,{})),n[r]=o}return n}var vn=function(t){this.props={},t.props&&mn(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:yn("plugin")};vn.prototype.getState=function(t){return t[this.key]};var gn=Object.create(null);function yn(t){return t in gn?t+"$"+ ++gn[t]:(gn[t]=0,t+"$")}var bn=function(t){void 0===t&&(t="key"),this.key=yn(t)};bn.prototype.get=function(t){return t.config.pluginsByKey[this.key]},bn.prototype.getState=function(t){return t[this.key]};var wn={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var kn=/Edge\/(\d+)/.exec(navigator.userAgent),xn=/MSIE \d/.test(navigator.userAgent),Cn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);wn.mac=/Mac/.test(navigator.platform);var Tn=wn.ie=!!(xn||Cn||kn);wn.ie_version=xn?document.documentMode||6:Cn?+Cn[1]:kn?+kn[1]:null,wn.gecko=!Tn&&/gecko\/(\d+)/i.test(navigator.userAgent),wn.gecko_version=wn.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Mn=!Tn&&/Chrome\/(\d+)/.exec(navigator.userAgent);wn.chrome=!!Mn,wn.chrome_version=Mn&&+Mn[1],wn.safari=!Tn&&/Apple Computer/.test(navigator.vendor),wn.ios=wn.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),wn.android=/Android \d/.test(navigator.userAgent),wn.webkit="webkitFontSmoothing"in document.documentElement.style,wn.webkit_version=wn.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Sn=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},En=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Nn=null,On=function(t,e,n){var r=Nn||(Nn=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Dn=function(t,e,n,r){return n&&(Ln(t,e,n,r,-1)||Ln(t,e,n,r,1))},An=/^(img|br|input|textarea|hr)$/i;function Ln(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:In(t))){var i=t.parentNode;if(1!=i.nodeType||Rn(t)||An.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Sn(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?In(t):0}}}function In(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Rn(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Pn=function(t){var e=t.isCollapsed;return e&&wn.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Bn(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Hn(t,e){return"number"==typeof t?t:t[e]}function zn(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function jn(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=En(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?Fn(i):zn(s),l=0,u=0;if(e.top<c.top+Hn(r,"top")?u=-(c.top-e.top+Hn(o,"top")):e.bottom>c.bottom-Hn(r,"bottom")&&(u=e.bottom-c.bottom+Hn(o,"bottom")),e.left<c.left+Hn(r,"left")?l=-(c.left-e.left+Hn(o,"left")):e.right>c.right-Hn(r,"right")&&(l=e.right-c.right+Hn(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var f=s.scrollLeft-p,h=s.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(a)break}}function _n(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=En(t));return e}function qn(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var Vn=null;function $n(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=On(c).getClientRects()}for(var p=0;p<u.length;p++){var d=u[p];if(d.top<=s&&d.bottom>=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var f=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==c.nodeType&&f&&(i=l+(e.left>=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=Gn(r,1);if(i.top!=i.bottom&&Un(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:$n(n,r)}function Un(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Wn(t,e,n){var r=t.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var s=t.childNodes[i];if(1==s.nodeType)for(var a=s.getClientRects(),c=0;c<a.length;c++){var l=a[c];if(Un(e,l))return Wn(s,e,l)}if((i=(i+1)%r)==o)break}return t}function Jn(t,e){var n,r,o,i,s=t.root;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var l,u=s.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!Un(e,p))return null;if(!(u=Wn(t.dom,e,p)))return null}if(wn.safari)for(var d=u;o&&d;d=En(d))d.draggable&&(o=i=null);if(u=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(u,e),o){if(wn.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var f,h=o.childNodes[i];"IMG"==h.nodeName&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=$n(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:l,inside:m?m.posAtStart-m.border:-1}}function Gn(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Kn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Zn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=wn.webkit||wn.gecko;if(3==o.nodeType){if(!s||!Kn.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==o.nodeValue.length?(a--,l=1):n<0?a--:c++,Xn(Gn(On(o,a,c),l),l<0)}var u=Gn(On(o,i,i),n);if(wn.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var p=Gn(On(o,i-1,i-1),-1);if(p.top==u.top){var d=Gn(On(o,i,i+1),-1);if(d.top!=u.top)return Xn(d,d.left<p.left)}}return u}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==In(o))){var f=o.childNodes[i-1];if(1==f.nodeType)return Qn(f.getBoundingClientRect(),!1)}if(i<In(o)){var h=o.childNodes[i];if(1==h.nodeType)return Qn(h.getBoundingClientRect(),!0)}return Qn(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==In(o))){var m=o.childNodes[i-1],v=3==m.nodeType?On(m,In(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return Xn(Gn(v,1),!1)}if(i<In(o)){var g=o.childNodes[i],y=3==g.nodeType?On(g,0,s?0:1):1==g.nodeType?g:null;if(y)return Xn(Gn(y,-1),!0)}return Xn(Gn(3==o.nodeType?On(o):o,-n),n>=0)}function Xn(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Qn(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Yn(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var tr=/[\u0590-\u08ac]/;var er=null,nr=null,rr=!1;function or(t,e,n){return er==e&&nr==n?rr:(er=e,nr=n,rr="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return Yn(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Zn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=On(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top&&("up"==n?l.bottom<i.top+1:l.top>i.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return tr.test(r.parent.textContent)&&a.modify?Yn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var ir=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},sr={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};ir.prototype.matchesWidget=function(){return!1},ir.prototype.matchesMark=function(){return!1},ir.prototype.matchesNode=function(){return!1},ir.prototype.matchesHack=function(){return!1},sr.beforePosition.get=function(){return!1},ir.prototype.parseRule=function(){return null},ir.prototype.stopEvent=function(){return!1},sr.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},sr.border.get=function(){return 0},ir.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},ir.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},sr.posBefore.get=function(){return this.parent.posBeforeChild(this)},sr.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},sr.posAfter.get=function(){return this.posBefore+this.size},sr.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},ir.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(t==this.dom&&this.contentDOM)a=e>Sn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},ir.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},ir.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},ir.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},ir.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},ir.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=!0;;r++,o=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var i=r==this.children.length?null:this.children[r];if(n==t&&(0==e||!i||!i.size||i.border||e<0&&o)||i&&i.domAtom&&t<n+i.size)return{node:this.contentDOM,offset:i?Sn(i.dom):this.contentDOM.childNodes.length};if(!i)throw new Error("Invalid position "+t);var s=n+i.size;if(!i.domAtom&&(e<0&&!i.border?s>=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},ir.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Sn(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var d=s+1;d<this.children.length;d++){var f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Sn(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},ir.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},ir.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},ir.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],l=a+c.size;if(o>a&&i<l)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=l}var u=this.domFromPos(t,t?-1:1),p=e==t?u:this.domFromPos(e,e?-1:1),d=n.getSelection(),f=!1;if((wn.gecko||wn.safari)&&t==e){var h=u.node,m=u.offset;if(3==h.nodeType)(f=m&&"\n"==h.nodeValue[m-1])&&m==h.nodeValue.length&&h.nextSibling&&"BR"==h.nextSibling.nodeName&&(u=p={node:h.parentNode,offset:Sn(h)+1});else{var v=h.childNodes[m-1];f=v&&("BR"==v.nodeName||"false"==v.contentEditable)}}if(wn.gecko&&d.focusNode&&d.focusNode!=p.node&&1==d.focusNode.nodeType){var g=d.focusNode.childNodes[d.focusOffset];g&&"false"==g.contentEditable&&(r=!0)}if(r||f&&wn.safari||!Dn(u.node,u.offset,d.anchorNode,d.anchorOffset)||!Dn(p.node,p.offset,d.focusNode,d.focusOffset)){var y=!1;if((d.extend||t==e)&&!f){d.collapse(u.node,u.offset);try{t!=e&&d.extend(p.node,p.offset),y=!0}catch(t){if(!(t instanceof DOMException))throw t}}if(!y){if(t>e){var b=u;u=p,p=b}var w=document.createRange();w.setEnd(p.node,p.offset),w.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(w)}}},ir.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},sr.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},ir.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},ir.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},sr.domAtom.get=function(){return!1},Object.defineProperties(ir.prototype,sr);var ar=[],cr=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,ar,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ir),lr=function(t){function e(e,n,r,o){t.call(this,e,ar,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(ir),ur=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=kt.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Er(i,n,s,r)),t>0&&(i=Er(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(ir),pr=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?ar:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,l=i.nodeViews[n.type.name],u=l&&l(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r,o),p=u&&u.dom,d=u&&u.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(a=kt.renderSpec(document,n.type.spec.toDOM(n))).dom,d=a.contentDOM);d||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=xr(p,r,n),u?c=new mr(t,n,r,o,p,d,f,u,i,s+1):n.isText?new fr(t,n,r,o,p,f,i):new e(t,n,r,o,p,d,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?p.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&Cr(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=r&&t.composing&&this.localCompositionNode(t,e),s=new Mr(this,i&&i.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var d=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[d])).push(o[c++]);if(f){f.sort(Sr);for(var h=0;h<f.length;h++)n(f[h],p,!!u)}else n(d,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from<=i&&o[c].to>i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var w=0;w<l.length;w++)l[w].to<b&&(b=l[w].to);b<y&&(u=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}r(m,l.length?m.isInline&&!m.isLeaf?l.filter((function(t){return!t.inline})):l.slice():ar,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?s.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&s.syncToMarks(i==n.node.childCount?v.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(ar,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),vr(this.contentDOM,this.children,t),wn.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof Qe)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=In(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new lr(this,i,n,o);t.compositionNodes.push(s),this.children=Er(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!Cr(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=wr(this.dom,this.nodeDOM,br(this.outerDeco,this.node,e),br(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(ir);function dr(t,e,n,r,o){return xr(r,e,t),new pr(null,t,e,n,r,r,r,o,0)}var fr=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(pr),hr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ir),mr=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(pr);function vr(t,e,n){for(var r=t.firstChild,o=!1,i=0;i<e.length;i++){var s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=Tr(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof ur){var c=r?r.previousSibling:t.lastChild;vr(s.contentDOM,s.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=Tr(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}function gr(t){t&&(this.nodeName=t)}gr.prototype=Object.create(null);var yr=[new gr];function br(t,e,n){if(0==t.length)return yr;for(var r=n?yr[0]:new gr,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs;if(s)for(var a in s.nodeName&&o.push(r=new gr(s.nodeName)),s){var c=s[a];null!=c&&(n&&1==o.length&&o.push(r=new gr(e.isInline?"span":"div")),"class"==a?r.class=(r.class?r.class+" ":"")+c:"style"==a?r.style=(r.style?r.style+";":"")+c:"nodeName"!=a&&(r[a]=c))}}return o}function wr(t,e,n,r){if(n==yr&&r==yr)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).pmIsDeco=!0,c.appendChild(o),a=yr[0]),o=c}kr(o,a||yr[0],s)}return o}function kr(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" ").filter(Boolean):ar,s=n.class?n.class.split(" ").filter(Boolean):ar,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c])}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function xr(t,e,n){return wr(t,t,yr,br(e,n,1!=t.nodeType))}function Cr(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Tr(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var Mr=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){for(var n=t.childCount,r=e.length,o=new Map;n>0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Sr(t,e){return t.type.side-e.type.side}function Er(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function Nr(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,l=r.resolve(s);if(Pn(n)){for(a=l;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&tn.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==In(t);r||o;){if(t==n)return!0;var i=Sn(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==In(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;c=new tn(s==u?l:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;a=r.resolve(p)}c||(c=Fr(t,a,l,"pointer"==e||t.state.selection.head<l.pos&&!i?1:-1));return c}function Or(t){return t.editable?t.hasFocus():Hr(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Dr(t,e){var n=t.state.selection;if(Pr(t,n),Or(t)){if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,Sn(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&wn.ie&&wn.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,s=n.head;!Ar||n instanceof Qe||(n.$from.parent.inlineContent||(r=Lr(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Lr(t,n.to))),t.docView.setSelection(i,s,t.root,e),Ar&&(r&&Rr(r),o&&Rr(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),setTimeout((function(){Or(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}Mr.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},Mr.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Mr.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=ur.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},Mr.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s<o.length;s++)if(o[s].matchesNode(t,e,n)){i=s;break}}else for(var a=this.index,c=Math.min(o.length,a+1);a<c;a++){var l=o[a];if(l.matchesNode(t,e,n)&&!this.preMatch.matched.has(l)){i=a;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)},Mr.prototype.updateNextNode=function(t,e,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var s=this.top.children[i];if(s instanceof pr){var a=this.preMatch.matched.get(s);if(null!=a&&a!=o)return!1;var c=s.dom;if(!(this.lock&&(c==this.lock||1==c.nodeType&&c.contains(this.lock.parentNode))&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&3!=s.dirty&&Cr(e,s.outerDeco)))&&s.update(t,e,n,r))return this.destroyBetween(this.index,i),s.dom!=c&&(this.changed=!0),this.index++,!0;break}}return!1},Mr.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,pr.create(this.top,t,e,n,r,o)),this.changed=!0},Mr.prototype.placeWidget=function(t,e,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var o=new cr(this.top,t,e,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},Mr.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof ur;)t=t.children[t.children.length-1];if(!t||!(t instanceof fr)||/\n$/.test(t.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var e=document.createElement("br");this.top.children.splice(this.index++,0,new hr(this.top,ar,e,null)),this.changed=!0}};var Ar=wn.safari||wn.chrome&&wn.chrome_version<63;function Lr(t,e){var n=t.docView.domFromPos(e,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(wn.safari&&i&&"false"==i.contentEditable)return Ir(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Ir(i);if(s)return Ir(s)}}function Ir(t){return t.contentEditable="true",wn.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Rr(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Pr(t,e){if(e instanceof tn){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Br(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Br(t)}function Br(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Fr(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||Qe.between(e,n,r)}function Hr(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function zr(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ke.findFrom(s,e)}function jr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _r(t,e,n){var r=t.state.selection;if(!(r instanceof Qe)){if(r instanceof tn&&r.node.isInline)return jr(t,new Qe(e>0?r.$to:r.$from));var o=zr(t.state,e);return!!o&&jr(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=zr(t.state,e);return!!(i&&i instanceof tn)&&jr(t,i)}if(!(wn.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var l=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM)&&(tn.isSelectable(c)?jr(t,new tn(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!wn.webkit&&jr(t,new Qe(t.state.doc.resolve(e<0?l:l+c.nodeSize))))}}function qr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Vr(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function $r(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(wn.gecko&&1==n.nodeType&&r<qr(n)&&Vr(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Vr(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Wr(n))break;for(var c=n.previousSibling;c&&Vr(c);)o=n.parentNode,i=Sn(c),c=c.previousSibling;if(c)r=qr(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Jr(t,e,n,r):o&&Jr(t,e,o,i)}}function Ur(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=qr(n);;)if(r<s){if(1!=n.nodeType)break;if(!Vr(n.childNodes[r]))break;o=n,i=++r}else{if(Wr(n))break;for(var a=n.nextSibling;a&&Vr(a);)o=a.parentNode,i=Sn(a)+1,a=a.nextSibling;if(a)r=0,s=qr(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Jr(t,e,o,i)}}function Wr(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Jr(t,e,n,r){if(Pn(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection();var i=t.state;setTimeout((function(){t.state==i&&Dr(t)}),50)}function Gr(t,e,n){var r=t.state.selection;if(r instanceof Qe&&!r.empty||n.indexOf("s")>-1)return!1;if(wn.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=zr(t.state,e);if(s&&s instanceof tn)return jr(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof nn?Ke.near(a,e):Ke.findFrom(a,e);return!!c&&jr(t,c)}return!1}function Kr(t,e){if(!(t.state.selection instanceof Qe))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function Zr(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xr(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||wn.mac&&72==n&&"c"==r?Kr(t,-1)||$r(t):46==n||wn.mac&&68==n&&"c"==r?Kr(t,1)||Ur(t):13==n||27==n||(37==n?_r(t,-1,r)||$r(t):39==n?_r(t,1,r)||Ur(t):38==n?Gr(t,-1,r)||$r(t):40==n?function(t){if(wn.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;Zr(t,o,!0),setTimeout((function(){return Zr(t,o,!1)}),20)}}}(t)||Gr(t,1,r)||Ur(t):r==(wn.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Qr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(wn.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||wn.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Yr(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,s=Nr(t,i);if(s&&!t.state.selection.eq(s)){var a=t.state.tr.setSelection(s);"pointer"==i?a.setMeta("pointer",!0):"key"==i&&a.scrollIntoView(),t.dispatch(a)}}else{var c=t.state.doc.resolve(e),l=c.sharedDepth(n);e=c.before(l+1),n=t.state.doc.resolve(n).after(l+1);var u=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Pn(l)||u.push({node:l.focusNode,offset:l.focusOffset})),wn.chrome&&8===t.lastKeyCode)for(var d=s;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){s=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||ut.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Qr,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(wn.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(m=t.state.selection.to,v="end"):(m=t.state.selection.from,v="start"),t.lastKeyCode=null;var b=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){r-=a+Math.max(0,i-Math.min(a,c))-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((wn.ios&&t.lastIOSEnter>Date.now()-225||wn.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})))return void(t.lastIOSEnter=0);if(d.sel){var w=to(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:u.from,endA:u.to,endB:u.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof Qe&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),wn.ie&&wn.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&" "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((wn.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!T&&x.pos<d.doc.content.size&&(k=Ke.findFrom(d.doc.resolve(x.pos+1),1,!0))&&k.head==C.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>b.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||eo(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(eo(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||eo(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(g,b.start,b.endA,x,C)&&t.someProp("handleKeyDown",(function(e){return e(t,Bn(8,"Backspace"))})))wn.android&&wn.chrome&&t.domObserver.suppressSelectionUpdates();else{wn.chrome&&wn.android&&b.toB==b.from&&(t.lastAndroidDelete=Date.now()),wn.android&&!T&&x.start()!=C.start()&&0==C.parentOffset&&x.depth==C.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==b.endA&&(b.endB-=2,C=d.doc.resolveNoCache(b.endB-d.from),setTimeout((function(){t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))}))}),20));var M,S,E,N,O=b.start,D=b.endA;if(T)if(x.pos==C.pos)wn.ie&&wn.ie_version<=11&&0==x.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Dr(t)}),20)),M=t.state.tr.delete(O,D),S=g.resolve(b.start).marksAcross(g.resolve(b.endA));else if(b.endA==b.endB&&(N=g.resolve(b.start))&&(E=function(t,e){for(var n,r,o,i=t.firstChild.marks,s=e.firstChild.marks,a=i,c=s,l=0;l<s.length;l++)a=s[l].removeFromSet(a);for(var u=0;u<i.length;u++)c=i[u].removeFromSet(c);if(1==a.length&&0==c.length)r=a[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=a.length||1!=c.length)return null;r=c[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var d=[],f=0;f<e.childCount;f++)d.push(o(e.child(f)));if(p.from(d).eq(t))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,C.parentOffset),N.parent.content.cut(N.parentOffset,b.endA-N.start()))))M=t.state.tr,"add"==E.type?M.addMark(O,D,E.mark):M.removeMark(O,D,E.mark);else if(x.parent.child(x.index()).isText&&x.index()==C.index()-(C.textOffset?0:1)){var A=x.parent.textBetween(x.parentOffset,C.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,O,D,A)})))return;M=t.state.tr.insertText(A,O,D)}if(M||(M=t.state.tr.replace(O,D,d.doc.slice(b.start-d.from,b.endB-d.from))),d.sel){var L=to(t,M.doc,d.sel);L&&!(wn.chrome&&wn.android&&t.composing&&L.empty&&(b.start!=b.endB||t.lastAndroidDelete<Date.now()-100)&&(L.head==O||L.head==M.mapping.map(D)-1)||wn.ie&&L.empty&&L.head==O)&&M.setSelection(L)}S&&M.ensureMarks(S),t.dispatch(M.scrollIntoView())}}}function to(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Fr(t,e.resolve(n.anchor),e.resolve(n.head))}function eo(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function no(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||kt.fromSchema(t.state.schema),c=uo(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=co[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=c.createElement(u[d]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function ro(t,e,n,r,o){var i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||a||!n);if(c){if(t.someProp("transformPastedText",(function(t){e=t(e,a||r)})),a)return new y(p.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?s=l:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=uo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&co[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n);var u=i&&i.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!s){var f=t.someProp("clipboardParser")||t.someProp("domParser")||ut.fromSchema(t.state.schema);s=f.parseSlice(i,{preserveWhitespace:!(!c&&!d),context:o})}return s=d?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,i=t.openStart,s=t.openEnd,a=n.length-2;a>=0;a-=2){var c=r.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;o=p.from(c.create(n[a+1],o)),i++,s++}return new y(o,i,s)}(function(t,e,n){e<t.openStart&&(t=new y(ao(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd));n<t.openEnd&&(t=new y(ao(t.content,1,n,t.openEnd,0,0),t.openStart,n));return t}(s,+d[1],+d[2]),d[3]):y.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,i=[];if(t.forEach((function(t){if(i){var e,n=r.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&o.length&&io(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=so(i[i.length-1],o.length));var s=oo(t,n);i.push(s),r=r.matchType(s.type,s.attrs),o=n}}})),i)return{v:p.from(i)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(s.content,o),!1),t.someProp("transformPasted",(function(t){s=t(s)})),s}function oo(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,p.from(t));return t}function io(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){var i=io(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(p.from(oo(n,t,o+1))))}}function so(t,e){if(0==e)return t;var n=t.content.replaceChild(t.childCount-1,so(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(p.empty,!0);return t.copy(n.append(r))}function ao(t,e,n,r,o,i){var s=e<0?t.firstChild:t.lastChild,a=s.content;return o<r-1&&(a=ao(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(p.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}var co={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},lo=null;function uo(){return lo||(lo=document.implementation.createHTMLDocument("title"))}var po={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fo=wn.ie&&wn.ie_version<=11,ho=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};ho.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},ho.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var mo=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);wn.ie&&wn.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new ho,fo&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};mo.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},mo.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},mo.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,po),fo&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},mo.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}fo&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},mo.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},mo.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},mo.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},mo.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Hr(t)){var t;if(this.suppressingSelectionUpdates)return Dr(this.view);if(wn.ie&&wn.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&Dn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},mo.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},mo.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},mo.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Hr(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&(i=!0))}if(wn.gecko&&s.length>1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(vo)return;vo=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Dr(this.view),this.currentSelection.set(e))}},mo.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;r<t.addedNodes.length;r++)e.push(t.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var o=t.previousSibling,i=t.nextSibling;if(wn.ie&&wn.ie_version<=11&&t.addedNodes.length)for(var s=0;s<t.addedNodes.length;s++){var a=t.addedNodes[s],c=a.previousSibling,l=a.nextSibling;(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c),(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(i=l)}var u=o&&o.parentNode==t.target?Sn(o)+1:0,p=n.localPosFromDOM(t.target,u,-1),d=i&&i.parentNode==t.target?Sn(i):t.target.childNodes.length;return{from:p,to:n.localPosFromDOM(t.target,d,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var vo=!1;var go={},yo={};function bo(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function wo(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return ko(t,e)})}))}function ko(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function xo(t){return{left:t.clientX,top:t.clientY}}function Co(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function To(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Mo(t,e,n,r,o){return Co(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof tn&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(tn.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(To(t,tn.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&tn.isSelectable(r))&&(To(t,new tn(n),"pointer"),!0)}(t,n))}function So(t,e,n,r){return Co(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function Eo(t,e,n,r){return Co(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(To(t,Qe.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)To(t,Qe.create(n,s+1,s+1+i.content.size),"pointer");else{if(!tn.isSelectable(i))continue;To(t,tn.create(n,s),"pointer")}return!0}}(t,n)}function No(t){return Po(t)}yo.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!Ao(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!wn.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Xr(t,e)?e.preventDefault():bo(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},yo.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},yo.keypress=function(t,e){if(!(Ao(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||wn.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof Qe&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var Oo=wn.mac?"metaKey":"ctrlKey";go.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=No(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[Oo]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(xo(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Do(t,i,e,n)):("doubleClick"==o?So:Eo)(t,i.pos,i.inside,e)?e.preventDefault():bo(t,"pointer"))};var Do=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Oo],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null;var u=t.state.selection;(o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof tn&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&wn.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),bo(t,"pointer")};function Ao(t,e){return!!t.composing||!!(wn.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Do.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Do.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(xo(t))),this.allowDefault||!e?bo(this.view,"pointer"):Mo(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||wn.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||wn.chrome&&!(this.view.state.selection instanceof Qe)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2?(To(this.view,Ke.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):bo(this.view,"pointer")}},Do.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),bo(this.view,"pointer"),0==t.buttons&&this.done()},go.touchdown=function(t){No(t),bo(t,"pointer")},go.contextmenu=function(t){return No(t)};var Lo=wn.android?5e3:-1;function Io(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Po(t)}),e))}function Ro(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Po(t,e){if(t.domObserver.forceFlush(),Ro(t),e||t.docView.dirty){var n=Nr(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}yo.compositionstart=yo.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Po(t,!0),t.markCursor=null;else if(Po(t),wn.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Io(t,Lo)},yo.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Io(t,20))};var Bo=wn.ie&&wn.ie_version<15||wn.ios&&wn.webkit_version<604;function Fo(t,e,n,r){var o=ro(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||y.empty)})))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}go.copy=yo.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Bo?null:e.clipboardData,i=no(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},yo.paste=function(t,e){var n=Bo?null:e.clipboardData;n&&Fo(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Fo(t,r.value,null,e):Fo(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Ho=function(t,e){this.slice=t,this.move=e},zo=wn.mac?"altKey":"ctrlKey";for(var jo in go.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(xo(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof tn?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=no(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Bo?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",Bo||e.dataTransfer.setData("text/plain",l),t.dragging=new Ho(s,!e[zo])}},go.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},yo.dragover=yo.dragenter=function(t,e){return e.preventDefault()},yo.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(xo(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=ro(t,e.dataTransfer.getData(Bo?"Text":"text/plain"),Bo?null:e.dataTransfer.getData("text/html"),!1,o);var s=n&&!e[zo];if(t.someProp("handleDrop",(function(n){return n(t,e,i||y.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?function(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var l=c.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=c.doc;if(u?c.replaceRangeWith(l,l,i.content.firstChild):c.replaceRange(l,l,i),!c.doc.eq(p)){var d=c.doc.resolve(l);if(u&&tn.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new tn(d));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Fr(t,d,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},go.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Dr(t)}),20))},go.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},go.beforeinput=function(t,e){if(wn.chrome&&wn.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Bn(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},yo)go[jo]=yo[jo];function _o(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var qo=function(t,e){this.spec=e||Go,this.side=this.spec.side||0,this.toDOM=t};qo.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Uo(i-n,i-n,this)},qo.prototype.valid=function(){return!0},qo.prototype.eq=function(t){return this==t||t instanceof qo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&_o(this.spec,t.spec))};var Vo=function(t,e){this.spec=e||Go,this.attrs=t};Vo.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Uo(o,i,this)},Vo.prototype.valid=function(t,e){return e.from<e.to},Vo.prototype.eq=function(t){return this==t||t instanceof Vo&&_o(this.attrs,t.attrs)&&_o(this.spec,t.spec)},Vo.is=function(t){return t.type instanceof Vo};var $o=function(t,e){this.spec=e||Go,this.attrs=t};$o.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Uo(o.pos-n,i.pos-n,this)},$o.prototype.valid=function(t,e){var n=t.content.findIndex(e.from),r=n.index,o=n.offset;return o==e.from&&o+t.child(r).nodeSize==e.to},$o.prototype.eq=function(t){return this==t||t instanceof $o&&_o(this.attrs,t.attrs)&&_o(this.spec,t.spec)};var Uo=function(t,e,n){this.from=t,this.to=e,this.type=n},Wo={spec:{configurable:!0},inline:{configurable:!0}};Uo.prototype.copy=function(t,e){return new Uo(t,e,this.type)},Uo.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Uo.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Uo.widget=function(t,e,n){return new Uo(t,t,new qo(e,n))},Uo.inline=function(t,e,n,r){return new Uo(t,e,new Vo(n,r))},Uo.node=function(t,e,n,r){return new Uo(t,e,new $o(n,r))},Wo.spec.get=function(){return this.type.spec},Wo.inline.get=function(){return this.type instanceof Vo},Object.defineProperties(Uo.prototype,Wo);var Jo=[],Go={},Ko=function(t,e){this.local=t&&t.length?t:Jo,this.children=e&&e.length?e:Jo};Ko.create=function(t,e){return e.length?ei(e,t,0,Go):Zo},Ko.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Ko.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Ko.prototype.map=function(t,e,n){return this==Zo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Go)},Ko.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(l=r-n-(e-t))&&(a[s]+=l,a[s+1]+=l))}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(-1==a[p+1]){var d=n.map(t[p]+i),f=d-o;if(f<0||f>=r.content.size){u=!0;continue}var h=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=a[p+2].mapInner(n,y,d+1,t[p]+i+1,s);b!=Zo?(a[p]=f,a[p+1]=h,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var w=ei(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=w.local;for(var k=0;k<a.length;k+=3)a[k+1]<0&&(a.splice(k,3),k-=3);for(var x=0,C=0;x<w.children.length;x+=3){for(var T=w.children[x];C<a.length&&a[C]<T;)C+=3;a.splice(C,0,w.children[x],w.children[x+1],w.children[x+2])}}return new Ko(e&&e.sort(ni),a)}(this.children,i,t,e,n,r,o):i?new Ko(i.sort(ni)):Zo},Ko.prototype.add=function(t,e){return e.length?this==Zo?Ko.create(t,e):this.addInner(t,e,0):this},Ko.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Yo(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,ei(a,t,c+1,Go)),i+=3}}));for(var s=Qo(i?ti(e):e,-n),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Ko(s.length?this.local.concat(s).sort(ni):this.local,r||this.children)},Ko.prototype.remove=function(t){return 0==t.length||this==Zo?this:this.removeInner(t,0)},Ko.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=Zo?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,d=void 0;p<t.length;p++)if(d=t[p])for(var f=0;f<r.length;f++)r[f].eq(d,e)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Ko(r,n):Zo},Ko.prototype.forChild=function(t,e){if(this==Zo)return this;if(e.isLeaf)return Ko.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof Vo){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Ko(r.sort(ni));return n?new Xo([p,n]):p}return n||Zo},Ko.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Ko)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Ko.prototype.locals=function(t){return ri(this.localsInner(t))},Ko.prototype.localsInner=function(t){if(this==Zo)return Jo;if(t.inlineContent||!this.local.some(Vo.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Vo||e.push(this.local[n]);return e};var Zo=new Ko;Ko.empty=Zo,Ko.removeOverlap=ri;var Xo=function(t){this.members=t};function Qo(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Uo(o.from+e,o.to+e,o.type))}return n}function Yo(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function ti(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ei(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Yo(t,e,s+n);if(a){i=!0;var c=ei(a,e,n+s+1,r);c!=Zo&&o.push(s,s+e.nodeSize,c)}}));for(var s=Qo(i?ti(t):t,-n).sort(ni),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Ko(s,o):Zo}function ni(t,e){return t.from-e.from||t.to-e.to}function ri(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),oi(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),oi(e,o+1,i.copy(r.to,i.to)))}}return e}function oi(t,e,n){for(;e<t.length&&ni(n,t[e])>0;)e++;t.splice(e,0,n)}function ii(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Zo&&e.push(r)})),t.cursorWrapper&&e.push(Ko.create(t.state.doc,[t.cursorWrapper.deco])),Xo.from(e)}Xo.prototype.forChild=function(t,e){if(e.isLeaf)return Ko.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Zo&&(o instanceof Xo?n=n.concat(o.members):n.push(o))}return Xo.from(n)},Xo.prototype.eq=function(t){if(!(t instanceof Xo)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},Xo.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?ri(n?e:e.sort(ni)):Jo},Xo.from=function(t){switch(t.length){case 0:return Zo;case 1:return t[0];default:return new Xo(t)}};var si=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=ui(this),this.markCursor=null,this.cursorWrapper=null,li(this),this.nodeViews=pi(this),this.docView=dr(this.state.doc,ci(this),ii(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new mo(t,(function(e,n,r,o){return Yr(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=go[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||ko(t,e)||!t.editable&&e.type in yo||n(t,e)})};for(var n in go)e(n);wn.safari&&t.dom.addEventListener("input",(function(){return null})),wo(t)}(this),this.pluginViews=[],this.updatePluginViews()},ai={props:{configurable:!0},root:{configurable:!0}};function ci(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r?e.class+=" "+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Uo.node(0,t.state.doc.content.size,e)]}function li(t){if(t.markCursor){var e=document.createElement("img");e.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:e,deco:Uo.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ui(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function pi(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}ai.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},si.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&wo(this),this._props=t,this.updateStateInner(t.state,!0)},si.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},si.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},si.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1,i=!1;if(t.storedMarks&&this.composing&&(Ro(this),i=!0),this.state=t,e){var s=pi(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,o=!0),wo(this)}this.editable=ui(this),li(this);var a=ii(this),c=ci(this),l=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,c,a);!u&&t.selection.eq(r.selection)||(i=!0);var p,d,f,h,m,v,g,y,b,w,k,x="preserve"==l&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:_n(t.dom)}}(this);if(i){this.domObserver.stop();var C=u&&(wn.ie||wn.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(h=r.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(u){var T=wn.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=dr(t.doc,c,a,this.dom,this)),T&&!this.trackWrites&&(C=!0)}C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(p=this,d=p.docView.domFromPos(p.state.selection.anchor,0),f=p.root.getSelection(),Dn(d.node,d.offset,f.anchorNode,f.anchorOffset)))?Dr(this,C):(Pr(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==l)this.dom.scrollTop=0;else if("to selection"==l){var M=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof tn?jn(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),M):jn(this,this.coordsAtPos(t.selection.head,1),M))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,qn(w,0==k?0:k-b))},si.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},si.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var o=this.state.plugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}},si.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;var o=this.state.plugins;if(o)for(var i=0;i<o.length;i++){var s=o[i].props[t];if(null!=s&&(n=e?e(s):s))return n}},si.prototype.hasFocus=function(){return this.root.activeElement==this.dom},si.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(Vn)return t.focus(Vn);var e=_n(t);t.focus(null==Vn?{get preventScroll(){return Vn={preventScroll:!0},!0}}:void 0),Vn||(Vn=!1,qn(e,0))}(this.dom),Dr(this),this.domObserver.start()},ai.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},si.prototype.posAtCoords=function(t){return Jn(this,t)},si.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),Zn(this,t,e)},si.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},si.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},si.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},si.prototype.endOfTextblock=function(t,e){return or(this,e||this.state,t)},si.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ii(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},si.prototype.dispatchEvent=function(t){return function(t,e){ko(t,e)||!go[e.type]||!t.editable&&e.type in yo||go[e.type](t,e)}(this,t)},si.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(si.prototype,ai);for(var di={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:"'",229:"q"},fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},hi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),mi="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),vi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),gi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),yi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),bi=hi&&(gi||+hi[1]<57)||vi&&gi,wi=0;wi<10;wi++)di[48+wi]=di[96+wi]=String(wi);for(wi=1;wi<=24;wi++)di[wi+111]="F"+wi;for(wi=65;wi<=90;wi++)di[wi]=String.fromCharCode(wi+32),fi[wi]=String.fromCharCode(wi);for(var ki in di)fi.hasOwnProperty(ki)||(fi[ki]=di[ki]);var xi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function Ci(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);xi?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function Ti(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function Mi(t){return new vn({props:{handleKeyDown:Si(t)}})}function Si(t){var e=function(t){var e=Object.create(null);for(var n in t)e[Ci(n)]=t[n];return e}(t);return function(t,n){var r,o=function(t){var e=!(bi&&(t.ctrlKey||t.altKey||t.metaKey)||(mi||yi)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?fi:di)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),i=1==o.length&&" "!=o,s=e[Ti(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=di[n.keyCode])&&r!=o){var a=e[Ti(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[Ti(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}function Ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Di(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=Ai(r);if(!o)return!1;var i=o.nodeAfter;if(Fi(t,o,e))return!0;if(0==r.parent.content.size&&(Ni(i,"start")||tn.isSelectable(i))){if(e){var s=t.tr.deleteRange(r.before(),r.after());s.setSelection(Ni(i,"start")?Ke.findFrom(s.doc.resolve(s.mapping.map(o.pos)),1):tn.create(s.doc,s.mapping.map(o.pos))),e(s.scrollIntoView())}return!0}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}function Ai(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Li(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}function Ii(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ri(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=Ii(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),l=t.tr.replaceWith(c,c,a.createAndFill());l.setSelection(Ke.near(l.doc.resolve(c),1)),e(l.scrollIntoView())}return!0}function Pi(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof tn&&t.selection.node.isBlock)return!(!r.parentOffset||!Le(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,s=t.tr;(t.selection instanceof Qe||t.selection instanceof nn)&&s.deleteSelection();var a=0==r.depth?null:Ii(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=i&&a?[{type:a}]:null,l=Le(s.doc,s.mapping.map(r.pos),1,c);if(c||l||!Le(s.doc,s.mapping.map(r.pos),1,a&&[{type:a}])||(c=[{type:a}],l=!0),l&&(s.split(s.mapping.map(r.pos),1,c),!i&&!r.parentOffset&&r.parent.type!=a)){var u=s.mapping.map(r.before()),p=s.doc.resolve(u);r.node(-1).canReplaceWith(p.index(),p.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}e(s.scrollIntoView())}return!0}function Bi(t,e){return e&&e(t.tr.setSelection(new nn(t.doc))),!0}function Fi(t,e,n){var r,o,i=e.nodeBefore,s=e.nodeAfter;if(i.type.spec.isolating||s.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(i,i+1)||!o.isTextblock&&!Ie(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;var a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&o.matchType(r[0]||s.type).validEnd){if(n){for(var c=e.pos+s.nodeSize,l=p.empty,u=r.length-1;u>=0;u--)l=p.from(r[u].create(null,l));l=p.from(i.copy(l));var d=t.tr.step(new Ee(e.pos-1,c,e.pos,c,new y(l,1,0),r.length,!0)),f=c+2*r.length;Ie(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=Ke.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),v=m&&De(m);if(null!=v&&v>=e.depth)return n&&n(t.tr.lift(m,v).scrollIntoView()),!0;if(a&&s.isTextblock&&Ni(i,"end")){for(var g=i,b=[];b.push(g),!g.isTextblock;)g=g.lastChild;if(g.canReplace(g.childCount,g.childCount,s.content)){if(n){for(var w=p.empty,k=b.length-1;k>=0;k--)w=p.from(b[k].copy(w));n(t.tr.step(new Ee(e.pos-b.length,e.pos+s.nodeSize,e.pos+1,e.pos+s.nodeSize-1,new y(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Hi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&function(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return a&&a.validEnd?s:null}(r,e);return i?o.map(Ae).concat({type:e,attrs:n}).concat(i.map(Ae)):null}(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function zi(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function ji(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],d=p.$from,f=p.$to;c=n.doc.rangeHasMark(d.pos,f.pos,t)}for(var h=0;h<a.length;h++){var m=a[h],v=m.$from,g=m.$to;if(c)l.removeMark(v.pos,g.pos,t);else{var y=v.pos,b=g.pos,w=v.nodeAfter,k=g.nodeBefore,x=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,C=k&&k.isText?/\s*$/.exec(k.text)[0].length:0;y+x<b&&(y+=x,b-=C),l.addMark(y,b,t.create(e))}}r(l.scrollIntoView())}return!0}}function _i(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var qi=_i(Ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=Oi(r);if(!o){var i=r.blockRange(),s=i&&De(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Fi(t,o,e))return!0;if(0==r.parent.content.size&&(Ni(a,"end")||tn.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Ni(a,"end")?Ke.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):tn.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Oi(o)}var s=i&&i.nodeBefore;return!(!s||!tn.isSelectable(s))&&(e&&e(t.tr.setSelection(tn.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)})),Vi=_i(Ei,Di,(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=Ai(o)}var s=i&&i.nodeAfter;return!(!s||!tn.isSelectable(s))&&(e&&e(t.tr.setSelection(tn.create(t.doc,i.pos)).scrollIntoView()),!0)})),$i={Enter:_i(Li,(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(n instanceof nn||r.parent.inlineContent||o.parent.inlineContent)return!1;var i=Ii(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(Qe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}),(function(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(Le(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&De(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),Pi),"Mod-Enter":Ri,Backspace:qi,"Mod-Backspace":qi,Delete:Vi,"Mod-Delete":Vi,"Mod-a":Bi},Ui={"Ctrl-h":$i.Backspace,"Alt-Backspace":$i["Mod-Backspace"],"Ctrl-d":$i.Delete,"Ctrl-Alt-Backspace":$i["Mod-Delete"],"Alt-Delete":$i["Mod-Delete"],"Alt-d":$i["Mod-Delete"]};for(var Wi in $i)Ui[Wi]=$i[Wi];var Ji=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Ui:$i,Gi=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Ki(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}new Gi(/--$/,"—"),new Gi(/\.\.\.$/,"…"),new Gi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new Gi(/"$/,"”"),new Gi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new Gi(/'$/,"’");var Zi=200,Xi=function(){};Xi.prototype.append=function(t){return t.length?(t=Xi.from(t),!this.length&&t||t.length<Zi&&this.leafAppend(t)||this.length<Zi&&t.leafPrepend(this)||this.appendInner(t)):this},Xi.prototype.prepend=function(t){return t.length?Xi.from(t).append(this):this},Xi.prototype.appendInner=function(t){return new Yi(this,t)},Xi.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Xi.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Xi.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Xi.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Xi.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Xi.from=function(t){return t instanceof Xi?t:t&&t.length?new Qi(t):Xi.empty};var Qi=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Zi)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Zi)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Xi);Xi.empty=new Qi([]);var Yi=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Xi),ts=Xi,es=function(t,e){this.items=t,this.eventCount=e};es.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new ns(t.map));var p,d=t.step.map(r.slice(o));d&&c.maybeStep(d).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new ns(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new es(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},es.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var l,u=t.steps[c].invert(t.docs[c]),p=new ns(t.mapping.maps[c],u,e);(l=a&&a.merge(p))&&(p=l,c?o.pop():s=s.slice(0,s.length-1)),o.push(p),e&&(i++,e=null),r||(a=p)}var d,f,h,m=i-n.depth;return m>is&&(f=m,(d=s).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),s=d.slice(h),i-=m),new es(s.append(o),i)},es.prototype.remapping=function(t,e){var n=new ye;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},es.prototype.addMaps=function(t){return 0==this.eventCount?this:new es(this.items.append(t.map((function(t){return new ns(t)}))),this.eventCount)},es.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new ns(c,l,u))}else n.push(new ns(c))}}),r);for(var c=[],l=e;l<i;l++)c.push(new ns(o.maps[l]));var u=this.items.slice(0,r).append(c).append(n),p=new es(u,s);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},es.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},es.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new ns(c.invert(),a,l),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new es(ts.from(r.reverse()),o)},es.empty=new es(ts.empty,0);var ns=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};ns.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new ns(e.getMap().invert(),e,this.selection)}};var rs=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},is=20;function ss(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function as(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function cs(t,e,n,r){var o=ps(e),i=ds.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new rs(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(ds,{redo:r,historyState:l}).scrollIntoView())}}var ls=!1,us=null;function ps(t){var e=t.plugins;if(us!=e){ls=!1,us=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ls=!0;break}}return ls}var ds=new bn("history"),fs=new bn("closeHistory");function hs(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new vn({key:ds,state:{init:function(){return new rs(es.empty,es.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(ds);if(i)return i.historyState;n.getMeta(fs)&&(t=new rs(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(ds))return s.getMeta(ds).redo?new rs(t.done.addTransform(n,null,r,ps(e)),t.undone,ss(n.mapping.maps[n.steps.length-1]),t.prevTime):new rs(t.done,t.undone.addTransform(n,null,r,ps(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new rs(t.done.rebased(n,o),t.undone.rebased(n,o),as(t.prevRanges,n.mapping),t.prevTime):new rs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),as(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?as(t.prevRanges,n.mapping):ss(n.mapping.maps[n.steps.length-1]);return new rs(t.done.addTransform(n,a?e.selection.getBookmark():null,r,ps(e)),es.empty,c,n.time)}(n,r,e,t)}},config:t})}function ms(t,e){var n=ds.getState(t);return!(!n||0==n.done.eventCount)&&(e&&cs(n,t,e,!1),!0)}function vs(t,e){var n=ds.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&cs(n,t,e,!0),!0)}function gs(t,e){var n=t.nodes.paragraph;return e?n.create(null,Pt()(e)?t.text(e):e):n.createAndFill()}function ys(t,e,n){return t.text(e,n)}function bs(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return Qe.create(t.doc,Math.min(e,o),Math.min(n,o))}function ws(t,e,n){var r=e.pos;return t.replaceWith(r,r,gs(n)),t.setSelection(bs(t,r+1))}function ks(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,s=e.tr,a=e.doc,c=e.schema,l=r;l<=o;l+=1){var u=a.child(l),d=u.nodeSize,f=u.textContent,h=u.content,m=i(f),v=m?ys(c,m):p.empty,g=s.mapping.map(n),y=g+h.size;s.replaceWith(g,y,v),n+=d}return s}function xs(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(bs(t,t.mapping.map(e)-o))}function Cs(t){return t.sourcepos[0][0]}function Ts(t){return t.sourcepos[1][0]}function Ms(t){return t.sourcepos[0][1]}function Ss(t){return t.sourcepos[1][1]}function Es(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Ns(t){return t&&("item"===t.type||"list"===t.type)}function Os(t){return Ns(t)&&"ordered"===t.listData.type}function Ds(t){return Ns(t)&&"ordered"!==t.listData.type}function As(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function Ls(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function Is(t,e){return[t[0],t[1]+e]}function Rs(t,e){return[t[0],e]}function Ps(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function Bs(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}function Fs(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var Hs=[],zs={},js=/\$\$widget\d+\s/;function _s(t){var e=t.search(js);if(-1!==e){var n=t.substring(e).replace(js,"").replace("$$","");t=t.substring(0,e),t+=_s(n)}return t}function qs(t,e){return"$$"+t+" "+e+"$$"}function Vs(t,e){var n=zs[t],r=n.rule;return(0,n.toDOM)(e=_s(e).match(r)[0])}function $s(){return Hs}function Us(t){(Hs=t).forEach((function(t,e){zs["widget"+e]=t}))}function Ws(t,e,n,r){return t.concat(Js(e,n,r))}function Js(t,e,n){void 0===n&&(n=0);var r=[],o=(Hs[n]||{}).rule,i=n+1;if(t=_s(t),o&&o.test(t)){for(var s=void 0;-1!==(s=t.search(o));){var a=t.substring(0,s);a&&(r=Ws(r,a,e,i));var c=(t=t.substring(s)).match(o)[0],l="widget"+n;r.push(e.nodes.widget.create({info:l},e.text(qs(l,c)))),t=t.substring(c.length)}t&&(r=Ws(r,t,e,i))}else t&&(r=n<Hs.length-1?Ws(r,t,e,i):[e.text(t)]);return r}function Gs(t){for(var e,n="",r=t.walker();e=r.next();){var o=e.node;e.entering&&(o!==t&&"text"!==o.type?(n+=Ps(o),r.resumeAt(t,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}function Ks(){return{deleteSelection:function(){return Ei},selectAll:function(){return Bi},undo:function(){return ms},redo:function(){return vs}}}var Zs=new bn("widget"),Xs=function(){function t(t){var e=this;this.popup=null,this.removeWidget=function(){e.popup&&(document.body.removeChild(e.popup),e.popup=null)},this.eventEmitter=t,this.eventEmitter.listen("blur",this.removeWidget),this.eventEmitter.listen("removePopupWidget",this.removeWidget)}return t.prototype.update=function(t){var e=Zs.getState(t.state);if(this.removeWidget(),e){var n=e.node,r=e.style,o=t.coordsAtPos(e.pos),i=o.top,s=o.left,a=o.bottom-i;Ot()(n,{position:"absolute",left:s+"px",opacity:"0"}),document.body.appendChild(n),Ot()(n,{top:("bottom"===r?i+a:i-n.clientHeight-a)+"px",opacity:"1"}),this.popup=n,t.focus()}},t.prototype.destroy=function(){this.eventEmitter.removeEventHandler("blur",this.removeWidget)},t}();function Qs(t){return new vn({key:Zs,state:{init:function(){return null},apply:function(t){return t.getMeta("widget")}},view:function(){return new Xs(t)}})}var Ys=n(893),ta=n.n(Ys),ea=n(990),na=n.n(ea);function ra(t,e,n){t.emit("addImageBlobHook",e,(function(n,r){t.emit("command","addImage",{imageUrl:n,altText:r||e.name||"image"})}),n)}function oa(t){var e=na()(t).filter((function(t){return-1!==t.type.indexOf("image")}));if(1===e.length){var n=e[0];if(n)return n.getAsFile()}return null}function ia(t){var e=t.eventEmitter;return new vn({props:{handleDOMEvents:{drop:function(t,n){var r,o=null===(r=n.dataTransfer)||void 0===r?void 0:r.files;return o&&ta()(o,(function(t){return-1===t.type.indexOf("image")||(n.preventDefault(),n.stopPropagation(),ra(e,t,n.type),!1)})),!0}}}})}var sa=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"node"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function aa(t){var e=document.createElement("span"),n=Vs(t.attrs.info,t.textContent);return e.className="tui-widget",e.appendChild(n),{dom:e}}function ca(t){return"widget"===t.type.name}var la=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"widget"},enumerable:!1,configurable:!0}),Object.defineProperty(n.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(t){return{info:t.textContent.match(/\$\$(widget\d+)/)[1]}}}]}},enumerable:!1,configurable:!0}),n}(sa),ua=function(){function t(t){this.el=document.createElement("div"),this.el.className="toastui-editor",this.eventEmitter=t,this.placeholder={text:""}}return t.prototype.createState=function(){return dn.create({schema:this.schema,plugins:this.createPlugins()})},t.prototype.initEvent=function(){var t=this,e=t.eventEmitter,n=t.view,r=t.editorType;n.dom.addEventListener("focus",(function(){return e.emit("focus",r)})),n.dom.addEventListener("blur",(function(){return e.emit("blur",r)}))},t.prototype.emitChangeEvent=function(t){this.eventEmitter.emit("caretChange",this.editorType),t.docChanged&&this.eventEmitter.emit("change",this.editorType)},Object.defineProperty(t.prototype,"defaultPlugins",{get:function(){var t,e=Ks(),n=e.undo,r=e.redo,s=this.createInputRules(),a=i(i([],this.keymaps),[Mi(o({"Mod-z":n(),"Shift-Mod-z":r(),"Shift-Enter":Ji.Enter},Ji)),hs(),(t=this.placeholder,new vn({props:{decorations:function(e){var n=e.doc;if(t.text&&1===n.childCount&&n.firstChild.isTextblock&&0===n.firstChild.content.size){var r=document.createElement("span");return At()(r,"placeholder"),t.className&&At()(r,t.className),r.textContent=t.text,Ko.create(n,[Uo.widget(1,r)])}return null}}})),Qs(this.eventEmitter),ia(this.context)]);return s?a.concat(s):a},enumerable:!1,configurable:!0}),t.prototype.createInputRules=function(){var t=$s().map((function(t){var e=t.rule;return new Gi(e,(function(t,n,r,o){var i=t.schema,s=t.tr,a=t.doc,c=n.input.match(new RegExp(e,"g")),l=a.resolve(r),u=l.parent,p=0;if(ca(u)&&(u=l.node(l.depth-1)),u.forEach((function(t){return ca(t)&&(p+=1)})),c.length>p){var d=se(c),f=Js(d,i);return s.replaceWith(o-d.length+1,o,f)}return null}))}));return t.length?function(t){var e=t.rules,n=new vn({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Ki(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&Ki(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:t}):null},t.prototype.createSchema=function(){return new ct({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){return t?this.specs.keymaps():[]},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map((function(e){return e(t.eventEmitter)}))},t.prototype.focus=function(){var t=this;setTimeout((function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())}))},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.view.destroy(),Object.keys(this).forEach((function(e){delete t[e]}))},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),pa=n(294),da=n.n(pa);function fa(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var ha=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter((function(t){return"node"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter((function(t){return"mark"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter((function(t){return t.commands})).reduce((function(e,n){var r={},i=n.commands();return da()(i)?r[n.name]=function(e){return fa(t,i,e)}:Object.keys(i).forEach((function(e){r[e]=function(n){return fa(t,i[e],n)}})),o(o({},e),r)}),{}),r=Ks();return Object.keys(r).forEach((function(e){n[e]=function(n){return fa(t,r[e],n)}})),e&&Object.keys(e).forEach((function(r){n[r]=function(n){return fa(t,e[r],n)}})),n},t.prototype.keymaps=function(){return this.specs.filter((function(t){return t.keymaps})).map((function(t){return t.keymaps()})).map((function(t){return Mi(t)}))},t.prototype.setContext=function(t){this.specs.forEach((function(e){e.setContext(t)}))},t}(),ma=n(322),va=n.n(ma),ga=n(714),ya=n.n(ga),ba=n(471),wa=n.n(ba),ka="[A-Za-z][A-Za-z0-9-]*",xa="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ca="<("+ka+")("+xa+")*\\s*/?>",Ta="(?:"+Ca+"|</([A-Za-z][A-Za-z0-9-]*)\\s*[>])",Ma=new RegExp("^"+Ta,"i"),Sa=/<br\s*\/*>/i,Ea="</p><p>";function Na(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),s=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+s}var Oa="toastui-editor-";function Da(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,o=t;r<o.length;r++){var i=o[r],s=void 0;(s=Array.isArray(i)?i[0]?i[1]:null:i)&&n.push(""+Oa+s)}return n.join(" ")}function Aa(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map((function(t){return Oa+"md-"+t})).join(" ")}function La(t){return t&&t.nodeType===Node.ELEMENT_NODE}function Ia(t){t.parentNode&&t.parentNode.removeChild(t)}function Ra(t,e,n){zt()(n)&&(n=!ya()(t,e)),(n?At():It())(t,e)}function Pa(t,e){var n=document.createElement("div");Pt()(t)?n.innerHTML=t:n.appendChild(t);var r=n.firstChild;return e&&e.appendChild(r),r}function Ba(t){var e=window.getComputedStyle(t);return["margin-left","margin-right"].reduce((function(t,n){return t+parseInt(e.getPropertyValue(n),10)}),0)+t.offsetWidth}function Fa(t,e){var n;for(n=Pt()(e)?function(t){return wa()(t,e)}:function(t){return t===e};t&&t!==document;){if(La(t)&&n(t))return t;t=t.parentNode}return null}function Ha(t,e){for(var n=0,r=0;t&&t!==e;){if(n+=t.offsetTop,r+=t.offsetLeft,t.offsetParent===e.offsetParent)break;t=t.offsetParent}return{offsetTop:n,offsetLeft:r}}function za(t,e){Object.keys(t).forEach((function(n){oe(t[n])?e.removeAttribute(n):e.setAttribute(n,t[n])}))}function ja(t){var e=t.from,n=t.to;return t instanceof nn?[e+1,n-1]:[e,n]}function _a(t){return t.index(0)+1}function qa(t,e,n){void 0===n&&(n=1);var r=0;return t.forEach((function(t,o){ca(t)&&o+2<e&&(r+=2*n)})),r}function Va(t,e,n){void 0===n&&(n=e);var r=e===n,o=t.resolve(e),i=_a(o),s=i,a=o.start(1),c=a;if(!r){var l=t.resolve(n===t.content.size?n-1:n);c=l.start(1),s=_a(l),l.pos===t.content.size&&(n=t.content.size-2)}var u=Math.max(e-a+1,1),p=Math.max(n-c+1,1);return[[i,u+qa(t.child(i-1),u,-1)],[s,p+qa(t.child(s-1),p,-1)]]}function $a(t,e){for(var n=[],r=0,o=0;r<e;r+=1){var i=t.child(r);n[r]=o,o+=i.nodeSize}return n}function Ua(t,e,n){var r=$a(t,n[0]),o=e[0]-1,i=n[0]-1,s=t.child(o),a=t.child(i),c=r[o],l=r[i];return c+=e[1]+qa(s,e[1]-1),l+=n[1]+qa(a,n[1]-1),[c,Math.min(l,t.content.size)]}function Wa(t){var e=t.$from,n=t.$to,r=t.from,o=t.to,i=e.doc;return t instanceof nn&&(e=i.resolve(r+1),n=i.resolve(o-1)),0===e.depth&&(n=e=i.resolve(r-1)),{startFromOffset:e.start(1),endFromOffset:n.start(1),startToOffset:e.end(1),endToOffset:n.end(1),startIndex:e.index(0),endIndex:n.index(0),from:e.pos,to:n.pos}}function Ja(t,e){for(var n=1,r=1,o=0,i=0;o<t.childCount;o+=1){var s=t.child(o).nodeSize;if(n=i+1,r=i+s-1,o===e)break;i+=s}return{startOffset:n,endOffset:r}}var Ga="heading",Ka="link",Za="code",Xa="meta",Qa="delimiter",Ya="markedText",tc={strong:2,emph:1,strike:2};function ec(t,e,n,r){return{start:t,end:e,spec:{type:n,attrs:r}}}function nc(t,e,n){var r=t.type,o=Is(e,tc[r]),i=Is(n,-tc[r]);return[ec(o,i,r),ec(e,o,Qa),ec(i,n,Qa)]}function rc(t,e,n,r){return[ec(t,e,Ka),ec(Rs(t,n[1]+1),Rs(e,r),Ka,{desc:!0}),ec(Rs(e,r+2),Is(e,-1),Ka,{url:!0})]}function oc(t,e,n,r){var i={start:e,end:n,spec:{attrs:{className:r+"-line-background",codeStart:e[0],codeEnd:n[0]}},lineBackground:!0};return"item"!==t.type&&"blockQuote"!==t.type?[o(o({},i),{end:e,spec:{attrs:{className:r+"-line-background start"}}}),o(o({},i),{start:[Math.min(e[0]+1,n[0]),e[1]]})]:null}function ic(t,e){for(var n=[];t;){var r=t.type;"paragraph"!==r&&"codeBlock"!==r||n.push(ec([Cs(t),Ms(t)-1],[Ts(t),Ss(t)+1],e)),t=t.next}return n}var sc={heading:function(t,e,n){var r=t.level,o=t.headingType,i=[ec(e,n,Ga,{level:r})];return"atx"===o?i.push(ec(e,Is(e,r),Qa)):i.push(ec(Rs(n,0),n,Ga,{seText:!0})),i},strong:nc,emph:nc,strike:nc,link:function(t,e,n){var r=t.lastChild,o=t.extendedAutolink,i=r?Ss(r)+1:2;return o?[ec(e,n,Ka,{desc:!0})]:rc(e,n,e,i)},image:function(t,e,n){var r=t.lastChild,o=r?Ss(r)+1:3,s=Is(e,1);return i([ec(e,s,Xa)],rc(e,n,s,o))},code:function(t,e,n){var r=t.tickCount,o=Is(e,r),i=Is(n,-r);return[ec(e,n,Za),ec(e,o,Za,{start:!0}),ec(o,i,Za,{marked:!0}),ec(i,n,Za,{end:!0})]},codeBlock:function(t,e,n,r){var o=t.fenceOffset,i=t.fenceLength,s=t.fenceChar,a=t.info,c=t.infoPadding,l=t.parent,u=o+i,p=[ec(Rs(e,1),n,"codeBlock")];s&&p.push(ec(e,Is(e,u),Qa)),a&&p.push(ec(Is(e,i),Is(e,i+c+a.length),Xa)),new RegExp("^(\\s{0,4})("+s+"{"+i+",})").test(r)&&p.push(ec(Rs(n,1),n,Qa));var d=oc(l,e,n,"code-block");return d?p.concat(d):p},blockQuote:function(t,e,n){var r=t.parent&&"blockQuote"!==t.parent.type?[ec(e,n,"blockQuote")]:[];if(t.firstChild){var o=[];"paragraph"===t.firstChild.type?o=function(t){for(var e=[];t;)e.push(ec([Cs(t),Ms(t)],[Ts(t),Ss(t)+1],Ya)),t=t.next;return e}(t.firstChild.firstChild):"list"===t.firstChild.type&&(o=ic(t.firstChild,Ya)),r=i(i([],r),o)}return r},item:function(t,e){var n=t.listData,r=n.padding,s=n.task,a=function(t){for(var e=0;t.parent.parent&&"item"===t.parent.parent.type;)t=t.parent.parent,e+=1;return["listItem",o(o({},[{odd:!0},{even:!0}][e%2]),{listStyle:!0})]}(t),c=[ec.apply(void 0,i([e,Is(e,r)],a))];return s&&(c.push(ec(Is(e,r),Is(e,r+3),"taskDelimiter")),c.push(ec(Is(e,r+1),Is(e,r+2),Xa))),c.concat(ic(t.firstChild,Ya))},customBlock:function(t,e,n){var r=t,o=r.offset,i=r.syntaxLength,s=r.info,a=r.parent,c=o+i,l=[ec(Rs(e,1),n,"customBlock")];l.push(ec(e,Is(e,c),Qa)),s&&l.push(ec(Is(e,c),Is(e,i+s.length),Xa)),l.push(ec(Rs(n,1),n,Qa));var u=oc(a,e,n,"custom-block");return u?l.concat(u):l}},ac={thematicBreak:"thematicBreak",table:"table",tableCell:"tableCell",htmlInline:"html"};function cc(t,e,n,r){var o=t.type;return da()(sc[o])?sc[o](t,e,n,r):ac[o]?[ec(e,n,ac[o])]:null}var lc={};function uc(t){var e=t.schema,n=t.toastMark;return new vn({appendTransaction:function(t,r,o){var i=t[0],s=o.tr;if(i.docChanged){var a=[];i.getMeta("editResult").forEach((function(t){var e=t.nodes,r=t.removedNodeRange;if(e.length){a=a.concat(function(t,e){var n=t.doc,r=e[0].sourcepos[0],o=se(e).sourcepos[1],i=[r[0],r[1]],s=[o[0],o[1]+1],a=[];return function(t,e,n){var r=[];lc={};for(var o=e[0]-1;o<n[0];o+=1){var i=t.child(o),s=i.attrs.codeEnd,a=i.attrs.codeStart;if(a&&s&&!Qt(r,a)){r.push(a),s=Math.min(s,t.childCount);for(var c=a-1,l=n[0],u=c;u<l;u+=1)lc[u]=!0}}}(n,r,o),a.push({start:i,end:s}),a}(s,e));for(var o=0,i=e;o<i.length;o++)for(var c=i[o].walker(),l=c.next();l;){var u=l.node;l.entering&&(a=a.concat(dc(u,n))),l=c.next()}}else if(r)for(var p=s.doc.childCount-1,d=r.line,f=d[0],h=d[1],m=Math.min(f,p),v=Math.min(h,p),g=m;g<=v;g+=1)lc[g]=!0})),function(t,e,n){var r=t.doc,o=e.nodes.paragraph,i=$a(r,r.childCount);n.forEach((function(n){var s=n.start,a=n.end,c=n.spec,l=n.lineBackground,u=Math.min(s[0],r.childCount)-1,p=Math.min(a[0],r.childCount)-1,d=r.child(u),f=r.child(p),h=i[u],m=i[p];(h+=s[1]+qa(d,s[1]-1),m+=a[1]+qa(f,a[1]-1),c)?l?function(t,e,n,r,o){void 0===o&&(o={});for(var i=r.startIndex,s=r.endIndex,a=r.from,c=r.to,l=!1,u=i;u<=s;u+=1)delete lc[u],l=pc(e,u,o);l&&t.setBlockType(a,c,n,o)}(t,r,o,{from:h,to:m,startIndex:u,endIndex:p},c.attrs):t.addMark(h,m,e.mark(c.type,c.attrs)):t.removeMark(h,m)})),function(t,e,n){Object.keys(lc).forEach((function(r){var o=Number(r),i=Math.min(Number(r)+1,t.doc.childCount-1),s=e[o],a=e[i]-1;o===i&&(a+=2),t.setBlockType(s,a,n)}))}(t,i,o)}(s,e,a)}return s.setMeta("widget",i.getMeta("widget"))}})}function pc(t,e,n){return Object.keys(n).some((function(r){return n[r]!==t.child(e).attrs[r]}))}function dc(t,e){var n=e.getLineTexts(),r=[Cs(t),Ms(t)],o=[Ts(t),Ss(t)+1],i=cc(t,r,o,n[o[0]-1]);return null!=i?i:[]}function fc(t){var e={},n=!0;return function(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;)e(t),t=t.parent}(t,(function(t){var r=function(t){return Ns(t)?t.listData.task?"taskList":"ordered"===t.listData.type?"orderedList":"bulletList":-1!==t.type.indexOf("table")?"table":t.type}(t);"customBlock"!==r&&"image"!==r&&"link"!==r&&("bulletList"===r||"orderedList"===r?n&&(e[r]=!0,n=!1):e[r]=!0)})),e}function hc(t){var e=t.toastMark,n=t.eventEmitter;return new vn({view:function(){return{update:function(t,r){var o=t.state,i=o.doc,s=o.selection;if(!(r&&r.doc.eq(i)&&r.selection.eq(s))){var a=s.from,c=o.doc.resolve(a).start(),l=a-c;a===c&&(l+=1);var u=[o.doc.content.findIndex(a).index+1,l],p=e.findNodeAtPosition(u),d=fc(p);n.emit("changeToolbarState",{cursorPos:u,mdNode:p,toolbarState:d}),n.emit("setFocusedNode",p)}}}}})}var mc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),n}(sa),vc=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"mark"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function gc(t,e){return yc(t,e-1)}function yc(t,e){return t.child(e).textContent}var bc=/^\s*> ?/,wc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("block-quote")},0]}}},enumerable:!1,configurable:!0}),n.prototype.createBlockQuoteText=function(t,e){return e?t.replace(bc,"").trim():"> "+t.trim()},n.prototype.extendBlockQuote=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,s=e.schema,a=Wa(r),c=a.endFromOffset,l=a.endToOffset,u=a.endIndex,p=a.to,d=yc(o,u);if(bc.test(d)&&p>c&&r.empty){if(!d.replace(bc,"").trim())i.deleteRange(c,l).split(i.mapping.map(l));else{var f=d.slice(p-c).trim();xs(i,l,f,ys(s,t.createBlockQuoteText(f)))}return n(i),!0}return!1}},n.prototype.commands=function(){var t=this;return function(){return function(e,n){var r=e.selection,o=e.doc,i=Wa(r),s=i.startFromOffset,a=i.endToOffset,c=i.startIndex,l=i.endIndex,u=bc.test(yc(o,c)),p=ks({state:e,startIndex:c,endIndex:l,from:s,createText:function(e){return t.createBlockQuoteText(e,u)}});return n(p.setSelection(bs(p,p.mapping.map(a)))),!0}}},n.prototype.keymaps=function(){var t=this.commands()();return{"alt-q":t,"alt-Q":t,Enter:this.extendBlockQuote()}},n}(vc),kc=/(^\s*)([-*+] |[\d]+\. )/,xc=/(^\s*)([\d])+\.( \[[ xX]])? /,Cc=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Tc=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Mc=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,Sc=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Ec=/(^\s*)([-*+])( \[[ xX]]) /;function Nc(t){return xc.test(t)?"ordered":"bullet"}function Oc(t){for(var e=0;t&&"document"!==t.type;)"list"===t.type&&(e+=1),t=t.parent;return e}function Dc(t,e,n,r){for(var o=t.getLineTexts().length,i=[],s=e;r?s<o:s>1;){s=r?s+1:s-1;var a=t.findFirstNodeAtLine(s),c=Oc(a);if(c===n)i.push({line:s,depth:n,mdNode:a});else if(c<n)break}return i}function Ac(t,e,n,r){void 0===r&&(r=0);var o=Number.MAX_VALUE,i=0;return{changedResults:e.map((function(e,s){var a=e.line;o=Math.min(a-1,o),i=Math.max(a-1,i);var c=gc(t,a);return{text:c="bullet"===n?function(t){if(!kc.test(t))return"* "+t;var e=Nc(t);return"bullet"===e&&Tc.test(t)?t=t.replace(Ec,"$1$2 "):"ordered"===e&&(t=t.replace(xc,"$1* ")),t}(c):function(t,e){if(!kc.test(t))return e+". "+t;var n=Nc(t);if("bullet"===n||"ordered"===n&&Tc.test(t))t=t.replace(Tc,"$1"+e+". ");else if("ordered"===n){var r=Cc.exec(t)[3];Number(r)!==e&&(t=t.replace(xc,"$1"+e+". "))}return t}(c,s+1+r),line:a}})),firstIndex:o,lastIndex:i}}function Lc(t,e){var n,r,o,i,s,a,c,l=(r=(n=e).toastMark,o=n.mdNode,i=n.line,s=Oc(o),a=Dc(r,i,s,!1).reverse(),c=Dc(r,i,s,!0),a.concat([{line:i,depth:s,mdNode:o}]).concat(c));return Ac(e.doc,l,t)}var Ic={bullet:function(t){return Lc("bullet",t)},ordered:function(t){return Lc("ordered",t)},task:function(t){var e=t.mdNode,n=t.doc,r=t.line,o=gc(n,r);return e.listData.task?o=o.replace(Sc,"$1$2"):Ns(e)&&(o=o.replace(kc,"$1$2[ ] ")),{changedResults:[{text:o,line:r}]}}},Rc={bullet:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* "+gc(e,n),line:n}]}},ordered:function(t){for(var e=t.toastMark,n=t.doc,r=t.line,o=t.startLine,i=gc(n,r),s=1,a=o,c=0,l=o-1;l>0;l-=1){var u=e.findFirstNodeAtLine(l),p=gc(n,l)&&!!Ls(u,(function(t){return Ns(t)})),d=Cc.exec(gc(n,l));if(!d&&!p)break;if(d||!p){var f=d,h=f[1],m=f[3];if(!h){s=Number(m),a=l;break}}else c+=1}return{changedResults:[{text:s+r-a-c+". "+i,line:r}]}},task:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* [ ] "+gc(e,n),line:n}]}}},Pc={bullet:function(t){var e=t.line,n=gc(t.doc,e),r=Mc.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(t){var e=t.toastMark,n=t.line,r=t.mdNode,i=t.doc,s=Oc(r),a=gc(i,n),c=Cc.exec(a),l=c[1],u=c[3],p=c[4],d=Number(u)+1,f=""+l+d+p,h=Dc(e,n,s,!0).filter((function(t){var e=Cc.exec(gc(i,t.line));return e&&e[1].length===l.length&&!!Ls(t.mdNode,(function(t){return Os(t)}))}));return o({listSyntax:f},Ac(i,h,"ordered",d))}};function Bc(t,e,n,r,o){for(var i=[],s=gc(t,n),a=Cc.exec(s);a;){var c=a[1],l=a[4],u=a[5],p=c.length;if(p===o)i.push(ys(e,""+c+r+l+u)),r+=1,n+=1;else if(p>o){var d=Bc(t,e,n,1,p);n=d.line,i=i.concat(d.nodes)}if(p<o||n>t.childCount)break;s=gc(t,n),a=Cc.exec(s)}return{nodes:i,line:n}}var Fc=/(^\s{1,4})(.*)/;function Hc(t,e,n){return t<e||kc.test(n)||bc.test(n)}function zc(t,e,n){var r=n.$from;0===r.depth&&(r=t.resolve(r.pos-1));var o=r.node(1),i=r.start(1),s=o.content.size;return o.rangeHasMark(0,s,e.marks.table)&&r.pos-i!==s&&r.pos!==i}function jc(t,e){var n=e.from,r=e.to;if("indent"===e.type){n+=4,r+=4*(e.lineLen+1)}else{var o=e.spaceLenList;n-=o[0];for(var i=0;i<o.length;i+=1)r-=o[i]}return bs(t,n,r)}var _c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(n.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(t){var e=t.attrs;return e.className?["div",{class:Aa(e.className)},0]:["div",0]}}},enumerable:!1,configurable:!0}),n.prototype.reorderList=function(t,e){for(var n=this.context,r=n.view,o=n.toastMark,i=n.schema,s=r.state,a=s.tr,c=s.selection,l=s.doc,u=o.findFirstNodeAtLine(t),p=u;u&&!Ds(u)&&"document"!==u.parent.type;)if(Os(u=u.parent)){p=u;break}p&&(t=p.sourcepos[0][0]);var d=Cc.exec(gc(l,t)),f=d[1],h=d[3],m=f.length,v=Bc(l,i,t,Number(h),m),g=v.line,y=v.nodes;e=Math.max(e,g-1);for(var b=Ja(l,t-1).startOffset,w=t-1;w<=e-1;w+=1){var k=l.child(w),x=k.nodeSize,C=k.content,T=a.mapping.map(b),M=T+C.size;a.replaceWith(T,M,y[w-t+1]),b+=x}var S=bs(a,c.from,c.to);r.dispatch(a.setSelection(S))},n.prototype.indent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.schema,i=n.selection,s=n.doc,a=Wa(i),c=a.from,l=a.to,u=a.startFromOffset,p=a.startIndex,d=a.endIndex;if(t&&zc(s,o,i))return!1;var f=yc(s,p);if(t&&Hc(c,l,f)||!t&&kc.test(f)){var h=ks({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){return" "+t}}),m={type:"indent",from:c,to:l,lineLen:d-p};r(h.setSelection(jc(h,m))),Cc.test(f)&&e.reorderList(p+1,d+1)}else t&&r(n.tr.insert(l,ys(o," ")));return!0}}},n.prototype.outdent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.selection,i=n.doc,s=n.schema,a=Wa(o),c=a.from,l=a.to,u=a.startFromOffset,p=a.startIndex,d=a.endIndex;if(t&&zc(i,s,o))return!1;var f=yc(i,p);if(t&&Hc(c,l,f)||!t&&kc.test(f)){var h=[],m=ks({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){var e=Fc.exec(t);return h.push(e?e[1].length:0),t.replace(Fc,"$2")}}),v={type:"outdent",from:c,to:l,spaceLenList:h};r(m.setSelection(jc(m,v))),Cc.test(f)&&e.reorderList(p+1,d+1)}else if(t){var g=f.slice(0,l-u),y=g.replace(/\s{1,4}$/,""),b=l-(g.length-y.length);r(n.tr.delete(b,l))}return!0}}},n.prototype.deleteLines=function(){var t=this;return function(e,n){var r=t.context.view,o=Wa(e.selection),i=o.startFromOffset,s=o.endToOffset;return _i((function(){return n(e.tr.deleteRange(i,s)),!0}),Di)(e,n,r)}},n.prototype.moveDown=function(){return function(t,e){var n=t.doc,r=t.tr,o=t.selection,i=t.schema,s=Wa(o),a=s.startFromOffset,c=s.endToOffset,l=s.endIndex;if(l<n.content.childCount-1){var u=n.child(l+1),p=u.nodeSize,d=u.textContent;return r.delete(c,c+p).split(a).insert(r.mapping.map(a)-2,ys(i,d)),e(r),!0}return!1}},n.prototype.moveUp=function(){return function(t,e){var n=t.tr,r=t.doc,o=t.selection,i=t.schema,s=Wa(o),a=s.startFromOffset,c=s.endToOffset,l=s.startIndex;if(l>0){var u=r.child(l-1),p=u.nodeSize,d=u.textContent;return n.delete(a-p,a).split(n.mapping.map(c)).insert(n.mapping.map(c),ys(i,d)),e(n),!0}return!1}},n.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},n.prototype.keymaps=function(){return{Tab:this.indent(!0)(),"Shift-Tab":this.outdent(!0)(),"Mod-d":this.deleteLines(),"Mod-D":this.deleteLines(),"Alt-ArrowUp":this.moveUp(),"Alt-ArrowDown":this.moveDown()}},n}(sa),qc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),n}(sa),Vc=/^#{1,6}\s/,$c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(t){var e=t.attrs,n="heading|heading"+e.level;return e.seText&&(n+="|delimiter|setext"),["span",{class:Aa.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.createHeadingText=function(t,e,n){for(var r=e.replace(n,"").trim(),o="";t>0;)o+="#",t-=1;return o+" "+r},n.prototype.commands=function(){var t=this;return function(e){return function(n,r){var o=e.level,i=Wa(n.selection),s=i.startFromOffset,a=i.endToOffset,c=ks({state:n,from:s,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(e){var n=e.match(Vc),r=n?n[0]:"";return t.createHeadingText(o,e,r)}});return r(c.setSelection(bs(c,c.mapping.map(a)))),!0}}},n}(vc),Uc="```",Wc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("code-block")},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=Wa(n),s=i.startFromOffset,a=i.endToOffset,c=ys(r,Uc);return o.insert(s,c).split(s+Uc.length),o.split(o.mapping.map(a)).insert(o.mapping.map(a),c),e(o.setSelection(bs(o,o.mapping.map(a)-(Uc.length+2)))),!0}}},n.prototype.keepIndentation=function(){var t=this;return function(e,n){var r=e.selection,o=e.tr,i=e.doc,s=e.schema,a=t.context.toastMark,c=Wa(r),l=c.startFromOffset,u=c.endToOffset,p=c.endIndex,d=c.from,f=c.to,h=yc(i,p);if(d===f&&h.trim()){var m=h.match(/^\s+/);if(function(t){return t&&"codeBlock"===t.type}(a.findFirstNodeAtLine(p+1))&&m){var v=m[0],g=h.slice(f-l);return xs(o,u,g,ys(s,v+g)),n(o),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,Enter:this.keepIndentation()}},n}(vc),Jc=/\||\s/g;function Gc(t,e){for(var n="|",r=0;r<t;r+=1)n+=e?" --- |":" |";return n}var Kc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("table")},0]}}},enumerable:!1,configurable:!0}),n.prototype.extendTable=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,s=e.schema;if(!r.empty)return!1;var a=Wa(r),c=a.endFromOffset,l=a.endToOffset,u=a.endIndex,p=a.to,d=yc(o,u),f=[u+1,p-c+1],h=Ls(t.context.toastMark.findNodeAtPosition(f),(function(t){return As(t)&&("tableDelimRow"===t.parent.type||"tableBody"===t.parent.parent.type)}));if(h){var m=!d.replace(Jc,"").trim(),v=Gc(h.parent.parent.parent.columns.length);return m?i.deleteRange(c,l).split(i.mapping.map(l)):i.split(l).insert(i.mapping.map(l),ys(s,v)).setSelection(bs(i,i.mapping.map(l)-2)),n(i),!0}return!1}},n.prototype.moveTableCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,s=Wa(o),a=s.endFromOffset,c=[s.endIndex+1,s.to-a],l=Ls(e.context.toastMark.findNodeAtPosition(c),(function(t){return As(t)}));if(l){var u=l.parent,p=function(t){return t?{type:"next",parentType:"tableHead",childType:"firstChild"}:{type:"prev",parentType:"tableBody",childType:"lastChild"}}(t),d=p.type,f=p.parentType,h=p.childType,m=Ss(l);if(l[d])m=Ss(l[d])-1;else{var v=u[d]||u.parent.type!==f?u[d]:u.parent[d][h];if("next"===d)m+=(v?Ss(v[h]):0)+2;else"prev"===d&&(m=v?-4:0)}return r(i.setSelection(bs(i,a+m))),!0}return!1}},n.prototype.addTable=function(){return function(t){return function(e,n){var r=e.selection,o=e.tr,s=e.schema,a=t,c=a.columnCount,l=a.rowCount,u=Wa(r).endToOffset,p=function(t){return[Gc(t),Gc(t,!0)]}(c),d=function(t,e){for(var n=[],r=0;r<e;r+=1)n.push(Gc(t));return n}(c,l-1);return i(i([],p),d).forEach((function(t){o.split(o.mapping.map(u)).insert(o.mapping.map(u),ys(s,t))})),n(o.setSelection(bs(o,u+4))),!0}}},n.prototype.commands=function(){return{addTable:this.addTable()}},n.prototype.keymaps=function(){return{Enter:this.extendTable(),Tab:this.moveTableCell(!0),"Shift-Tab":this.moveTableCell(!1)}},n}(vc),Zc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("thematic-break")},0]}}},enumerable:!1,configurable:!0}),n.prototype.hr=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=Wa(n),s=i.from,a=i.to,c=i.endToOffset,l=ys(r,"***");return o.split(s).replaceWith(o.mapping.map(s),o.mapping.map(a),l).split(o.mapping.map(a)).setSelection(bs(o,o.mapping.map(c))),e(o),!0}}},n.prototype.commands=function(){return{hr:this.hr()}},n.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},n}(vc);function Xc(t,e){var n=t.type;return e<=t.sourcepos[0][0]&&("codeBlock"===n||"heading"===n||n.match("table"))}var Qc=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{odd:{default:!1},even:{default:!1},listStyle:{default:!1}},toDOM:function(t){var e=t.attrs,n=e.odd,r=e.even,o="list-item";return e.listStyle&&(o+="|list-item-style"),n&&(o+="|list-item-odd"),r&&(o+="|list-item-even"),["span",{class:Aa.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.extendList=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.schema,s=e.tr,a=t.context.toastMark,c=Wa(r),l=c.to,u=c.startFromOffset,p=c.endFromOffset,d=c.endIndex,f=c.endToOffset,h=yc(o,d);if(!kc.test(h)||r.from===u||!r.empty)return!1;if(!h.replace(Tc,"").trim())s.deleteRange(p,f).split(s.mapping.map(f));else{var m=Nc(h),v=a.findFirstNodeAtLine(d+1),g=h.slice(l-p),y={toastMark:a,mdNode:v,doc:o,line:d+1},b=Pc[m](y),w=b.listSyntax,k=b.changedResults;if(null==k?void 0:k.length){s.split(l),k.unshift({text:w+g,line:d+1}),t.changeToListPerLine(s,k,{from:l,startLine:k[0].line,endLine:se(k).line});var x=s.mapping.map(f)-g.length;s.setSelection(bs(s,x))}else{xs(s,f,g,ys(i,w+g))}}return n(s),!0}},n.prototype.toList=function(t){var e=this;return function(){return function(n,r){for(var o=n.doc,i=n.tr,s=n.selection,a=e.context.toastMark,c=Wa(s),l=c.startIndex+1,u=c.endIndex+1,p=c.endToOffset,d=[],f=l;f<=u;f+=1){var h=a.findFirstNodeAtLine(f);if(h&&Xc(h,f))break;if(-1===d.indexOf(f)){var m={toastMark:a,mdNode:h,doc:o,line:f,startLine:l},v=(Ns(h)?Ic[t](m):Rc[t](m)).changedResults,g=e.changeToListPerLine(i,v,{from:Ja(o,v[0].line-1).startOffset,startLine:v[0].line,endLine:se(v).line,indexDiff:1});p=Math.max(g,p),v&&(d=d.concat(v.map((function(t){return t.line}))))}}return r(i.setSelection(bs(i,i.mapping.map(p)))),!0}}},n.prototype.changeToListPerLine=function(t,e,n){for(var r=n.from,o=n.startLine,i=n.endLine,s=n.indexDiff,a=void 0===s?0:s,c=0,l=function(n){var o=t.doc.child(n),i=o.nodeSize,s=o.content,l=t.mapping.map(r),p=l+s.size,d=e.filter((function(t){return t.line-a===n}))[0];d&&(t.replaceWith(l,p,ys(u.context.schema,d.text)),c=Math.max(c,r+s.size)),r+=i},u=this,p=o-a;p<=i-a;p+=1)l(p);return c},n.prototype.toggleTask=function(){var t=this;return function(e,n){for(var r=e.selection,o=e.tr,i=e.doc,s=e.schema,a=t.context.toastMark,c=Wa(r),l=c.startIndex,u=c.endIndex,p=null,d=l;d<=u;d+=1){var f=a.findFirstNodeAtLine(d+1);if(Ns(f)&&f.listData.task){var h=f.listData,m=h.checked,v=h.padding,g=m?" ":"x",y=f.sourcepos[0],b=Ja(i,y[0]-1).startOffset;b+=y[1]+v,p=o.replaceWith(b,b+1,s.text(g))}}return!!p&&(n(p),!0)}},n.prototype.commands=function(){return{bulletList:this.toList("bullet"),orderedList:this.toList("ordered"),taskList:this.toList("task")}},n.prototype.keymaps=function(){var t=this.toList("bullet")(),e=this.toList("ordered")(),n=this.toList("task")(),r=this.toggleTask();return{"Mod-u":t,"Mod-U":t,"Mod-o":e,"Mod-O":e,"alt-t":n,"alt-T":n,"Shift-Ctrl-x":r,"Shift-Ctrl-X":r,Enter:this.extendList()}},n}(vc);function Yc(t,e){return function(){return function(n,r){var o=n.tr,i=n.selection,s=da()(t)?t:function(e){return t.test(e)},a=e.length,c=o.doc,l=ja(i),u=l[0],p=l[1],d=Math.max(u-a,1),f=Math.min(p+a,c.content.size-1),h=i.content(),m=h.content.textBetween(0,h.content.size,"\n"),v=c.textBetween(d,u,"\n"),g=c.textBetween(p,f,"\n");if(m=""+v+m+g,v&&g&&s(m))o.delete(f-a,f).delete(d,d+a);else{o.insertText(e,p).insertText(e,u);var y=i.empty?bs(o,u+a):bs(o,u+a,p+a);o.setSelection(y)}return r(o),!0}}}var tl=/^(\*{2}|_{2}).*([\s\S]*)\1$/m,el=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("strong")},0]}}},enumerable:!1,configurable:!0}),n.prototype.bold=function(){return Yc(tl,"**")},n.prototype.commands=function(){return{bold:this.bold()}},n.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},n}(vc),nl=/^(~{2}).*([\s\S]*)\1$/m,rl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("strike")},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return Yc(nl,"~~")},n.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},n}(vc),ol=/^(\*|_).*([\s\S]*)\1$/m,il=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("emph")},0]}}},enumerable:!1,configurable:!0}),n.prototype.italic=function(){return Yc(ol,"*")},n.prototype.commands=function(){return{italic:this.italic()}},n.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},n}(vc),sl=/^(`).*([\s\S]*)\1$/m,al=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{start:{default:!1},end:{default:!1},marked:{default:!1}},toDOM:function(t){var e=t.attrs,n="code";return e.start&&(n+="|delimiter|start"),e.end&&(n+="|delimiter|end"),e.marked&&(n+="|marked-text"),["span",{class:Aa.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return Yc(sl,"`")},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},n}(vc),cl=[{regExp:/\(/g,encoded:"%28",escaped:"\\("},{regExp:/\)/g,encoded:"%29",escaped:"\\)"},{regExp:/\[/g,encoded:"%5B",escaped:"\\["},{regExp:/\]/g,encoded:"%5D",escaped:"\\]"},{regExp:/</g,encoded:"%3C",escaped:"\\<"},{regExp:/>/g,encoded:"%3E",escaped:"\\>"},{regExp:/ /g,encoded:"%20",escaped:" "}];function ll(t){return cl.reduce((function(t,e){var n=e.regExp,r=e.escaped;return t.replace(n,r)}),t)}var ul=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(t){var e=t.attrs,n="link";return e.url&&(n+="|link-url|marked-text"),e.desc&&(n+="|link-desc|marked-text"),["span",{class:Aa.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),n.prototype.addLinkOrImage=function(t){return function(e){return function(n,r){var o=n.selection,i=n.tr,s=n.schema,a=ja(o),c=a[0],l=a[1],u=e,p=u.linkText,d=u.altText,f=u.linkUrl,h=u.imageUrl,m=p,v=f,g="";return"image"===t&&(m=d,v=h,g="!"),g+="["+(m=ll(m))+"]("+(v=function(t){return cl.reduce((function(t,e){var n=e.regExp,r=e.encoded;return t.replace(n,r)}),t)}(v))+")",r(i.replaceWith(c,l,ys(s,g))),!0}}},n.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},n}(vc),pl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),n}(vc),dl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("delimiter")},0]}}},enumerable:!1,configurable:!0}),n}(vc),fl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("meta")},0]}}},enumerable:!1,configurable:!0}),n}(vc),hl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("marked-text")},0]}}},enumerable:!1,configurable:!0}),n}(vc),ml=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("table-cell")},0]}}},enumerable:!1,configurable:!0}),n}(vc),vl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("html")},0]}}},enumerable:!1,configurable:!0}),n}(vc),gl=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Aa("custom-block")},0]}}},enumerable:!1,configurable:!0}),n}(vc),yl=/x|backspace/i,bl=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;var wl="cut",kl=/\r\n|\n|\r/,xl=function(t){function n(e,n){var r=t.call(this,e)||this,i=n.toastMark,s=n.useCommandShortcut,a=void 0===s||s,c=n.mdPlugins,l=void 0===c?[]:c;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=i,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(a),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(o(o({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",(function(t){return r.toggleActive(!0,t)})),r.eventEmitter.listen("changePreviewTabPreview",(function(){return r.toggleActive(!1)})),r.initEvent(),r}return e(n,t),n.prototype.toggleActive=function(t,e){Ra(this.el,"active",t),t?e||this.focus():this.blur()},n.prototype.createClipboard=function(){var t=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Da("pseudo-clipboard"),this.clipboard.addEventListener("paste",(function(e){var n=e.clipboardData||window.clipboardData,r=n&&n.items;if(r){var o=oa(r);o&&(e.preventDefault(),ra(t.eventEmitter,o,e.type))}})),this.clipboard.addEventListener("input",(function(e){var n=e.target.value;t.replaceSelection(n),e.preventDefault(),e.target.value=""})),this.el.insertBefore(this.clipboard,this.view.dom)},n.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},n.prototype.createSpecs=function(){return new ha([new mc,new _c,new la,new qc,new $c,new wc,new Wc,new gl,new Kc,new ml,new Zc,new Qc,new el,new rl,new il,new al,new ul,new dl,new pl,new hl,new fl,new vl])},n.prototype.createPlugins=function(){return this.defaultPlugins.concat(i([uc(this.context),hc(this.context),(t=this.context,e=t.schema,n=t.toastMark,new vn({props:{handleDOMEvents:{keyup:function(t,r){var o,i=t.state,s=i.doc,a=i.tr,c=i.selection;if(c.empty&&yl.test(r.key)){var l=Wa(c),u=l.startIndex,p=l.startFromOffset,d=[u+1,l.from-p+1],f=Ls(n.findNodeAtPosition(d),(function(t){var e;return"paragraph"===t.type&&"item"===(null===(e=t.parent)||void 0===e?void 0:e.type)}));if(null===(o=null==f?void 0:f.firstChild)||void 0===o?void 0:o.literal){var h=f.firstChild,m=h.literal.match(bl);if(m){var v=h.sourcepos[0],g=m[1],y=m[2],b=m[3],w=g.length+b.length,k=Ja(s,v[0]-1).startOffset,x=v[1]+k;if(y){var C=w?w+1:0;a.replaceWith(x,C+x,e.text(y)),t.dispatch(a)}else w||(a.insertText(" ",x),t.dispatch(a))}}}return!1}}}}))],this.createPluginProps()));var t,e,n},n.prototype.createView=function(){var t=this;return new si(this.el,{state:this.createState(),dispatchTransaction:function(e){t.updateMarkdown(e);var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e)},handleKeyDown:function(e,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&t.clipboard.focus(),t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{copy:function(e,n){return t.captureCopy(n)},cut:function(e,n){return t.captureCopy(n,wl)},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1}},nodeViews:{widget:aa}})},n.prototype.createCommands=function(){return this.specs.commands(this.view)},n.prototype.captureCopy=function(t,e){t.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return t.clipboardData?t.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),e===wl&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",wl)),!0},n.prototype.updateMarkdown=function(t){var e=this;t.docChanged&&t.steps.forEach((function(n,r){if(n.slice&&!(n instanceof Ee)){var o=t.docs[r],i=[n.from,n.to],s=Va(o,i[0],i[1]),a=s[0],c=s[1],l=e.getChanged(n.slice);a[0]===c[0]&&a[1]===c[1]&&""===l&&(l="\n");var u=e.toastMark.editMarkdown(a,c,l);e.eventEmitter.emit("updatePreview",u),t.setMeta("editResult",u).scrollIntoView()}}))},n.prototype.getChanged=function(t){var e="",n=t.content.size;return t.content.nodesBetween(0,n,(function(t,r){t.isText?e+=t.text.slice(Math.max(0,r)-r,n-r):t.isBlock&&r>0&&(e+="\n")})),e},n.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=Ua(n.doc,t,e),o=r[0],i=r[1];this.view.dispatch(n.setSelection(bs(n,o,i)).scrollIntoView())},n.prototype.replaceSelection=function(t,e,n){var r,o=this.view.state,i=o.tr,s=o.schema,a=o.doc,c=t.split(kl).map((function(t){return gs(s,Js(t,s))})),l=new y(p.from(c),1,1);if(this.focus(),e&&n){var u=Ua(a,e,n),d=u[0],f=u[1];r=i.replaceRange(d,f,l)}else r=i.replaceSelection(l);this.view.dispatch(r.scrollIntoView())},n.prototype.deleteSelection=function(t,e){var n,r=this.view.state,o=r.tr,i=r.doc;if(t&&e){var s=Ua(i,t,e),a=s[0],c=s[1];n=o.deleteRange(a,c)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},n.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;if(t&&e){var a=Ua(r,t,e);i=a[0],s=a[1]}return r.textBetween(i,s,"\n")},n.prototype.getSelection=function(){var t=this.view.state.selection,e=t.from,n=t.to;return Va(this.view.state.tr.doc,e,n)},n.prototype.setMarkdown=function(t,e){void 0===e&&(e=!0);var n=t.split(kl),r=this.view.state,o=r.tr,i=r.doc,s=r.schema,a=n.map((function(t){return gs(s,Js(t,s))}));this.view.dispatch(o.replaceWith(0,i.content.size,a)),e&&this.moveCursorToEnd(!0)},n.prototype.addWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.doc,s=r.selection,a=n?Ua(i,n,n)[0]:s.to;this.view.dispatch(o.setMeta("widget",{pos:a,node:t,style:e}))},n.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.schema,s=Ua(r.doc,t,e),a=Js(n,i);this.view.dispatch(o.replaceWith(s[0],s[1],a))},n.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t||Va(n,r.from)[0],i=this.toastMark.findNodeAtPosition(o);return"text"===i.type&&"paragraph"!==i.parent.type&&(i=i.parent),i.sourcepos[1][1]+=1,{range:i.sourcepos,type:i.type}},n.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map((function(t){return _s(t)})).join("\n")},n.prototype.getToastMark=function(){return this.toastMark},n}(ua),Cl=n(349),Tl=n.n(Cl),Ml=n(348),Sl=n.n(Ml),El=function(t,e){return(El=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Nl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}El(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ol=function(){return(Ol=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function Dl(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var Al="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},Ll={};function Il(t,e,n){var r,o,i,s,a,c="";for("string"!=typeof e&&(n=e,e=Il.defaultChars),void 0===n&&(n=!0),a=function(t){var e,n,r=Ll[t];if(r)return r;for(r=Ll[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)r[t.charCodeAt(e)]=t[e];return r}(e),r=0,o=t.length;r<o;r++)if(i=t.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(r+1,r+3)))c+=t.slice(r,r+3),r+=2;else if(i<128)c+=a[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(s=t.charCodeAt(r+1))>=56320&&s<=57343){c+=encodeURIComponent(t[r]+t[r+1]),r++;continue}c+="%EF%BF%BD"}else c+=encodeURIComponent(t[r]);return c}Il.defaultChars=";/?:@&=+$,-_.!~*'()#",Il.componentChars="-_.!~*'()";var Rl=Il,Pl={},Bl={},Fl={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅",in:"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺",int:"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""},Hl={Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"},zl={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},jl={},_l=Al&&Al.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jl,"__esModule",{value:!0});var ql=_l({0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}),Vl=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t)};jl.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in ql.default&&(t=ql.default[t]),Vl(t))};var $l=Al&&Al.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.decodeHTML=Bl.decodeHTMLStrict=Bl.decodeXML=void 0;var Ul=$l(Fl),Wl=$l(Hl),Jl=$l(zl),Gl=$l(jl),Kl=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function Zl(t){var e=Ql(t);return function(t){return String(t).replace(Kl,e)}}Bl.decodeXML=Zl(Jl.default),Bl.decodeHTMLStrict=Zl(Ul.default);var Xl=function(t,e){return t<e?1:-1};function Ql(t){return function(e){if("#"===e.charAt(1)){var n=e.charAt(2);return"X"===n||"x"===n?Gl.default(parseInt(e.substr(3),16)):Gl.default(parseInt(e.substr(2),10))}return t[e.slice(1,-1)]||e}}Bl.decodeHTML=function(){for(var t=Object.keys(Wl.default).sort(Xl),e=Object.keys(Ul.default).sort(Xl),n=0,r=0;n<e.length;n++)t[r]===e[n]?(e[n]+=";?",r++):e[n]+=";";var o=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=Ql(Ul.default);function s(t){return";"!==t.substr(-1)&&(t+=";"),i(t)}return function(t){return String(t).replace(o,s)}}();var Yl={},tu=Al&&Al.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Yl,"__esModule",{value:!0}),Yl.escapeUTF8=Yl.escape=Yl.encodeNonAsciiHTML=Yl.encodeHTML=Yl.encodeXML=void 0;var eu=au(tu(zl).default),nu=cu(eu);Yl.encodeXML=fu(eu);var ru,ou,iu=au(tu(Fl).default),su=cu(iu);function au(t){return Object.keys(t).sort().reduce((function(e,n){return e[t[n]]="&"+n+";",e}),{})}function cu(t){for(var e=[],n=[],r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];1===i.length?e.push("\\"+i):n.push(i)}e.sort();for(var s=0;s<e.length-1;s++){for(var a=s;a<e.length-1&&e[a].charCodeAt(1)+1===e[a+1].charCodeAt(1);)a+=1;var c=1+a-s;c<3||e.splice(s,c,e[s]+"-"+e[a])}return n.unshift("["+e.join("")+"]"),new RegExp(n.join("|"),"g")}Yl.encodeHTML=(ru=iu,ou=su,function(t){return t.replace(ou,(function(t){return ru[t]})).replace(lu,pu)}),Yl.encodeNonAsciiHTML=fu(iu);var lu=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,uu=null!=String.prototype.codePointAt?function(t){return t.codePointAt(0)}:function(t){return 1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)-56320+65536};function pu(t){return"&#x"+(t.length>1?uu(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var du=new RegExp(nu.source+"|"+lu.source,"g");function fu(t){return function(e){return e.replace(du,(function(e){return t[e]||pu(e)}))}}Yl.escape=function(t){return t.replace(du,pu)},Yl.escapeUTF8=function(t){return t.replace(nu,pu)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=Bl,n=Yl;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=Yl;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=Bl;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(Pl);var hu="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",mu=/[\\&]/,vu="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",gu=new RegExp("\\\\"+vu+"|"+hu,"gi"),yu=new RegExp('[&<>"]',"g"),bu=function(t){return 92===t.charCodeAt(0)?t.charAt(1):Pl.decodeHTML(t)};function wu(t){return mu.test(t)?t.replace(gu,bu):t}function ku(t){try{return Rl(t)}catch(e){return t}}function xu(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function Cu(t){return yu.test(t)?t.replace(yu,xu):t}function Tu(t,e){for(var n=[],r=0;r<e;r++)n.push(t);return n.join("")}function Mu(t){return!t||!/[^ \t]+/.test(t)}var Su=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.next=function(){var t=this.current,e=this.entering;if(null===t)return null;var n=Eu(t);return e&&n?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:null===t.next?(this.current=t.parent,this.entering=!1):(this.current=t.next,this.entering=!0),{entering:e,node:t}},t.prototype.resumeAt=function(t,e){this.current=t,this.entering=!0===e},t}();function Eu(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var Nu=1,Ou={};function Du(t){delete Ou[t]}var Au=function(){function t(t,e){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===t?-1:Nu++,this.type=t,this.sourcepos=e,Ou[this.id]=this}return t.prototype.isContainer=function(){return Eu(this)},t.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},t.prototype.replaceWith=function(t){this.insertBefore(t),this.unlink()},t.prototype.insertAfter=function(t){t.unlink(),t.next=this.next,t.next&&(t.next.prev=t),t.prev=this,this.next=t,this.parent&&(t.parent=this.parent,t.next||(t.parent.lastChild=t))},t.prototype.insertBefore=function(t){t.unlink(),t.prev=this.prev,t.prev&&(t.prev.next=t),t.next=this,this.prev=t,t.parent=this.parent,t.prev||(t.parent.firstChild=t)},t.prototype.appendChild=function(t){t.unlink(),t.parent=this,this.lastChild?(this.lastChild.next=t,t.prev=this.lastChild,this.lastChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.prependChild=function(t){t.unlink(),t.parent=this,this.firstChild?(this.firstChild.prev=t,t.next=this.firstChild,this.firstChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.walker=function(){return new Su(this)},t}(),Lu=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=e,r}return Nl(e,t),e}(Au),Iu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.listData=null,e}return Nl(e,t),e}(Lu),Ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.level=0,e.headingType="atx",e}return Nl(e,t),e}(Lu),Pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isFenced=!1,e.fenceChar=null,e.fenceLength=0,e.fenceOffset=-1,e.info=null,e.infoPadding=0,e}return Nl(e,t),e}(Lu),Bu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.columns=[],e}return Nl(e,t),e}(Lu),Fu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.startIdx=0,e.endIdx=0,e.paddingLeft=0,e.paddingRight=0,e.ignored=!1,e}return Nl(e,t),e}(Lu),Hu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="",e.dest="",e.label="",e}return Nl(e,t),e}(Lu),zu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.syntaxLength=0,e.offset=-1,e.info="",e}return Nl(e,t),e}(Lu),ju=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.htmlBlockType=-1,e}return Nl(e,t),e}(Lu),_u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.destination=null,e.title=null,e.extendedAutolink=!1,e}return Nl(e,t),e}(Au),qu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.tickCount=0,e}return Nl(e,t),e}(Au),Vu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.info="",e}return Nl(e,t),e}(Au);function $u(t,e){switch(t){case"heading":return new Ru(t,e);case"list":case"item":return new Iu(t,e);case"link":case"image":return new _u(t,e);case"codeBlock":return new Pu(t,e);case"htmlBlock":return new ju(t,e);case"table":return new Bu(t,e);case"tableCell":return new Fu(t,e);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new Lu(t,e);case"code":return new qu(t,e);case"refDef":return new Hu(t,e);case"customBlock":return new zu(t,e);case"customInline":return new Vu(t,e);default:return new Au(t,e)}}function Uu(t){return"codeBlock"===t.type}function Wu(t){return"list"===t.type}function Ju(t){return"refDef"===t.type}function Gu(t){return"customBlock"===t.type}function Ku(t,e){var n=$u("text",e);return n.literal=t,n}var Zu,Xu="[A-Za-z][A-Za-z0-9-]*",Qu="<"+Xu+"(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Yu="</"+Xu+"\\s*[>]",tp=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*[>]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)Zu=function(t){try{return String.fromCodePoint(t)}catch(t){if(t instanceof RangeError)return String.fromCharCode(65533);throw t}};else{var ep=String.fromCharCode,np=Math.floor;Zu=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r,o=16384,i=[],s=-1,a=t.length;if(!a)return"";for(var c="";++s<a;){var l=Number(t[s]);if(!isFinite(l)||l<0||l>1114111||np(l)!==l)return String.fromCharCode(65533);l<=65535?i.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,i.push(n,r)),(s+1===a||i.length>o)&&(c+=ep.apply(void 0,i),i.length=0)}return c}}var rp=Zu;function op(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r<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,e[0].length);return t.substring(0,t.length-s)}}return t}function ip(t){return t.replace(/&[A-Za-z0-9]+;$/,"")}function sp(t){return Dl(Dl([],function(t){for(var e,n=new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]","g"),r=[];e=n.exec(t);){var o=ip(op(e[0])),i="www"===e[1]?"http://":"";r.push({text:o,range:[e.index,e.index+o.length-1],url:""+i+o})}return r}(t)),function(t){for(var e,n=new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+","g"),r=[];e=n.exec(t);){var o=e[0];/[_-]+$/.test(o)||r.push({text:o,range:[e.index,e.index+o.length-1],url:"mailto:"+o})}return r}(t)).sort((function(t,e){return t.range[0]-e.range[0]}))}function ap(t){return t[t.length-1]}function cp(t){return t.slice(1,t.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function lp(t,e){Object.keys(t).forEach((function(n){e(n,t[n])}))}function up(t){return!Object.keys(t).length}var pp=126,dp=39,fp=34,hp=36,mp="\\\\"+vu,vp=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]/),gp=new RegExp('^(?:"('+mp+'|[^"\\x00])*"|\'('+mp+"|[^'\\x00])*'|\\(("+mp+"|[^()\\x00])*\\))"),yp=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,bp=new RegExp("^"+vu),wp=new RegExp("^"+hu,"i"),kp=/`+/,xp=/^`+/,Cp=/\.\.\./g,Tp=/--+/g,Mp=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,Sp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Ep=/^ *(?:\n *)?/,Np=/^[ \t\n\x0b\x0c\x0d]/,Op=/^\s/,Dp=/ *$/,Ap=/^ */,Lp=/^ *(?:\n|$)/,Ip=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,Rp=/^[^\n`\[\]\\!<&*_'"~$]+/m,Pp=function(){function t(t){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},t.prototype.spnl=function(){return this.match(Ep),!0},t.prototype.parseBackticks=function(t){var e=this.pos+1,n=this.match(xp);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match(kp));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),s=this.sourcepos(e,this.pos),a=i.split("\n");if(a.length>1){var c=ap(a);this.lineIdx+=a.length-1,this.linePosOffset=-(this.pos-c.length-n.length),s[1]=this.sourcepos(this.pos),i=a.join(" ")}var l=$u("code",s);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?l.literal=i.slice(1,i.length-1):l.literal=i,l.tickCount=n.length,t.appendChild(l),!0}return this.pos=o,t.appendChild(Ku(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=$u("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):bp.test(n.charAt(this.pos))?(t.appendChild(Ku(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(Ku("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Mp))?(n=e.slice(1,e.length-1),(r=$u("link",this.sourcepos(o,this.pos))).destination=ku("mailto:"+n),r.title="",r.appendChild(Ku(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Sp))&&(n=e.slice(1,e.length-1),(r=$u("link",this.sourcepos(o,this.pos))).destination=ku(n),r.title="",r.appendChild(Ku(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(tp);if(null===n)return!1;var r=$u("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===dp||t===fp)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(t===pp||t===hp))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":rp(i);var s,a,c=Op.test(r),l=vp.test(r),u=Op.test(o),p=vp.test(o),d=!c&&(!l||u||p),f=!u&&(!p||c||l);return 95===t?(s=d&&(!f||p),a=f&&(!d||l)):t===dp||t===fp?(s=d&&!f,a=f):t===hp?(s=!c,a=!u):(s=d,a=f),this.pos=n,{numdelims:e,canOpen:s,canClose:a}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=Ku(t===dp?"’":t===fp?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==dp&&t!==fp)&&(this.delimiters={cc:t,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,s,a,c=!1,l=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,a=!1;null!==n&&n!==t&&n!==l[u][p?r.origdelims%3:0];){if(c=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!c){a=!0;break}n=n.previous}if(o=r,p||u===pp||u===hp)if(a){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,s=r.node;var h=p?1===d?"emph":"strong":"strike";u===hp&&(h="customInline");var m=$u(h),v=i.sourcepos[1],g=s.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,s.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),s.literal=s.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==s;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===hp){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length===x.length+1?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&s.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===dp?(r.node.literal="’",a&&(n.node.literal="‘"),r=r.next):u===fp&&(r.node.literal="”",a&&(n.node.literal="“"),r=r.next);a||(l[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(gp);return null===t?null:wu(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(yp);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&bp.test(this.subject.charAt(this.pos+1)))this.pos+=1,-1!==this.peek()&&(this.pos+=1);else if(40===r)this.pos+=1,n+=1;else if(41===r){if(n<1)break;this.pos+=1,n-=1}else{if(null!==Np.exec(rp(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:ku(wu(t=this.subject.substr(e,this.pos-e)))}return ku(wu(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(Ip);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=Ku("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=Ku("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else{n=Ku("!",this.sourcepos(this.pos,this.pos));t.appendChild(n)}return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(Ku("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(Ku("]",this.sourcepos(o,o))),this.removeBracket(),!0;var s=i.image,a=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(Np.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=a);var c="";if(!r){var l=this.pos,u=this.parseLinkLabel();if(u>2?c=this.subject.slice(l,l+u):i.bracketAfter||(c=this.subject.slice(i.index,o)),0===u&&(this.pos=a),c){c=cp(c);var p=this.refMap[c];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=$u(s?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!s)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:c}),!0}return this.removeBracket(),this.pos=o,t.appendChild(Ku("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:c}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(wp))&&(t.appendChild(Ku(Pl.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(Rp)){if(this.options.smart){var r=e.replace(Cp,"…").replace(Tp,(function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),Tu("—",n)+Tu("–",e)}));t.appendChild(Ku(r,this.sourcepos(n,this.pos)))}else{var o=Ku(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(Dp,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild($u(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild($u("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(Ap),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var s=this.parseLinkDestination();if(null===s)return this.pos=r,0;var a=this.pos;this.spnl(),this.pos!==a&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=a);var c=!0;if(null===this.match(Lp)&&(""===n?c=!1:(n="",this.pos=a,c=null!==this.match(Lp))),!c)return this.pos=r,0;var l=cp(i);if(""===l)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=$u("refDef",u);return p.title=n,p.dest=s,p.label=l,t.insertBefore(p),e[l]?this.refDefCandidateMap[p.id]=p:e[l]=Cd(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],s=n[n.length-1];i.sourcepos&&s.sourcepos&&(i.sourcepos[1]=s.sourcepos[1]),i.next=s.next,i.next&&(i.next.prev=i);for(var a=1;a<n.length;a+=1)i.literal+=n[a].literal,n[a].unlink();n=[]}}},t.prototype.getReferenceDefSourcepos=function(t){for(var e=t.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<e.length;i+=1){var s=e[i];if(Np.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:e[a].length},n=!0}var c=s.match(/'|"/g);if(c&&(r+=c.length),2===r){o={line:i,ch:s.length};break}}return[[t.sourcepos[0][0],t.sourcepos[0][1]],[t.sourcepos[0][0]+o.line,o.ch]]},t.prototype.parseInline=function(t){var e,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(t);break;case 92:n=this.parseBackslash(t);break;case 96:n=this.parseBackticks(t);break;case 42:case 95:case pp:case hp:n=this.handleDelim(r,t);break;case dp:case fp:n=!!(null===(e=this.options)||void 0===e?void 0:e.smart)&&this.handleDelim(r,t);break;case 91:n=this.parseOpenBracket(t);break;case 33:n=this.parseBang(t);break;case 93:n=this.parseCloseBracket(t);break;case 60:n=this.parseAutolink(t)||this.parseHtmlTag(t);break;case 38:n=this.parseEntity(t);break;default:n=this.parseString(t)}return n||(this.pos+=1,t.appendChild(Ku(rp(r),this.sourcepos(this.pos,this.pos+1)))),!0},t.prototype.parse=function(t){for(this.subject=t.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=t.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=t.sourcepos[0][0],function(t){return"heading"===t.type}(t)&&(this.lineOffsets[0]+=t.level+1);this.parseInline(t););t.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(t.walker());var e=this.options,n=e.extendedAutolinks,r=e.customParser;if(n&&function(t,e){var n;"boolean"==typeof e&&(e=sp);for(var r=function(){var t=n.entering,r=n.node;if(t&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=e(o);if(!i||!i.length)return"continue";for(var s=0,a=r.sourcepos[0],c=a[0],l=a[1],u=function(t,e){return[[c,l+t],[c,l+e]]},p=[],d=0,f=i;d<f.length;d++){var h=f[d],m=h.range,v=h.url,g=h.text;m[0]>s&&p.push(Ku(o.substring(s,m[0]),u(s,m[0]-1)));var y=$u("link",u.apply(void 0,m));y.appendChild(Ku(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),s=m[1]+1}s<o.length&&p.push(Ku(o.substring(s),u(s,o.length-1)));for(var b=0,w=p;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=t.next();)r()}(t.walker(),n),r&&t.firstChild)for(var o,i=t.firstChild.walker();o=i.next();){var s=o.node,a=o.entering;r[s.type]&&r[s.type](s,{entering:a,options:this.options})}},t}(),Bp=/^\[([ \txX])\][ \t]+/;var Fp=/[^ \t\f\v\r\n]/,Hp=/^(?:`{3,}|~{3,})(?= *$)/;function zp(t){for(var e=t;e;){if(e.lastLineBlank)return!0;var n=e.type;if(e.lastLineChecked||"list"!==n&&"item"!==n){e.lastLineChecked=!0;break}e.lastLineChecked=!0,e=e.lastChild}return!1}function jp(t,e){return e<t.length?t.charCodeAt(e):-1}function _p(t){return!Fp.test(t)}function qp(t){return 32===t||9===t}var Vp=/^\$\$$/,$p={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},Up={document:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},list:{continue:function(){return 0},finalize:function(t,e){for(var n=e.firstChild;n;){if(zp(n)&&n.next){e.listData.tight=!1;break}for(var r=n.firstChild;r;){if(zp(r)&&(n.next||r.next)){e.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(t){return"item"===t},acceptsLines:!1},blockQuote:{continue:function(t){var e=t.currentLine;return t.indented||62!==jp(e,t.nextNonspace)?1:(t.advanceNextNonspace(),t.advanceOffset(1,!1),qp(jp(e,t.offset))&&t.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},item:{continue:function(t,e){if(t.blank){if(null===e.firstChild)return 1;t.advanceNextNonspace()}else{if(!(t.indent>=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(Bp);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:{continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(Hp);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&qp(jp(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),s=r.slice(o+1),a=i.match(/^(\s*)(.*)/);e.infoPadding=a[1].length,e.info=wu(a[2].trim()),e.literal=s}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===jp(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&_p(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:$p,customBlock:{continue:function(t,e){var n=t.currentLine,r=n.match(Vp);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&qp(jp(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),s=o.match(/^(\s*)(.*)/);e.info=wu(s[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},frontMatter:$p};function Wp(t){for(var e=0,n=0,r=[],o=0;o<t.length;o+=1)if("|"===t[o]&&"\\"!==t[o-1]){var i=t.substring(e,o);0===e&&Mu(i)?n=o+1:r.push(i),e=o+1}e<t.length&&(Mu(i=t.substring(e,t.length))||r.push(i));return[n,r]}function Jp(t,e,n,r){for(var o=[],i=0,s=e;i<s.length;i++){var a=s[i],c=a.match(/^[ \t]+/),l=c?c[0].length:0,u=void 0,p=void 0;if(l===a.length)l=0,u=0,p="";else{var d=a.match(/[ \t]+$/);u=d?d[0].length:0,p=a.slice(l,a.length-u)}var f=r+l,h=$u(t,[[n,r],[n,r+a.length-1]]);h.stringContent=p.replace(/\\\|/g,"|"),h.startIdx=o.length,h.endIdx=o.length,h.lineOffsets=[f-1],h.paddingLeft=l,h.paddingRight=u,o.push(h),r+=a.length+1}return o}function Gp(t){var e=null,n=t.stringContent,r=n[0];return":"===n[n.length-1]?e=":"===r?"center":"right":":"===r&&(e="left"),{align:e}}var Kp=/^(\$\$)(\s*[a-zA-Z])+/,Zp=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,Xp=/^`{3,}(?!.*`)|^~{3,}/,Qp=[/./,/^<(?: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("^(?:"+Qu+"|"+Yu+")\\s*$","i")],Yp=/^(?:=+|-+)[ \t]*$/,td=/^#{1,6}(?:[ \t]+|$)/,ed=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,nd=/^[*+-]/,rd=/^(\d{1,9})([.)])/;function od(t,e){return t.options.disallowDeepHeading&&("blockQuote"===e.type||"item"===e.type)}var id=[function(t){return t.indented||62!==jp(t.currentLine,t.nextNonspace)?0:(t.advanceNextNonspace(),t.advanceOffset(1,!1),qp(jp(t.currentLine,t.offset))&&t.advanceOffset(1,!0),t.closeUnmatchedBlocks(),t.addChild("blockQuote",t.nextNonspace),1)},function(t,e){var n;if(!t.indented&&!od(t,e)&&(n=t.currentLine.slice(t.nextNonspace).match(td))){t.advanceNextNonspace(),t.advanceOffset(n[0].length,!1),t.closeUnmatchedBlocks();var r=t.addChild("heading",t.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=t.currentLine.slice(t.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),t.advanceOffset(t.currentLine.length-t.offset),2}return 0},function(t){var e;if(!t.indented&&(e=t.currentLine.slice(t.nextNonspace).match(Xp))){var n=e[0].length;t.closeUnmatchedBlocks();var r=t.addChild("codeBlock",t.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=e[0][0],r.fenceOffset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0},function(t,e){if(!t.indented&&60===jp(t.currentLine,t.nextNonspace)){var n=t.currentLine.slice(t.nextNonspace),r=t.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(Qp[o]);if(i){if(7===o){if("paragraph"===e.type)return 0;if(r.length>0)if(new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return t.closeUnmatchedBlocks(),t.addChild("htmlBlock",t.offset).htmlBlockType=o,2}}}return 0},function(t,e){var n;if(null!==e.stringContent&&!t.indented&&"paragraph"===e.type&&!od(t,e.parent)&&(n=t.currentLine.slice(t.nextNonspace).match(Yp))){t.closeUnmatchedBlocks();for(var r=void 0;91===jp(e.stringContent,0)&&(r=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(r);if(e.stringContent.length>0){var o=$u("heading",e.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=e.stringContent,e.insertAfter(o),e.unlink(),t.tip=o,t.advanceOffset(t.currentLine.length-t.offset,!1),2}return 0}return 0},function(t){return!t.indented&&ed.test(t.currentLine.slice(t.nextNonspace))?(t.closeUnmatchedBlocks(),t.addChild("thematicBreak",t.nextNonspace),t.advanceOffset(t.currentLine.length-t.offset,!1),2):0},function(t,e){var n,r,o,i=e;return t.indented&&"list"!==e.type||!(n=function(t,e){var n,r,o=t.currentLine.slice(t.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:t.indent,task:!1,checked:!1};if(t.indent>=4)return null;if(n=o.match(nd))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(rd))||"paragraph"===e.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=jp(t.currentLine,t.nextNonspace+n[0].length))&&9!==r&&32!==r)return null;if("paragraph"===e.type&&!t.currentLine.slice(t.nextNonspace+n[0].length).match(Fp))return null;t.advanceNextNonspace(),t.advanceOffset(n[0].length,!0);var s=t.column,a=t.offset;do{t.advanceOffset(1,!0),r=jp(t.currentLine,t.offset)}while(t.column-s<5&&qp(r));var c=-1===jp(t.currentLine,t.offset),l=t.column-s;return l>=5||l<1||c?(i.padding=n[0].length+1,t.column=s,t.offset=a,qp(jp(t.currentLine,t.offset))&&t.advanceOffset(1,!0)):i.padding=n[0].length+l,i}(t,i))?0:(t.closeUnmatchedBlocks(),"list"===t.tip.type&&(r=i.listData,o=n,r.type===o.type&&r.delimiter===o.delimiter&&r.bulletChar===o.bulletChar)||((i=t.addChild("list",t.nextNonspace)).listData=n),(i=t.addChild("item",t.nextNonspace)).listData=n,1)},function(t){return t.indented&&"paragraph"!==t.tip.type&&!t.blank?(t.advanceOffset(4,!0),t.closeUnmatchedBlocks(),t.addChild("codeBlock",t.offset),2):0},function(t,e){var n=e.stringContent;if("paragraph"===e.type&&!t.indented&&!t.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),s=t.currentLine.slice(t.nextNonspace),a=Wp(i),c=a[0],l=a[1],u=Wp(s),p=u[0],d=u[1],f=/^[ \t]*:?-+:?[ \t]*$/;if(!l.length||!d.length||d.some((function(t){return!f.test(t)}))||1===d.length&&0!==s.indexOf("|"))return 0;var h=e.lineOffsets,m=t.lineNumber-1,v=ap(h)+1,g=$u("table",[[m,v],[t.lineNumber,t.offset]]);if(g.columns=d.map((function(){return{align:null}})),e.insertAfter(g),1===h.length)e.unlink();else{e.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;t.lastLineLength=h[h.length-2]+y,t.finalize(e,m-1)}t.advanceOffset(t.currentLine.length-t.offset,!1);var b=$u("tableHead",[[m,v],[t.lineNumber,t.offset]]);g.appendChild(b);var w=$u("tableRow",[[m,v],[m,v+i.length-1]]),k=$u("tableDelimRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.offset]]);b.appendChild(w),b.appendChild(k),Jp("tableCell",l,m,v+c).forEach((function(t){w.appendChild(t)}));var x=Jp("tableDelimCell",d,t.lineNumber,t.nextNonspace+1+p);return x.forEach((function(t){k.appendChild(t)})),g.columns=x.map(Gp),t.tip=g,2}return 0},function(t,e){if("table"!==e.type&&"tableBody"!==e.type||!t.blank&&-1===t.currentLine.indexOf("|"))return 0;if(t.advanceOffset(t.currentLine.length-t.offset,!1),t.blank){var n=e;return"tableBody"===e.type&&(n=e.parent,t.finalize(e,t.lineNumber-1)),t.finalize(n,t.lineNumber-1),0}var r=e;"table"===e.type&&((r=t.addChild("tableBody",t.nextNonspace)).stringContent=null);var o=$u("tableRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.currentLine.length]]);r.appendChild(o);var i=r.parent,s=Wp(t.currentLine.slice(t.nextNonspace)),a=s[0];return Jp("tableCell",s[1],t.lineNumber,t.nextNonspace+1+a).forEach((function(t,e){e>=i.columns.length&&(t.ignored=!0),o.appendChild(t)})),2},function(t){var e;if(!t.indented&&!Zp.test(t.currentLine)&&(e=t.currentLine.match(Kp))){var n=e[1].length;t.closeUnmatchedBlocks();var r=t.addChild("customBlock",t.nextNonspace);return r.syntaxLength=n,r.offset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0}],sd=/^(-{3}|\+{3}|;{3})$/,ad=function(t,e){var n=t.currentLine,r=t.lineNumber,o=t.indented;return 1===r&&!o&&"document"===e.type&&sd.test(n)?(t.closeUnmatchedBlocks(),t.addChild("frontMatter",t.nextNonspace).stringContent=n,t.advanceNextNonspace(),t.advanceOffset(n.length,!1),2):0},cd={continue:function(t,e){var n=t.currentLine,r=n.match(sd);return"frontMatter"===e.type&&r?(e.stringContent+=n,t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2):0},finalize:function(t,e){null!==e.stringContent&&(e.literal=e.stringContent,e.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},ld=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],ud=/^[#`~*+_=<>0-9-;$]/,pd=/\r\n|\n|\r/;function dd(){return $u("document",[[1,1],[0,0]])}var fd={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},hd=function(){function t(t){this.options=Ol(Ol({},fd),t),this.doc=dd(),this.tip=this.doc,this.oldtip=this.doc,this.lineNumber=0,this.offset=0,this.column=0,this.nextNonspace=0,this.nextNonspaceColumn=0,this.indent=0,this.currentLine="",this.indented=!1,this.blank=!1,this.partiallyConsumedTab=!1,this.allClosed=!0,this.lastMatchedContainer=this.doc,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.lastLineLength=0,this.lines=[],this.options.frontMatter&&(Up.frontMatter=cd,id.unshift(ad)),this.inlineParser=new Pp(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=Tu(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!Up[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=$u(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],Up[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.entering,s=o.type;n&&n[s]&&n[s](o,{entering:i,options:this.options}),i||"paragraph"!==s&&"heading"!==s&&("tableCell"!==s||o.ignored)||this.inlineParser.parse(o)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),Up[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&Up[e.type].acceptsLines,i=id.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!ud.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var s=0;s<i;){var a=id[s](this,e);if(1===a){e=this.tip;break}if(2===a){e=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&&e.lastChild&&(e.lastChild.lastLineBlank=!0);for(var c=e.type,l=this.blank&&!("blockQuote"===c||Uu(e)&&e.isFenced||"item"===c&&!e.firstChild&&e.sourcepos[0][0]===this.lineNumber),u=e;u;)u.lastLineBlank=l,u=u.parent;Up[c].acceptsLines?(this.addLine(),function(t){return"htmlBlock"===t.type}(e)&&e.htmlBlockType>=1&&e.htmlBlockType<=5&&ld[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offset<t.length&&!this.blank&&(e=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=t.length},t.prototype.parse=function(t,e){this.doc=dd(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=t.split(pd),r=n.length;this.lines=e||n,this.options.referenceDefinition&&this.clearRefMaps(),10===t.charCodeAt(t.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},t.prototype.partialParseStart=function(t,e){this.doc=dd(),this.tip=this.doc,this.lineNumber=t-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=e.length,r=0;r<n;r++)this.incorporateLine(e[r]);return this.doc},t.prototype.partialParseExtends=function(t){for(var e=0;e<t.length;e++)this.incorporateLine(t[e])},t.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},t.prototype.setRefMaps=function(t,e,n){this.refMap=t,this.refLinkCandidateMap=e,this.refDefCandidateMap=n},t.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(t){var e;e=t,Object.keys(e).forEach((function(t){delete e[t]}))}))},t}();function md(t,e){return t[0]<e[0]?1:t[0]>e[0]?-1:t[1]<e[1]?1:t[1]>e[1]?-1:0}function vd(t,e){var n=t[0];return 1===md(t[1],e)?1:-1===md(n,e)?-1:0}function gd(t,e){for(var n=0,r=e;n<r.length;n++){var o=r[n];t.insertBefore(o)}}function yd(t,e){var n=t[0];return t[1][0]<e?1:n[0]>e?-1:0}function bd(t,e){for(var n=t.firstChild;n;){var r=yd(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function wd(t){return function(t){return Ou[t]}(t)||null}function kd(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var xd=/\r\n|\n|\r/;function Cd(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var Td=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new hd(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(xd),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,o=t[0],i=t[1],s=e[0],a=e[1],c=n.split(xd),l=c.length,u=this.lineTexts[o-1],p=this.lineTexts[s-1];c[0]=u.slice(0,i-1)+c[0],c[l-1]=c[l-1]+p.slice(a-1);var d=s-o+1;return(r=this.lineTexts).splice.apply(r,Dl([o-1,d],c)),l-d},t.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?(gd(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var s=i[o];n[s]&&(Du(n[s].id),n[s]=null)}n=r}t.next=e.next,e.next?e.next.prev=t:t.parent.lastChild=t}}(t,e),[t.id,e.id].forEach((function(t){return Du(t)})),t.unlink()):e?(gd(e,n),Du(e.id),e.unlink()):function(t,e){for(var n=e.length-1;n>=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=bd(this.root,t[0]),r=bd(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach((function(t){t(e)}))},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&(Wu(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return nd.test(n)||rd.test(n)}(this.lineTexts[n-1])||function(t){return"table"===t.type}(t.prev)&&(!_p(o=this.lineTexts[n-1])&&-1!==o.indexOf("|")))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),s=this.parser.partialParseStart(n,i),a=e?e.next:this.root.firstChild,c=s.lastChild,l=c&&Uu(c)&&c.open,u=c&&Gu(c)&&c.open,p=c&&Wu(c);(l||u)&&a||p&&a&&("list"===a.type||a.sourcepos[0][1]>=2);){var d=this.extendEndLine(a.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=a,r=d,a=a.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(s),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&Ju(t)||e&&Ju(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!up(this.refMap)){var r=function(t){if(Ju(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&kd(r,t.parent,e),e&&kd(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!up(this.refMap)){var n=function(t){if(Ju(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=Cd(t))}};t.forEach((function(t){kd(n,t)}))}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;up(this.refDefCandidateMap)||lp(this.refDefCandidateMap,(function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=Cd(n))}))},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!up(this.refMap)){var i=bd(this.root,t-1),s=bd(this.root,e+1);i&&Ju(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),s&&Ju(s)&&s!==n&&s!==r&&(r=s,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],s=o?Math.min(o.sourcepos[0][0],t[0]):t[0],a=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),c=this.parseRange.apply(this,this.getRangeWithRefDef(s,a,o,i,n)),l=c.newNodes,u=c.extStartNode,p=c.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,l),this.replaceWithNewRefDefState(l)):this.replaceRangeNodes(u,p,l),{nodes:l,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return up(this.refMap)||lp(this.refMap,(function(n,r){r.unlinked&&delete t.refMap[n],lp(t.refLinkCandidateMap,(function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))}))})),e},t.prototype.removeUnlinkedCandidate=function(){up(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach((function(t){lp(t,(function(e){(function(t){var e=wd(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]}))}))},t.prototype.editMarkdown=function(t,e,n){var r=this.updateLineTexts(t,e,n),o=this.parse(t,e,r),i=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=Ol({},t);return e.forEach((function(t){delete r[t]})),r}(o,"nextNode");!function(t,e){if(t&&t.parent&&0!==e){var n,r=t.parent.walker();for(r.resumeAt(t,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=e,o.sourcepos[1][0]+=e)}}}(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},t.prototype.getLineTexts=function(){return this.lineTexts},t.prototype.getRootNode=function(){return this.root},t.prototype.findNodeAtPosition=function(t){var e=function(t,e){for(var n=t,r=null;n;){var o=vd(n.sourcepos,e);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,t);return e&&e!==this.root?e:null},t.prototype.findFirstNodeAtLine=function(t){return function(t,e){for(var n=t.firstChild,r=null;n;){var o=yd(n.sourcepos,e);if(0===o){if(n.sourcepos[0][0]===e||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(t){for(;t.parent&&"document"!==t.parent.type&&t.parent.sourcepos[0][0]===t.sourcepos[0][0];)t=t.parent;return t}(function(t){for(;t.lastChild;)t=t.lastChild;return t}(r)):null}(this.root,t)},t.prototype.on=function(t,e){this.eventHandlerMap[t].push(e)},t.prototype.off=function(t,e){var n=this.eventHandlerMap[t],r=n.indexOf(e);n.splice(r,1)},t.prototype.findNodeById=function(t){return wd(t)},t.prototype.removeAllNode=function(){Ou={}},t}(),Md=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function Sd(t){return Md.test(t)?t.replace(Md,(function(t,e){return"<"+e})):t}var Ed={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.listData,o=r.type,i=r.start,s="bullet"===o?"ul":"ol",a={};return"ol"===s&&null!==i&&1!==i&&(a.start=i.toString()),{type:n?"openTag":"closeTag",tagName:s,attributes:a,outerNewLine:!0}},item:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?Sd(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?Sd(t.literal):t.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+Cu(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:Ol({href:Cu(o)},r&&{title:Cu(r)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,r=e.skipChildren,o=t,i=o.title,s=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:Ol({src:Cu(s),alt:n(t)},i&&{title:Cu(i)})}},customBlock:function(t,e,n){var r=t.info.trim().toLowerCase(),o=n[r];if(o)try{return o(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+r+" block node was parsed in markdown renderer: "+t)}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.sourcepos,i=r.info,s=i.trim().toLowerCase(),a=n[s],c=e.entering;if(a)try{return a(t,e)}catch(t){console.warn("[@toast-ui/editor] - The error occurred when "+s+" inline node was parsed in markdown renderer: "+t)}var l=o[1][1]-o[0][1]+1===i.length+4?"":i+" ";return c?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+l}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},Nd={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,r=t.listData,o=r.checked,i=r.task;if(n){var s={type:"openTag",tagName:"li",outerNewLine:!0};return i?[s,{type:"openTag",tagName:"input",selfClose:!0,attributes:Ol(Ol({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;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(t,e){var n=e.entering;if(t.ignored)return{type:"text",content:""};var r=t.parent.parent,o="tableHead"===r.type?"th":"td",i=r.parent.columns[t.startIdx],s=(null==i?void 0:i.align)?{align:i.align}:null;return n?Ol({type:"openTag",tagName:o,outerNewLine:!0},s&&{attributes:s}):{type:"closeTag",tagName:o,outerNewLine:!0}}},Od={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function Dd(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var Ad=function(){function t(t){this.buffer=[],this.options=Ol(Ol({},Od),t),this.convertors=this.createConvertors(),delete this.options.convertors}return t.prototype.createConvertors=function(){var t=Ol({},Ed);if(this.options.gfm&&(t=Ol(Ol({},t),Nd)),this.options.convertors){var e=this.options.convertors,n=Object.keys(e),r=Ol(Ol({},Ed),Nd);n.forEach((function(n){var o=t[n],i=e[n],s=-1===Object.keys(r).indexOf(n)?n.toLowerCase():n;t[s]=o?function(t,e,n){return e.origin=function(){return o(t,e,n)},i(t,e)}:i}))}return t},t.prototype.getConvertors=function(){return this.convertors},t.prototype.getOptions=function(){return this.options},t.prototype.render=function(t){var e=this;this.buffer=[];for(var n=t.walker(),r=null,o=function(){var t=r.node,o=r.entering,s=i.convertors[t.type];if(!s)return"continue";var a=!1,c={entering:o,leaf:!Eu(t),options:i.options,getChildrenText:Dd,skipChildren:function(){a=!0}},l=Gu(t)||function(t){return"customInline"===t.type}(t)?s(t,c,i.convertors):s(t,c);l&&((Array.isArray(l)?l:[l]).forEach((function(n,r){"openTag"===n.type&&e.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(t.id)),e.renderHTMLNode(n)})),a&&(n.resumeAt(t,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},t.prototype.renderHTMLNode=function(t){switch(t.type){case"openTag":case"closeTag":this.renderElementNode(t);break;case"text":this.renderTextNode(t);break;case"html":this.renderRawHtmlNode(t)}},t.prototype.generateOpenTagString=function(t){var e=this,n=t.tagName,r=t.classNames,o=t.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach((function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')})),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push("</"+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==ap(ap(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(Cu(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),Ld=n(368),Id=n.n(Ld),Rd=["iframe","embed"],Pd=[];function Bd(t){Qt(Rd,t)&&Pd.push(t.toLowerCase())}function Fd(t,e){return Id().sanitize(t,o({ADD_TAGS:Pd,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},e))}function Hd(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]+?>)|(</"+e+"\\s*[>])","ig"),"").trim()}function zd(t){var e=(t=t.match(Ma)[0]).match(new RegExp(xa,"g"));return e?e.reduce((function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t}),{}):{}}function jd(t){return na()(t.attributes).reduce((function(t,e){return t[e.nodeName]=e.nodeValue,t}),{})}function _d(t,e,n,r){var o=r.getToDOMNode(e)(t),i=n(o.outerHTML),s=document.createElement("div");return s.innerHTML=i,{dom:o=s.firstChild,htmlAttrs:jd(o)}}var qd={htmlBlock:function(t,e,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:jd(t),childrenHTML:t.innerHTML}}}],toDOM:function(r){var o=_d(r,t,e,n),s=o.dom,a=o.htmlAttrs;return a.class=a.class?a.class+" html-block":"html-block",i([t,a],na()(s.childNodes))}}},htmlInline:function(t,e,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:jd(t)}}}],toDOM:function(r){var o=_d(r,t,e,n).htmlAttrs;return[t,o,0]}}}};var Vd=/^\s*<\s*\//,$d={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/<br ?\/?>/.test(t.prev.literal)?"\n":"<br>\n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.info,o=r?r.split(/\s+/):[],i=[],s={};if(n>3&&(s["data-backticks"]=n),o.length>0&&o[0].length>0){var a=o[0];i.push("lang-"+a),s["data-language"]=a}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:s},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:Vs(i,Gs(t)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function Ud(t,e){var n=o({},$d);return t&&(n.link=function(e,n){var r=n.entering,i=(0,n.origin)();return r&&(i.attributes=o(o({},i.attributes),t)),i}),e&&Object.keys(e).forEach((function(t){var r=n[t],i=e[t];r&&da()(i)?n[t]=function(t,e){var n=o({},e);return n.origin=function(){return r(t,e)},i(t,n)}:Qt(["htmlBlock","htmlInline"],t)&&!da()(i)?n[t]=function(t,e){var n=t.literal.match(Ma);if(n){var r=n[0],s=n[1],a=n[3],c=(s||a).toLowerCase(),l=i[c],u=Hd(t,c);if(l){var p=o({},t);return p.attrs=zd(r),p.childrenHTML=u,p.type=c,e.entering=!Vd.test(t.literal),l(p,e)}}return e.origin()}:n[t]=i})),n}var Wd=["list","item","blockQuote"],Jd=["UL","OL","BLOCKQUOTE"];function Gd(t,e){var n,r=t.child(e);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function Kd(t,e,n){var r=Cs(e)-1,o=Ts(e)-1,i=n[r].getBoundingClientRect(),s=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:s<=0?n[r].clientHeight:s+Zd(t,n,Math.min(o+1,t.childCount-1)),rect:i}}function Zd(t,e,n){for(var r=t.childCount-1,o=0;n<=r&&Gd(t,n);)o+=e[n].clientHeight,n+=1;return o}function Xd(t,e){for(var n=0;t&&t!==e&&(Qt(Jd,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function Qd(t,e,n){return t&&e>n+t.offsetTop?Qd(t.nextElementSibling,e,n)||t:null}function Yd(t){for(var e=document.querySelector('[data-nodeid="'+t.id+'"]');!e||Es(t);)t=t.parent,e=document.querySelector('[data-nodeid="'+t.id+'"]');return function(t){var e=t.mdNode,n=t.el;for(;(Qt(Wd,e.type)||"table"===e.type)&&e.firstChild;)e=e.firstChild,n=n.firstElementChild;return{mdNode:e,el:n}}({mdNode:t,el:e})}var tf={};function ef(t){t&&(delete tf[Number(t.getAttribute("data-nodeid"))],na()(t.children).forEach((function(t){ef(t)})))}function nf(t,e,n){var r,o=tf[r=n]&&tf[r].height,i=function(t){return tf[t]&&tf[t].offsetTop}(n),s=o||t.clientHeight,a=i||Xd(t,e)||t.offsetTop;return o||function(t,e){tf[t]=tf[t]||{},tf[t].height=e}(n,s),i||function(t,e){tf[t]=tf[t]||{},tf[t].offsetTop=e}(n,a),{nodeHeight:s,offsetTop:a}}var rf=Da("md-preview-highlight");var of=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=Da("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,s=e.highlight,a=void 0!==s&&s;this.renderer=new Ad({gfm:!0,nodeId:!0,convertors:Ud(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(a),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return t.prototype.initContentSection=function(){this.previewContent=Pa('<div class="'+Da("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){Ra(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(t&&(this.eventEmitter.listen("changeToolbarState",(function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)})),this.eventEmitter.listen("blur",(function(){e.removeHighlight()}))),Sl()(this.el,"scroll",(function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=Qd(o,t,Xd(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))})),this.eventEmitter.listen("changePreviewTabPreview",(function(){return e.toggleActive(!0)})),this.eventEmitter.listen("changePreviewTabWrite",(function(){return e.toggleActive(!1)})))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&It()(t,rf)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=Ls(t,(function(t){return!function(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(t)}))).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(Ms(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&It()(r,rf),o&&At()(o,rf),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach((function(t){return e.replaceRangeNodes(t)})),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map((function(t){return e.renderer.render(t)})).join("")));if(r){var s=r.id,a=s[0],c=s[1],l=this.getElementByNodeId(a),u=this.getElementByNodeId(c);if(l){l.insertAdjacentHTML("beforebegin",i);for(var p=l;p&&p!==u;){var d=p.nextElementSibling;Ia(p),ef(p),p=d}(null==p?void 0:p.parentNode)&&(Ia(p),ef(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){Tl()(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t}();function sf(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r,n))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}function af(t){return!!sf(t,(function(t){var e=t.type;return"listItem"===e.name||"bulletList"===e.name||"orderedList"===e.name}))}function cf(t){return!!sf(t,(function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name}))}function lf(t){return sf(t,(function(t){return"listItem"===t.type.name}))}function uf(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}function pf(t){return Object.keys(t).reduce((function(e,n){return"rawHTML"!==n&&t[n]&&(e[n="className"===n?"class":n]=t[n]),e}),{})}function df(t){return{tag:t,getAttrs:function(t){return["rawHTML","colspan","rowspan","extended"].reduce((function(e,n){var r="rawHTML"===n?"data-raw-html":n,o=t.getAttribute(r);return o&&(e[n]=Qt(["rawHTML","extended"],n)?o:Number(o)),e}),{})}}}function ff(t){var e=t.htmlAttrs,n=t.classNames;return o(o({},e),{class:n?n.join(" "):null})}function hf(t,e,n,r){var o=e.$from,i=e.$to,s=e.depth,a=e,c=!1;if(s>=2&&o.node(s-1).type.compatibleContent(n)&&0===e.startIndex&&o.index(s-1)){var l=t.doc.resolve(e.start-2);a=new B(l,l,s),e.endIndex<e.parent.childCount&&(e=new B(o,t.doc.resolve(i.end(s)),s)),c=!0}var u=function(t,e,n,r){var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(i){var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}return null}(t,n),i=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(s){for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c+=1)a=a.matchType(n.child(c).type);if(a&&a.validEnd)return s}return null}(e,n);if(o&&i){var s=o.map((function(t){return{type:t}})),a=i.map((function(t){return{type:t,attrs:r}}));return s.concat({type:n}).concat(a)}return null}(a,e,n,r);return u?function(t,e,n,r,o){for(var i=e.start,s=e.end,a=e.startIndex,c=e.endIndex,l=e.parent,u=p.empty,d=n.length-1;d>=0;d-=1)u=p.from(n[d].type.create(n[d].attrs,u));t.step(new Ee(i-(r?2:0),s,i,s,new y(u,0,0),n.length,!0));var f=0;for(d=0;d<n.length;d+=1)if(n[d].type===o){f=d+1;break}for(var h=n.length-f,m=i+n.length-(r?2:0),v=(d=a,c);d<v;d+=1)!(d===a)&&Le(t.doc,m,h)&&(t.split(m,h),m+=2*h),m+=l.child(d).nodeSize;return t}(t,e,u,c,n):t}function mf(t,e){for(var n=t.resolve(e);"paragraph"!==n.node().type.name;)e-=2,n=t.resolve(e);return lf(n)}function vf(t){return function(e,n){var r=e.selection,o=e.tr,i=r.$from,s=r.$to,a=i.blockRange(s);return!!a&&(n(af(i)?function(t,e,n){var r=e.$from,o=e.$to,i=lf(r),s=lf(o);if(i&&s)for(;s;){var a=s.offset,c=s.node,l=s.depth;c.attrs.task&&t.setNodeMarkup(a,null,{task:!1,checked:!1});var u=t.doc.resolve(a);if(u.parent.type!==n){var p=u.before(l-1);t.setNodeMarkup(p,n)}if(a===i.offset)break;s=mf(t.doc,a)}return t}(o,a,t):hf(o,a,t)),!0)}}function gf(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,s=n.$to,a=i.blockRange(s);return!!a&&(e(af(i)?function(t,e){var n=e.$from,r=e.$to,o=lf(n),i=lf(r);if(o&&i)for(;i;){var s=i.offset,a={task:!i.node.attrs.task,checked:!1};if(t.setNodeMarkup(s,null,a),s===o.offset)break;i=mf(t.doc,s)}return t}(r,a):hf(r,a,o.nodes.bulletList,{task:!0})),!0)}}function yf(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s,(function(e){var n=e.childCount,r=e.firstChild;return!!n&&r.type===t}));return!!a&&(n(i.node(a.depth-1).type===t?function(t,e,n){var r=e.$from,o=e.$to,i=e.end,s=e.depth,a=e.parent,c=o.end(s);return i<c&&(t.step(new Ee(i-1,c,i,c,new y(p.from(n.create(null,a.copy())),1,0),1,!0)),e=new B(t.doc.resolve(r.pos),t.doc.resolve(c),s)),t.lift(e,De(e)),t}(r,a,t):function(t,e){for(var n=e.parent,r=e.end,o=e.endIndex-1,i=e.startIndex;o>i;o-=1)r-=n.child(o).nodeSize,t.delete(r-1,r+1);var s=t.doc.resolve(e.start),a=s.nodeAfter,c=0===e.startIndex,l=e.endIndex===n.childCount,u=s.node(-1),d=s.index(-1),f=u.canReplace(d+(c?0:1),d+1,null==a?void 0:a.content.append(l?p.empty:p.from(n)));if(a&&f){var h=s.pos,m=h+a.nodeSize;t.step(new Ee(h-(c?1:0),m+(l?1:0),h+1,m-1,new y((c?p.empty:p.from(n.copy(p.empty))).append(l?p.empty:p.from(n.copy(p.empty))),c?0:1,l?0:1),c?0:1))}return t}(r,a)),!0)}}function bf(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!af(o))&&function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s,(function(e){var n=e.childCount,r=e.firstChild;return!!n&&r.type===t}));if(a&&a.startIndex>0){var c=a.parent,l=c.child(a.startIndex-1);if(l.type!==t)return!1;var u=l.lastChild&&l.lastChild.type===c.type,d=u?p.from(t.create()):null,f=new y(p.from(t.create(null,p.from(c.type.create(null,d)))),u?3:1,0),h=a.start,m=a.end;return r.step(new Ee(h-(u?3:1),m,h,m,f,1,!0)),n(r),!0}return!1}}(r.nodes.listItem)(t,e)}}}function wf(){return{indent:bf(),outdent:function(){return function(t,e){var n=t.selection,r=t.schema,o=n.$from,i=n.$to;return!(!o.blockRange(i)||!af(o))&&yf(r.nodes.listItem)(t,e)}}}}var kf=new Map,xf=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=sf(e,(function(t){return"table"===t.type.name}));if(n){var r=n.node,o=n.depth,i=n.offset,s=kf.get(r);if((null==s?void 0:s.tableStartPos)===i+1)return s;var a=[],c=e.start(o),l=r.child(0),u=r.child(1),p=Cf(l,c),d=Cf(u,c+l.nodeSize);l.forEach((function(t){return a.push(t)})),u.forEach((function(t){return a.push(t)}));var f=new t(r,a,c,p.concat(d));return kf.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},t.prototype.getNodeAndPos=function(t,e){var n=this.rowInfo[t][e];return{node:this.table.nodeAt(n.offset-1),pos:n.offset}},t.prototype.extendedRowspan=function(t,e){return!1},t.prototype.extendedColspan=function(t,e){return!1},t.prototype.getRowspanCount=function(t,e){return 0},t.prototype.getColspanCount=function(t,e){return 0},t.prototype.decreaseColspanCount=function(t,e){return 0},t.prototype.decreaseRowspanCount=function(t,e){return 0},t.prototype.getColspanStartInfo=function(t,e){return null},t.prototype.getRowspanStartInfo=function(t,e){return null},t.prototype.getCellStartOffset=function(t,e){var n=this.rowInfo[t][e].offset;return this.extendedRowspan(t,e)?this.posAt(t,e):n},t.prototype.getCellEndOffset=function(t,e){var n=this.rowInfo[t][e],r=n.offset,o=n.nodeSize;return this.extendedRowspan(t,e)?this.posAt(t,e):r+o},t.prototype.getCellIndex=function(t){for(var e=0;e<this.totalRowCount;e+=1)for(var n=this.rowInfo[e],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>t.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),s=i[0],a=i[1],c=this.getCellIndex(e),l=c[0],u=c[1];return s=(r=de(s,l))[0],l=r[1],a=(o=de(a,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:s,startColIdx:a,endRowIdx:l,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),Cf=function(t,e){var n=[];return t.forEach((function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach((function(t,n){for(var i=t.nodeSize,s=0;o[s];)s+=1;o[s]={offset:e+r+n+2,nodeSize:i},o.length+=1})),n.push(o)})),n};function Tf(t,e){return pe(xf.prototype,t),Cf=e,xf}var Mf=function(t){function n(e,n){void 0===n&&(n=e);var r=this,o=e.node(0),i=xf.create(e),s=i.getRectOffsets(e,n),a=function(t,e,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,s=n.endColIdx,a=[],c=r;c<=i;c+=1)for(var l=o;l<=s;l+=1){var u=e.getCellInfo(c,l),p=u.offset,d=u.nodeSize;a.push(new Xe(t.resolve(p+1),t.resolve(p+d-1)))}return a}(o,i,s);return(r=t.call(this,a[0].$from,a[0].$to,a)||this).startCell=e,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return e(n,t),n.prototype.map=function(t,e){var r=this.startCell.pos,o=this.endCell.pos,i=t.resolve(e.map(r)),s=t.resolve(e.map(o)),a=xf.create(i);if(this.offsetMap.totalColumnCount>a.totalColumnCount||this.offsetMap.totalRowCount>a.totalRowCount){var c={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[s.parent.type.name],l=s.end(s.depth-c),u=Math.min(l-4,s.pos);return Qe.create(t,u)}return new n(i,s)},n.prototype.eq=function(t){return t instanceof n&&t.startCell.pos===this.startCell.pos&&t.endCell.pos===this.endCell.pos},n.prototype.content=function(){for(var t=this.startCell.node(-2),e=this.startCell.start(-2),n=t.child(1).firstChild,r=t.child(0).type.create(),o=t.child(1).type.create(),i=xf.create(this.startCell),s=i.getRectOffsets(this.startCell,this.endCell),a=s.startRowIdx,c=s.startColIdx,l=s.endRowIdx,u=s.endColIdx,d=!1,f=a;f<=l;f+=1){for(var h=[],m=c;m<=u;m+=1){var v=i.getCellInfo(f,m).offset,g=t.nodeAt(v-e);g&&(d="tableHeadCell"===g.type.name,i.extendedRowspan(f,m)||i.extendedColspan(f,m)?h.push(g.type.create({extended:!0})):h.push(g.copy(g.content)))}var b=n.copy(p.from(h)),w=d?r:o;w.content=w.content.append(p.from(b))}return new y(function(t,e){var n=[];return t.childCount&&n.push(t),e.childCount&&n.push(e),p.from(n)}(r,o),1,1)},n}(Ke);function Sf(t,e,n,r){for(var o=n.nodes,i=o.tableRow,s=o.tableBodyCell,a=o.paragraph,c=[],l=0;l<t;l+=1){for(var u=[],p=0;p<e;p+=1){var d=r&&r[l*e+p],f=a.create(null,d?n.text(d):[]);u.push(s.create(null,f))}c.push(i.create(null,u))}return c}function Ef(t,e,n,r){void 0===r&&(r=null);for(var o=n.nodes,i=o.tableHeadCell,s=o.tableBodyCell,a=o.paragraph,c=0===e?i:s,l=[],u=0;u<t;u+=1)l.push(c.create(r,a.create()));return l}function Nf(t,e){for(;t&&t!==e;){if("TD"===t.nodeName||"TH"===t.nodeName)return t;t=t.parentNode}return null}function Of(t){return sf(t,(function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name}))}function Df(t){if(t instanceof Qe){var e=t.$anchor,n=Of(e);if(n){var r=e.node(0).resolve(e.before(n.depth));return{anchor:r,head:r}}}var o=t;return{anchor:o.startCell,head:o.endCell}}function Af(t){var e;if(t.size){var n=t.content,r=t.openStart,o=t.openEnd;if(1!==n.childCount)return null;for(;1===n.childCount&&(r>0&&o>0||"table"===(null===(e=n.firstChild)||void 0===e?void 0:e.type.name));)r-=1,o-=1,n=n.firstChild.content;if("tableHead"===n.firstChild.type.name||"tableBody"===n.firstChild.type.name)return n}return null}function Lf(t){var e=t.startRowIdx,n=t.startColIdx;return{rowCount:t.endRowIdx-e+1,columnCount:t.endColIdx-n+1}}function If(t,e){return o(o({},t.attrs),e)}var Rf=new bn("cellSelection"),Pf=function(){function t(t){this.view=t,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return t.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},t.prototype.handleMousedown=function(t){var e=Nf(t.target,this.view.dom);if(2!==t.button){if(e){var n=this.getCellPos(t);n&&(this.startCellPos=n),this.bindEvent()}}else t.preventDefault()},t.prototype.handleMousemove=function(t){var e,n=Rf.getState(this.view.state),r=this.getCellPos(t),o=this.startCellPos;n?e=this.view.state.doc.resolve(n):o!==r&&(e=o),e&&o&&r&&this.setCellSelection(o,r)},t.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==Rf.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(Rf,-1))},t.prototype.bindEvent=function(){var t=this.view.dom;t.addEventListener("mousemove",this.handlers.mousemove),t.addEventListener("mouseup",this.handlers.mouseup)},t.prototype.unbindEvent=function(){var t=this.view.dom;t.removeEventListener("mousemove",this.handlers.mousemove),t.removeEventListener("mouseup",this.handlers.mouseup)},t.prototype.getCellPos=function(t){var e=t.clientX,n=t.clientY,r=this.view.posAtCoords({left:e,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),s=Of(i);if(s){var a=i.before(s.depth);return o.resolve(a)}}return null},t.prototype.setCellSelection=function(t,e){var n=this.view.state,r=n.selection,o=n.tr,i=null===Rf.getState(this.view.state),s=new Mf(t,e);if(i||!r.eq(s)){var a=o.setSelection(s);i&&a.setMeta(Rf,e.pos),this.view.dispatch(a)}},t.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},t}(),Bf=Da("cell-selected");function Ff(t){var e=t.selection,n=t.doc;if(e instanceof Mf){var r=[];return e.ranges.forEach((function(t){var e=t.$from,n=t.$to;r.push(Uo.node(e.pos-1,n.pos+1,{class:Bf}))})),Ko.create(n,r)}return null}var Hf=n(928),zf=n.n(Hf),jf=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return zf()(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach((function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)}))},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),_f="en-US",qf=new(function(){function t(){this.code=_f,this.langs=new jf}return t.prototype.setCode=function(t){this.code=t||_f},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach((function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,Et()(r,e))}else n.langs.set(t,e)}))},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(_f));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}()),Vf=[[{action:"Add row to up",command:"addRowToUp",disableInThead:!0,className:"add-row-up"},{action:"Add row to down",command:"addRowToDown",disableInThead:!0,className:"add-row-down"},{action:"Remove row",command:"removeRow",disableInThead:!0,className:"remove-row"}],[{action:"Add column to left",command:"addColumnToLeft",className:"add-column-left"},{action:"Add column to right",command:"addColumnToRight",className:"add-column-right"},{action:"Remove column",command:"removeColumn",className:"remove-column"}],[{action:"Align column to left",command:"alignColumn",payload:{align:"left"},className:"align-column-left"},{action:"Align column to center",command:"alignColumn",payload:{align:"center"},className:"align-column-center"},{action:"Align column to right",command:"alignColumn",payload:{align:"right"},className:"align-column-right"}],[{action:"Remove table",command:"removeTable",className:"remove-table"}]];function $f(t,e){return Vf.map((function(n){return n.map((function(n){var r=n.action,o=n.command,i=n.payload,s=n.disableInThead,a=n.className;return{label:qf.get(r),onClick:function(){t.emit("command",o,i)},disabled:e&&!!s,className:a}}))})).concat()}function Uf(t){return new vn({props:{handleDOMEvents:{contextmenu:function(e,n){var r=Nf(n.target,e.dom);if(r){n.preventDefault();var o=n,i=o.clientX,s=o.clientY,a=e.dom.parentNode.getBoundingClientRect(),c=a.left,l=a.top,u="TH"===r.nodeName;return t.emit("contextmenu",{pos:{left:i-c+10+"px",top:s-l+30+"px"},menuGroups:$f(t,u),tableCell:r}),!0}return!1}}}})}var Wf=["image","link","customBlock","frontMatter"],Jf=["strong","strike","emph","code"],Gf=["bulletList","orderedList","taskList"];function Kf(t,e,n){var r=t.$from,i=t.$to,s=t.from,a=t.to,c={},l={};return e.nodesBetween(s,a,(function(t,e,o){var s=function(t,e){var n=t.type.name;return"listItem"===n?t.attrs.task?"taskList":e.type.name:-1!==n.indexOf("table")?"table":n}(t,o);Qt(Wf,s)||(Qt(Gf,s)?function(t,e){e[t]=!0,Gf.filter((function(e){return e!==t})).forEach((function(t){e[t]&&delete e[t]}))}(s,c):"paragraph"===s||"text"===s?l=function(t,e,n){var r={};return Jf.forEach((function(o){var i=n.marks[o],s=t.marksAcross(e)||[];i.isInSet(s)&&(r[o]=!0)})),r}(r,i,n):c[s]=!0)})),o(o({},c),l)}function Zf(t){return new vn({view:function(){return{update:function(e){var n=e.state,r=n.selection,o=n.doc,i=n.schema;t.emit("changeToolbarState",{toolbarState:Kf(r,o,i)})}}}})}var Xf=function(){function t(t,e,n,r){var o=this;this.openEditor=function(){if(o.innerEditorView)throw new Error("The editor is already opened.");o.dom.draggable=!1,o.wrapper.style.display="none",o.innerViewContainer.style.display="block",o.innerEditorView=new si(o.innerViewContainer,{state:dn.create({doc:o.node,plugins:[Mi({"Mod-z":function(){return ms(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return vs(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(t,e){return e(t.tr.insertText("\t")),!0},Enter:Li,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),hs()]}),dispatchTransaction:function(t){return o.dispatchInner(t)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=t,this.editorView=e,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Da("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Da("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return t.prototype.renderToolArea=function(){var t=this,e=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");e.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",(function(){return t.openEditor()})),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e)},t.prototype.renderCustomBlock=function(){var t=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(t){for(var e=t(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);e&&this.wrapper.appendChild(e),this.renderToolArea()}},t.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Da("custom-block-editor"),this.innerViewContainer.style.display="none"},t.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},t.prototype.saveAndFinishEditing=function(){var t=this.editorView.state.selection.to,e=this.editorView.state;this.editorView.dispatch(e.tr.setSelection(bs(e.tr,t))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},t.prototype.cancelEditing=function(){var t,e,n=(t=this.innerEditorView.state,(e=ds.getState(t))?e.done.eventCount:0);for(this.canceled=!0;n--;)ms(this.innerEditorView.state,this.innerEditorView.dispatch),ms(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var r=this.editorView.state.selection.to,o=this.editorView.state;this.editorView.dispatch(o.tr.setSelection(Qe.create(o.doc,r))),this.editorView.focus(),this.closeEditor()},t.prototype.dispatchInner=function(t){var e=this.innerEditorView.state.applyTransaction(t),n=e.state,r=e.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&da()(this.getPos)){for(var o=this.editorView.state.tr,i=ge.offset(this.getPos()+1),s=0;s<r.length;s+=1)for(var a=r[s].steps,c=0;c<a.length;c+=1)o.step(a[c].map(i));o.docChanged&&this.editorView.dispatch(o)}},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,this.innerEditorView||this.renderCustomBlock(),!0)},t.prototype.stopEvent=function(t){return!!this.innerEditorView&&!!t.target&&this.innerEditorView.dom.contains(t.target)},t.prototype.ignoreMutation=function(){return!0},t.prototype.destroy=function(){this.dom.removeEventListener("dblclick",this.openEditor),this.closeEditor()},t}(),Qf="image-link",Yf=function(){function t(t,e,n,r){var o,i=this;this.handleMousedown=function(t){t.preventDefault();var e=t.target,n=t.offsetX,r=t.offsetY;if(i.imageLink&&da()(i.getPos)&&ya()(e,Qf)){var o=getComputedStyle(e,":before");if(t.stopPropagation(),Na(o,n,r)){var s=i.view.state.tr,a=i.getPos();s.setSelection(bs(s,a,a+1)),i.view.dispatch(s),i.eventEmitter.emit("openPopup","link",i.imageLink.attrs)}}},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.imageLink=null!==(o=t.marks.filter((function(t){return"link"===t.type.name}))[0])&&void 0!==o?o:null,this.dom=this.createElement(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.createImageElement(this.node);if(this.imageLink){var e=document.createElement("span");return e.className=Qf,e.appendChild(t),e}return t},t.prototype.createImageElement=function(t){var e=document.createElement("img"),n=t.attrs,r=n.imageUrl,o=n.altText,i=ff(t.attrs);return e.src=r,o&&(e.alt=o),za(i,e),e},t.prototype.bindEvent=function(){this.imageLink&&this.dom.addEventListener("mousedown",this.handleMousedown)},t.prototype.stopEvent=function(){return!0},t.prototype.destroy=function(){this.imageLink&&this.dom.removeEventListener("mousedown",this.handleMousedown)},t}(),th=function(){function t(t,e,n,r){var o=this;this.dom=null,this.contentDOM=null,this.input=null,this.handleMousedown=function(t){var e=t.target;if("none"!==getComputedStyle(e,":after").backgroundImage&&da()(o.getPos)){var n=o.view.coordsAtPos(o.getPos()),r=n.top,i=n.right;o.createLanguageEditor({top:r,right:i})}},this.handleKeydown=function(t){"Enter"===t.key&&o.input&&(t.preventDefault(),o.changeLanguage())},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.createElement(),this.bindDOMEvent(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.node.attrs.language,e=document.createElement("div");e.setAttribute("data-language",t||"text"),e.className="toastui-editor-ww-code-block";var n=this.createCodeBlockElement(),r=n.firstChild;e.appendChild(n),this.dom=e,this.contentDOM=r},t.prototype.createCodeBlockElement=function(){var t=document.createElement("pre"),e=document.createElement("code"),n=this.node.attrs.language,r=ff(this.node.attrs);return n&&e.setAttribute("data-language",n),za(r,t),t.appendChild(e),t},t.prototype.createLanguageEditor=function(t){var e=this,n=t.top,r=t.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),document.querySelector(".toastui-editor.ww-mode").appendChild(o);var s=o.clientWidth;Ot()(o,{top:n+10+"px",left:r-s-10+"px",width:s+"px"}),this.input=i,this.input.addEventListener("blur",(function(){return e.changeLanguage()})),this.input.addEventListener("keydown",this.handleKeydown),setTimeout((function(){return e.input.focus()}))},t.prototype.bindDOMEvent=function(){this.dom&&this.dom.addEventListener("click",this.handleMousedown)},t.prototype.bindEvent=function(){var t=this;this.eventEmitter.listen("scroll",(function(){t.input&&t.reset()}))},t.prototype.changeLanguage=function(){if(this.input&&da()(this.getPos)){var t=this.input.value;this.reset();var e=this.getPos(),n=this.view.state.tr;n.setNodeMarkup(e,null,{language:t}),this.view.dispatch(n)}},t.prototype.reset=function(){var t;if(null===(t=this.input)||void 0===t?void 0:t.parentElement){var e=this.input.parentElement;this.input=null,Ia(e)}},t.prototype.stopEvent=function(){return!0},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,!0)},t.prototype.destroy=function(){this.reset(),this.dom&&this.dom.removeEventListener("click",this.handleMousedown)},t}(),eh=/MsoListParagraph/,nh=/style=(.|\n)*mso-/,rh=/mso-list:(.*)/,oh=/O:P/,ih=/^(n|u|l)/;function sh(t){for(var e=[],n=document.createTreeWalker(t,1,null,!1);n.nextNode();){var r=n.currentNode;if(La(r)){var o=r,i=o.outerHTML,s=o.textContent,a=nh.test(i),c=rh.test(i);a&&!c&&s?e.push([r,!0]):(oh.test(r.nodeName)||a&&!s||c)&&e.push([r,!1])}}return e.forEach((function(t){var e=t[0];t[1]?function(t){for(var e=[];t.firstChild;)e.push(t.firstChild),t.parentNode&&t.parentNode.insertBefore(t.firstChild,t);Ia(t)}(e):Ia(e)})),t.innerHTML.trim()}function ah(t){var e=[];return t.forEach((function(t,n){var r=e[n-1],o=function(t,e){var n=t.getAttribute("style");if(n){var r=n.match(rh)[1].trim().split(" ")[1];return{id:e,level:parseInt(r.replace("level",""),10),prev:null,parent:null,children:[],unordered:ih.test(t.textContent||""),contents:sh(t)}}return null}(t,n);o&&(r&&function(t,e){if(e.level<t.level)e.children.push(t),t.parent=e;else{for(;e&&e.level!==t.level;)e=e.parent;e&&(t.prev=e,t.parent=e.parent,t.parent&&t.parent.children.push(t))}}(o,r),e.push(o))})),e}function ch(t){var e=t[0].unordered?"ul":"ol",n=document.createElement(e);return t.forEach((function(t){var e=t.children,r=t.contents,o=document.createElement("li");o.innerHTML=r,n.appendChild(o),e.length&&n.appendChild(ch(e))})),n}function lh(t){return ch(ah(t).filter((function(t){return!t.parent})))}function uh(t){var e=document.createElement("div");e.innerHTML=t;var n,r,o,i=[],s=(n=e,r="p.MsoListParagraph",(o=na()(n.querySelectorAll(r))).length?o:[]);return s.forEach((function(t){var n=function(t){for(;t&&!La(t);)t=t.nextSibling;return!t||!eh.test(t.className)}(t.nextSibling);if(i.push(t),n){var r=lh(i),o=t.nextSibling;o?function(t,e){e.parentNode&&e.parentNode.insertBefore(t,e)}(r,o):function(t,e){(e=va()(e)?na()(e):[e]).forEach((function(e){t.appendChild(e)}))}(e,r),i=[]}Ia(t)})),""+(s.length?"<p></p>":"")+e.innerHTML}var ph="\x3c!--StartFragment--\x3e";function dh(t){return function(t){return nh.test(t)}(t=function(t){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(t)&&(t="<tr>"+t+"</tr>"),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(t)&&(t="<table>"+t+"</table>"),t}(t=function(t){var e=t.indexOf(ph),n=t.lastIndexOf("\x3c!--EndFragment--\x3e");return e>-1&&n>-1&&(t=t.slice(e+ph.length,n)),t.replace(/<br[^>]*>/g,Ea)}(t)))&&(t=uh(t)),t}function fh(t,e,n){for(var r=[],o=t.childCount,i=0;i<o;i+=1)if(!t.child(i).attrs.extended){var s=i<o?n.create(t.child(i).attrs,t.child(i).content):n.createAndFill();r.push(s)}return r}function hh(t,e,n){var r=n.nodes,o=r.tableRow,i=fh(t,0,r.tableHeadCell);return o.create(null,i)}function mh(t,e,n){var r=n.nodes,o=r.tableRow,i=fh(t,0,r.tableBodyCell);return o.create(null,i)}function vh(t){var e=[],n=[];"tableHead"===t.firstChild.type.name&&t.firstChild.forEach((function(t){return e.push(t)}));"tableBody"===t.lastChild.type.name&&t.lastChild.forEach((function(t){return n.push(t)}));return i(i([],e),n)}function gh(t,e,n){var r=hh(t,0,n);return n.nodes.tableHead.create(null,r)}function yh(t,e,n){var r=t.map((function(t){return mh(t,0,n)}));if(!t.length){var o=function(t,e){for(var n=e.nodes,r=n.tableRow,o=n.tableBodyCell,i=[],s=0;s<t;s+=1){var a=o.createAndFill();i.push(a)}return r.create({dummyRowForPasting:!0},i)}(e,n);r.push(o)}return n.nodes.tableBody.create(null,r)}function bh(t,e,n){var r=[],o=t.content,i=t.openStart,s=t.openEnd;return o.forEach((function(t){if("table"===t.type.name){var o=Af(new y(p.from(t),0,0));if(o){var i=vh(o),s="tableBody"===o.firstChild.type.name,a=function(t,e,n,r){var o=function(t){return t.reduce((function(t,e){return t.childCount>e.childCount?t:e})).childCount}(t);if(n&&r)return e.nodes.table.create(null,[yh(t,o,e)]);var i=t[0],s=t.slice(1),a=[gh(i,0,e)];return s.length&&a.push(yh(s,o,e)),e.nodes.table.create(null,a)}(i,e,s,n);r.push(a)}}else r.push(t)})),new y(p.from(r),i,s)}function wh(t){return 4*t}function kh(t,e){var n=t.state,r=n.selection,o=n.schema,i=n.tr,s=Df(r),a=s.anchor,c=s.head;if(a&&c){var l=Af(e);if(!l)return!1;var u=xf.create(a),p=u.getRectOffsets(a,c),d=function(t,e,n){var r=[],o=vh(t),i=(o[0].childCount,o.length),s=0===e.startRowIdx,a=o.slice(0,i);if(s){var c=a.shift();if(c){var l=hh(c,0,n).content;r.push(l)}}return a.forEach((function(t){if(!t.attrs.dummyRowForPasting){var e=mh(t,0,n).content;r.push(e)}})),r}(l,p,o),f=function(t,e,n){for(var r=e.startRowIdx,o=e.startColIdx,i=n.length,s=0,a=function(t){var e=n[t].childCount;n[t].forEach((function(t){var n=t.attrs.colspan;n>1&&(e+=n-1)})),s=Math.max(s,e)},c=0;c<i;c+=1)a(c);var l=r+i-1,u=o+s-1;return{startRowIdx:r,startColIdx:o,endRowIdx:l,endColIdx:u,addedRowCount:Math.max(l+1-t.totalRowCount,0),addedColumnCount:Math.max(u+1-t.totalColumnCount,0)}}(u,p,d),h=[];return function(t,e){var n=Lf(t.getSpannedOffsets(e)),r=n.rowCount,o=n.columnCount,i=Lf(e),s=i.rowCount,a=i.columnCount;return r===s&&o===a}(u,f)&&(function(t,e){for(var n=t.startRowIdx,r=t.startColIdx,o=t.endRowIdx,i=t.endColIdx,s=t.addedRowCount,a=t.addedColumnCount,c=n;c<=o-s;c+=1)e.push({rowIdx:c,startColIdx:r,endColIdx:i-a})}(f,h),f.addedColumnCount&&function(t,e,n,r,o){for(var i=r.startRowIdx,s=r.startColIdx,a=r.endRowIdx,c=r.endColIdx,l=r.addedRowCount,u=r.addedColumnCount,p=n.totalRowCount,d=0,f=0;f<p;f+=1){var h=n.getCellInfo(f,c-u),m=h.offset,v=h.nodeSize,g=t.mapping.map(m+v),y=Ef(u,f,e);if(t.insert(g,y),f>=i&&f<=a-l){var b=n.getCellInfo(f,c-u),w=t.mapping.map(b.offset),k=g+wh(u);o[d]={rowIdx:f,startColIdx:s,endColIdx:c,dummyOffsets:[w,k]},d+=1}}}(i,o,u,f,h),f.addedRowCount&&function(t,e,n,r,o){var i=r.addedRowCount,s=r.addedColumnCount,a=r.startColIdx,c=r.endColIdx,l=t.mapping.maps.length,u=n.tableEndOffset-2,p=Sf(i,n.totalColumnCount+s,e),d=u;t.insert(t.mapping.slice(l).map(d),p);for(var f=0;f<i;f+=1){var h=d+wh(a)+1,m=d+wh(c+1)+1,v=d+wh(n.totalColumnCount+s)+2;o.push({rowIdx:f+n.totalRowCount,startColIdx:a,endColIdx:c,dummyOffsets:[h,m]}),d=v}}(i,o,u,f,h),function(t,e,n,r){var o=t.mapping.maps.length;n.forEach((function(n,i){var s=n.rowIdx,a=n.startColIdx,c=n.endColIdx,l=n.dummyOffsets,u=t.mapping.slice(o),p=new y(e[i],0,0),d=l?l[0]:r.getCellStartOffset(s,a),f=l?l[1]:r.getCellEndOffset(s,c);t.replace(u.map(d),u.map(f),p)}))}(i,d,h,u),t.dispatch(i),function(t,e,n){var r=t.state,o=r.tr,i=r.doc,s=xf.create(i.resolve(n)),a=e[0],c=a.rowIdx,l=a.startColIdx,u=se(e),p=u.rowIdx,d=u.endColIdx,f=s.getCellInfo(c,l).offset,h=s.getCellInfo(p,d).offset;t.dispatch(o.setSelection(new Mf(i.resolve(f),i.resolve(h))))}(t,h,u.getCellInfo(0,0).offset)),!0}return!1}var xh,Ch=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),n}(sa),Th=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"inline*",group:"block",attrs:o({},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"p"}],toDOM:function(t){return["p",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n}(sa),Mh=/\s{1,4}$/,Sh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),n.prototype.addSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to;return!(!o.blockRange(i)||af(o)||cf(o))&&(e(r.insertText(" ",o.pos,i.pos)),!0)}},n.prototype.removeSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to,s=n.from;if(o.blockRange(i)&&!af(o)&&!cf(o)){var a=o.nodeBefore;if(a&&a.isText){var c=a.text,l=c.replace(Mh,""),u=c.length-l.length;return e(r.delete(s-u,s)),!0}}return!1}},n.prototype.keymaps=function(){return{Tab:this.addSpaces(),"Shift-Tab":this.removeSpaces()}},n}(sa),Eh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"levels",{get:function(){return[1,2,3,4,5,6]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){var t=this.levels.map((function(t){return{tag:"h"+t,getAttrs:function(e){var n=e.getAttribute("data-raw-html");return o({level:t},n&&{rawHTML:n})}}}));return{attrs:o({level:{default:1},headingType:{default:"atx"},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"inline*",group:"block",defining:!0,parseDOM:t,toDOM:function(t){var e=t.attrs;return["h"+e.level,ff(e),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(t){return function(e,n){return zi(e.schema.nodes[t.level?"heading":"paragraph"],t)(e,n)}}},n}(sa),Nh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:o({language:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),code:!0,defining:!0,marks:"",parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){var e=t.getAttribute("data-raw-html"),n=t.firstElementChild;return o({language:(null==n?void 0:n.getAttribute("data-language"))||null},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"pre",["code",o({"data-language":e.language},ff(e)),0]]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return zi(t.schema.nodes.codeBlock)(t,e)}}},n.prototype.moveCursor=function(t){var e=this;return function(n,r){var o,i,s=n.tr,a=n.doc,c=n.schema,l=n.selection.$from;if(e.context.view.endOfTextblock(t)&&"codeBlock"===l.node().type.name){var u=l.parent.textContent.split("\n"),p="up"===t?l.start():l.end(),d="up"===t?[p,u[0].length+p]:[p-se(u).length,p],f=a.resolve("up"===t?l.before():l.after()),h="up"===t?f.nodeBefore:f.nodeAfter;if(o=l.pos,i=d[1],o>=d[0]&&o<=i&&!h){var m=ws(s,f,c);if(m)return r(m),!0}}return!1}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},n}(sa),Oh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[uf("ul")],toDOM:function(t){return["ul",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.changeList=function(){return function(t,e){return vf(t.schema.nodes.bulletList)(t,e)}},n.prototype.commands=function(){return{bulletList:this.changeList,taskList:gf}},n.prototype.keymaps=function(){var t=this.changeList(),e=wf(),n=e.indent,r=e.outdent;return{"Mod-u":t,"Mod-U":t,Tab:n(),"Shift-Tab":r()}},n}(sa),Dh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:o({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(t){var e=t.getAttribute("start"),n=t.getAttribute("data-raw-html");return o({order:t.hasAttribute("start")?Number(e):1},n&&{rawHTML:n})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"ol",o({start:1===e.order?null:e.order},ff(e)),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return vf(t.schema.nodes.orderedList)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()(),e=wf(),n=e.indent,r=e.outdent;return{"Mod-o":t,"Mod-O":t,Tab:n(),"Shift-Tab":r()}},n}(sa),Ah=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"paragraph block*",selectable:!1,attrs:{task:{default:!1},checked:{default:!1},rawHTML:{default:null}},defining:!0,parseDOM:[{tag:"li",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({task:t.hasAttribute("data-task"),checked:t.hasAttribute("data-task-checked")},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs,n=e.task,r=e.checked;if(!n)return[e.rawHTML||"li",0];var i=["task-list-item"];return r&&i.push("checked"),[e.rawHTML||"li",o({class:i.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),n.prototype.liftToPrevListItem=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,s=n.empty,a=o.nodes.listItem,c=i.parent,l=i.node(-1);if(s&&!c.childCount&&l.type===a){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),e(r),!0;if(i.node(-3).type===a)return r.delete(i.start(-2)-1,i.end(-1)),e(r),!0}return!1}},n.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(t,e){return function(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to;if(i.depth<2||!i.sameParent(s))return!1;var a=i.node(-1);if(a.type!==t)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==t||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,l=p.empty,u=i.depth-(c?1:2);u>=i.depth-3;u-=1)l=p.from(i.node(u).copy(l));return l=l.append(p.from(t.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new y(l,c?3:2,2)),r.setSelection(Ke.near(r.doc.resolve(i.pos+(c?3:2)))),n(r),!0}var d=s.pos===i.end()?a.contentMatchAt(0).defaultType:null,f=d&&[null,{type:d}];return r.delete(i.pos,s.pos),!!Le(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),n(r),!0)}}(t.schema.nodes.listItem)(t,e)}}},n}(sa),Lh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[uf("blockquote")],toDOM:function(t){return["blockquote",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return Hi(t.schema.nodes.blockQuote)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()();return{"Alt-q":t,"Alt-Q":t}},n}(sa),Ih={left:function(t,e){var n=t[0],r=t[1],o=e.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var s=e.getCellInfo(n,r),a=s.offset,c=s.nodeSize;return a+c-2}return null},right:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount,i=e.totalColumnCount,s=r===i-1;if(n!==o-1||!s){var a=r+1,c=e.getColspanStartInfo(n,r);return(null==c?void 0:c.count)>1&&(a+=c.count-1),(s||a===i)&&(n+=1,a=0),e.getCellInfo(n,a).offset+2}return null},up:function(t,e){var n=t[0],r=t[1];if(n>0){var o=e.getCellInfo(n-1,r),i=o.offset,s=o.nodeSize;return i+s-2}return null},down:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount;if(n<o-1){var i=n+1,s=e.getRowspanStartInfo(n,r);return(null==s?void 0:s.count)>1&&(i+=s.count-1),e.getCellInfo(i,r).offset+2}return null}};function Rh(t,e,n,r){var o=e[0],i=e[1],s=o+3,a=i>=s,c=a?o+1:i,l=function(t,e,n,r,o){var i=e[0],s=e[1],a=e[2];if(t===xh.LEFT||t===xh.UP){if(o&&!function(t,e,n){var r=n[0],o=n[1],i=e.resolve(t.before(r-1));return o===r&&!i.nodeBefore}(n,r,[i,s]))return!1;var c=n.before(a);if(r.resolve(c).nodeBefore)return!1}return!0}(t,[i,s,c],n,r,a),u=function(t,e,n,r,o){if(t===xh.RIGHT||t===xh.DOWN){if(o&&!function(t){for(var e,n,r=t.depth;r&&"tableBodyCell"!==(n=t.node(r)).type.name;){if("listItem"===n.type.name){var o=t.node(r-1).lastChild===n,i="paragraph"!==(null===(e=n.lastChild)||void 0===e?void 0:e.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(e);if(r.resolve(i).nodeAfter)return!1}return!0}(t,c,n,r,a);return l&&u}function Ph(t,e,n){var r=n[0],o=n[1],i=e.getRowspanStartInfo(r,o),s=t===xh.UP&&0===r,a=t===xh.DOWN&&((null==i?void 0:i.count)>1?r+i.count-1:r)===e.totalRowCount-1;return s||a}function Bh(t,e,n){var r=t.doc.resolve(e.tableEndOffset);return r.nodeAfter?t.setSelection(Ke.near(r,1)):ws(t,r,n)}function Fh(t,e,n,r){var o=(0,Ih[t])(n,r);if(o){var i=t===xh.RIGHT||t===xh.DOWN?1:-1;return e.setSelection(Ke.near(e.doc.resolve(o),i))}return null}function Hh(t,e,n){var r=t.getCellInfo(e,0).offset,o=t.getCellInfo(e,n-1);return{from:r,to:o.offset+o.nodeSize}}!function(t){t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down"}(xh||(xh={}));var zh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[uf("table")],toDOM:function(t){return["table",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n.prototype.addTable=function(){return function(t){return void 0===t&&(t={rowCount:2,columnCount:1,data:[]}),function(e,n){var r=t.rowCount,o=t.columnCount,i=t.data,s=e.schema,a=e.selection,c=e.tr,l=a.from,u=a.to,p=a.$from;if(l===u&&!cf(p)){var d=s.nodes,f=d.tableHead,h=d.tableBody,m=null==i?void 0:i.slice(0,o),v=null==i?void 0:i.slice(o,i.length),g=function(t,e,n){for(var r=e.nodes,o=r.tableRow,i=r.tableHeadCell,s=r.paragraph,a=[],c=0;c<t;c+=1){var l=n&&n[c],u=s.create(null,l?e.text(l):[]);a.push(i.create(null,u))}return[o.create(null,a)]}(o,s,m),y=Sf(r-1,o,s,v),b=s.nodes.table.create(null,[f.create(null,g),h.create(null,y)]);return n(c.replaceSelectionWith(b)),!0}return!1}}},n.prototype.removeTable=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=xf.create(n.$anchor);if(o){var i=o.tableStartOffset,s=o.tableEndOffset,a=i-1,c=bs(r.delete(a,s),a);return e(r.setSelection(c)),!0}return!1}}},n.prototype.addColumn=function(t){return function(){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,s=Df(r),a=s.anchor,c=s.head;if(a&&c){for(var l=xf.create(a),u=l.getRectOffsets(a,c),p=t===xh.LEFT?u.startColIdx:u.endColIdx+1,d=Lf(u).columnCount,f=l.totalRowCount,h=0;h<f;h+=1){var m=Ef(d,h,i);o.insert(o.mapping.map(l.posAt(h,p)),m)}return n(o),!0}return!1}}},n.prototype.removeColumn=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Df(n),i=o.anchor,s=o.head;if(i&&s){var a=xf.create(i),c=a.getRectOffsets(i,s),l=a.totalColumnCount,u=a.totalRowCount;if(Lf(c).columnCount===l)return!1;for(var p=c.startColIdx,d=c.endColIdx,f=r.mapping.maps.length,h=0;h<u;h+=1)for(var m=d;m>=p;m-=1){var v=a.getCellInfo(h,m),g=v.offset,y=v.nodeSize,b=r.mapping.slice(f).map(g),w=b+y;r.delete(b,w)}return e(r),!0}return!1}}},n.prototype.addRow=function(t){return function(){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,s=Df(r),a=s.anchor,c=s.head;if(a&&c){var l=xf.create(a),u=l.totalColumnCount,p=l.getRectOffsets(a,c),d=Lf(p).rowCount,f=function(t,e,n){var r,o,i;return t===xh.UP?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=e.totalColumnCount-1,i=e.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(t,l,p),h=f.targetRowIdx,m=f.insertColIdx,v=f.nodeSize;if(!(0===h)){for(var g=[],y=i.mapping.map(l.posAt(h,m))+v,b=[],w=0;w<u;w+=1)b=b.concat(Ef(1,h,o));for(var k=0;k<d;k+=1)g.push(o.nodes.tableRow.create(null,b));return n(i.insert(y,g)),!0}}return!1}}},n.prototype.removeRow=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Df(n),i=o.anchor,s=o.head;if(i&&s){var a=xf.create(i),c=a.totalRowCount,l=a.totalColumnCount,u=a.getRectOffsets(i,s),p=Lf(u).rowCount,d=u.startRowIdx,f=u.endRowIdx;if(p===c-1||0===d)return!1;for(var h=f;h>=d;h-=1){var m=Hh(a,h,l),v=m.from,g=m.to;r.delete(v-1,g+1)}return e(r),!0}return!1}}},n.prototype.alignColumn=function(){return function(t){return void 0===t&&(t={align:"center"}),function(e,n){var r=t.align,o=e.selection,i=e.tr,s=Df(o),a=s.anchor,c=s.head;if(a&&c){for(var l=xf.create(a),u=l.totalRowCount,p=l.getRectOffsets(a,c),d=p.startColIdx,f=p.endColIdx,h=0;h<u;h+=1)for(var m=d;m<=f;m+=1)if(!l.extendedRowspan(h,m)&&!l.extendedColspan(h,m)){var v=l.getNodeAndPos(h,m),g=v.node,y=v.pos,b=If(g,{align:r});i.setNodeMarkup(y,null,b)}return n(i),!0}return!1}}},n.prototype.moveToCell=function(t){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,s=Df(r),a=s.anchor,c=s.head;if(a&&c){var l=xf.create(a),u=l.getCellIndex(a),p=void 0;if(p=Ph(t,l,u)?Bh(o,l,i):Fh(t,o,u,l))return n(p),!0}return!1}},n.prototype.moveInCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,s=n.doc,a=n.schema,c=o.$from;if(!e.context.view.endOfTextblock(t))return!1;var l=sf(c,(function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name}));if(l){var u=sf(c,(function(t){return"paragraph"===t.type.name})),p=l.depth;if(u&&Rh(t,[p,u.depth],c,s)){var d=Df(o).anchor,f=xf.create(d),h=f.getCellIndex(d),m=void 0;if(!function(t,e,n){var r=n[0],o=n[1];if(t===xh.UP||t===xh.DOWN)return!1;var i=e.tableStartOffset,s=e.tableEndOffset,a=e.getCellInfo(r,o),c=a.offset,l=a.nodeSize;return(t===xh.LEFT?i:s)===(t===xh.LEFT?c-2:c+l+3)}(t,f,h)?Ph(t,f,h)?t===xh.UP?m=function(t,e,n){var r=t.doc.resolve(e.tableStartOffset-1);return r.nodeBefore?t.setSelection(Ke.near(r,-1)):ws(t,r,n)}(i,f,a):t===xh.DOWN&&(m=Bh(i,f,a)):m=Fh(t,i,h,f):m=function(t,e,n){var r=t.doc.resolve(e.before(n-3));return t.setSelection(new tn(r))}(i,c,p),m)return r(m),!0}}return!1}},n.prototype.deleteCells=function(){return function(t,e){var n=t.schema,r=t.selection,o=t.tr,i=Df(r),s=i.anchor,a=i.head;if(s&&a&&!(r instanceof Qe)){for(var c=xf.create(s),l=c.getRectOffsets(s,a),u=l.startRowIdx,p=l.startColIdx,d=l.endRowIdx,f=l.endColIdx,h=u;h<=d;h+=1)for(var m=p;m<=f;m+=1)if(!c.extendedRowspan(h,m)&&!c.extendedColspan(h,m)){var v=c.getNodeAndPos(h,m),g=v.node,y=v.pos,b=Ef(1,h,n,g.attrs);o.replaceWith(o.mapping.map(y),o.mapping.map(y+g.nodeSize),b)}return e(o),!0}return!1}},n.prototype.commands=function(){return{addTable:this.addTable(),removeTable:this.removeTable(),addColumnToLeft:this.addColumn(xh.LEFT),addColumnToRight:this.addColumn(xh.RIGHT),removeColumn:this.removeColumn(),addRowToUp:this.addRow(xh.UP),addRowToDown:this.addRow(xh.DOWN),removeRow:this.removeRow(),alignColumn:this.alignColumn()}},n.prototype.keymaps=function(){var t=this.deleteCells();return{Tab:this.moveToCell(xh.RIGHT),"Shift-Tab":this.moveToCell(xh.LEFT),ArrowUp:this.moveInCell(xh.UP),ArrowDown:this.moveInCell(xh.DOWN),ArrowLeft:this.moveInCell(xh.LEFT),ArrowRight:this.moveInCell(xh.RIGHT),Backspace:t,"Mod-Backspace":t,Delete:t,"Mod-Delete":t}},n}(sa),jh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableHead"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"tableRow{1}",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[uf("thead")],toDOM:function(t){return["thead",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n}(sa),_h=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableBody"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"tableRow+",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tbody",getAttrs:function(t){var e=t.querySelectorAll("tr")[0].children.length,n=t.getAttribute("data-raw-html");return!!e&&o({},n&&{rawHTML:n})}}],toDOM:function(t){return["tbody",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n}(sa),qh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableRow"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"(tableHeadCell | tableBodyCell)*",attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tr",getAttrs:function(t){var e=t.children.length,n=t.getAttribute("data-raw-html");return!!e&&o({},n&&{rawHTML:n})}}],toDOM:function(t){return["tr",ff(t.attrs),0]}}},enumerable:!1,configurable:!0}),n}(sa),Vh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableHeadCell"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"paragraph+",attrs:o({align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},extended:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),isolating:!0,parseDOM:[df("th")],toDOM:function(t){var e=t.attrs,n=pf(e);return["th",o(o({},n),ff(e)),0]}}},enumerable:!1,configurable:!0}),n}(sa),$h=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"tableBodyCell"},enumerable:!1,configurable:!0}),Object.defineProperty(n.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:[df("td")],toDOM:function(t){return["td",pf(t.attrs),0]}}},enumerable:!1,configurable:!0}),n}(sa),Uh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"image"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{inline:!0,attrs:o({imageUrl:{default:""},altText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"img[src]",getAttrs:function(t){var e=Fd(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("src")||"",r=e.getAttribute("data-raw-html"),i=e.getAttribute("alt");return o({imageUrl:n,altText:i},r&&{rawHTML:r})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"img",o(o({src:e.imageUrl},e.altText&&{alt:e.altText}),ff(e))]}}},enumerable:!1,configurable:!0}),n.prototype.addImage=function(){return function(t){return function(e,n){var r=e.schema,i=e.tr,s=t,a=s.imageUrl,c=s.altText;if(!a)return!1;var l=r.nodes.image.createAndFill(o({imageUrl:Xt(a)},c&&{altText:c}));return n(i.replaceSelectionWith(l).scrollIntoView()),!0}}},n.prototype.commands=function(){return{addImage:this.addImage()}},n}(sa),Wh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"block",parseDOM:[{tag:"hr"}],selectable:!1,toDOM:function(t){var e=t.attrs;return["div",ff(e),[e.rawHTML||"hr"]]}}},enumerable:!1,configurable:!0}),n.prototype.hr=function(){var t=this;return function(){return function(e,n){var r,o=e.selection,i=o.$from;if(i===o.$to){var s=e.doc,a=e.schema.nodes,c=a.thematicBreak,l=a.paragraph,u=[c.create()],p=i.node(1),d=s.child(s.childCount-1)===p,f=s.resolve(i.after(1)),h=(null===(r=i.nodeAfter)||void 0===r?void 0:r.type.name)===t.name;return(d||h)&&u.push(l.create()),n(e.tr.insert(f.pos,u).scrollIntoView()),!0}return!1}}},n.prototype.commands=function(){return{hr:this.hr()}},n.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},n}(sa),Jh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){var t=["b","strong"].map((function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}));return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"strong",ff(e)]}}},enumerable:!1,configurable:!0}),n.prototype.bold=function(){return function(){return function(t,e){return ji(t.schema.marks.strong)(t,e)}}},n.prototype.commands=function(){return{bold:this.bold()}},n.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},n}(vc),Gh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){var t=["i","em"].map((function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}));return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"em",ff(e)]}}},enumerable:!1,configurable:!0}),n.prototype.italic=function(){return function(){return function(t,e){return ji(t.schema.marks.emph)(t,e)}}},n.prototype.commands=function(){return{italic:this.italic()}},n.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},n}(vc),Kh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){var t=["s","del"].map((function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}}));return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"del",ff(e)]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return ji(t.schema.marks.strike)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},n}(vc),Zh=function(t){function n(e){var n=t.call(this)||this;return n.linkAttributes=e,n}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){var t=this;return{attrs:o({linkUrl:{default:""},linkText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){var e=Fd(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("href")||"",r=e.getAttribute("data-raw-html");return o({linkUrl:n,linkText:e.textContent},r&&{rawHTML:r})}}],toDOM:function(e){var n=e.attrs;return[n.rawHTML||"a",o(o({href:n.linkUrl},t.linkAttributes),ff(n))]}}},enumerable:!1,configurable:!0}),n.prototype.addLink=function(){return function(t){return function(e,n){var r=t,o=r.linkUrl,i=r.linkText,s=void 0===i?"":i,a=e.schema,c=e.tr,l=e.selection,u=l.empty,p=l.from,d=l.to;if(p&&d&&o){var f={linkUrl:Xt(o),linkText:ll(s)},h=a.mark("link",f);if(u&&s){var m=ys(a,s,h);c.replaceRangeWith(p,d,m)}else c.addMark(p,d,h);return n(c.scrollIntoView()),!0}return!1}}},n.prototype.toggleLink=function(){return function(t){return function(e,n){return ji(e.schema.marks.link,t)(e,n)}}},n.prototype.commands=function(){return{addLink:this.addLink(),toggleLink:this.toggleLink()}},n}(vc),Xh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{attrs:o({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"code",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return o({},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"code",ff(e)]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e){return ji(t.schema.marks.code)(t,e)}}},n.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},n}(vc),Qh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:{info:{default:null}},atom:!0,code:!0,defining:!0,parseDOM:[{tag:"div[data-custom-info]",getAttrs:function(t){return{info:t.getAttribute("data-custom-info")}}}],toDOM:function(t){return["div",{"data-custom-info":t.attrs.info||null},0]}}},enumerable:!1,configurable:!0}),n}(sa),Yh=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),Object.defineProperty(n.prototype,"name",{get:function(){return"frontMatter"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,parseDOM:[{tag:"div[data-front-matter]"}],toDOM:function(){return["div",{"data-front-matter":"true"},0]}}},enumerable:!1,configurable:!0}),n.prototype.commands=function(){return function(){return function(t,e,n){var r=t.selection.$from;return!(!n.endOfTextblock("down")||"frontMatter"!==r.node().type.name)&&Ri(t,e)}}},n.prototype.keymaps=function(){return{Enter:this.commands()()}},n}(sa);var tm=Da("contents"),em=function(t){function n(e,n){var r=t.call(this,e)||this,i=n.toDOMAdaptor,s=n.htmlSchemaMap,a=void 0===s?{}:s,c=n.linkAttributes,l=void 0===c?{}:c,u=n.useCommandShortcut,p=void 0===u||u,d=n.wwPlugins,f=void 0===d?[]:d,h=n.wwNodeViews,m=void 0===h?{}:h;return r.editorType="wysiwyg",r.el.classList.add("ww-mode"),r.toDOMAdaptor=i,r.linkAttributes=l,r.extraPlugins=f,r.pluginNodeViews=m,r.specs=r.createSpecs(),r.schema=r.createSchema(a),r.context=r.createContext(),r.keymaps=r.createKeymaps(p),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(o(o({},r.context),{view:r.view})),r.initEvent(),r}return e(n,t),n.prototype.createSpecs=function(){return t=this.linkAttributes,new ha([new Ch,new Th,new Sh,new Eh,new Nh,new Oh,new Dh,new Ah,new Lh,new zh,new jh,new _h,new qh,new Vh,new $h,new Uh,new Wh,new Jh,new Gh,new Kh,new Zh(t),new Xh,new Qh,new Yh,new la]);var t},n.prototype.createContext=function(){return{schema:this.schema,eventEmitter:this.eventEmitter}},n.prototype.createSchema=function(t){return new ct({nodes:o(o({},this.specs.nodes),t.nodes),marks:o(o({},this.specs.marks),t.marks)})},n.prototype.createPlugins=function(){return this.defaultPlugins.concat(i([new vn({key:Rf,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(Rf);if(n)return-1===n?null:n;if(_t()(e)||!t.docChanged)return e;var r=t.mapping.mapResult(e),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:Ff,createSelectionBetween:function(t){var e=t.state;return _t()(Rf.getState(e))?null:e.selection}},view:function(t){return new Pf(t)}}),Uf(this.eventEmitter),new vn({props:{handleDOMEvents:{mousedown:function(t,e){var n=e,r=n.clientX,i=n.clientY,s=t.posAtCoords({left:r,top:i});if(s){var a=t.state,c=a.doc,l=a.tr,u=c.resolve(s.pos),p=lf(u),d=e.target,f=getComputedStyle(d,":before"),h=e,m=h.offsetX,v=h.offsetY;if(!p||!Na(f,m,v))return!1;e.preventDefault();var g=u.before(p.depth),y=p.node.attrs;return l.setNodeMarkup(g,null,o(o({},y),{checked:!y.checked})),t.dispatch(l),!0}return!1}}}}),Zf(this.eventEmitter)],this.createPluginProps()))},n.prototype.createPluginNodeViews=function(){var t=this.eventEmitter,e=this.pluginNodeViews,n={};return e&&Object.keys(e).forEach((function(r){n[r]=function(n,o,i){return e[r](n,o,i,t)}})),n},n.prototype.createView=function(){var t=this,e=this.toDOMAdaptor,n=this.eventEmitter;return new si(this.el,{state:this.createState(),attributes:{class:tm},nodeViews:o({customBlock:function(t,n,r){return new Xf(t,n,r,e)},image:function(t,e,r){return new Yf(t,e,r,n)},codeBlock:function(t,e,r){return new th(t,e,r,n)},widget:aa},this.createPluginNodeViews()),dispatchTransaction:function(e){var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e.scrollIntoView()),t.eventEmitter.emit("setFocusedNode",n.selection.$from.node(1))},transformPastedHTML:dh,transformPasted:function(e){return bh(e,t.schema,cf(t.view.state.selection.$from))},handlePaste:function(t,e,n){return kh(t,n)},handleKeyDown:function(e,n){return t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{paste:function(e,n){var r=n.clipboardData||window.clipboardData,o=null==r?void 0:r.items;if(1===(null==o?void 0:o.length)){var i=oa(o);i&&(n.preventDefault(),ra(t.eventEmitter,i,n.type))}return!1},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0}}})},n.prototype.createCommands=function(){return this.specs.commands(this.view,wf())},n.prototype.getHTML=function(){return this.view.dom.innerHTML},n.prototype.getModel=function(){return this.view.state.doc},n.prototype.getSelection=function(){var t=this.view.state.selection;return[t.from,t.to]},n.prototype.getSchema=function(){return this.view.state.schema},n.prototype.replaceSelection=function(t,e,n){var r=this.view.state,o=r.schema,i=r.tr,s=t.split("\n").map((function(t){return gs(o,Js(t,o))})),a=new y(p.from(s),1,1),c=Ft()(e)&&Ft()(n)?i.replaceRange(e,n,a):i.replaceSelection(a);this.view.dispatch(c),this.focus()},n.prototype.deleteSelection=function(t,e){var n=this.view.state.tr,r=Ft()(t)&&Ft()(e)?n.deleteRange(t,e):n.deleteSelection();this.view.dispatch(r.scrollIntoView())},n.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,s=o.to;return Ft()(t)&&Ft()(e)&&(i=t,s=e),r.textBetween(i,s,"\n")},n.prototype.setModel=function(t,e){void 0===e&&(e=!1);var n=this.view.state,r=n.tr,o=n.doc;this.view.dispatch(r.replaceWith(0,o.content.size,t)),e&&this.moveCursorToEnd(!0)},n.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=bs(n,t,e);this.view.dispatch(n.setSelection(r).scrollIntoView())},n.prototype.addWidget=function(t,e,n){var r=this.view,o=r.dispatch,i=r.state;o(i.tr.setMeta("widget",{pos:null!=n?n:i.selection.to,node:t,style:e}))},n.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=Js(n,r.schema);this.view.dispatch(o.replaceWith(t,e,i))},n.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t?n.resolve(t):r.$from,i=o.marks(),s=o.node(),a=o.start(),c=o.end(),l=s.type.name;if(i.length||"paragraph"===l){var u=i[i.length-1];l=u?u.type.name:"text",s.forEach((function(t,e){var n=t.isText,r=t.nodeSize,i=t.marks,s=o.pos-a;n&&e<=s&&e+r>=s&&function(t){return!t.length||Qt(t,u)}(i)&&(c=(a+=e)+r)}))}return{range:[a,c],type:l}},n}(ua),nm=n(404),rm=n.n(nm),om=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","change","caretChange","destroy","focus","blur","keydown","keyup"],im=function(){function t(){var t=this;this.events=new jf,this.eventTypes=om.reduce((function(t,e){return o(o({},t),{type:e})}),{}),this.hold=!1,om.forEach((function(e){t.addEventType(e)}))}return t.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this.getTypeInfo(t),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach((function(t){var n=t.apply(void 0,e);zt()(n)||i.push(n)})),i},t.prototype.emitReduce=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(t);return!this.hold&&o&&o.forEach((function(t){var r=t.apply(void 0,i([e],n));rm()(r)||(e=r)})),e},t.prototype.getTypeInfo=function(t){var e=t.split(".");return{type:e[0],namespace:e[1]}},t.prototype.hasEventType=function(t){return!zt()(this.eventTypes[this.getTypeInfo(t).type])},t.prototype.addEventType=function(t){if(this.hasEventType(t))throw new Error("There is already have event type "+t);this.eventTypes[t]=t},t.prototype.removeEventHandler=function(t,e){var n=this,r=this.getTypeInfo(t),o=r.type,i=r.namespace;o&&e?this.removeEventHandlerWithHandler(o,e):o&&!i?this.events.delete(o):!o&&i?this.events.forEach((function(t,e){n.removeEventHandlerWithTypeInfo(e,i)})):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},t.prototype.removeEventHandlerWithHandler=function(t,e){var n=this.events.get(t);if(n){var r=n.indexOf(e);n.indexOf(e)>=0&&n.splice(r,1)}},t.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map((function(t){return t.namespace!==e&&n.push(t),null})),this.events.set(t,n))},t.prototype.getEvents=function(){return this.events},t.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},t}(),sm=function(){function t(t,e,n,r){this.eventEmitter=t,this.mdCommands=e,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return t.prototype.initEvent=function(){var t=this;this.eventEmitter.listen("command",(function(e,n){t.exec(e,n)}))},t.prototype.addCommand=function(t,e,n){"markdown"===t?this.mdCommands[e]=n:this.wwCommands[e]=n},t.prototype.deleteCommand=function(t,e){"markdown"===t?delete this.mdCommands[e]:delete this.wwCommands[e]},t.prototype.exec=function(t,e){"markdown"===this.getEditorType()?this.mdCommands[t](e):this.wwCommands[t](e)},t}();function am(t){return"\n"===t[t.length-1]?t.slice(0,t.length-1):t}function cm(t,e){var n=t.schema,r=e.literal.match(Ma);if(r){var o=r[1],i=r[3],s=(o||i).toLowerCase();return"htmlInline"===e.type&&!(!n.marks[s]&&!n.nodes[s])}return!1}function lm(t){return Qt(["text","strong","emph","strike","image","link","code"],t.type)}function um(t){return"softbreak"===(null==t?void 0:t.type)}function pm(t){var e=t.type,n=t.literal,r="htmlInline"===e&&n.match(Ma);if(r){var o=r[1],i=r[3],s=o||i;if(s)return Qt(["ul","ol","li"],s.toLowerCase())}return!1}function dm(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=document.createElement("div");r.innerHTML=Fd(t);var o=r.firstChild;return e.map((function(t){return o.getAttribute(t)||""}))}var fm=function(t){var e={};return Object.keys(t).forEach((function(n){n.split(", ").forEach((function(r){var o=r.toLowerCase();e[o]=t[n]}))})),e}({"b, strong":function(t,e,n){var r=t.schema.marks.strong;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"i, em":function(t,e,n){var r=t.schema.marks.emph;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"s, del":function(t,e,n){var r=t.schema.marks.strike;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},code:function(t,e,n){var r=t.schema.marks.code;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},a:function(t,e,n){var r=e.literal,o=t.schema.marks.link;if(n){var i=dm(r,"href")[0];t.openMark(o.create({linkUrl:i,rawHTML:n}))}else t.closeMark(o)},img:function(t,e,n){var r=e.literal;if(n){var i=dm(r,"src","alt"),s=i[0],a=i[1],c=t.schema.nodes.image;t.addNode(c,o({rawHTML:n,imageUrl:s},a&&{altText:a}))}},hr:function(t,e,n){t.addNode(t.schema.nodes.thematicBreak,{rawHTML:n})},br:function(t,e){var n=t.schema.nodes.paragraph,r=e.parent,o=e.prev,i=e.next;"paragraph"===(null==r?void 0:r.type)?(um(o)&&t.openNode(n),um(i)?t.closeNode():i&&(t.closeNode(),t.openNode(n))):"tableCell"===(null==r?void 0:r.type)&&(o&&(lm(o)||cm(t,o))&&t.closeNode(),i&&(lm(i)||cm(t,i))&&t.openNode(n))},pre:function(t,e,n){var r,o,i=document.createElement("div");i.innerHTML=e.literal;var s=null===(o=null===(r=i.firstChild)||void 0===r?void 0:r.firstChild)||void 0===o?void 0:o.textContent;t.openNode(t.schema.nodes.codeBlock,{rawHTML:n}),t.addText(am(s)),t.closeNode()},"ul, ol":function(t,e,n){if("tableCell"===e.parent.type){var r=t.schema.nodes,o=r.bulletList,i=r.orderedList,s=r.paragraph,a="ul"===n?o:i;n?(e.prev&&!pm(e.prev)&&t.closeNode(),t.openNode(a,{rawHTML:n})):(t.closeNode(),e.next&&!pm(e.next)&&t.openNode(s))}},li:function(t,e,n){var r;if("tableCell"===(null===(r=e.parent)||void 0===r?void 0:r.type)){var i=t.schema.nodes,s=i.listItem,a=i.paragraph;if(n){var c=function(t){var e=t.literal;return{task:/data-task/.test(e),checked:/data-task-checked/.test(e)}}(e);e.prev&&!pm(e.prev)&&t.closeNode(),t.openNode(s,o({rawHTML:n},c)),e.next&&!pm(e.next)&&t.openNode(a)}else e.prev&&!pm(e.prev)&&t.closeNode(),t.closeNode()}}});function hm(t){return"htmlInline"===t.type&&Sa.test(t.literal)}function mm(t){na()(t.childNodes).forEach((function(t){if(La(t)){var e=t.nodeName.toLowerCase();t.setAttribute("data-raw-html",e),t.childNodes&&mm(t)}}))}var vm={text:function(t,e){t.addText(e.literal||"")},paragraph:function(t,e,n,r){var o;if(n.entering){var i=t.schema.nodes.paragraph;"paragraph"===(null===(o=e.prev)||void 0===o?void 0:o.type)&&(t.openNode(i,r),t.closeNode()),t.openNode(i,r)}else t.closeNode()},heading:function(t,e,n,r){if(n.entering){var i=e,s=i.level,a=i.headingType;t.openNode(t.schema.nodes.heading,o({level:s,headingType:a},r))}else t.closeNode()},codeBlock:function(t,e,n){var r=t.schema.nodes.codeBlock,i=e,s=i.info,a=i.literal;t.openNode(r,o({language:s},n)),t.addText(am(a||"")),t.closeNode()},list:function(t,e,n,r){if(n.entering){var i=t.schema.nodes,s=i.bulletList,a=i.orderedList,c=e.listData,l=c.type,u=c.start;"bullet"===l?t.openNode(s,r):t.openNode(a,o({order:u},r))}else t.closeNode()},item:function(t,e,n,r){var i=n.entering,s=t.schema.nodes.listItem,a=e.listData,c=a.task,l=a.checked;if(i){var u=o(o(o({},c&&{task:c}),l&&{checked:l}),r);t.openNode(s,u)}else t.closeNode()},blockQuote:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.blockQuote,r):t.closeNode()},image:function(t,e,n,r){var i=n.entering,s=n.skipChildren,a=t.schema.nodes.image,c=e,l=c.destination,u=c.firstChild;i&&s&&s(),t.addNode(a,o(o({imageUrl:l},u&&{altText:u.literal}),r))},thematicBreak:function(t,e,n,r){t.addNode(t.schema.nodes.thematicBreak,r)},strong:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strong;o?t.openMark(i.create(r)):t.closeMark(i)},emph:function(t,e,n,r){var o=n.entering,i=t.schema.marks.emph;o?t.openMark(i.create(r)):t.closeMark(i)},link:function(t,e,n,r){var i=n.entering,s=t.schema.marks.link,a=e,c=a.destination,l=a.title;if(i){var u=o(o({linkUrl:c},l&&{linkText:l}),r);t.openMark(s.create(u))}else t.closeMark(s)},softbreak:function(t,e){if("paragraph"===e.parent.type){var n=e.prev,r=e.next;n&&!hm(n)&&t.closeNode(),r&&!hm(r)&&t.openNode(t.schema.nodes.paragraph)}},table:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.table,r):t.closeNode()},tableHead:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableHead,r):t.closeNode()},tableBody:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableBody,r):t.closeNode()},tableRow:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableRow,r):t.closeNode()},tableCell:function(t,e,n){var r,o=n.entering,i=t.schema.nodes,s=i.tableHeadCell,a=i.tableBodyCell,c=i.paragraph,l=e.parent.parent,u="tableHead"===l.type?s:a,p=function(e){return e&&(lm(e)||cm(t,e))};if(o){var d=null;if(!e.ignored){var f=l.parent,h=e.startIdx;if(f.columns.length>h){var m=f.columns[h].align;d=null!==(r=e.attrs)&&void 0!==r?r:{},m&&(d.align=m)}}t.openNode(u,d),p(e.firstChild)&&t.openNode(c)}else p(e.lastChild)&&t.closeNode(),t.closeNode()},strike:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strike;o?t.openMark(i.create(r)):t.closeMark(i)},code:function(t,e,n,r){var o=t.schema.marks.code;t.openMark(o.create(r)),t.addText(am(e.literal||"")),t.closeMark(o)},customBlock:function(t,e){var n=t.schema.nodes,r=n.customBlock,o=n.paragraph,i=e,s=i.info,a=i.literal;t.openNode(r,{info:s}),t.addText(am(a||"")),t.closeNode(),e.next||(t.openNode(o),t.closeNode())},frontMatter:function(t,e){t.openNode(t.schema.nodes.frontMatter),t.addText(e.literal),t.closeNode()},htmlInline:function(t,e){var n=e.literal,r=n.match(Ma),o=r[1],i=r[3],s=(o||i).toLowerCase(),a=t.schema.marks[s],c=Fd(n);if(null==a?void 0:a.spec.attrs.htmlInline)if(o){var l=zd(c);t.openMark(a.create({htmlAttrs:l}))}else t.closeMark(a);else{var u=fm[s];u&&u(t,e,o)}},htmlBlock:function(t,e){var n=e.literal,r=document.createElement("div"),o=n.match(Ma),i=o[1],s=o[3],a=(i||s).toLowerCase(),c=t.schema.nodes[a],l=Fd(n);if(null==c?void 0:c.spec.attrs.htmlBlock){var u=zd(l),p=Hd(e,a);t.addNode(c,{htmlAttrs:u,childrenHTML:p})}else r.innerHTML=l,mm(r),t.convertByDOMParser(r)},customInline:function(t,e,n){var r=n.entering,o=n.skipChildren,i=e.info,s=t.schema;if(-1!==i.indexOf("widget")&&r){var a=Gs(e);o(),t.addNode(s.nodes.widget,{info:i},[s.text(qs(i,a))])}}};var gm=function(){function t(t,e){this.schema=t,this.convertors=e,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=v.none}return t.prototype.top=function(){return se(this.stack)},t.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},t.prototype.addText=function(t){if(t){var e=this.top().content,n=se(e),r=this.schema.text(t,this.marks),o=n&&(s=r,!!((i=n).isText&&s.isText&&v.sameSet(i.marks,s.marks))&&i.withText(i.text+s.text));o?e[e.length-1]=o:e.push(r)}var i,s},t.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},t.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},t.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},t.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},t.prototype.closeNode=function(){this.marks.length&&(this.marks=v.none);var t=this.stack.pop(),e=t.type,n=t.attrs,r=t.content;return this.addNode(e,n,r)},t.prototype.convertByDOMParser=function(t){var e=this;ut.fromSchema(this.schema).parse(t).content.forEach((function(t){return e.push(t)}))},t.prototype.closeUnmatchedHTMLInline=function(t,e){var n;if(!e&&"htmlInline"!==t.type)for(var r=this.stack.length-1;r>=0;r-=1){var o=this.stack[r];if(!(null===(n=o.attrs)||void 0===n?void 0:n.rawHTML))break;o.content.length?this.closeNode():this.stack.pop()}},t.prototype.convert=function(t,e){for(var n=t.walker(),r=n.next(),o=function(){var t=r.node,o=r.entering,s=i.convertors[t.type],a=!1;if(s){var c={entering:o,leaf:!Bs(t),getChildrenText:Fs,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){a=!0}};if(i.closeUnmatchedHTMLInline(t,o),s(i,t,c),(null==e?void 0:e.node)===t){var l=i.stack.reduce((function(t,e){return t+e.content.reduce((function(t,e){return t+e.nodeSize}),0)}),0)+1;e.setMappedPos(l)}}a&&(n.resumeAt(t,!1),n.next()),r=n.next()},i=this;r;)o()},t.prototype.convertNode=function(t,e){return this.convert(t,e),this.stack.length?this.closeNode():null},t}();var ym={text:function(t,e){var n,r=e.node;t.text(null!==(n=r.text)&&void 0!==n?n:"")},paragraph:function(t,e){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o;if(t.stopNewline)t.convertInline(n);else{var s=0===i,a=!s&&r.child(i-1),c=a&&0===a.childCount,l=i<r.childCount-1&&r.child(i+1),u=l&&"paragraph"===l.type.name,p=0===n.childCount;p&&c?t.write("<br>\n"):!p||c||s?(t.convertInline(n),u?t.write("\n"):t.closeBlock(n)):t.write("\n")}},heading:function(t,e,n){var r=e.node,o=n.delim;"atx"===r.attrs.headingType?(t.write(o+" "),t.convertInline(r),t.closeBlock(r)):(t.convertInline(r),t.ensureNewLine(),t.write(o),t.closeBlock(r))},codeBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},blockQuote:function(t,e,n){var r=e.node,o=e.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&t.flushClose(1),t.wrapBlock(i,null,r,(function(){return t.convertNode(r)}))},bulletList:function(t,e,n){var r=e.node,o=n.delim;t.convertList(r,ne(" ",4),(function(){return o+" "}))},orderedList:function(t,e){var n=e.node,r=n.attrs.order||1;t.convertList(n,ne(" ",4),(function(t){return String(r+t)+". "}))},listItem:function(t,e){var n=e.node,r=n.attrs,o=r.task,i=r.checked;o&&t.write("["+(i?"x":" ")+"] "),t.convertNode(n)},image:function(t,e,n){var r=n.attrs;t.write("+")")},thematicBreak:function(t,e,n){var r=e.node,o=n.delim;t.write(o),t.closeBlock(r)},table:function(t,e){var n=e.node;t.convertNode(n),t.closeBlock(n)},tableHead:function(t,e,n){var r=e.node,o=n.delim,i=r.firstChild;t.convertNode(r);var s=null!=o?o:"";!o&&i&&i.forEach((function(t){var e=function(t,e){var n=t.length,r="",o="";return"left"===e?(r=":",n-=1):"right"===e?(o=":",n-=1):"center"===e&&(r=":",o=":",n-=2),""+r+ne("-",Math.max(n,3))+o}(t.textContent,t.attrs.align);s+="| "+e+" "})),t.write(s+"|"),t.ensureNewLine()},tableBody:function(t,e){var n=e.node;t.convertNode(n)},tableRow:function(t,e){var n=e.node;t.convertNode(n),t.write("|"),t.ensureNewLine()},tableHeadCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},tableBodyCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},customBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,s=o,a=s[0],c=s[1];t.write(a),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(c),t.closeBlock(r)},frontMatter:function(t,e,n){var r=e.node,o=n.text;t.text(o,!1),t.closeBlock(r)},widget:function(t,e,n){var r=n.text;t.write(r)},html:function(t,e,n){var r=n.text;t.write(r)}};function bm(t,e){var n=t.text,r=/`+/g,o=0;if(t.isText&&n)for(var i=r.exec(n);i;)o=Math.max(o,i[0].length),i=r.exec(n);for(var s=o>0&&e>0?" `":"`",a=0;a<o;a+=1)s+="`";return o>0&&e<0&&(s+=" "),s}function wm(t){return t?["<"+t+">","</"+t+">"]:null}function km(t){return t?"<"+t+">":null}function xm(t){return t?"</"+t+">":null}var Cm={heading:function(t){var e=t.node.attrs,n=e.level,r=ne("#",n);return"setext"===e.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:wm(e.rawHTML)}},codeBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:wm(n.rawHTML),text:r}},blockQuote:function(t){return{delim:"> ",rawHTML:wm(t.node.attrs.rawHTML)}},bulletList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:wm(o)}},orderedList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:wm(o)}},listItem:function(t,e){var n=t.node,r=e.inTable,o=n.attrs,i=o.task,s=o.checked,a=n.attrs.rawHTML;return r&&(a=a||"li"),{rawHTML:a?["<"+a+(i?' class="task-list-item'+(s?" checked":"")+'"':"")+(i?" data-task"+(s?" data-task-checked":""):"")+">","</"+a+">"]:null}},table:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableHead:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableBody:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableRow:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableHeadCell:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},tableBodyCell:function(t){return{rawHTML:wm(t.node.attrs.rawHTML)}},image:function(t){var e=t.node.attrs,n=re(e.altText||""),r=Xt(e.imageUrl),o=n?' alt="'+n+'"':"";return{rawHTML:e.rawHTML?"<"+e.rawHTML+' src="'+r+'"'+o+">":null,attrs:{altText:n,imageUrl:r}}},thematicBreak:function(t){return{delim:"***",rawHTML:km(t.node.attrs.rawHTML)}},customBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(t){return{text:t.node.textContent}},widget:function(t){return{text:t.node.textContent}},strong:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"**",rawHTML:r?km(o):xm(o)}},emph:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"*",rawHTML:r?km(o):xm(o)}},strike:function(t,e){var n=t.node,r=e.entering,o=n.attrs.rawHTML;return{delim:"~~",rawHTML:r?km(o):xm(o)}},link:function(t,e){var n=t.node,r=e.entering,o=n.attrs,i=Xt(o.linkUrl),s=o.rawHTML;return r?{delim:"[",rawHTML:s?"<"+s+' href="'+i+'">':null}:{delim:"]("+(o.title?" "+function(t){var e;return(e=-1===t.indexOf('"')?'""':-1===t.indexOf("'")?"''":"()")[0]+t+e[1]}(o.linkText):"")+i+")",rawHTML:xm(s)}},code:function(t,e){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o,s=e.entering;return{delim:s?bm(r.child(i),-1):bm(r.child(i-1),1),rawHTML:s?km(n.attrs.rawHTML):xm(n.attrs.rawHTML)}},html:function(t,e){var n=t.node,r=e.entering,o=n.type.name,i=n.attrs.htmlAttrs,s="<"+o,a="</"+o+">";return Object.keys(i).forEach((function(t){s+=" "+t+'="'+i[t].replace(/"/g,"'")+'"'})),s+=">",n.attrs.htmlInline?{rawHTML:r?s:a}:{text:""+s+n.attrs.childrenHTML+a}}},Tm={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Mm(t){var e={};return Object.keys(ym).forEach((function(n){e[n]=function(e,r){if(ym[n]){var o=t[n],i=o?o(r,{inTable:e.inTable}):{};!function(t,e){var n=e.state,r=e.nodeInfo,o=e.params,i=o.rawHTML;i?zf()(t,["heading","codeBlock"])>-1?function(t,e,n){var r=n[0],o=n[1];t.write(r),t.convertInline(e),t.write(o)}(n,r.node,i):zf()(t,["image","thematicBreak"])>-1?n.write(i):function(t,e,n){var r=e.node,o=e.parent,i=n[0],s=n[1];t.stopNewline=!0,t.write(i),t.convertNode(r),t.write(s),"doc"===(null==o?void 0:o.type.name)&&(t.closeBlock(r),t.stopNewline=!1)}(n,r,i):ym[t](n,r,o)}(n,{state:e,nodeInfo:r,params:i})}}})),e}function Sm(t){return Object.keys(t).forEach((function(e){var n=Cm[e],r=t[e];Cm[e]=n?function(t,e){return e.origin=function(){return n(t,e)},r(t,e)}:r,delete t[e]})),{nodeTypeConvertors:Mm(Cm),markTypeConvertors:function(t){var e={};return Object.keys(Tm).forEach((function(n){e[n]=function(e,r){var i=Tm[n],s=t[n],a=s&&e&&!zt()(r)?s(e,{entering:r}):{};return o(o({},a),i)}})),e}(Cm)}}var Em=function(){function t(t){var e=t.nodeTypeConvertors,n=t.markTypeConvertors;this.nodeTypeConvertors=e,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return t.prototype.getMarkConvertor=function(t){var e=t.attrs.htmlInline?"html":t.type.name;return this.markTypeConvertors[e]},t.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},t.prototype.markText=function(t,e,n,r){var o=this.getMarkConvertor(t);if(o){var i=o({node:t,parent:n,index:r},e),s=i.delim;return i.rawHTML||s}return""},t.prototype.flushClose=function(t){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),t||(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;r<t;r+=1)this.result+=e+"\n"}this.closed=!1}},t.prototype.wrapBlock=function(t,e,n,r){var o=this.delim;this.write(e||t),this.delim+=t,r(),this.delim=o,this.closeBlock(n)},t.prototype.ensureNewLine=function(){this.isInBlank()||(this.result+="\n")},t.prototype.write=function(t){void 0===t&&(t=""),this.flushClose(),this.delim&&this.isInBlank()&&(this.result+=this.delim),t&&(this.result+=t)},t.prototype.closeBlock=function(t){this.closed=t},t.prototype.text=function(t,e){void 0===e&&(e=!0);for(var n=t.split("\n"),r=0;r<n.length;r+=1)this.write(),this.result+=e?re(n[r]):n[r],r!==n.length-1&&(this.result+="\n")},t.prototype.convertBlock=function(t,e,n){var r=t.type.name,o=this.nodeTypeConvertors[r],i={node:t,parent:e,index:n};t.attrs.htmlBlock?this.nodeTypeConvertors.html(this,i):o&&o(this,i)},t.prototype.convertInline=function(t){var e=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[],c=r;if(r="",o&&o.isText&&a.some((function(t){var n=e.getMarkConvertor(t),r=n&&n();return r&&r.removedEnclosingWhitespace}))&&o&&o.text){var l=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=l[1],p=l[2],d=l[3];c+=u,r=d,(u||d)&&((o=p?o.withText(p):null)||(a=n))}for(var f=a.length&&se(a),h=f&&e.getMarkConvertor(f),m=h&&h(),v=m&&!1===m.escape,g=a.length-(v?1:0),y=0;y<g;y+=1){p=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(p.eq(w)){y>b?a=a.slice(0,b).concat(p).concat(a.slice(b,y)).concat(a.slice(y+1,g)):b>y&&(a=a.slice(0,y).concat(a.slice(y+1,b)).concat(p).concat(a.slice(b,g)));break}}}for(var k=0;k<Math.min(n.length,g)&&a[k].eq(n[k]);)k+=1;for(;k<n.length;){var x=n.pop();x&&e.text(e.markText(x,!1,t,s),!1)}if(c&&e.text(c),o){for(;n.length<g;){p=a[n.length];n.push(p),e.text(e.markText(p,!0,t,s),!1)}v&&o.isText?e.text(e.markText(f,!0,t,s)+o.text+e.markText(f,!1,t,s+1),!1):e.convertBlock(o,t,s)}};t.forEach(o),o(null,0,t.childCount)},t.prototype.convertList=function(t,e,n){var r,o=this;this.closed&&this.closed.type===t.type?this.flushClose(3):this.tightList&&this.flushClose(1);var i=null===(r=t.attrs.tight)||void 0===r||r,s=this.tightList;this.tightList=i,t.forEach((function(r,s,a){a&&i&&o.flushClose(1),o.wrapBlock(e,n(a),t,(function(){return o.convertBlock(r,t,a)}))})),this.tightList=s},t.prototype.convertTableCell=function(t){var e=this;this.stopNewline=!0,this.inTable=!0,t.forEach((function(n,r,o){Qt(["bulletList","orderedList"],n.type.name)?(e.convertBlock(n,t,o),e.closed=!1):(e.convertInline(n),o<t.childCount-1&&"paragraph"===t.child(o+1).type.name&&e.write("<br>"))})),this.stopNewline=!1,this.inTable=!1},t.prototype.convertNode=function(t,e){var n=this;return t.forEach((function(r,o,i){if(n.convertBlock(r,t,i),(null==e?void 0:e.node)===r){var s=n.result.split("\n");e.setMappedPos([s.length,se(s).length+1])}})),this.result},t}(),Nm=function(){function t(t,e,n,r){var i=this;this.setMappedPos=function(t){i.mappedPosWhenConverting=t},this.schema=t,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(t){var e=Object.keys(t),n=o({},vm),r=new Ad({gfm:!0,nodeId:!0,convertors:t}).getConvertors();return e.forEach((function(e){var o=vm[e];o&&!Qt(["htmlBlock","htmlInline"],e)&&(n[e]=function(n,i,s){s.origin=function(){return r[e](i,s)};var a,c=t[e](i,s);if(c){var l=Array.isArray(c)?c[0]:c;a={htmlAttrs:l.attributes,classNames:l.classNames}}o(n,i,s,a)})})),n}(n),this.toMdConvertors=Sm(e||{}),this.eventEmitter.listen("setFocusedNode",(function(t){return i.focusedNode=t}))}return t.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},t.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},t.prototype.toWysiwygModel=function(t){return new gm(this.schema,this.toWwConvertors).convertNode(t,this.getInfoForPosSync())},t.prototype.toMarkdownText=function(t){var e=new Em(this.toMdConvertors).convertNode(t,this.getInfoForPosSync());return e=this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",e)},t}();function Om(t,e,n){return e.listen("mixinTableOffsetMapPrototype",Tf),(null!=t?t:[]).reduce((function(t,r){var i=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:vn,Selection:Ke,TextSelection:Qe},pmView:{Decoration:Uo,DecorationSet:Ko},pmModel:{Fragment:p},i18n:qf};if(va()(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(r,e,n);if(!i)throw new Error("The return value of the executed plugin is empty.");var s=i.markdownParsers,a=i.toHTMLRenderers,c=i.toMarkdownRenderers,l=i.markdownPlugins,u=i.wysiwygPlugins,d=i.wysiwygNodeViews,f=i.markdownCommands,h=i.wysiwygCommands,m=i.toolbarItems;return a&&(t.toHTMLRenderers=ce(t.toHTMLRenderers,a)),c&&(t.toMarkdownRenderers=ce(t.toMarkdownRenderers,c)),l&&(t.mdPlugins=t.mdPlugins.concat(l)),u&&(t.wwPlugins=t.wwPlugins.concat(u)),d&&(t.wwNodeViews=o(o({},t.wwNodeViews),d)),f&&(t.mdCommands=o(o({},t.mdCommands),f)),h&&(t.wwCommands=o(o({},t.wwCommands),h)),m&&(t.toolbarItems=t.toolbarItems.concat(m)),s&&(t.markdownParsers=o(o({},t.markdownParsers),s)),t}),{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Dm=function(){function t(t){var e=this;this.options=Et()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},t),this.eventEmitter=new im;var n,r=ee(this.options.linkAttributes),i=Om(this.options.plugins,this.eventEmitter,this.options.usageStatistics)||{},s=i.toHTMLRenderers,a=i.markdownParsers,c=this.options,l=c.customHTMLRenderer,u=c.extendedAutolinks,p=c.referenceDefinition,d=c.frontMatter,f=c.customHTMLSanitizer,h={linkAttributes:r,customHTMLRenderer:o(o({},s),l),extendedAutolinks:u,referenceDefinition:p,frontMatter:d,sanitizer:f||Fd};n=h.customHTMLRenderer,["htmlBlock","htmlInline"].forEach((function(t){n[t]&&Object.keys(n[t]).forEach((function(t){return Bd(t)}))})),this.options.events&&Mt()(this.options.events,(function(t,n){e.on(n,t)}));var m=this.options,v=m.el,g=m.initialValue,y=m.theme,b=v.innerHTML;"light"!==y&&v.classList.add(Da(y)),v.innerHTML="",this.toastMark=new Td("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:u,referenceDefinition:p,disallowDeepHeading:!0,frontMatter:d,customParser:a}),this.preview=new of(this.eventEmitter,o(o({},h),{isViewer:!0})),Sl()(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),g?this.setMarkdown(g):b&&this.preview.setHTML(b),v.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return t.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&Na(n,t.offsetX,t.offsetY)&&Ra(e,"checked")},t.prototype.setMarkdown=function(t){var e=this.toastMark.getLineTexts(),n=[e.length,se(e).length+1],r=this.toastMark.editMarkdown([1,1],n,t||"");this.eventEmitter.emit("updatePreview",r)},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.destroy=function(){Tl()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},t.prototype.isViewer=function(){return!0},t.prototype.isMarkdownMode=function(){return!1},t.prototype.isWysiwygMode=function(){return!1},t}();function Am(t){return t instanceof z}function Lm(t){return Qt(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],t)}var Im={openTag:function(t,e){var n=t,r=n.tagName,i=n.classNames,s=n.attributes,a=document.createElement(r),c={};i&&(a.className=i.join(" ")),s&&(c=o(o({},c),s)),za(c,a),e.push(a)},closeTag:function(t,e){if(e.length>1){var n=e.pop();se(e).appendChild(n)}},html:function(t,e){se(e).insertAdjacentHTML("beforeend",t.content)},text:function(t,e){var n=document.createTextNode(t.content);se(e).appendChild(n)}},Rm=function(){function t(t,e){var n=Ud(t,e),r=o(o({},e.htmlBlock),e.htmlInline);this.customConvertorKeys=Object.keys(e).concat(Object.keys(r)),this.renderer=new Ad({gfm:!0,convertors:o(o({},n),r)}),this.convertors=this.renderer.getConvertors()}return t.prototype.generateTokens=function(t){var e=function(t){var e=t.attrs,n=t.type.name,r={type:n,wysiwygNode:!0,literal:!Lm(n)&&Am(t)?t.textContent:null},i={heading:{level:e.level},link:{destination:e.linkUrl,title:e.linkText},image:{destination:e.imageUrl},codeBlock:{info:e.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:e.order}},listItem:{type:"item",listData:{task:e.task,checked:e.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:e.align},tableBodyCell:{type:"tableCell",cellType:"body",align:e.align},customBlock:{info:e.info}}[n],s=o(o({},r),i),a=t.attrs,c=a.htmlAttrs,l=a.childrenHTML;return c?o(o({},s),{attrs:c,childrenHTML:l}):s}(t),n={entering:!0,leaf:!!Am(t)&&t.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Am(t)?t.textContent:""},skipChildren:function(){return!1}},r=this.convertors[t.type.name],i=r(e,n,this.convertors),s=va()(i)?i:[i];return(Lm(t.type.name)||t.attrs.htmlInline)&&(n.entering=!1,s.push({type:"text",content:Am(t)?t.textContent:""}),s=s.concat(r(e,n,this.convertors))),s},t.prototype.toDOMNode=function(t){var e=this.generateTokens(t),n=[];return e.forEach((function(t){return Im[t.type](t,n)})),n[0]},t.prototype.getToDOMNode=function(t){return Qt(this.customConvertorKeys,t)?this.toDOMNode.bind(this):null},t}(),Pm=null,Bm=null;function Fm(t,e){var n=e.syncScrollTop,r=e.releaseEventBlock;Bm&&clearTimeout(Bm),n(t),Bm=setTimeout((function(){r()}),15)}var Hm=function(){function t(t,e,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0;var r=e.previewContent,o=e.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=t,this.editorView=t.view,this.toastMark=t.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return t.prototype.addScrollSyncEvent=function(){var t=this;this.eventEmitter.listen("afterPreviewRender",(function(){setTimeout((function(){t.syncPreviewScrollTop(!0)}),200)})),this.eventEmitter.listen("scroll",(function(e,n){t.active&&("editor"===e&&"editor"!==t.blockedScroll?t.syncPreviewScrollTop():"preview"===e&&"preview"!==t.blockedScroll&&t.syncEditorScrollTop(n))})),this.eventEmitter.listen("toggleScrollSync",(function(e){t.active=e}))},t.prototype.getMdNodeAtPos=function(t,e){var n=t.content.findIndex(e.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},t.prototype.getScrollTopByCaretPos=function(){var t=this.mdEditor.getSelection(),e=this.toastMark.findFirstNodeAtLine(t[0][0]),n=this.previewEl.clientHeight,r=Yd(e).el,o=(Xd(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().top<n?null:o},t.prototype.syncPreviewScrollTop=function(t){void 0===t&&(t=!1);var e=this,n=e.editorView,r=e.previewEl,o=e.previewRoot,i=n.dom.getBoundingClientRect(),s=i.left,a=i.top,c=n.posAtCoords({left:s,top:a}),l=n.state.doc,u=this.getMdNodeAtPos(l,c);if(u&&!function(t){var e=t.type;return"htmlBlock"===e||"htmlInline"===e}(u)){var p=r.scrollTop,d=n.dom,f=d.scrollTop,h=d.scrollHeight,m=d.clientHeight,v=d.children,g=h-f<=m+18,y=g?r.scrollHeight:0;if(f&&!g){if(t){var b=this.getScrollTopByCaretPos();if(!b)return;y=b}else{var w=Yd(u),k=w.el,x=Kd(l,w.mdNode,v),C=x.height,T=x.rect;y=(Xd(k,o)||k.offsetTop)+k.clientHeight*(a>T.top?Math.min((a-T.top)/C,1):0)}y=this.getResolvedScrollTop("editor",f,y,p),this.latestEditorScrollTop=f}y!==p&&this.run("editor",y,p)}},t.prototype.syncEditorScrollTop=function(t){var e=this,n=e.toastMark,r=e.editorView,o=e.previewRoot,i=e.previewEl,s=r.dom,a=r.state,c=i.scrollTop,l=i.clientHeight,u=i.scrollHeight-c<=l,p=s.scrollTop,d=u?s.scrollHeight:0;if(c&&t&&!u){if(!(t=function(t,e){for(;!t.getAttribute("data-nodeid")&&t.parentElement!==e;)t=t.parentElement;return t}(t,o)).getAttribute("data-nodeid"))return;var f=s.children,h=Number(t.getAttribute("data-nodeid")),m=Yd(n.findNodeById(h)),v=m.mdNode,g=m.el;d=f[Cs(v)-1].offsetTop;var y=Kd(a.doc,v,f).height,b=nf(g,o,h),w=b.nodeHeight;d+=function(t,e,n,r){return Math.min((t-e)/n,1)*r}(c,b.offsetTop,w,y),d=this.getResolvedScrollTop("preview",c,d,p),this.latestPreviewScrollTop=c}d!==p&&this.run("preview",d,p)},t.prototype.getResolvedScrollTop=function(t,e,n,r){var o="editor"===t?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o<e?Math.max(n,r):Math.min(n,r)},t.prototype.run=function(t,e,n){var r,o=this;"editor"===t?(r=this.previewEl,this.blockedScroll="preview"):(r=this.editorView.dom,this.blockedScroll="editor"),function(t,e,n){var r=e-t,o=Date.now(),i=function(){var s,a=(Date.now()-o)/100;Pm&&clearTimeout(Pm),a<1?(s=t+r*Math.cos((1-a)*Math.PI/2),Fm(Math.ceil(s),n),Pm=setTimeout(i,1)):(Fm(e,n),Pm=null)};i()}(n,e,{syncScrollTop:function(t){return r.scrollTop=t},releaseEventBlock:function(){return o.blockedScroll=null}})},t.prototype.destroy=function(){this.eventEmitter.removeEventHandler("scroll"),this.eventEmitter.removeEventHandler("afterPreviewRender")},t}(),zm={getPopupInitialValues:function(t,e){return"link"===e.popupName?{linkText:t.getSelectedText()}:{}}};var jm=function(){function t(t){var e=this;this.initialHTML=t.el.innerHTML,t.el.innerHTML="",this.options=Et()({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},t);var n=this.options,r=n.customHTMLRenderer,i=n.extendedAutolinks,s=n.referenceDefinition,a=n.frontMatter,c=n.customMarkdownRenderer,l=n.useCommandShortcut,u=n.initialEditType,p=n.widgetRules,d=n.customHTMLSanitizer;this.mode=u||"markdown",this.mdPreviewStyle=this.options.previewStyle,this.i18n=qf,this.i18n.setCode(this.options.language),this.eventEmitter=new im,Us(p);var f=ee(this.options.linkAttributes);this.pluginInfo=Om(this.options.plugins,this.eventEmitter,this.options.usageStatistics);var h=this.pluginInfo,m=h.toHTMLRenderers,v=h.toMarkdownRenderers,g=h.mdPlugins,y=h.wwPlugins,b=h.wwNodeViews,w=h.mdCommands,k=h.wwCommands,x=h.markdownParsers,C={linkAttributes:f,customHTMLRenderer:ce(m,r),extendedAutolinks:i,referenceDefinition:s,frontMatter:a,sanitizer:d||Fd},T=new Rm(f,C.customHTMLRenderer),M=function(t,e,n){var r={nodes:{},marks:{}};return["htmlBlock","htmlInline"].forEach((function(o){t[o]&&Object.keys(t[o]).forEach((function(t){var i="htmlBlock"===o?"nodes":"marks";Bd(t),r[i][t]=qd[o](t,e,n)}))})),r}(C.customHTMLRenderer,C.sanitizer,T);this.toastMark=new Td("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:i,referenceDefinition:s,disallowDeepHeading:!0,frontMatter:a,customParser:x}),this.mdEditor=new xl(this.eventEmitter,{toastMark:this.toastMark,useCommandShortcut:l,mdPlugins:g}),this.preview=new of(this.eventEmitter,o(o({},C),{isViewer:!1,highlight:this.options.previewHighlight})),this.wwEditor=new em(this.eventEmitter,{toDOMAdaptor:T,useCommandShortcut:l,htmlSchemaMap:M,linkAttributes:f,wwPlugins:y,wwNodeViews:b}),this.convertor=new Nm(this.wwEditor.getSchema(),o(o({},v),c),Ud(f,C.customHTMLRenderer),this.eventEmitter),this.setMinHeight(this.options.minHeight),this.setHeight(this.options.height),this.setMarkdown(this.options.initialValue,!1),this.options.placeholder&&this.setPlaceholder(this.options.placeholder),this.options.initialValue||this.setHTML(this.initialHTML,!1),this.commandManager=new sm(this.eventEmitter,this.mdEditor.commands,this.wwEditor.commands,(function(){return e.mode})),this.options.usageStatistics&&Vt()("editor","UA-129966929-1"),this.scrollSync=new Hm(this.mdEditor,this.preview,this.eventEmitter),this.addInitEvent(),this.addInitCommand(w,k),function(t){t.eventEmitter.listen("query",(function(e,n){return zm[e](t,n)}))}(this),this.options.hooks&&Mt()(this.options.hooks,(function(t,n){return e.addHook(n,t)})),this.options.events&&Mt()(this.options.events,(function(t,n){return e.on(n,t)})),this.eventEmitter.emit("load",this),this.moveCursorToStart(this.options.autofocus)}return t.prototype.addInitEvent=function(){this.on("needChangeMode",this.changeMode.bind(this)),function(t){t.listen("addImageBlobHook",(function(t,e){var n=new FileReader;n.onload=function(t){var n=t.target;return e(n.result)},n.readAsDataURL(t)}))}(this.eventEmitter)},t.prototype.addInitCommand=function(t,e){var n=this,r=function(t,e){Object.keys(e).forEach((function(r){n.addCommand(t,r,e[r])}))};this.addCommand("markdown","toggleScrollSync",(function(t){return n.eventEmitter.emit("toggleScrollSync",t.active),!0})),r("markdown",t),r("wysiwyg",e)},t.prototype.getCurrentModeEditor=function(){return this.isMarkdownMode()?this.mdEditor:this.wwEditor},t.factory=function(e){return e.viewer?new Dm(e):new t(e)},t.setLanguage=function(t,e){qf.setLanguage(t,e)},t.prototype.changePreviewStyle=function(t){this.mdPreviewStyle!==t&&(this.mdPreviewStyle=t,this.eventEmitter.emit("changePreviewStyle",t))},t.prototype.exec=function(t,e){this.commandManager.exec(t,e)},t.prototype.addCommand=function(t,e,n){var r=this;this.commandManager.addCommand(t,e,(function(e){void 0===e&&(e={});var o=("markdown"===t?r.mdEditor:r.wwEditor).view;n(e,o.state,o.dispatch,o)}))},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.removeHook=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.focus=function(){this.getCurrentModeEditor().focus()},t.prototype.blur=function(){this.getCurrentModeEditor().blur()},t.prototype.moveCursorToEnd=function(t){void 0===t&&(t=!0),this.getCurrentModeEditor().moveCursorToEnd(t)},t.prototype.moveCursorToStart=function(t){void 0===t&&(t=!0),this.getCurrentModeEditor().moveCursorToStart(t)},t.prototype.setMarkdown=function(t,e){if(void 0===t&&(t=""),void 0===e&&(e=!0),this.mdEditor.setMarkdown(t,e),this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r,e)}},t.prototype.setHTML=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!0);var n=document.createElement("div");n.innerHTML=function(t){var e=t.replace(/<p><br\s*\/*><\/p>/gi,"<p></p>"),n=new RegExp(Ta,"ig"),r=e.match(n);return null==r||r.forEach((function(t,n){if(Sa.test(t)){var o=Ea;if(n){var i=r[n-1].match(Ca);if(i&&!/br/i.test(i[1])){var s=i[1];o="</"+s+"><"+s+">"}}e=e.replace(Sa,o)}})),e}(t);var r=ut.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),e):this.wwEditor.setModel(r,e)},t.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},t.prototype.getHTML=function(){var t=this;return this.eventEmitter.holdEventInvoke((function(){if(t.isMarkdownMode()){var e=t.toastMark.getRootNode(),n=t.convertor.toWysiwygModel(e);t.wwEditor.setModel(n)}})),this.wwEditor.view.dom.innerHTML},t.prototype.insertText=function(t){this.getCurrentModeEditor().replaceSelection(t)},t.prototype.setSelection=function(t,e){this.getCurrentModeEditor().setSelection(t,e)},t.prototype.replaceSelection=function(t,e,n){this.getCurrentModeEditor().replaceSelection(t,e,n)},t.prototype.deleteSelection=function(t,e){this.getCurrentModeEditor().deleteSelection(t,e)},t.prototype.getSelectedText=function(t,e){return this.getCurrentModeEditor().getSelectedText(t,e)},t.prototype.getRangeInfoOfNode=function(t){return this.getCurrentModeEditor().getRangeInfoOfNode(t)},t.prototype.addWidget=function(t,e,n){this.getCurrentModeEditor().addWidget(t,e,n)},t.prototype.replaceWithWidget=function(t,e,n){this.getCurrentModeEditor().replaceWithWidget(t,e,n)},t.prototype.setHeight=function(t){var e=this.options.el;Pt()(t)&&("auto"===t?(At()(e,"auto-height"),this.setMinHeight(this.getMinHeight())):(It()(e,"auto-height"),this.setMinHeight(t))),Ot()(e,{height:t}),this.height=t},t.prototype.getHeight=function(){return this.height},t.prototype.setMinHeight=function(t){var e;this.minHeight=t;var n=this.options.el.clientHeight-((null===(e=document.querySelector("."+Da("main")))||void 0===e?void 0:e.clientHeight)||0),r=parseInt(t,10);r=Math.max(r-n,0),this.wwEditor.setMinHeight(r),this.mdEditor.setMinHeight(r),this.preview.setMinHeight(r)},t.prototype.getMinHeight=function(){return this.minHeight},t.prototype.isMarkdownMode=function(){return"markdown"===this.mode},t.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},t.prototype.isViewer=function(){return!1},t.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},t.prototype.changeMode=function(t,e){if(this.mode!==t){if(this.mode=t,this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r)}else{r=this.wwEditor.getModel();this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),!e)}if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",t),!e){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&Ft()(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},t.prototype.destroy=function(){var t=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach((function(e,n){return t.off(n)}))},t.prototype.hide=function(){this.eventEmitter.emit("hide")},t.prototype.show=function(){this.eventEmitter.emit("show")},t.prototype.setScrollTop=function(t){this.getCurrentModeEditor().setScrollTop(t)},t.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},t.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},t.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},t.prototype.setPlaceholder=function(t){this.mdEditor.setPlaceholder(t),this.wwEditor.setPlaceholder(t)},t.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},t}();var _m=n(326),qm=n.n(_m),Vm=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.walk=function(){var t=this.entering,e=this.current;return e?(t?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:e.next?(this.current=e.next,this.entering=!0):(this.current=e.parent,this.entering=!1),{vnode:e,entering:t}):null},t}(),$m=function(){function t(t,e,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=t,this.props=e,this.children=n,this.props.children=n,e.ref&&(this.ref=e.ref,delete e.ref),e.key&&(this.key=e.key,delete e.key)}return t.prototype.walker=function(){return new Vm(this)},t.removalNodes=[],t}();function Um(t,e){var n,r=t;qm()(t)||null==t?r=null:(Pt()(t)||Ft()(t))&&(n=String(t),r=new $m("TEXT_NODE",{nodeValue:n},[])),r&&e.push(r)}var Wm=function(t){for(var e,n,r=arguments,o=1,i="",s="",a=[0],c=function(t){1===o&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(t?r[t]:i):3===o&&(t||i)?(a[1]=t?r[t]:i,o=2):2===o&&"..."===i&&t?a[2]=pe(a[2]||{},r[t]):2===o&&i&&!t?(a[2]=a[2]||{})[i]=!0:o>=5&&(5===o?((a[2]=a[2]||{})[n]=t?i?i+r[t]:r[t]:i,o=6):(t||i)&&(a[2][n]+=t?i+r[t]:i)),i=""},l=0;l<t.length;l++){l&&(1===o&&c(),c(l));for(var u=0;u<t[l].length;u++)e=t[l][u],1===o?"<"===e?(c(),a=[a,"",null],o=3):i+=e:4===o?"--"===i&&">"===e?(o=1,i=""):i=e+i[0]:s?e===s?s="":i+=e:'"'===e||"'"===e?s=e:">"===e?(c(),o=1):o&&("="===e?(o=5,n=i,i=""):"/"===e&&(o<5||">"===t[l][u+1])?(c(),3===o&&(a=a[0]),o=a,(a=a[0]).push(this.apply(null,o.slice(1))),o=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(c(),o=2):i+=e),3===o&&"!--"===i&&(o=4,a=a[0])}return c(),a.length>2?a.slice(1):a[1]}.bind((function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=[];return n.forEach((function(t){Array.isArray(t)?t.forEach((function(t){Um(t,o)})):Um(t,o)})),new $m(t,e||{},o)})),Jm=n(73),Gm=n.n(Jm);function Km(t){var e;return"TEXT_NODE"===t.type?e=document.createTextNode(t.props.nodeValue):Ym(e=document.createElement(t.type),{},t.props),e}function Zm(t,e){t.node?e.removeChild(t.node):Zm(t.firstChild,e)}function Xm(t,e,n){Object.keys(e).forEach((function(r){if(/^on/.test(r)){if(!n[r]||e[r]!==n[r]){var o=r.slice(2).toLowerCase();t.removeEventListener(o,e[r])}}else"children"===r||n[r]||function(t){return(null==t?void 0:t.nodeType)===Node.TEXT_NODE}(t)||t.removeAttribute(r)})),Ym(t,e,n,(function(t){return!ie(e[t],n[t])}))}var Qm=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function Ym(t,e,n,r){Object.keys(n).forEach((function(o){if(!r||r(o))if(/^on/.test(o)){var i=o.slice(2).toLowerCase();t.addEventListener(i,n[o])}else"nodeValue"===o?t[o]=n[o]:"style"===o&&Gm()(n[o])?function(t,e,n){e&&Object.keys(e).forEach((function(e){t.style[e]=""}));Object.keys(n).forEach((function(e){var r=n[e];t.style[e]=Ft()(r)&&!Qm.test(e)?r+"px":r}))}(t,e[o],n[o]):"children"!==o&&(!1===n[o]?t.removeAttribute(o):t.setAttribute(o,n[o]))}))}function tv(t){if($m.removalNodes.forEach((function(t){return nv(t)})),t)for(var e=void 0,n=t.walker();e=n.walk();)if(t=e.vnode,e.entering)nv(t);else if(da()(t.type)){var r=t.component;if(!t.old&&r.mounted&&r.mounted(),t.old&&r.updated){var o=r.prevProps||{};r.updated(o)}}}function ev(t){for(var e=t.parent;!e.node;)e=e.parent;return e.node}function nv(t){if(t&&t.parent){if(t.node){var e=ev(t);"A"===t.effect?e.appendChild(t.node):"U"===t.effect&&Xm(t.node,t.old.props,t.props)}if("D"===t.effect)for(var n=void 0,r=t.walker();n=r.walk();)if(t=n.vnode,!n.entering)if(da()(t.type)){var o=t.component;o.beforeDestroy&&o.beforeDestroy()}else{Zm(t,e=ev(t))}t.ref&&(t.component?t.ref(t.component):t.node&&t.ref(t.node))}}function rv(t,e){var n=e.props,r=e.component;return r?(r.prevProps=r.props,r.props=e.props,r):new t(n)}function ov(t){for(var e=t;t&&!t.skip;){if(da()(t.type)){var n=rv(t.type,t);n.vnode=t,t.component=n,t.props.children=t.children=[n.render()],iv(t)}else t.node||(t.node=Km(t)),iv(t);if(t.firstChild)t=t.firstChild;else{for(;t&&t.parent&&!t.next&&(t=t.parent)!==e;);t=t.next}}}function iv(t){var e=t.children,n=t.old?t.old.firstChild:null,r=null;e.forEach((function(e,o){var i=function(t,e){return t&&e&&e.type===t.type&&(!e.key||e.key===t.key)}(n,e);i&&(e.old=n,e.parent=t,e.node=n.node,e.component=n.component,e.effect="U"),e&&!i&&(e.old=null,e.parent=t,e.node=null,e.effect="A"),n&&!i&&($m.removalNodes.push(n),n.effect="D"),n&&(n=n.next),0===o?t.firstChild=e:e&&(r.next=e),r=e}));var o=se(e);if(!e.length)for(;n;)$m.removalNodes.push(n),n.effect="D",n=n.next;for(;n&&o;)n&&o.old!==n&&($m.removalNodes.push(n),n.effect="D",n=n.next)}function sv(t,e){var n=new $m(t.tagName.toLowerCase(),{},[e]);return n.node=t,$m.removalNodes=[],ov(n),tv(n),function(){return function(t){t.effect="D",$m.removalNodes=[t],tv(),$m.removalNodes=[]}(n.firstChild)}}var av,cv=function(){function t(t){this.props=t,this.state={},this.refs={}}return t.prototype.setState=function(t){var e=o(o({},this.state),t);ie(this.state,e)||(this.state=e,function(t){var e=t.vnode;e.effect="U",e.old=e,e.next&&(e.next.skip=!0),$m.removalNodes=[],ov(e),tv(e),e.next&&(e.next.skip=!1)}(this))},t}(),lv=function(t){function n(e){var n=t.call(this,e)||this;return n.state={hide:!1},n}return e(n,t),n.prototype.show=function(){this.setState({hide:!1})},n.prototype.hide=function(){this.setState({hide:!0})},n.prototype.render=function(){var t=this.props,e=t.editorType,n=t.eventEmitter;return Wm(av||(av=s(['\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 "])),Da("mode-switch"),this.state.hide?"none":"block","markdown"===e?" active":"",(function(){n.emit("needChangeMode","markdown")}),qf.get("Markdown"),"wysiwyg"===e?" active":"",(function(){n.emit("needChangeMode","wysiwyg")}),qf.get("WYSIWYG"))},n}(cv),uv=n(423),pv=n.n(uv),dv=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some((function(t,r){return t[0]===e&&(n=r,!0)})),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];t.call(e,o[1],o[0])}},e}()}(),fv="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,hv=void 0!==n.g&&n.g.Math===Math?n.g:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),mv="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(hv):function(t){return setTimeout((function(){return t(Date.now())}),1e3/60)};var vv=["top","right","bottom","left","width","height","size","weight"],gv="undefined"!=typeof MutationObserver,yv=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,r=!1,o=0;function i(){n&&(n=!1,t()),r&&a()}function s(){mv(i)}function a(){var t=Date.now();if(n){if(t-o<2)return;r=!0}else n=!0,r=!1,setTimeout(s,e);o=t}return a}(this.refresh.bind(this),20)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter((function(t){return t.gatherActive(),t.hasActive()}));return t.forEach((function(t){return t.broadcastActive()})),t.length>0},t.prototype.connect_=function(){fv&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),gv?(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)},t.prototype.disconnect_=function(){fv&&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)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;vv.some((function(t){return!!~n.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),bv=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},wv=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||hv},kv=Ev(0,0,0,0);function xv(t){return parseFloat(t)||0}function Cv(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce((function(e,n){return e+xv(t["border-"+n+"-width"])}),0)}function Tv(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return kv;var r=wv(t).getComputedStyle(t),o=function(t){for(var e={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],i=t["padding-"+o];e[o]=xv(i)}return e}(r),i=o.left+o.right,s=o.top+o.bottom,a=xv(r.width),c=xv(r.height);if("border-box"===r.boxSizing&&(Math.round(a+i)!==e&&(a-=Cv(r,"left","right")+i),Math.round(c+s)!==n&&(c-=Cv(r,"top","bottom")+s)),!function(t){return t===wv(t).document.documentElement}(t)){var l=Math.round(a+i)-e,u=Math.round(c+s)-n;1!==Math.abs(l)&&(a-=l),1!==Math.abs(u)&&(c-=u)}return Ev(o.left,o.top,a,c)}var Mv="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof wv(t).SVGGraphicsElement}:function(t){return t instanceof wv(t).SVGElement&&"function"==typeof t.getBBox};function Sv(t){return fv?Mv(t)?function(t){var e=t.getBBox();return Ev(0,0,e.width,e.height)}(t):Tv(t):kv}function Ev(t,e,n,r){return{x:t,y:e,width:n,height:r}}var Nv=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ev(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=Sv(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),Ov=function(t,e){var n=function(t){var e=t.x,n=t.y,r=t.width,o=t.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(i.prototype);return bv(s,{x:e,y:n,width:r,height:o,top:n,right:e+r,bottom:o+n,left:e}),s}(e);bv(this,{target:t,contentRect:n})},Dv=function(){function t(t,e,n){if(this.activeObservations_=[],this.observations_=new dv,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof wv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Nv(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof wv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach((function(e){e.isActive()&&t.activeObservations_.push(e)}))},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map((function(t){return new Ov(t.target,t.broadcastRect())}));this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Av="undefined"!=typeof WeakMap?new WeakMap:new dv,Lv=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=yv.getInstance(),r=new Dv(e,n,this);Av.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){Lv.prototype[t]=function(){var e;return(e=Av.get(this))[t].apply(e,arguments)}}));var Iv,Rv,Pv,Bv,Fv,Hv,zv,jv,_v,qv,Vv,$v,Uv,Wv,Jv,Gv,Kv=void 0!==hv.ResizeObserver?hv.ResizeObserver:Lv,Zv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.execCommand=function(t){var e=Fa(t.target,"li");this.props.execCommand("heading",{level:Number(e.getAttribute("data-level"))})},n.prototype.render=function(){var t=this;return Wm(Rv||(Rv=s(["\n <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(e){return t.execCommand(e)}),qf.get("Headings"),[1,2,3,4,5,6].map((function(t){return Wm(Iv||(Iv=s(['\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 "])),t,"h"+t,qf.get("Heading"),t)})),qf.get("Paragraph"))},n}(cv),Xv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.toggleTab=function(t,e){this.props.onClick(t,e)},n.prototype.render=function(){var t=this;return Wm(Bv||(Bv=s(['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "],['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "])),Da("tabs"),this.props.tabs.map((function(e){var n=e.name,r=e.text,o=t.props.activeTab===n;return Wm(Pv||(Pv=s(['\n <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(e){return t.toggleTab(e,n)}),qf.get(r),o?"true":"false",o?"0":"-1",qf.get(r))})))},n}(cv),Qv=function(t){function n(e){var n=t.call(this,e)||this;return n.initialize=function(t){void 0===t&&(t="file");var e=n.refs.url;e.value="",n.refs.altText.value="",n.refs.file.value="",It()(e,"wrong"),n.setState({activeTab:t,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(t,e){e!==n.state.activeTab&&n.initialize(e)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(t){var e=t.target.files;(null==e?void 0:e.length)&&n.setState({file:e[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return e(n,t),n.prototype.emitAddImageBlob=function(){var t=this,e=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null==e?void 0:e.length){r="";var o=e.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,(function(e,r){return t.props.execCommand("addImage",{imageUrl:e,altText:r||n.value})}),"ui")}this.setState({fileNameElClassName:r})},n.prototype.emitAddImage=function(){var t=this.refs.url,e=this.refs.altText,n=t.value,r=e.value||"image";It()(t,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):At()(t,"wrong")},n.prototype.preventSelectStart=function(t){t.preventDefault()},n.prototype.updated=function(){this.props.show||this.initialize()},n.prototype.render=function(){var t=this,e=this.state,n=e.activeTab,r=e.file,o=e.fileNameElClassName;return Wm(Fv||(Fv=s(['\n <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 "])),qf.get("Insert image"),Xv,this.tabs,n,this.toggleTab,"url"===n?"block":"none",qf.get("Image URL"),(function(e){return t.refs.url=e}),"file"===n?"block":"none",qf.get("Select image file"),Da("file-name"),r?" has-file":o,this.showFileSelectBox,this.preventSelectStart,r?r.name:qf.get("No file"),Da("file-select-button"),this.showFileSelectBox,qf.get("Choose a file"),this.changeFile,(function(e){return t.refs.file=e}),qf.get("Description"),(function(e){return t.refs.altText=e}),Da("button-container"),Da("close-button"),this.props.hidePopup,qf.get("Cancel"),Da("ok-button"),this.execCommand,qf.get("OK"))},n}(cv),Yv=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.execCommand=function(){var t=e.refs.url,n=e.refs.text;(It()(t,"wrong"),It()(n,"wrong"),t.value.length<1)?At()(t,"wrong"):zt()(e.props.initialValues.linkUrl)&&n.value.length<1?At()(n,"wrong"):e.props.execCommand("addLink",{linkUrl:t.value,linkText:n.value})},e}return e(n,t),n.prototype.initialize=function(){var t=this.props.initialValues,e=t.linkUrl,n=t.linkText,r=this.refs.url,o=this.refs.text;It()(r,"wrong"),It()(o,"wrong","disabled"),o.removeAttribute("disabled"),e&&(At()(o,"disabled"),o.setAttribute("disabled","disabled")),r.value=e||"",o.value=n||""},n.prototype.mounted=function(){this.initialize()},n.prototype.updated=function(t){!t.show&&this.props.show&&this.initialize()},n.prototype.render=function(){var t=this;return Wm(Hv||(Hv=s(['\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 "])),qf.get("Insert link"),qf.get("URL"),(function(e){return t.refs.url=e}),qf.get("Link text"),(function(e){return t.refs.text=e}),Da("button-container"),Da("close-button"),this.props.hidePopup,qf.get("Cancel"),Da("ok-button"),this.execCommand,qf.get("OK"))},n}(cv),tg=function(t){function n(e){var n=t.call(this,e)||this;return n.extendSelectionRange=function(t){var e=t.pageX,r=t.pageY,i=e-n.offsetRect.left,s=r-n.offsetRect.top,a=n.getSelectionRangeByOffset(i,s);n.setState(o({},a))},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 e(n,t),n.prototype.getDescription=function(){return-1===this.state.colIdx?"":this.state.colIdx+1+" x "+(this.state.rowIdx+1)},n.prototype.getBoundByRange=function(t,e){return{width:20*(t+1),height:20*(e+1)}},n.prototype.getRangeByOffset=function(t,e){return{colIdx:Math.floor(t/20),rowIdx:Math.floor(e/20)}},n.prototype.getTableRange=function(){var t=this.state,e=t.colIdx,n=t.rowIdx,r=Math.max(e,5),o=Math.max(n,5);return e>=5&&r<9&&(r+=1),n>=5&&o<14&&(o+=1),{colIdx:r+1,rowIdx:o+1}},n.prototype.getSelectionAreaBound=function(){var t=this.getBoundByRange(this.state.colIdx,this.state.rowIdx),e=t.width,n=t.height;return e||n?{width:e-1,height:n-1,display:"block"}:{display:"none"}},n.prototype.getSelectionRangeByOffset=function(t,e){var n=this.getRangeByOffset(t,e);return n.rowIdx=Math.min(Math.max(n.rowIdx,1),14),n.colIdx=Math.min(Math.max(n.colIdx,1),9),n},n.prototype.updated=function(){if(this.props.show){if(-1===this.state.colIdx&&-1===this.state.rowIdx){var t=this.refs.tableEl.getBoundingClientRect(),e=t.left,n=t.top;this.offsetRect={left:window.pageXOffset+e,top:window.pageYOffset+n}}}else this.setState({colIdx:-1,rowIdx:-1})},n.prototype.createTableArea=function(t){for(var e=t.colIdx,n=t.rowIdx,r=[],o=0;o<n;o+=1){for(var i=[],a=0;a<e;a+=1){var c=Da("table-cell")+(o>0?"":" header");i.push(Wm(zv||(zv=s(['<div class="','"></div>'],['<div class="','"></div>'])),c))}r.push(Wm(jv||(jv=s(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Da("table-row"),i))}return Wm(_v||(_v=s(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Da("table"),r)},n.prototype.render=function(){var t=this,e=this.getTableRange(),n=this.getSelectionAreaBound();return Wm(qv||(qv=s(['\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 "])),qf.get("Insert table"),Da("table-selection"),(function(e){return t.refs.tableEl=e}),this.extendSelectionRange,this.execCommand,this.createTableArea(e),Da("table-selection-layer"),n,Da("table-description"),this.getDescription())},n}(cv),eg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},n.prototype.updated=function(t){this.refs.el.replaceChild(this.props.body,t.body)},n.prototype.render=function(){var t=this;return Wm(Vv||(Vv=s(["<div ref=","></div>"],["<div ref=","></div>"])),(function(e){return t.refs.el=e}))},n}(cv);function ng(t){return Pt()(t)?function(t){var e;switch(t){case"heading":e={name:"heading",className:"heading",tooltip:qf.get("Headings"),state:"heading"};break;case"bold":e={name:"bold",className:"bold",command:"bold",tooltip:qf.get("Bold"),state:"strong"};break;case"italic":e={name:"italic",className:"italic",command:"italic",tooltip:qf.get("Italic"),state:"emph"};break;case"strike":e={name:"strike",className:"strike",command:"strike",tooltip:qf.get("Strike"),state:"strike"};break;case"hr":e={name:"hr",className:"hrline",command:"hr",tooltip:qf.get("Line"),state:"thematicBreak"};break;case"quote":e={name:"quote",className:"quote",command:"blockQuote",tooltip:qf.get("Blockquote"),state:"blockQuote"};break;case"ul":e={name:"ul",className:"bullet-list",command:"bulletList",tooltip:qf.get("Unordered list"),state:"bulletList"};break;case"ol":e={name:"ol",className:"ordered-list",command:"orderedList",tooltip:qf.get("Ordered list"),state:"orderedList"};break;case"task":e={name:"task",className:"task-list",command:"taskList",tooltip:qf.get("Task"),state:"taskList"};break;case"table":e={name:"table",className:"table",tooltip:qf.get("Insert table"),state:"table"};break;case"image":e={name:"image",className:"image",tooltip:qf.get("Insert image")};break;case"link":e={name:"link",className:"link",tooltip:qf.get("Insert link")};break;case"code":e={name:"code",className:"code",command:"code",tooltip:qf.get("Code"),state:"code"};break;case"codeblock":e={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:qf.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":e={name:"indent",className:"indent",command:"indent",tooltip:qf.get("Indent")};break;case"outdent":e={name:"outdent",className:"outdent",command:"outdent",tooltip:qf.get("Outdent")};break;case"scrollSync":e=function(){var t=document.createElement("label"),e=document.createElement("input"),n=document.createElement("span");t.className="scroll-sync active",e.type="checkbox",e.checked=!0,n.className="switch";var r=function(n){return e.addEventListener("change",(function(e){var r=e.target.checked;r?At()(t,"active"):It()(t,"active"),n("toggleScrollSync",{active:r})}))};return t.appendChild(e),t.appendChild(n),{name:"scrollSync",el:t,onMounted:r}}();break;case"more":e={name:"more",className:"more",tooltip:qf.get("More")}}"scrollSync"!==e.name&&(e.className+=" "+Da("toolbar-icons"));return e}(t):t}function rg(t,e){var n=e.el,r=e.pos,i=e.popup,a=e.initialValues;switch(t){case"heading":return{render:function(t){return Wm($v||($v=s(["<"," ..."," />"],["<"," ..."," />"])),Zv,t)},className:Da("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(t){return Wm(Uv||(Uv=s(["<"," ..."," />"],["<"," ..."," />"])),Yv,t)},className:Da("popup-add-link"),fromEl:n,pos:r,initialValues:a};case"image":return{render:function(t){return Wm(Wv||(Wv=s(["<"," ..."," />"],["<"," ..."," />"])),Qv,t)},className:Da("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(t){return Wm(Jv||(Jv=s(["<"," ..."," />"],["<"," ..."," />"])),tg,t)},className:Da("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return i?o({render:function(t){return Wm(Gv||(Gv=s(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),eg,t,i.body)},fromEl:n,pos:r},i):null;default:return null}}function og(t){t.hidden=t.length===t.filter((function(t){return t.hidden})).length}function ig(t,e){return t.reduce((function(t,n){t.push(n.map((function(t){return function(t){return t.hidden="scrollSync"===t.name&&e,t}(ng(t))})));var r=t[(t.length||1)-1];return r&&og(r),t}),[])}var sg,ag,cg=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleMousedown=function(t){Fa(t.target,"."+Da("popup"))||Fa(t.target,e.props.info.fromEl)||e.props.hidePopup()},e}return e(n,t),n.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},n.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},n.prototype.updated=function(t){var e=this.props,n=e.show,r=e.info;if(n&&r.pos&&t.show!==n){var i=o({},r.pos),s=this.refs.el.offsetWidth,a=Fa(this.refs.el,"."+Da("toolbar")).offsetWidth;i.left+s>=a&&(i.left=a-s-20),ie(this.state.popupPos,i)||this.setState({popupPos:i})}},n.prototype.render=function(){var t=this,e=this.props,n=e.info,r=e.show,i=e.hidePopup,a=e.eventEmitter,c=e.execCommand,l=n||{},u=l.className,p=void 0===u?"":u,d=l.style,f=l.render,h=l.initialValues,m=void 0===h?{}:h,v=o(o({display:r?"block":"none"},d),this.state.popupPos);return Wm(sg||(sg=s(['\n <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 "])),Da("popup"),p,v,(function(e){return t.refs.el=e}),Da("popup-body"),f&&f({eventEmitter:a,show:r,hidePopup:i,execCommand:c,initialValues:m}))},n}(cv);function lg(t){return function(n){function r(t){var e=n.call(this,t)||this;return e.showTooltip=function(t){var n=e.props.item.tooltip;if(!e.props.disabled&&n){var r=e.getBound(t),o=r.left+6+"px",i=r.top+6+"px";Ot()(e.props.tooltipRef.current,{display:"block",left:o,top:i}),e.props.tooltipRef.current.querySelector(".text").textContent=n}},e.hideTooltip=function(){Ot()(e.props.tooltipRef.current,"display","none")},e.state={active:!1},e.addEvent(),e}return e(r,n),r.prototype.addEvent=function(){var t=this,e=this.props,n=e.item,r=e.eventEmitter;n.state&&r.listen("changeToolbarState",(function(e){var r=!!e.toolbarState[n.state];t.setState({active:r})}))},r.prototype.getBound=function(t){var e=Ha(t,Fa(t,"."+Da("toolbar"))),n=e.offsetLeft,r=e.offsetTop;return{left:n,top:t.offsetHeight+r}},r.prototype.render=function(){return Wm(ag||(ag=s(["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "],["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n />\n "])),t,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound)},r}(cv)}var ug,pg,dg,fg,hg,mg,vg,gg,yg,bg,wg,kg,xg,Cg,Tg=lg(function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.execCommand=function(){var t=e.props,n=t.item,r=t.execCommand,o=t.setPopupInfo,i=t.getBound,s=t.eventEmitter,a=n.command,c=n.name,l=n.popup;if(a)r(a);else{var u=l?"customPopupBody":c,p=s.emit("query","getPopupInitialValues",{popupName:u})[0],d=rg(u,{el:e.refs.el,pos:i(e.refs.el),popup:l,initialValues:p});d&&o(d)}},e}return e(n,t),n.prototype.mounted=function(){this.setItemWidth()},n.prototype.updated=function(t){t.item.name!==this.props.item.name&&this.setItemWidth()},n.prototype.setItemWidth=function(){var t=this.props,e=t.setItemWidth,n=t.item;e&&e(n.name,Ba(this.refs.el)+(n.hidden?80:0))},n.prototype.render=function(){var t=this,e=this.props,n=e.hideTooltip,r=e.disabled,i=e.item,a=e.active,c=o({display:i.hidden?"none":null},i.style),l=(i.className||"")+(a?" active":"");return Wm(ug||(ug=s(["\n <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(e){return t.refs.el=e}),c,l,this.execCommand,this.showTooltip,n,!!r,i.text||i.tooltip||"",i.text||"")},n}(cv)),Mg=lg(function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.showPopup=function(){var t=rg("customPopupBody",{el:e.refs.el,pos:e.props.getBound(e.refs.el),popup:e.props.item.popup});t&&e.props.setPopupInfo(t)},e}return e(n,t),n.prototype.mounted=function(){var t=this.props,e=t.setItemWidth,n=t.item;this.refs.el.appendChild(n.el),e&&e(n.name,Ba(this.refs.el)),n.onMounted&&n.onMounted(this.props.execCommand)},n.prototype.updated=function(t){var e,n=this.props,r=n.item,o=n.active,i=n.disabled;t.active===o&&t.disabled===i||null===(e=r.onUpdated)||void 0===e||e.call(r,{active:o,disabled:i})},n.prototype.render=function(){var t=this,e=this.props,n=e.disabled,r={display:e.item.hidden?"none":"inline-block"},o=function(t){return n?null:t};return Wm(pg||(pg=s(["\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(e){return t.refs.el=e}),r,Da("toolbar-item-wrapper"),o(this.showPopup),o(this.showTooltip),o(this.props.hideTooltip))},n}(cv)),Sg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.render=function(){var t=this,e=this.props,n=e.group,r=e.hiddenDivider,o=n.hidden?{display:"none"}:null,i=r?{display:"none"}:null;return Wm(fg||(fg=s(['\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 "])),Da("toolbar-group"),o,n.map((function(e){var n=e.el?Mg:Tg;return Wm(dg||(dg=s(["<"," key="," ..."," item="," />"],["<"," key="," ..."," item="," />"])),n,e.name,t.props,e)})),Da("toolbar-divider"),i)},n}(cv),Eg=lg(function(t){function n(e){var n=t.call(this,e)||this;return n.handleClickDocument=function(t){var e=t.target;Fa(e,"."+Da("dropdown-toolbar"))||Fa(e,".more")||n.setState({showDropdown:!1,dropdownPos:null})},n.showTooltip=function(){n.props.showTooltip(n.refs.el)},n.state={showDropdown:!1,dropdownPos:null},n}return e(n,t),n.prototype.getBound=function(){var t=this.props.getBound(this.refs.el);return t.top+=4,o(o({},t),{left:null,right:10})},n.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},n.prototype.updated=function(){this.state.showDropdown&&!this.state.dropdownPos&&this.setState({dropdownPos:this.getBound()})},n.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},n.prototype.render=function(){var t=this,e=this.state,n=e.showDropdown,r=e.dropdownPos,i=this.props,a=i.disabled,c=i.item,l=i.items,u=i.hideTooltip,p=l.filter((function(t){return!t.hidden})),d=p.length?null:{display:"none"},f=n?null:{display:"none"};return Wm(mg||(mg=s(['\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 "])),Da("toolbar-group"),d,(function(e){return t.refs.el=e}),c.className,(function(){return t.setState({showDropdown:!0})}),this.showTooltip,u,a,Da("dropdown-toolbar"),o(o({},f),r),(function(e){return t.refs.dropdownEl=e}),p.length?p.map((function(e,n){var r;return Wm(hg||(hg=s(["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "])),Sg,e,n===p.length-1||(null===(r=p[n+1])||void 0===r?void 0:r.hidden),t.props)})):null)},n}(cv)),Ng=function(t){function n(e){var n=t.call(this,e)||this;return n.toggleTab=function(t,e){var r=n.props.eventEmitter;if(n.state.activeTab!==e){var o="write"===e?"changePreviewTabWrite":"changePreviewTabPreview";r.emit(o),n.setState({activeTab:e})}},n.setItemWidth=function(t,e){n.itemWidthMap[t]=e},n.setPopupInfo=function(t){n.setState({showPopup:!0,popupInfo:t})},n.openPopup=function(t,e){void 0===e&&(e={});var r=document.querySelector("."+Da("toolbar-group")+" ."+t);if(r){var o=Ha(r,Fa(r,"."+Da("toolbar"))),i=o.offsetLeft,s=o.offsetTop,a=rg(t,{el:r,pos:{left:i,top:r.offsetHeight+s},initialValues:e});a&&n.setPopupInfo(a)}},n.hidePopup=function(){n.state.showPopup&&n.setState({showPopup:!1})},n.execCommand=function(t,e){n.props.eventEmitter.emit("command",t,e),n.hidePopup()},n.tabs=[{name:"write",text:"Write"},{name:"preview",text:"Preview"}],n.itemWidthMap={},n.initialItems=ig(e.toolbarItems||[],n.hiddenScrollSync()),n.state={items:n.initialItems,dropdownItems:[],showPopup:!1,popupInfo:{},activeTab:"write"},n.tooltipRef={current:null},n.resizeObserver=new Kv((function(){return n.handleResize()})),n.addEvent(),n}return e(n,t),n.prototype.insertToolbarItem=function(t,e){var n=t.groupIndex,r=t.itemIndex,o=this.initialItems[n];e=ng(e),o?o.splice(r,0,e):this.initialItems.push([e]),this.setState(this.classifyToolbarItems())},n.prototype.removeToolbarItem=function(t){var e=this;ta()(this.initialItems,(function(n){var r=!1;return ta()(n,(function(o,i){return o.name!==t||(r=!0,n.splice(i,1),e.setState(e.classifyToolbarItems()),!1)})),!r}))},n.prototype.addEvent=function(){var t=this,e=this.props.eventEmitter;this.handleResize=pv()((function(){t.setState({items:t.initialItems,dropdownItems:[]}),t.setState(t.classifyToolbarItems())}),200),e.listen("openPopup",this.openPopup)},n.prototype.appendTooltipToRoot=function(){var t='<div class="'+Da("tooltip")+'" style="display:none">\n <div class="arrow"></div>\n <span class="text"></span>\n </div>';this.tooltipRef.current=Pa(t,this.refs.el)},n.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},n.prototype.movePrevItemToDropdownToolbar=function(t,e,n,r){var o=function(t){var e=t.pop();e&&r.push(e)};if(t>1)o(n);else{var i=se(e);i&&o(i)}},n.prototype.classifyToolbarItems=function(){var t=this,e=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+Da("toolbar-divider")),o=r?Ba(r):0,i=[],s=[],a=!1;return this.initialItems.forEach((function(r,c){var l=[],u=[];r.forEach((function(r,o){r.hidden||((e+=t.itemWidthMap[r.name])>n-50?(a||(t.movePrevItemToDropdownToolbar(o,i,l,u),a=!0),u.push(r)):l.push(r))})),l.length&&(og(l),i.push(l)),u.length&&(og(u),s.push(u)),c<t.state.items.length-1&&(e+=o)})),{items:i,dropdownItems:s}},n.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)},n.prototype.updated=function(t){var e,n,r=this.props,o=r.editorType,i=r.previewStyle,s=r.eventEmitter,a=i!==t.previewStyle,c=o!==t.editorType;if(a||c){e=this.initialItems,n=this.hiddenScrollSync(),e.forEach((function(t){t.forEach((function(t){return t.hidden="scrollSync"===t.name&&n})),og(t)}));var l=this.classifyToolbarItems();(a||"tab"===i&&"markdown"===o)&&(s.emit("changePreviewTabWrite"),l.activeTab="write"),this.setState(l)}},n.prototype.beforeDestroy=function(){window.removeEventListener("resize",this.handleResize),this.resizeObserver.disconnect(),Ia(this.tooltipRef.current)},n.prototype.render=function(){var t=this,e=this.props,n=e.previewStyle,r=e.eventEmitter,o=e.editorType,i=this.state,a=i.popupInfo,c=i.showPopup,l=i.activeTab,u=i.items,p=i.dropdownItems,d={eventEmitter:r,tooltipRef:this.tooltipRef,disabled:"markdown"===o&&"tab"===n&&"preview"===l,execCommand:this.execCommand,setPopupInfo:this.setPopupInfo},f="tab"===n?{borderTopLeftRadius:0}:null;return Wm(gg||(gg=s(['\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 "])),Da("toolbar"),Da("md-tab-container"),"wysiwyg"===o||"vertical"===n?"none":"block",Xv,this.tabs,l,this.toggleTab,Da("defaultUI-toolbar"),(function(e){return t.refs.el=e}),f,u.map((function(e,n){var r;return Wm(vg||(vg=s(["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "])),Sg,e,n===u.length-1||(null===(r=u[n+1])||void 0===r?void 0:r.hidden),t.setItemWidth,d)})),Eg,ng("more"),p,d,cg,a,c,r,this.hidePopup,this.execCommand)},n}(cv),Og=function(t){function n(e){var n=t.call(this,e)||this;return n.handleClickDocument=function(t){Fa(t.target,"."+Da("context-menu"))||n.setState({pos:null})},n.state={pos:null,menuGroups:[]},n.addEvent(),n}return e(n,t),n.prototype.addEvent=function(){var t=this;this.props.eventEmitter.listen("contextmenu",(function(e){var n=e.pos,r=e.menuGroups;t.setState({pos:n,menuGroups:r})}))},n.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},n.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},n.prototype.getMenuGroupElements=function(){var t=this,e=this.state,n=e.pos,r=e.menuGroups;return n?r.reduce((function(e,n){var r=[];return n.forEach((function(e){var n=e.label,o=e.className,i=void 0!==o&&o,a=e.disabled,c=e.onClick;r.push(Wm(yg||(yg=s(["\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(){a||(c(),t.setState({pos:null}))}),a?" disabled":"",i,n))})),e.push(Wm(bg||(bg=s(['<ul class="menu-group">\n ',"\n </ul>"],['<ul class="menu-group">\n ',"\n </ul>"])),r)),e}),[]):[]},n.prototype.render=function(){var t=o({display:this.state.pos?"block":"none"},this.state.pos);return Wm(wg||(wg=s(['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"],['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"])),Da("context-menu"),t,this.getMenuGroupElements())},n}(cv),Dg=function(t){function n(e){var n=t.call(this,e)||this;n.changeMode=function(t){t!==n.state.editorType&&n.setState({editorType:t})},n.changePreviewStyle=function(t){t!==n.state.previewStyle&&n.setState({previewStyle:t})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=e.editorType,o=e.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return e(n,t),n.prototype.mounted=function(){var t=this.props.slots,e=t.wwEditor,n=t.mdEditor,r=t.mdPreview;this.refs.wwContainer.appendChild(e),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},n.prototype.insertToolbarItem=function(t,e){this.toolbar.insertToolbarItem(t,e)},n.prototype.removeToolbarItem=function(t){this.toolbar.removeToolbarItem(t)},n.prototype.render=function(){var t=this,e=this.props,n=e.eventEmitter,r=e.hideModeSwitch,o=e.toolbarItems,i=e.theme,a=this.state,c=a.hide,l=a.previewStyle,u=a.editorType,p=c?" hidden":"",d=Da("markdown"===u?"md-mode":"ww-mode"),f=Da("md")+"-"+l+"-style",h=Da(["light"!==i,i+" "]);return Wm(xg||(xg=s(['\n <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,Da("defaultUI"),p,(function(e){return t.refs.el=e}),Ng,(function(e){return t.toolbar=e}),n,l,o,u,Da("main"),d,(function(e){return t.refs.editorSection=e}),Da("main-container"),Da("md-container"),f,(function(e){return t.refs.mdContainer=e}),Da("md-splitter"),Da("ww-container"),(function(e){return t.refs.wwContainer=e}),!r&&Wm(kg||(kg=s(["<"," eventEmitter="," editorType="," />"],["<"," eventEmitter="," editorType="," />"])),lv,n,u),Og,n)},n.prototype.addEvent=function(){var t=this.props.eventEmitter;t.listen("hide",this.hide),t.listen("show",this.show),t.listen("changeMode",this.changeMode),t.listen("changePreviewStyle",this.changePreviewStyle)},n}(cv),Ag=function(t){function n(e){var n,r,o=t.call(this,e)||this,i=sv(o.options.el,Wm(Cg||(Cg=s(["\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 "])),Dg,(function(t){return r=t}),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(t){var e=t.groupIndex,n=t.itemIndex,r=t.item;o.defaultUI.insertToolbarItem({groupIndex:e,itemIndex:n},r)})),o}return e(n,t),n.factory=function(t){return t.viewer?new Dm(t):new n(t)},n.prototype.insertToolbarItem=function(t,e){this.defaultUI.insertToolbarItem(t,e)},n.prototype.removeToolbarItem=function(t){this.defaultUI.removeToolbarItem(t)},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.defaultUI.destroy()},n}(jm);jm.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"});var Lg=Ag}(),r=r.default}()}));
|