Kremta-Website/_astro/marked.esm.BhM9K_2c.js

47 lines
39 KiB
JavaScript
Raw Normal View History

var ie=(t,n,e)=>{if(!n.has(t))throw TypeError("Cannot "+e)},W=(t,n,e)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,e)},U=(t,n,e)=>(ie(t,n,"access private method"),e);function M(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}var I=M();function K(t){I=t}var Y=/[&<>"']/,se=new RegExp(Y.source,"g"),ee=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,re=new RegExp(ee.source,"g"),le={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=t=>le[t];function _(t,n){if(n){if(Y.test(t))return t.replace(se,F)}else if(ee.test(t))return t.replace(re,F);return t}var ae=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function te(t){return t.replace(ae,(n,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}var oe=/(^|[^\[])\^/g;function d(t,n){t=typeof t=="string"?t:t.source,n=n||"";const e={replace:(i,s)=>(s=typeof s=="object"&&"source"in s?s.source:s,s=s.replace(oe,"$1"),t=t.replace(i,s),e),getRegex:()=>new RegExp(t,n)};return e}var he=/[^\w:]/g,ce=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function X(t,n,e){if(t){let i;try{i=decodeURIComponent(te(e)).replace(he,"").toLowerCase()}catch{return null}if(i.indexOf("javascript:")===0||i.indexOf("vbscript:")===0||i.indexOf("data:")===0)return null}n&&!ce.test(e)&&(e=ge(n,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}var L={},pe=/^[^:]+:\/*[^/]*$/,ue=/^([^:]+:)[\s\S]*$/,fe=/^([^:]+:\/*[^/]*)[\s\S]*$/;function ge(t,n){L[" "+t]||(pe.test(t)?L[" "+t]=t+"/":L[" "+t]=P(t,"/",!0)),t=L[" "+t];const e=t.indexOf(":")===-1;return n.substring(0,2)==="//"?e?n:t.replace(ue,"$1")+n:n.charAt(0)==="/"?e?n:t.replace(fe,"$1")+n:t+n}var D={exec:()=>null};function G(t,n){const e=t.replace(/\|/g,(l,r,h)=>{let c=!1,u=r;for(;--u>=0&&h[u]==="\\";)c=!c;return c?"|":" |"}),i=e.split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),i.length>n)i.splice(n);else for(;i.length<n;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(/\\\|/g,"|");return i}function P(t,n,e){const i=t.length;if(i===0)return"";let s=0;for(;s<i;){const l=t.charAt(i-s-1);if(l===n&&!e)s++;else if(l!==n&&e)s++;else break}return t.slice(0,i-s)}function de(t,n){if(t.indexOf(n[1])===-1)return-1;const e=t.length;let i=0,s=0;for(;s<e;s++)if(t[s]==="\\")s++;else if(t[s]===n[0])i++;else if(t[s]===n[1]&&(i--,i<0))return s;return-1}function ke(t,n){!t||t.silent||(n&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(t.sanitize||t.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),(t.highlight||t.langPrefix!=="language-")&&console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),t.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),t.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),t.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypa
`).map(s=>{const l=s.match(/^\s+/);if(l===null)return s;const[r]=l;return r.length>=i.length?s.slice(i.length):s}).join(`
`)}var q=class{constructor(t){this.options=t||I}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const e=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?e:P(e,`
`)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const e=n[0],i=me(e,n[3]||"");return{type:"code",raw:e,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:i}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let e=n[2].trim();if(/#$/.test(e)){const i=P(e,"#");(this.options.pedantic||!i||/ $/.test(i))&&(e=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){const e=n[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:n[0],tokens:s,text:e}}}list(t){let n=this.rules.block.list.exec(t);if(n){let e,i,s,l,r,h,c,u,g,f,o,x,w=n[1].trim();const R=w.length>1,m={type:"list",raw:"",ordered:R,start:R?+w.slice(0,-1):"",loose:!1,items:[]};w=R?`\\d{1,9}\\${w.slice(-1)}`:`\\${w}`,this.options.pedantic&&(w=R?w:"[*+-]");const b=new RegExp(`^( {0,3}${w})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;t&&(x=!1,!(!(n=b.exec(t))||this.rules.block.hr.test(t)));){if(e=n[0],t=t.substring(e.length),u=n[2].split(`
`,1)[0].replace(/^\t+/,z=>" ".repeat(3*z.length)),g=t.split(`
`,1)[0],this.options.pedantic?(l=2,o=u.trimLeft()):(l=n[2].search(/[^ ]/),l=l>4?1:l,o=u.slice(l),l+=n[1].length),h=!1,!u&&/^ *$/.test(g)&&(e+=g+`
`,t=t.substring(g.length+1),x=!0),!x){const z=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),E=new RegExp(`^ {0,${Math.min(3,l-1)}}#`);for(;t&&(f=t.split(`
`,1)[0],g=f,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!($.test(g)||E.test(g)||z.test(g)||y.test(t)));){if(g.search(/[^ ]/)>=l||!g.trim())o+=`
`+g.slice(l);else{if(h||u.search(/[^ ]/)>=4||$.test(u)||E.test(u)||y.test(u))break;o+=`
`+g}!h&&!g.trim()&&(h=!0),e+=f+`
`,t=t.substring(f.length+1),u=g.slice(l)}}m.loose||(c?m.loose=!0:/\n *\n *$/.test(e)&&(c=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(o),i&&(s=i[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),m.items.push({type:"list_item",raw:e,task:!!i,checked:s,loose:!1,text:o}),m.raw+=e}m.items[m.items.length-1].raw=e.trimRight(),m.items[m.items.length-1].text=o.trimRight(),m.raw=m.raw.trimRight();const A=m.items.length;for(r=0;r<A;r++)if(this.lexer.state.top=!1,m.items[r].tokens=this.lexer.blockTokens(m.items[r].text,[]),!m.loose){const z=m.items[r].tokens.filter($=>$.type==="space"),y=z.length>0&&z.some($=>/\n.*\n/.test($.raw));m.loose=y}if(m.loose)for(r=0;r<A;r++)m.items[r].loose=!0;return m}}html(t){const n=this.rules.block.html.exec(t);if(n){const e={type:"html",block:!0,raw:n[0],pre:!this.options.sanitizer&&(n[1]==="pre"||n[1]==="script"||n[1]==="style"),text:n[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(n[0]):_(n[0]),s=e;s.type="paragraph",s.text=i,s.tokens=this.lexer.inline(i)}return e}}def(t){const n=this.rules.block.def.exec(t);if(n){const e=n[1].toLowerCase().replace(/\s+/g," "),i=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:e,raw:n[0],href:i,title:s}}}table(t){const n=this.rules.block.table.exec(t);if(n){const e={type:"table",header:G(n[1]).map(i=>({text:i})),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
`):[]};if(e.header.length===e.align.length){e.raw=n[0];let i=e.align.length,s,l,r,h;for(s=0;s<i;s++)/^ *-+: *$/.test(e.align[s])?e.align[s]="right":/^ *:-+: *$/.test(e.align[s])?e.align[s]="center":/^ *:-+ *$/.test(e.align[s])?e.align[s]="left":e.align[s]=null;for(i=e.rows.length,s=0;s<i;s++)e.rows[s]=G(e.rows[s],e.header.length).map(c=>({text:c}));for(i=e.header.length,l=0;l<i;l++)e.header[l].tokens=this.lexer.inline(e.header[l].text);for(i=e.rows.length,l=0;l<i;l++)for(h=e.rows[l],r=0;r<h.length;r++)h[r].tokens=this.lexer.inline(h[r].text);return e}}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const e=n[1].charAt(n[1].length-1)===`
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:e,tokens:this.lexer.inline(e)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:_(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):_(n[0]):n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const e=n[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const l=P(e.slice(0,-1),"\\");if((e.length-l.length)%2===0)return}else{const l=de(n[2],"()");if(l>-1){const h=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,h).trim(),n[3]=""}}let i=n[2],s="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],s=l[3])}else s=n[3]?n[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(e)?i=i.slice(1):i=i.slice(1,-1)),V(n,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(t,n){let e;if((e=this.rules.inline.reflink.exec(t))||(e=this.rules.inline.nolink.exec(t))){let i=(e[2]||e[1]).replace(/\s+/g," ");if(i=n[i.toLowerCase()],!i){const s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return V(e,i,e[0],this.lexer)}}emStrong(t,n,e=""){let i=this.rules.inline.emStrong.lDelim.exec(t);if(!i||i[3]&&e.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!e||this.rules.inline.punctuation.exec(e)){const l=i[0].length-1;let r,h,c=l,u=0;const g=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(g.lastIndex=0,n=n.slice(-1*t.length+l);(i=g.exec(n))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(h=r.length,i[3]||i[4]){c+=h;continue}else if((i[5]||i[6])&&l%3&&!((l+h)%3)){u+=h;continue}if(c-=h,c>0)continue;h=Math.min(h,h+c+u);const f=t.slice(0,l+i.index+h+1);if(Math.min(l,h)%2){const x=f.slice(1,-1);return{type:"em",raw:f,text:x,tokens:this.lexer.inlineTokens(x)}}const o=f.slice(2,-2);return{type:"strong",raw:f,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let e=n[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=_(e,!0),{type:"codespan",raw:n[0],text:e}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t,n){const e=this.rules.inline.autolink.exec(t);if(e){let i,s;return e[2]==="@"?(i=_(this.options.mangle?n(e[1]):e[1]),s="mailto:"+i):(i=_(e[1]),s=i),{type:"link",raw:e[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(t,n){let e;if(e=this.rules.inline.url.exec(t)){let i,s;if(e[2]==="@")i=_(this.options.mangle?n(e[0]):e[0]),s="mailto:"+i;else{let l;do l=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])[0];while(l!==e[0]);i=_(e[0]),e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t,n){const e=this.rules.inline.text.exec(t);if(e){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):_(e[0]):e[0]:i=_(this.options.smartypants?n(e[0]):e[0]),{type:"text",raw:e[0],text:i}}}},p={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\
]`).replace("lheading",p.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};var a={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:D,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:D,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/};a._punctuation="\\p{P}$+<=>`^|~";a.punctuation=d(a.punctuation,"u").replace(/punctuation/g,a._punctuation).getRegex();a.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;a.anyPunctuation=/\\[punct]/g;a._escapes=/\\([punct])/g;a._comment=d(p._comment).replace("(?:-->|$)","-->").getRegex();a.emStrong.lDelim=d(a.emStrong.lDelim,"u").replace(/punct/g,a._punctuation).getRegex();a.emStrong.rDelimAst=d(a.emStrong.rDelimAst,"gu").replace(/punct/g,a._punctuation).getRegex();a.emStrong.rDelimUnd=d(a.emStrong.rDelimUnd,"gu").replace(/punct/g,a._punctuation).getRegex();a.anyPunctuation=d(a.anyPunctuation,"gu").replace(/punct/g,a._punctuation).getRegex();a._escapes=d(a._escapes,"gu").replace(/punct/g,a._punctuation).getRegex();a._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;a._email=/[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])?)+(?![-_])/;a.autolink=d(a.autolink).replace("scheme",a._scheme).replace("email",a._email).getRegex();a._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;a.tag=d(a.tag).replace("comment",a._comment).replace("attribute",a._attribute).getRegex();a._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;a._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;a._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;a.link=d(a.link).replace("label",a._label).replace("href",a._href).replace("title",a._title).getRegex();a.reflink=d(a.reflink).replace("label",a._label).replace("ref",p._label).getRegex();a.nolink=d(a.nolink).replace("ref",p._label).getRegex();a.reflinkSearch=d(a.reflinkSearch,"g").replace("reflink",a.reflink).replace("nolink",a.nolink).getRegex();a.normal={...a};a.pedantic={...a.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",a._label).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",a._label).getRegex()};a.gfm={...a.normal,escape:d(a.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+
`),this.blockTokens(t,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(t,n=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(r,h,c)=>h+" ".repeat(c.length));let e,i,s,l;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(e=r.call({lexer:this},t,n))?(t=t.substring(e.raw.length),n.push(e),!0):!1))){if(e=this.tokenizer.space(t)){t=t.substring(e.raw.length),e.raw.length===1&&n.length>0?n[n.length-1].raw+=`
`:n.push(e);continue}if(e=this.tokenizer.code(t)){t=t.substring(e.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+e.raw,i.text+=`
`+e.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(e);continue}if(e=this.tokenizer.fences(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.heading(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.hr(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.blockquote(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.list(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.html(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.def(t)){t=t.substring(e.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+e.raw,i.text+=`
`+e.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[e.tag]||(this.tokens.links[e.tag]={href:e.href,title:e.title});continue}if(e=this.tokenizer.table(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.lheading(t)){t=t.substring(e.raw.length),n.push(e);continue}if(s=t,this.options.extensions&&this.options.extensions.startBlock){let r=1/0;const h=t.slice(1);let c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},h),typeof c=="number"&&c>=0&&(r=Math.min(r,c))}),r<1/0&&r>=0&&(s=t.substring(0,r+1))}if(this.state.top&&(e=this.tokenizer.paragraph(s))){i=n[n.length-1],l&&i.type==="paragraph"?(i.raw+=`
`+e.raw,i.text+=`
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(e),l=s.length!==t.length,t=t.substring(e.raw.length);continue}if(e=this.tokenizer.text(t)){t=t.substring(e.raw.length),i=n[n.length-1],i&&i.type==="text"?(i.raw+=`
`+e.raw,i.text+=`
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(e);continue}if(t){const r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let e,i,s,l=t,r,h,c;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)u.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(h||(c=""),h=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(e=u.call({lexer:this},t,n))?(t=t.substring(e.raw.length),n.push(e),!0):!1))){if(e=this.tokenizer.escape(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.tag(t)){t=t.substring(e.raw.length),i=n[n.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):n.push(e);continue}if(e=this.tokenizer.link(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(e.raw.length),i=n[n.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):n.push(e);continue}if(e=this.tokenizer.emStrong(t,l,c)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.codespan(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.br(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.del(t)){t=t.substring(e.raw.length),n.push(e);continue}if(e=this.tokenizer.autolink(t,J)){t=t.substring(e.raw.length),n.push(e);continue}if(!this.state.inLink&&(e=this.tokenizer.url(t,J))){t=t.substring(e.raw.length),n.push(e);continue}if(s=t,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const g=t.slice(1);let f;this.options.extensions.startInline.forEach(o=>{f=o.call({lexer:this},g),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(s=t.substring(0,u+1))}if(e=this.tokenizer.inlineText(s,xe)){t=t.substring(e.raw.length),e.raw.slice(-1)!=="_"&&(c=e.raw.slice(-1)),h=!0,i=n[n.length-1],i&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):n.push(e);continue}if(t){const u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},B=class{constructor(t){this.options=t||I}code(t,n,e){const i=(n||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(t,i);s!=null&&s!==t&&(e=!0,t=s)}return t=t.replace(/\n$/,"")+`
`,i?'<pre><code class="'+this.options.langPrefix+_(i)+'">'+(e?t:_(t,!0))+`</code></pre>
`:"<pre><code>"+(e?t:_(t,!0))+`</code></pre>
`}blockquote(t){return`<blockquote>
${t}</blockquote>
`}html(t,n){return t}heading(t,n,e,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(e);return`<h${n} id="${s}">${t}</h${n}>
`}return`<h${n}>${t}</h${n}>
`}hr(){return this.options.xhtml?`<hr/>
`:`<hr>
`}list(t,n,e){const i=n?"ol":"ul",s=n&&e!==1?' start="'+e+'"':"";return"<"+i+s+`>
`+t+"</"+i+`>
`}listitem(t,n,e){return`<li>${t}</li>
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(t){return`<p>${t}</p>
`}table(t,n){return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+n+`</table>
`}tablerow(t){return`<tr>
${t}</tr>
`}tablecell(t,n){const e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(t){return`<del>${t}</del>`}link(t,n,e){if(t=X(this.options.sanitize,this.options.baseUrl,t),t===null)return e;let i='<a href="'+t+'"';return n&&(i+=' title="'+n+'"'),i+=">"+e+"</a>",i}image(t,n,e){if(t=X(this.options.sanitize,this.options.baseUrl,t),t===null)return e;let i=`<img src="${t}" alt="${e}"`;return n&&(i+=` title="${n}"`),i+=this.options.xhtml?"/>":">",i}text(t){return t}},O=class{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,n,e){return""+e}image(t,n,e){return""+e}br(){return""}},Q=class{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,n){let e=t,i=0;if(this.seen.hasOwnProperty(e)){i=this.seen[t];do i++,e=t+"-"+i;while(this.seen.hasOwnProperty(e))}return n||(this.seen[t]=i,this.seen[e]=0),e}slug(t,n={}){const e=this.serialize(t);return this.getNextSafeSlug(e,n.dryrun)}},T=class{constructor(t){this.options=t||I,this.options.renderer=this.options.renderer||new B,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new O,this.slugger=new Q}static parse(t,n){return new T(n).parse(t)}static parseInline(t,n){return new T(n).parseInline(t)}parse(t,n=!0){let e="",i,s,l,r,h,c,u,g,f,o,x,w,R,m,b,A,z,y,$;const E=t.length;for(i=0;i<E;i++){if(o=t[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&($=this.options.extensions.renderers[o.type].call({parser:this},o),$!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type))){e+=$||"";continue}switch(o.type){case"space":continue;case"hr":{e+=this.renderer.hr();continue}case"heading":{e+=this.renderer.heading(this.parseInline(o.tokens),o.depth,te(this.parseInline(o.tokens,this.textRenderer)),this.slugger);continue}case"code":{e+=this.renderer.code(o.text,o.lang,!!o.escaped);continue}case"table":{for(g="",u="",r=o.header.length,s=0;s<r;s++)u+=this.renderer.tablecell(this.parseInline(o.header[s].tokens),{header:!0,align:o.align[s]});for(g+=this.renderer.tablerow(u),f="",r=o.rows.length,s=0;s<r;s++){for(c=o.rows[s],u="",h=c.length,l=0;l<h;l++)u+=this.renderer.tablecell(this.parseInline(c[l].tokens),{header:!1,align:o.align[l]});f+=this.renderer.tablerow(u)}e+=this.renderer.table(g,f);continue}case"blockquote":{f=this.parse(o.tokens),e+=this.renderer.blockquote(f);continue}case"list":{for(x=o.ordered,w=o.start,R=o.loose,r=o.items.length,f="",s=0;s<r;s++)b=o.items[s],A=b.checked,z=b.task,m="",b.task&&(y=this.renderer.checkbox(!!A),R?b.tokens.length>0&&b.tokens[0].type==="paragraph"?(b.tokens[0].text=y+" "+b.tokens[0].text,b.tokens[0].tokens&&b.tokens[0].tokens.length>0&&b.tokens[0].tokens[0].type==="text"&&(b.tokens[0].tokens[0].text=y+" "+b.tokens[0].tokens[0].text)):b.tokens.unshift({type:"text",text:y}):m+=y),m+=this.parse(b.tokens,R),f+=this.renderer.listitem(m,z,!!A);e+=this.renderer.list(f,x,w);continue}case"html":{e+=this.renderer.html(o.text,o.block);continue}case"paragraph":{e+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{for(f=o.tokens?this.parseInline(o.tokens):o.text;i+1<E&&t[i+1].type==="text";)o=t[++i],f+=`
`+(o.tokens?this.parseInline(o.tokens):o.text);e+=n?this.renderer.paragraph(f):f;continue}default:{const H='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(H),"";throw new Error(H)}}}return e}parseInline(t,n){n=n||this.renderer;let e="",i,s,l;const r=t.length;for(i=0;i<r;i++){if(s=t[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(l=this.options.extensions.renderers[s.type].call({parser:this},s),l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type))){e+=l||"";continue}switch(s.type){case"escape":{e+=n.text(s.text);break}case"html":{e+=n.html(s.text);break}case"link":{e+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break}case"image":{e+=n.image(s.href,s.title,s.text);break}case"strong":{e+=n.strong(this.parseInline(s.tokens,n));break}case"em":{e+=n.em(this.parseInline(s.tokens,n));break}case"codespan":{e+=n.codespan(s.text);break}case"br":{e+=n.br();break}case"del":{e+=n.del(this.parseInline(s.tokens,n));break}case"text":{e+=n.text(s.text);break}default:{const h='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return e}},C=class{constructor(t){this.options=t||I}preprocess(t){return t}postprocess(t){return t}};C.passThroughHooks=new Set(["preprocess","postprocess"]);var Z,j,N,ne,we=class{constructor(...t){W(this,Z),W(this,N),this.defaults=M(),this.options=this.setOptions,this.parse=U(this,Z,j).call(this,S.lex,T.parse),this.parseInline=U(this,Z,j).call(this,S.lexInline,T.parseInline),this.Parser=T,this.parser=T.parse,this.Renderer=B,this.TextRenderer=O,this.Lexer=S,this.lexer=S.lex,this.Tokenizer=q,this.Slugger=Q,this.Hooks=C,this.use(...t)}walkTokens(t,n){let e=[];for(const i of t)switch(e=e.concat(n.call(this,i)),i.type){case"table":{for(const s of i.header)e=e.concat(this.walkTokens(s.tokens,n));for(const s of i.rows)for(const l of s)e=e.concat(this.walkTokens(l.tokens,n));break}case"list":{e=e.concat(this.walkTokens(i.items,n));break}default:this.defaults.extensions&&this.defaults.extensions.childTokens&&this.defaults.extensions.childTokens[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{e=e.concat(this.walkTokens(i[s],n))}):i.tokens&&(e=e.concat(this.walkTokens(i.tokens,n)))}return e}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...r){let h=s.renderer.apply(this,r);return h===!1&&(h=l.apply(this,r)),h}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");n[s.level]?n[s.level].unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),i.extensions=n),e.renderer){const s=this.defaults.renderer||new B(this.defaults);for(const l in e.renderer){const r=s[l];s[l]=(...h)=>{let c=e.renderer[l].apply(s,h);return c===!1&&(c=r.apply(s,h)),c}}i.renderer=s}if(e.tokenizer){const s=this.defaults.tokenizer||new q(this.defaults);for(const l in e.tokenizer){const r=s[l];s[l]=(...h)=>{let c=e.tokenizer[l].apply(s,h);return c===!1&&(c=r.apply(s,h)),c}}i.tokenizer=s}if(e.hooks){const s=this.defaults.hooks||new C;for(const l in e.hooks){const r=s[l];C.passThroughHooks.has(l)?s[l]=h=>{if(this.defaults.async)return Promise.resolve(e.hooks[l].call(s,h)).then(u=>r.call(s,u));const c=e.hooks[l].call(s,h);return r.call(s,c)}:s[l]=(...h)=>{let c=e.hooks[l].apply(s,h);return c===!1&&(c=r.apply(s,h)),c}}i.hooks=s}if(e.walkTokens){const s=this.defaults.walkTokens;i.walkTokens=function(l){let r=
Please report this to https://github.com/markedjs/marked.`,t){const s="<p>An error occurred:</p><pre>"+_(i.message+"",!0)+"</pre>";if(n)return Promise.resolve(s);if(e){e(null,s);return}return s}if(n)return Promise.reject(i);if(e){e(i);return}throw i}};var v=new we;function k(t,n,e){return v.parse(t,n,e)}k.options=k.setOptions=function(t){return v.setOptions(t),k.defaults=v.defaults,K(k.defaults),k};k.getDefaults=M;k.defaults=I;k.use=function(...t){return v.use(...t),k.defaults=v.defaults,K(k.defaults),k};k.walkTokens=function(t,n){return v.walkTokens(t,n)};k.parseInline=v.parseInline;k.Parser=T;k.parser=T.parse;k.Renderer=B;k.TextRenderer=O;k.Lexer=S;k.lexer=S.lex;k.Tokenizer=q;k.Slugger=Q;k.Hooks=C;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;T.parse;S.lex;export{k as m};