138 lines
134 KiB
JavaScript
138 lines
134 KiB
JavaScript
|
const Lt=function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const o of c.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerpolicy&&(c.referrerPolicy=a.referrerpolicy),a.crossorigin==="use-credentials"?c.credentials="include":a.crossorigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(a){if(a.ep)return;a.ep=!0;const c=t(a);fetch(a.href,c)}};Lt();function Hr(e,u){const t=Object.create(null),r=e.split(",");for(let a=0;a<r.length;a++)t[r[a]]=!0;return u?a=>!!t[a.toLowerCase()]:a=>!!t[a]}const It="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Ht=Hr(It);function Ld(e){return!!e||e===""}function Or(e){if(q(e)){const u={};for(let t=0;t<e.length;t++){const r=e[t],a=me(r)?Bt(r):Or(r);if(a)for(const c in a)u[c]=a[c]}return u}else{if(me(e))return e;if(ce(e))return e}}const Ot=/;(?![^(]*\))/g,Rt=/:(.+)/;function Bt(e){const u={};return e.split(Ot).forEach(t=>{if(t){const r=t.split(Rt);r.length>1&&(u[r[0].trim()]=r[1].trim())}}),u}function Rr(e){let u="";if(me(e))u=e;else if(q(e))for(let t=0;t<e.length;t++){const r=Rr(e[t]);r&&(u+=r+" ")}else if(ce(e))for(const t in e)e[t]&&(u+=t+" ");return u.trim()}function Nt(e,u){if(e.length!==u.length)return!1;let t=!0;for(let r=0;t&&r<e.length;r++)t=Yu(e[r],u[r]);return t}function Yu(e,u){if(e===u)return!0;let t=ed(e),r=ed(u);if(t||r)return t&&r?e.getTime()===u.getTime():!1;if(t=Cu(e),r=Cu(u),t||r)return e===u;if(t=q(e),r=q(u),t||r)return t&&r?Nt(e,u):!1;if(t=ce(e),r=ce(u),t||r){if(!t||!r)return!1;const a=Object.keys(e).length,c=Object.keys(u).length;if(a!==c)return!1;for(const o in e){const p=e.hasOwnProperty(o),b=u.hasOwnProperty(o);if(p&&!b||!p&&b||!Yu(e[o],u[o]))return!1}}return String(e)===String(u)}function Id(e,u){return e.findIndex(t=>Yu(t,u))}const ir=e=>me(e)?e:e==null?"":q(e)||ce(e)&&(e.toString===Rd||!G(e.toString))?JSON.stringify(e,Hd,2):String(e),Hd=(e,u)=>u&&u.__v_isRef?Hd(e,u.value):iu(u)?{[`Map(${u.size})`]:[...u.entries()].reduce((t,[r,a])=>(t[`${r} =>`]=a,t),{})}:Qu(u)?{[`Set(${u.size})`]:[...u.values()]}:ce(u)&&!q(u)&&!Bd(u)?String(u):u,re={},cu=[],Se=()=>{},$t=()=>!1,Ft=/^on[^a-z]/,Xu=e=>Ft.test(e),Br=e=>e.startsWith("onUpdate:"),be=Object.assign,Nr=(e,u)=>{const t=e.indexOf(u);t>-1&&e.splice(t,1)},Ut=Object.prototype.hasOwnProperty,Y=(e,u)=>Ut.call(e,u),q=Array.isArray,iu=e=>Lu(e)==="[object Map]",Qu=e=>Lu(e)==="[object Set]",ed=e=>Lu(e)==="[object Date]",G=e=>typeof e=="function",me=e=>typeof e=="string",Cu=e=>typeof e=="symbol",ce=e=>e!==null&&typeof e=="object",Od=e=>ce(e)&&G(e.then)&&G(e.catch),Rd=Object.prototype.toString,Lu=e=>Rd.call(e),Dt=e=>Lu(e).slice(8,-1),Bd=e=>Lu(e)==="[object Object]",$r=e=>me(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,$u=Hr(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xu=e=>{const u=Object.create(null);return t=>u[t]||(u[t]=e(t))},Vt=/-(\w)/g,Ne=xu(e=>e.replace(Vt,(u,t)=>t?t.toUpperCase():"")),qt=/\B([A-Z])/g,pu=xu(e=>e.replace(qt,"-$1").toLowerCase()),er=xu(e=>e.charAt(0).toUpperCase()+e.slice(1)),or=xu(e=>e?`on${er(e)}`:""),Eu=(e,u)=>!Object.is(e,u),Fu=(e,u)=>{for(let t=0;t<e.length;t++)e[t](u)},qu=(e,u,t)=>{Object.defineProperty(e,u,{configurable:!0,enumerable:!1,value:t})},gr=e=>{const u=parseFloat(e);return isNaN(u)?e:u};let ud;const Kt=()=>ud||(ud=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Oe;class Wt{constructor(u=!1){this.active=!0,this.effects=[],this.cleanups=[],!u&&Oe&&(this.parent=Oe,this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}run(u){if(this.active){const t=Oe;try{return Oe=this,u()}finally{Oe=t}}}on(){Oe=this}off(){Oe=this.par
|
||
|
`),f=f.replace(/\r/g,`
|
||
|
`),f=f.replace(/\u00A0/g," "),s.smartIndentationFix&&(f=M(f)),f=`
|
||
|
|
||
|
`+f+`
|
||
|
|
||
|
`,f=r.subParser("detab")(f,s,k),f=f.replace(/^[ \t]+$/mg,""),r.helper.forEach(n,function(z){f=r.subParser("runExtension")(z,f,s,k)}),f=r.subParser("metadata")(f,s,k),f=r.subParser("hashPreCodeTags")(f,s,k),f=r.subParser("githubCodeBlocks")(f,s,k),f=r.subParser("hashHTMLBlocks")(f,s,k),f=r.subParser("hashCodeTags")(f,s,k),f=r.subParser("stripLinkDefinitions")(f,s,k),f=r.subParser("blockGamut")(f,s,k),f=r.subParser("unhashHTMLSpans")(f,s,k),f=r.subParser("unescapeSpecialChars")(f,s,k),f=f.replace(/¨D/g,"$$"),f=f.replace(/¨T/g,"\xA8"),f=r.subParser("completeHTMLDocument")(f,s,k),r.helper.forEach(i,function(z){f=r.subParser("runExtension")(z,f,s,k)}),h=k.metadata,f},this.makeMarkdown=this.makeMd=function(f,k){if(f=f.replace(/\r\n/g,`
|
||
|
`),f=f.replace(/\r/g,`
|
||
|
`),f=f.replace(/>[ \t]+</,">\xA8NBSP;<"),!k)if(window&&window.document)k=window.document;else throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");var z=k.createElement("div");z.innerHTML=f;var B={preList:we(z)};ae(z);for(var Z=z.childNodes,U="",se=0;se<Z.length;se++)U+=r.subParser("makeMarkdown.node")(Z[se],B);function ae(ie){for(var le=0;le<ie.childNodes.length;++le){var ne=ie.childNodes[le];ne.nodeType===3?!/\S/.test(ne.nodeValue)&&!/^[ ]+$/.test(ne.nodeValue)?(ie.removeChild(ne),--le):(ne.nodeValue=ne.nodeValue.split(`
|
||
|
`).join(" "),ne.nodeValue=ne.nodeValue.replace(/(\s)+/g,"$1")):ne.nodeType===1&&ae(ne)}}function we(ie){for(var le=ie.querySelectorAll("pre"),ne=[],oe=0;oe<le.length;++oe)if(le[oe].childElementCount===1&&le[oe].firstChild.tagName.toLowerCase()==="code"){var du=le[oe].firstChild.innerHTML.trim(),Le=le[oe].firstChild.getAttribute("data-language")||"";if(Le==="")for(var tu=le[oe].firstChild.className.split(" "),Ze=0;Ze<tu.length;++Ze){var l=tu[Ze].match(/^language-(.+)$/);if(l!==null){Le=l[1];break}}du=r.helper.unescapeHTMLEntities(du),ne.push(du),le[oe].outerHTML='<precode language="'+Le+'" precodenum="'+oe.toString()+'"></precode>'}else ne.push(le[oe].innerHTML),le[oe].innerHTML="",le[oe].setAttribute("prenum",oe.toString());return ne}return U},this.setOption=function(f,k){s[f]=k},this.getOption=function(f){return s[f]},this.getOptions=function(){return s},this.addExtension=function(f,k){k=k||null,T(f,k)},this.useExtension=function(f){T(f)},this.setFlavor=function(f){if(!b.hasOwnProperty(f))throw Error(f+" flavor was not found");var k=b[f];m=f;for(var z in k)k.hasOwnProperty(z)&&(s[z]=k[z])},this.getFlavor=function(){return m},this.removeExtension=function(f){r.helper.isArray(f)||(f=[f]);for(var k=0;k<f.length;++k){for(var z=f[k],B=0;B<n.length;++B)n[B]===z&&n.splice(B,1);for(var Z=0;Z<i.length;++Z)i[Z]===z&&i.splice(Z,1)}},this.getAllExtensions=function(){return{language:n,output:i}},this.getMetadata=function(f){return f?h.raw:h.parsed},this.getMetadataFormat=function(){return h.format},this._setMetadataPair=function(f,k){h.parsed[f]=k},this._setMetadataFormat=function(f){h.format=f},this._setMetadataRaw=function(f){h.raw=f}},r.subParser("anchors",function(d,s,n){d=n.converter._dispatch("anchors.before",d,s,n);var i=function(_,m,h,w,T,j,E){if(r.helper.isUndefined(E)&&(E=""),h=h.toLowerCase(),_.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)w="";else if(!w)if(h||(h=m.toLowerCase().replace(/ ?\n/g," ")),w="#"+h,!r.helper.isUndefined(n.gUrls[h]))w=n.gUrls[h],r.helper.isUndefined(n.gTitles[h])||(E=n.gTitles[h]);else return _;w=w.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var M='<a href="'+w+'"';return E!==""&&E!==null&&(E=E.replace(/"/g,"""),E=E.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),M+=' title="'+E+'"'),s.openLinksInNewWindow&&!/^#/.test(w)&&(M+=' rel="noopener noreferrer" target="\xA8E95Eblank"'),M+=">"+m+"</a>",M};return d=d.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,i),d=d.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,i),d=d.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,i),d=d.replace(/\[([^\[\]]+)]()()()()()/g,i),s.ghMentions&&(d=d.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi,function(_,m,h,w,T){if(h==="\\")return m+w;if(!r.helper.isString(s.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var j=s.ghMentionsLink.replace(/\{u}/g,T),E="";return s.openLinksInNewWindow&&(E=' rel="noopener noreferrer" target="\xA8E95Eblank"'),m+'<a href="'+j+'"'+E+">"+w+"</a>"})),d=n.converter._dispatch("anchors.after",d,s,n),d});var $=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,N=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,J=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,de=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,K=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,X=function(d){return function(s,n,i,_,m,h,w){i=i.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var T=i,j="",E="",M=n||"",f=w||"";return/^www\./i.test(i)&&(i=i.replace(/^www\./i,"http://www.")),d.excludeTrailingPunctuationFromURLs&&h&&(j=h),d.openLinksInNewWindow&&(E=' rel="noopener noreferrer" target="\xA8E95Eblank"'),M+'<a href="'+i+'"'+E+">"+T+"</a>"+j+f}},Ee=function(d,s){return
|
||
|
|
||
|
`;var i=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return s.splitAdjacentBlockquotes&&(i=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),d=d.replace(i,function(_){return _=_.replace(/^[ \t]*>[ \t]?/gm,""),_=_.replace(/¨0/g,""),_=_.replace(/^[ \t]+$/gm,""),_=r.subParser("githubCodeBlocks")(_,s,n),_=r.subParser("blockGamut")(_,s,n),_=_.replace(/(^|\n)/g,"$1 "),_=_.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(m,h){var w=h;return w=w.replace(/^ /mg,"\xA80"),w=w.replace(/¨0/g,""),w}),r.subParser("hashBlock")(`<blockquote>
|
||
|
`+_+`
|
||
|
</blockquote>`,s,n)}),d=n.converter._dispatch("blockQuotes.after",d,s,n),d}),r.subParser("codeBlocks",function(d,s,n){d=n.converter._dispatch("codeBlocks.before",d,s,n),d+="\xA80";var i=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;return d=d.replace(i,function(_,m,h){var w=m,T=h,j=`
|
||
|
`;return w=r.subParser("outdent")(w,s,n),w=r.subParser("encodeCode")(w,s,n),w=r.subParser("detab")(w,s,n),w=w.replace(/^\n+/g,""),w=w.replace(/\n+$/g,""),s.omitExtraWLInCodeBlocks&&(j=""),w="<pre><code>"+w+j+"</code></pre>",r.subParser("hashBlock")(w,s,n)+T}),d=d.replace(/¨0/,""),d=n.converter._dispatch("codeBlocks.after",d,s,n),d}),r.subParser("codeSpans",function(d,s,n){return d=n.converter._dispatch("codeSpans.before",d,s,n),typeof d=="undefined"&&(d=""),d=d.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(i,_,m,h){var w=h;return w=w.replace(/^([ \t]*)/g,""),w=w.replace(/[ \t]*$/g,""),w=r.subParser("encodeCode")(w,s,n),w=_+"<code>"+w+"</code>",w=r.subParser("hashHTMLSpans")(w,s,n),w}),d=n.converter._dispatch("codeSpans.after",d,s,n),d}),r.subParser("completeHTMLDocument",function(d,s,n){if(!s.completeHTMLDocument)return d;d=n.converter._dispatch("completeHTMLDocument.before",d,s,n);var i="html",_=`<!DOCTYPE HTML>
|
||
|
`,m="",h=`<meta charset="utf-8">
|
||
|
`,w="",T="";typeof n.metadata.parsed.doctype!="undefined"&&(_="<!DOCTYPE "+n.metadata.parsed.doctype+`>
|
||
|
`,i=n.metadata.parsed.doctype.toString().toLowerCase(),(i==="html"||i==="html5")&&(h='<meta charset="utf-8">'));for(var j in n.metadata.parsed)if(n.metadata.parsed.hasOwnProperty(j))switch(j.toLowerCase()){case"doctype":break;case"title":m="<title>"+n.metadata.parsed.title+`</title>
|
||
|
`;break;case"charset":i==="html"||i==="html5"?h='<meta charset="'+n.metadata.parsed.charset+`">
|
||
|
`:h='<meta name="charset" content="'+n.metadata.parsed.charset+`">
|
||
|
`;break;case"language":case"lang":w=' lang="'+n.metadata.parsed[j]+'"',T+='<meta name="'+j+'" content="'+n.metadata.parsed[j]+`">
|
||
|
`;break;default:T+='<meta name="'+j+'" content="'+n.metadata.parsed[j]+`">
|
||
|
`}return d=_+"<html"+w+`>
|
||
|
<head>
|
||
|
`+m+h+T+`</head>
|
||
|
<body>
|
||
|
`+d.trim()+`
|
||
|
</body>
|
||
|
</html>`,d=n.converter._dispatch("completeHTMLDocument.after",d,s,n),d}),r.subParser("detab",function(d,s,n){return d=n.converter._dispatch("detab.before",d,s,n),d=d.replace(/\t(?=\t)/g," "),d=d.replace(/\t/g,"\xA8A\xA8B"),d=d.replace(/¨B(.+?)¨A/g,function(i,_){for(var m=_,h=4-m.length%4,w=0;w<h;w++)m+=" ";return m}),d=d.replace(/¨A/g," "),d=d.replace(/¨B/g,""),d=n.converter._dispatch("detab.after",d,s,n),d}),r.subParser("ellipsis",function(d,s,n){return s.ellipsis&&(d=n.converter._dispatch("ellipsis.before",d,s,n),d=d.replace(/\.\.\./g,"\u2026"),d=n.converter._dispatch("ellipsis.after",d,s,n)),d}),r.subParser("emoji",function(d,s,n){if(!s.emoji)return d;d=n.converter._dispatch("emoji.before",d,s,n);var i=/:([\S]+?):/g;return d=d.replace(i,function(_,m){return r.helper.emojis.hasOwnProperty(m)?r.helper.emojis[m]:_}),d=n.converter._dispatch("emoji.after",d,s,n),d}),r.subParser("encodeAmpsAndAngles",function(d,s,n){return d=n.converter._dispatch("encodeAmpsAndAngles.before",d,s,n),d=d.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),d=d.replace(/<(?![a-z\/?$!])/gi,"<"),d=d.replace(/</g,"<"),d=d.replace(/>/g,">"),d=n.converter._dispatch("encodeAmpsAndAngles.after",d,s,n),d}),r.subParser("encodeBackslashEscapes",function(d,s,n){return d=n.converter._dispatch("encodeBackslashEscapes.before",d,s,n),d=d.replace(/\\(\\)/g,r.helper.escapeCharactersCallback),d=d.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g,r.helper.escapeCharactersCallback),d=n.converter._dispatch("encodeBackslashEscapes.after",d,s,n),d}),r.subParser("encodeCode",function(d,s,n){return d=n.converter._dispatch("encodeCode.before",d,s,n),d=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,r.helper.escapeCharactersCallback),d=n.converter._dispatch("encodeCode.after",d,s,n),d}),r.subParser("escapeSpecialCharsWithinTagAttributes",function(d,s,n){d=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",d,s,n);var i=/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,_=/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;return d=d.replace(i,function(m){return m.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),d=d.replace(_,function(m){return m.replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),d=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",d,s,n),d}),r.subParser("githubCodeBlocks",function(d,s,n){return s.ghCodeBlocks?(d=n.converter._dispatch("githubCodeBlocks.before",d,s,n),d+="\xA80",d=d.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(i,_,m,h){var w=s.omitExtraWLInCodeBlocks?"":`
|
||
|
`;return h=r.subParser("encodeCode")(h,s,n),h=r.subParser("detab")(h,s,n),h=h.replace(/^\n+/g,""),h=h.replace(/\n+$/g,""),h="<pre><code"+(m?' class="'+m+" language-"+m+'"':"")+">"+h+w+"</code></pre>",h=r.subParser("hashBlock")(h,s,n),`
|
||
|
|
||
|
\xA8G`+(n.ghCodeBlocks.push({text:i,codeblock:h})-1)+`G
|
||
|
|
||
|
`}),d=d.replace(/¨0/,""),n.converter._dispatch("githubCodeBlocks.after",d,s,n)):d}),r.subParser("hashBlock",function(d,s,n){return d=n.converter._dispatch("hashBlock.before",d,s,n),d=d.replace(/(^\n+|\n+$)/g,""),d=`
|
||
|
|
||
|
\xA8K`+(n.gHtmlBlocks.push(d)-1)+`K
|
||
|
|
||
|
`,d=n.converter._dispatch("hashBlock.after",d,s,n),d}),r.subParser("hashCodeTags",function(d,s,n){d=n.converter._dispatch("hashCodeTags.before",d,s,n);var i=function(_,m,h,w){var T=h+r.subParser("encodeCode")(m,s,n)+w;return"\xA8C"+(n.gHtmlSpans.push(T)-1)+"C"};return d=r.helper.replaceRecursiveRegExp(d,i,"<code\\b[^>]*>","</code>","gim"),d=n.converter._dispatch("hashCodeTags.after",d,s,n),d}),r.subParser("hashElement",function(d,s,n){return function(i,_){var m=_;return m=m.replace(/\n\n/g,`
|
||
|
`),m=m.replace(/^\n/,""),m=m.replace(/\n+$/g,""),m=`
|
||
|
|
||
|
\xA8K`+(n.gHtmlBlocks.push(m)-1)+`K
|
||
|
|
||
|
`,m}}),r.subParser("hashHTMLBlocks",function(d,s,n){d=n.converter._dispatch("hashHTMLBlocks.before",d,s,n);var i=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],_=function(f,k,z,B){var Z=f;return z.search(/\bmarkdown\b/)!==-1&&(Z=z+n.converter.makeHtml(k)+B),`
|
||
|
|
||
|
\xA8K`+(n.gHtmlBlocks.push(Z)-1)+`K
|
||
|
|
||
|
`};s.backslashEscapesHTMLTags&&(d=d.replace(/\\<(\/?[^>]+?)>/g,function(f,k){return"<"+k+">"}));for(var m=0;m<i.length;++m)for(var h,w=new RegExp("^ {0,3}(<"+i[m]+"\\b[^>]*>)","im"),T="<"+i[m]+"\\b[^>]*>",j="</"+i[m]+">";(h=r.helper.regexIndexOf(d,w))!==-1;){var E=r.helper.splitAtIndex(d,h),M=r.helper.replaceRecursiveRegExp(E[1],_,T,j,"im");if(M===E[1])break;d=E[0].concat(M)}return d=d.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(d,s,n)),d=r.helper.replaceRecursiveRegExp(d,function(f){return`
|
||
|
|
||
|
\xA8K`+(n.gHtmlBlocks.push(f)-1)+`K
|
||
|
|
||
|
`},"^ {0,3}<!--","-->","gm"),d=d.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(d,s,n)),d=n.converter._dispatch("hashHTMLBlocks.after",d,s,n),d}),r.subParser("hashHTMLSpans",function(d,s,n){d=n.converter._dispatch("hashHTMLSpans.before",d,s,n);function i(_){return"\xA8C"+(n.gHtmlSpans.push(_)-1)+"C"}return d=d.replace(/<[^>]+?\/>/gi,function(_){return i(_)}),d=d.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(_){return i(_)}),d=d.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(_){return i(_)}),d=d.replace(/<[^>]+?>/gi,function(_){return i(_)}),d=n.converter._dispatch("hashHTMLSpans.after",d,s,n),d}),r.subParser("unhashHTMLSpans",function(d,s,n){d=n.converter._dispatch("unhashHTMLSpans.before",d,s,n);for(var i=0;i<n.gHtmlSpans.length;++i){for(var _=n.gHtmlSpans[i],m=0;/¨C(\d+)C/.test(_);){var h=RegExp.$1;if(_=_.replace("\xA8C"+h+"C",n.gHtmlSpans[h]),m===10){console.error("maximum nesting of 10 spans reached!!!");break}++m}d=d.replace("\xA8C"+i+"C",_)}return d=n.converter._dispatch("unhashHTMLSpans.after",d,s,n),d}),r.subParser("hashPreCodeTags",function(d,s,n){d=n.converter._dispatch("hashPreCodeTags.before",d,s,n);var i=function(_,m,h,w){var T=h+r.subParser("encodeCode")(m,s,n)+w;return`
|
||
|
|
||
|
\xA8G`+(n.ghCodeBlocks.push({text:_,codeblock:T})-1)+`G
|
||
|
|
||
|
`};return d=r.helper.replaceRecursiveRegExp(d,i,"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),d=n.converter._dispatch("hashPreCodeTags.after",d,s,n),d}),r.subParser("headers",function(d,s,n){d=n.converter._dispatch("headers.before",d,s,n);var i=isNaN(parseInt(s.headerLevelStart))?1:parseInt(s.headerLevelStart),_=s.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,m=s.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;d=d.replace(_,function(T,j){var E=r.subParser("spanGamut")(j,s,n),M=s.noHeaderId?"":' id="'+w(j)+'"',f=i,k="<h"+f+M+">"+E+"</h"+f+">";return r.subParser("hashBlock")(k,s,n)}),d=d.replace(m,function(T,j){var E=r.subParser("spanGamut")(j,s,n),M=s.noHeaderId?"":' id="'+w(j)+'"',f=i+1,k="<h"+f+M+">"+E+"</h"+f+">";return r.subParser("hashBlock")(k,s,n)});var h=s.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;d=d.replace(h,function(T,j,E){var M=E;s.customizedHeaderId&&(M=E.replace(/\s?\{([^{]+?)}\s*$/,""));var f=r.subParser("spanGamut")(M,s,n),k=s.noHeaderId?"":' id="'+w(E)+'"',z=i-1+j.length,B="<h"+z+k+">"+f+"</h"+z+">";return r.subParser("hashBlock")(B,s,n)});function w(T){var j,E;if(s.customizedHeaderId){var M=T.match(/\{([^{]+?)}\s*$/);M&&M[1]&&(T=M[1])}return j=T,r.helper.isString(s.prefixHeaderId)?E=s.prefixHeaderId:s.prefixHeaderId===!0?E="section-":E="",s.rawPrefixHeaderId||(j=E+j),s.ghCompatibleHeaderId?j=j.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():s.rawHeaderId?j=j.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"\xA8").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():j=j.replace(/[^\w]/g,"").toLowerCase(),s.rawPrefixHeaderId&&(j=E+j),n.hashLinkCounts[j]?j=j+"-"+n.hashLinkCounts[j]++:n.hashLinkCounts[j]=1,j}return d=n.converter._dispatch("headers.after",d,s,n),d}),r.subParser("horizontalRule",function(d,s,n){d=n.converter._dispatch("horizontalRule.before",d,s,n);var i=r.subParser("hashBlock")("<hr />",s,n);return d=d.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,i),d=d.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,i),d=d.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,i),d=n.converter._dispatch("horizontalRule.after",d,s,n),d}),r.subParser("images",function(d,s,n){d=n.converter._dispatch("images.before",d,s,n);var i=/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,_=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,m=/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,h=/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,w=/!\[([^\[\]]+)]()()()()()/g;function T(E,M,f,k,z,B,Z,U){return k=k.replace(/\s/g,""),j(E,M,f,k,z,B,Z,U)}function j(E,M,f,k,z,B,Z,U){var se=n.gUrls,ae=n.gTitles,we=n.gDimensions;if(f=f.toLowerCase(),U||(U=""),E.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)k="";else if(k===""||k===null)if((f===""||f===null)&&(f=M.toLowerCase().replace(/ ?\n/g," ")),k="#"+f,!r.helper.isUndefined(se[f]))k=se[f],r.helper.isUndefined(ae[f])||(U=ae[f]),r.helper.isUndefined(we[f])||(z=we[f].width,B=we[f].height);else return E;M=M.replace(/"/g,""").replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),k=k.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var ie='<img src="'+k+'" alt="'+M+'"';return U&&r.helper.isString(U)&&(U=U.replace(/"/g,""").replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),ie+=' title="'+U+'"'),z&&B&&(z=z==="*"?"auto":z,B=B==="*"?"auto":B,ie+=' width="'+z+'"',ie+=' height="'+B+'"'),ie+=" />",ie}return d=d.replace(h,j),d=d.replace(m,T),d=d.replace(_,j),d=d.replace(i,j),d=d.replace(w,j),d=n.converter._dispatch("images.after",d,s,n),d}),r.subParser("italicsAndBold",function(d,s,n){d
|
||
|
`),h+="\xA80";var T=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,j=/\n[ \t]*\n(?!¨0)/.test(h);return s.disableForced4SpacesIndentedSublists&&(T=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),h=h.replace(T,function(E,M,f,k,z,B,Z){Z=Z&&Z.trim()!=="";var U=r.subParser("outdent")(z,s,n),se="";return B&&s.tasklists&&(se=' class="task-list-item" style="list-style-type: none;"',U=U.replace(/^[ \t]*\[(x|X| )?]/m,function(){var ae='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return Z&&(ae+=" checked"),ae+=">",ae})),U=U.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(ae){return"\xA8A"+ae}),M||U.search(/\n{2,}/)>-1?(U=r.subParser("githubCodeBlocks")(U,s,n),U=r.subParser("blockGamut")(U,s,n)):(U=r.subParser("lists")(U,s,n),U=U.replace(/\n$/,""),U=r.subParser("hashHTMLBlocks")(U,s,n),U=U.replace(/\n\n+/g,`
|
||
|
|
||
|
`),j?U=r.subParser("paragraphs")(U,s,n):U=r.subParser("spanGamut")(U,s,n)),U=U.replace("\xA8A",""),U="<li"+se+">"+U+`</li>
|
||
|
`,U}),h=h.replace(/¨0/g,""),n.gListLevel--,w&&(h=h.replace(/\s+$/,"")),h}function _(h,w){if(w==="ol"){var T=h.match(/^ *(\d+)\./);if(T&&T[1]!=="1")return' start="'+T[1]+'"'}return""}function m(h,w,T){var j=s.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,E=s.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,M=w==="ul"?j:E,f="";if(h.search(M)!==-1)(function z(B){var Z=B.search(M),U=_(h,w);Z!==-1?(f+=`
|
||
|
|
||
|
<`+w+U+`>
|
||
|
`+i(B.slice(0,Z),!!T)+"</"+w+`>
|
||
|
`,w=w==="ul"?"ol":"ul",M=w==="ul"?j:E,z(B.slice(Z))):f+=`
|
||
|
|
||
|
<`+w+U+`>
|
||
|
`+i(B,!!T)+"</"+w+`>
|
||
|
`})(h);else{var k=_(h,w);f=`
|
||
|
|
||
|
<`+w+k+`>
|
||
|
`+i(h,!!T)+"</"+w+`>
|
||
|
`}return f}return d=n.converter._dispatch("lists.before",d,s,n),d+="\xA80",n.gListLevel?d=d.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(h,w,T){var j=T.search(/[*+-]/g)>-1?"ul":"ol";return m(w,j,!0)}):d=d.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(h,w,T,j){var E=j.search(/[*+-]/g)>-1?"ul":"ol";return m(T,E,!1)}),d=d.replace(/¨0/,""),d=n.converter._dispatch("lists.after",d,s,n),d}),r.subParser("metadata",function(d,s,n){if(!s.metadata)return d;d=n.converter._dispatch("metadata.before",d,s,n);function i(_){n.metadata.raw=_,_=_.replace(/&/g,"&").replace(/"/g,"""),_=_.replace(/\n {4}/g," "),_.replace(/^([\S ]+): +([\s\S]+?)$/gm,function(m,h,w){return n.metadata.parsed[h]=w,""})}return d=d.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(_,m,h){return i(h),"\xA8M"}),d=d.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(_,m,h){return m&&(n.metadata.format=m),i(h),"\xA8M"}),d=d.replace(/¨M/g,""),d=n.converter._dispatch("metadata.after",d,s,n),d}),r.subParser("outdent",function(d,s,n){return d=n.converter._dispatch("outdent.before",d,s,n),d=d.replace(/^(\t|[ ]{1,4})/gm,"\xA80"),d=d.replace(/¨0/g,""),d=n.converter._dispatch("outdent.after",d,s,n),d}),r.subParser("paragraphs",function(d,s,n){d=n.converter._dispatch("paragraphs.before",d,s,n),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,"");for(var i=d.split(/\n{2,}/g),_=[],m=i.length,h=0;h<m;h++){var w=i[h];w.search(/¨(K|G)(\d+)\1/g)>=0?_.push(w):w.search(/\S/)>=0&&(w=r.subParser("spanGamut")(w,s,n),w=w.replace(/^([ \t]*)/g,"<p>"),w+="</p>",_.push(w))}for(m=_.length,h=0;h<m;h++){for(var T="",j=_[h],E=!1;/¨(K|G)(\d+)\1/.test(j);){var M=RegExp.$1,f=RegExp.$2;M==="K"?T=n.gHtmlBlocks[f]:E?T=r.subParser("encodeCode")(n.ghCodeBlocks[f].text,s,n):T=n.ghCodeBlocks[f].codeblock,T=T.replace(/\$/g,"$$$$"),j=j.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,T),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(j)&&(E=!0)}_[h]=j}return d=_.join(`
|
||
|
`),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),n.converter._dispatch("paragraphs.after",d,s,n)}),r.subParser("runExtension",function(d,s,n,i){if(d.filter)s=d.filter(s,i.converter,n);else if(d.regex){var _=d.regex;_ instanceof RegExp||(_=new RegExp(_,"g")),s=s.replace(_,d.replace)}return s}),r.subParser("spanGamut",function(d,s,n){return d=n.converter._dispatch("spanGamut.before",d,s,n),d=r.subParser("codeSpans")(d,s,n),d=r.subParser("escapeSpecialCharsWithinTagAttributes")(d,s,n),d=r.subParser("encodeBackslashEscapes")(d,s,n),d=r.subParser("images")(d,s,n),d=r.subParser("anchors")(d,s,n),d=r.subParser("autoLinks")(d,s,n),d=r.subParser("simplifiedAutoLinks")(d,s,n),d=r.subParser("emoji")(d,s,n),d=r.subParser("underline")(d,s,n),d=r.subParser("italicsAndBold")(d,s,n),d=r.subParser("strikethrough")(d,s,n),d=r.subParser("ellipsis")(d,s,n),d=r.subParser("hashHTMLSpans")(d,s,n),d=r.subParser("encodeAmpsAndAngles")(d,s,n),s.simpleLineBreaks?/\n\n¨K/.test(d)||(d=d.replace(/\n+/g,`<br />
|
||
|
`)):d=d.replace(/ +\n/g,`<br />
|
||
|
`),d=n.converter._dispatch("spanGamut.after",d,s,n),d}),r.subParser("strikethrough",function(d,s,n){function i(_){return s.simplifiedAutoLink&&(_=r.subParser("simplifiedAutoLinks")(_,s,n)),"<del>"+_+"</del>"}return s.strikethrough&&(d=n.converter._dispatch("strikethrough.before",d,s,n),d=d.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(_,m){return i(m)}),d=n.converter._dispatch("strikethrough.after",d,s,n)),d}),r.subParser("stripLinkDefinitions",function(d,s,n){var i=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,_=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;d+="\xA80";var m=function(h,w,T,j,E,M,f){return w=w.toLowerCase(),d.toLowerCase().split(w).length-1<2?h:(T.match(/^data:.+?\/.+?;base64,/)?n.gUrls[w]=T.replace(/\s/g,""):n.gUrls[w]=r.subParser("encodeAmpsAndAngles")(T,s,n),M?M+f:(f&&(n.gTitles[w]=f.replace(/"|'/g,""")),s.parseImgDimensions&&j&&E&&(n.gDimensions[w]={width:j,height:E}),""))};return d=d.replace(_,m),d=d.replace(i,m),d=d.replace(/¨0/,""),d}),r.subParser("tables",function(d,s,n){if(!s.tables)return d;var i=/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,_=/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;function m(E){return/^:[ \t]*--*$/.test(E)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(E)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(E)?' style="text-align:center;"':""}function h(E,M){var f="";return E=E.trim(),(s.tablesHeaderId||s.tableHeaderId)&&(f=' id="'+E.replace(/ /g,"_").toLowerCase()+'"'),E=r.subParser("spanGamut")(E,s,n),"<th"+f+M+">"+E+`</th>
|
||
|
`}function w(E,M){var f=r.subParser("spanGamut")(E,s,n);return"<td"+M+">"+f+`</td>
|
||
|
`}function T(E,M){for(var f=`<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
`,k=E.length,z=0;z<k;++z)f+=E[z];for(f+=`</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
`,z=0;z<M.length;++z){f+=`<tr>
|
||
|
`;for(var B=0;B<k;++B)f+=M[z][B];f+=`</tr>
|
||
|
`}return f+=`</tbody>
|
||
|
</table>
|
||
|
`,f}function j(E){var M,f=E.split(`
|
||
|
`);for(M=0;M<f.length;++M)/^ {0,3}\|/.test(f[M])&&(f[M]=f[M].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(f[M])&&(f[M]=f[M].replace(/\|[ \t]*$/,"")),f[M]=r.subParser("codeSpans")(f[M],s,n);var k=f[0].split("|").map(function(ie){return ie.trim()}),z=f[1].split("|").map(function(ie){return ie.trim()}),B=[],Z=[],U=[],se=[];for(f.shift(),f.shift(),M=0;M<f.length;++M)f[M].trim()!==""&&B.push(f[M].split("|").map(function(ie){return ie.trim()}));if(k.length<z.length)return E;for(M=0;M<z.length;++M)U.push(m(z[M]));for(M=0;M<k.length;++M)r.helper.isUndefined(U[M])&&(U[M]=""),Z.push(h(k[M],U[M]));for(M=0;M<B.length;++M){for(var ae=[],we=0;we<Z.length;++we)r.helper.isUndefined(B[M][we]),ae.push(w(B[M][we],U[we]));se.push(ae)}return T(Z,se)}return d=n.converter._dispatch("tables.before",d,s,n),d=d.replace(/\\(\|)/g,r.helper.escapeCharactersCallback),d=d.replace(i,j),d=d.replace(_,j),d=n.converter._dispatch("tables.after",d,s,n),d}),r.subParser("underline",function(d,s,n){return s.underline&&(d=n.converter._dispatch("underline.before",d,s,n),s.literalMidWordUnderscores?(d=d.replace(/\b___(\S[\s\S]*?)___\b/g,function(i,_){return"<u>"+_+"</u>"}),d=d.replace(/\b__(\S[\s\S]*?)__\b/g,function(i,_){return"<u>"+_+"</u>"})):(d=d.replace(/___(\S[\s\S]*?)___/g,function(i,_){return/\S$/.test(_)?"<u>"+_+"</u>":i}),d=d.replace(/__(\S[\s\S]*?)__/g,function(i,_){return/\S$/.test(_)?"<u>"+_+"</u>":i})),d=d.replace(/(_)/g,r.helper.escapeCharactersCallback),d=n.converter._dispatch("underline.after",d,s,n)),d}),r.subParser("unescapeSpecialChars",function(d,s,n){return d=n.converter._dispatch("unescapeSpecialChars.before",d,s,n),d=d.replace(/¨E(\d+)E/g,function(i,_){var m=parseInt(_);return String.fromCharCode(m)}),d=n.converter._dispatch("unescapeSpecialChars.after",d,s,n),d}),r.subParser("makeMarkdown.blockquote",function(d,s){var n="";if(d.hasChildNodes())for(var i=d.childNodes,_=i.length,m=0;m<_;++m){var h=r.subParser("makeMarkdown.node")(i[m],s);h!==""&&(n+=h)}return n=n.trim(),n="> "+n.split(`
|
||
|
`).join(`
|
||
|
> `),n}),r.subParser("makeMarkdown.codeBlock",function(d,s){var n=d.getAttribute("language"),i=d.getAttribute("precodenum");return"```"+n+`
|
||
|
`+s.preList[i]+"\n```"}),r.subParser("makeMarkdown.codeSpan",function(d){return"`"+d.innerHTML+"`"}),r.subParser("makeMarkdown.emphasis",function(d,s){var n="";if(d.hasChildNodes()){n+="*";for(var i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);n+="*"}return n}),r.subParser("makeMarkdown.header",function(d,s,n){var i=new Array(n+1).join("#"),_="";if(d.hasChildNodes()){_=i+" ";for(var m=d.childNodes,h=m.length,w=0;w<h;++w)_+=r.subParser("makeMarkdown.node")(m[w],s)}return _}),r.subParser("makeMarkdown.hr",function(){return"---"}),r.subParser("makeMarkdown.image",function(d){var s="";return d.hasAttribute("src")&&(s+="!["+d.getAttribute("alt")+"](",s+="<"+d.getAttribute("src")+">",d.hasAttribute("width")&&d.hasAttribute("height")&&(s+=" ="+d.getAttribute("width")+"x"+d.getAttribute("height")),d.hasAttribute("title")&&(s+=' "'+d.getAttribute("title")+'"'),s+=")"),s}),r.subParser("makeMarkdown.links",function(d,s){var n="";if(d.hasChildNodes()&&d.hasAttribute("href")){var i=d.childNodes,_=i.length;n="[";for(var m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);n+="](",n+="<"+d.getAttribute("href")+">",d.hasAttribute("title")&&(n+=' "'+d.getAttribute("title")+'"'),n+=")"}return n}),r.subParser("makeMarkdown.list",function(d,s,n){var i="";if(!d.hasChildNodes())return"";for(var _=d.childNodes,m=_.length,h=d.getAttribute("start")||1,w=0;w<m;++w)if(!(typeof _[w].tagName=="undefined"||_[w].tagName.toLowerCase()!=="li")){var T="";n==="ol"?T=h.toString()+". ":T="- ",i+=T+r.subParser("makeMarkdown.listItem")(_[w],s),++h}return i+=`
|
||
|
<!-- -->
|
||
|
`,i.trim()}),r.subParser("makeMarkdown.listItem",function(d,s){for(var n="",i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);return/\n$/.test(n)?n=n.split(`
|
||
|
`).join(`
|
||
|
`).replace(/^ {4}$/gm,"").replace(/\n\n+/g,`
|
||
|
|
||
|
`):n+=`
|
||
|
`,n}),r.subParser("makeMarkdown.node",function(d,s,n){n=n||!1;var i="";if(d.nodeType===3)return r.subParser("makeMarkdown.txt")(d,s);if(d.nodeType===8)return"<!--"+d.data+`-->
|
||
|
|
||
|
`;if(d.nodeType!==1)return"";var _=d.tagName.toLowerCase();switch(_){case"h1":n||(i=r.subParser("makeMarkdown.header")(d,s,1)+`
|
||
|
|
||
|
`);break;case"h2":n||(i=r.subParser("makeMarkdown.header")(d,s,2)+`
|
||
|
|
||
|
`);break;case"h3":n||(i=r.subParser("makeMarkdown.header")(d,s,3)+`
|
||
|
|
||
|
`);break;case"h4":n||(i=r.subParser("makeMarkdown.header")(d,s,4)+`
|
||
|
|
||
|
`);break;case"h5":n||(i=r.subParser("makeMarkdown.header")(d,s,5)+`
|
||
|
|
||
|
`);break;case"h6":n||(i=r.subParser("makeMarkdown.header")(d,s,6)+`
|
||
|
|
||
|
`);break;case"p":n||(i=r.subParser("makeMarkdown.paragraph")(d,s)+`
|
||
|
|
||
|
`);break;case"blockquote":n||(i=r.subParser("makeMarkdown.blockquote")(d,s)+`
|
||
|
|
||
|
`);break;case"hr":n||(i=r.subParser("makeMarkdown.hr")(d,s)+`
|
||
|
|
||
|
`);break;case"ol":n||(i=r.subParser("makeMarkdown.list")(d,s,"ol")+`
|
||
|
|
||
|
`);break;case"ul":n||(i=r.subParser("makeMarkdown.list")(d,s,"ul")+`
|
||
|
|
||
|
`);break;case"precode":n||(i=r.subParser("makeMarkdown.codeBlock")(d,s)+`
|
||
|
|
||
|
`);break;case"pre":n||(i=r.subParser("makeMarkdown.pre")(d,s)+`
|
||
|
|
||
|
`);break;case"table":n||(i=r.subParser("makeMarkdown.table")(d,s)+`
|
||
|
|
||
|
`);break;case"code":i=r.subParser("makeMarkdown.codeSpan")(d,s);break;case"em":case"i":i=r.subParser("makeMarkdown.emphasis")(d,s);break;case"strong":case"b":i=r.subParser("makeMarkdown.strong")(d,s);break;case"del":i=r.subParser("makeMarkdown.strikethrough")(d,s);break;case"a":i=r.subParser("makeMarkdown.links")(d,s);break;case"img":i=r.subParser("makeMarkdown.image")(d,s);break;default:i=d.outerHTML+`
|
||
|
|
||
|
`}return i}),r.subParser("makeMarkdown.paragraph",function(d,s){var n="";if(d.hasChildNodes())for(var i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);return n=n.trim(),n}),r.subParser("makeMarkdown.pre",function(d,s){var n=d.getAttribute("prenum");return"<pre>"+s.preList[n]+"</pre>"}),r.subParser("makeMarkdown.strikethrough",function(d,s){var n="";if(d.hasChildNodes()){n+="~~";for(var i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);n+="~~"}return n}),r.subParser("makeMarkdown.strong",function(d,s){var n="";if(d.hasChildNodes()){n+="**";for(var i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s);n+="**"}return n}),r.subParser("makeMarkdown.table",function(d,s){var n="",i=[[],[]],_=d.querySelectorAll("thead>tr>th"),m=d.querySelectorAll("tbody>tr"),h,w;for(h=0;h<_.length;++h){var T=r.subParser("makeMarkdown.tableCell")(_[h],s),j="---";if(_[h].hasAttribute("style")){var E=_[h].getAttribute("style").toLowerCase().replace(/\s/g,"");switch(E){case"text-align:left;":j=":---";break;case"text-align:right;":j="---:";break;case"text-align:center;":j=":---:";break}}i[0][h]=T.trim(),i[1][h]=j}for(h=0;h<m.length;++h){var M=i.push([])-1,f=m[h].getElementsByTagName("td");for(w=0;w<_.length;++w){var k=" ";typeof f[w]!="undefined"&&(k=r.subParser("makeMarkdown.tableCell")(f[w],s)),i[M].push(k)}}var z=3;for(h=0;h<i.length;++h)for(w=0;w<i[h].length;++w){var B=i[h][w].length;B>z&&(z=B)}for(h=0;h<i.length;++h){for(w=0;w<i[h].length;++w)h===1?i[h][w].slice(-1)===":"?i[h][w]=r.helper.padEnd(i[h][w].slice(-1),z-1,"-")+":":i[h][w]=r.helper.padEnd(i[h][w],z,"-"):i[h][w]=r.helper.padEnd(i[h][w],z);n+="| "+i[h].join(" | ")+` |
|
||
|
`}return n.trim()}),r.subParser("makeMarkdown.tableCell",function(d,s){var n="";if(!d.hasChildNodes())return"";for(var i=d.childNodes,_=i.length,m=0;m<_;++m)n+=r.subParser("makeMarkdown.node")(i[m],s,!0);return n.trim()}),r.subParser("makeMarkdown.txt",function(d){var s=d.nodeValue;return s=s.replace(/ +/g," "),s=s.replace(/¨NBSP;/g," "),s=r.helper.unescapeHTMLEntities(s),s=s.replace(/([*_~|`])/g,"\\$1"),s=s.replace(/^(\s*)>/g,"\\$1>"),s=s.replace(/^#/gm,"\\#"),s=s.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),s=s.replace(/^( {0,3}\d+)\./gm,"$1\\."),s=s.replace(/^( {0,3})([+-])/gm,"$1\\$2"),s=s.replace(/]([\s]*)\(/g,"\\]$1\\("),s=s.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:"),s});var fe=this;e.exports?e.exports=r:fe.showdown=r}).call(aa)})(St);/*!
|
||
|
* vue-showdown - Use showdown as a vue component
|
||
|
*
|
||
|
* @version v3.3.0
|
||
|
* @link https://vue-showdown.js.org
|
||
|
* @license MIT
|
||
|
* @copyright 2018-2022 meteorlxy
|
||
|
*/const ca=ot({name:"VueShowdown",props:{markdown:{type:String,required:!1,default:null},tag:{type:String,required:!1,default:"div"},flavor:{type:String,required:!1,default:null},options:{type:Object,required:!1,default:()=>({})},extensions:{type:Array,required:!1,default:null},vueTemplate:{type:Boolean,required:!1,default:!1},vueTemplateData:{type:Object,required:!1,default:()=>({})}},setup(e,{slots:u}){const t=fu(()=>{const c=new St.exports.Converter({extensions:e.extensions||void 0});return e.flavor!==null&&c.setFlavor(e.flavor),Object.entries(e.options).forEach(([o,p])=>{c.setOption(o,p)}),c}),r=fu(()=>{var c;if(e.markdown!==null)return e.markdown;const o=(c=u.default)===null||c===void 0?void 0:c.call(u)[0];return(o==null?void 0:o.type)===sr?o.children:""}),a=fu(()=>t.value.makeHtml(r.value));return()=>e.vueTemplate?kd({setup:()=>e.vueTemplateData,template:`<${e.tag}>${a.value}</${e.tag}>`}):kd(e.tag,{innerHTML:a.value})}});const ia={class:"wrapper"},oa={class:"editor-area"},fa={class:"title-area"},la=he("label",{for:"draft"},"Draft",-1),ha=he("br",null,null,-1),pa={class:"preview"},_a=he("p",{class:"preview-title"},"\xA0 Preview: ",-1),ma={class:"footer"},ga=he("br",null,null,-1),ba=he("br",null,null,-1),wa=he("br",null,null,-1),va=ot({name:"App",setup(e){const u=Nu(""),t=Nu(""),r=Nu(""),a=Nu(!1),c=()=>Math.round(new Date().getTime()/1e3).toString(),o=N=>N?new Date(Number(N)*1e3).toUTCString():"",p=N=>{if(!N)return"None yet.";for(N=N.replace(/[^a-zA-Z0-9_]+/gi,"-").toLowerCase();N.endsWith("-");)N=N.slice(0,-1);return N.length>50&&(N=N.substring(0,50),N.includes("-")&&(N=N.substring(0,Math.min(N.length,N.lastIndexOf("-"))))),N+".json"},b=N=>({postTitle:u.value,timestamp:N?"":r.value,postContent:t.value,filename:O.value,draft:a.value}),y=(N,J)=>{const de=new Blob([JSON.stringify(b(N),null,2)],{type:"text/plain"}),K=document.createElement("a");K.setAttribute("download",J?"archive.json":O.value),K.setAttribute("href",window.URL.createObjectURL(de)),K.click()},S=()=>{u.value||(u.value="No title."),t.value||(t.value="No content."),a.value?y(!0):y()};ht(()=>{setInterval(()=>{r.value=c()},1e3)});const O=fu(()=>p(u.value)),$=fu(()=>o(r.value));return(N,J)=>{const de=xn("VueShowdown");return ws(),ys(Re,null,[he("div",ia,[he("div",oa,[he("div",fa,[pr(he("input",{class:"title",type:"text",placeholder:"Post title...","onUpdate:modelValue":J[0]||(J[0]=K=>u.value=K)},null,512),[[zd,u.value]]),pr(he("input",{type:"checkbox",id:"draft","onUpdate:modelValue":J[1]||(J[1]=K=>a.value=K)},null,512),[[ua,a.value]]),la]),ha,pr(he("textarea",{class:"editor","onUpdate:modelValue":J[2]||(J[2]=K=>t.value=K),placeholder:"Post content..."},null,512),[[zd,t.value]])]),he("div",pa,[_a,Ce(de,{markdown:t.value,flavor:"github",options:{emoji:!0},tag:"span"},null,8,["markdown"])])]),he("div",ma,[Vu(" Filename: "+ir(Pr(O))+" ",1),ga,Vu(" Created on Timestamp: "+ir(Pr($))+" ",1),ba,Vu(" Is it a draft? "+ir(a.value?"Yes":"No")+". ",1),wa,he("button",{class:"btn-primary",onClick:S},"Save (ngx-retroblog format)")])],64)}}}),Tt=na(va);Tt.component("VueShowdown",ca);Tt.mount("#app");
|