File size: 56,452 Bytes
ed4ac02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function ot(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let K=ot();function Kt(c){K=c}const Jt=/[&<>"']/,On=new RegExp(Jt.source,"g"),en=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Cn=new RegExp(en.source,"g"),Dn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vt=c=>Dn[c];function $(c,e){if(e){if(Jt.test(c))return c.replace(On,vt)}else if(en.test(c))return c.replace(Cn,vt);return c}const Nn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Mn(c){return c.replace(Nn,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const zn=/(^|[^\[])\^/g;function x(c,e){let n=typeof c=="string"?c:c.source;e=e||"";const t={replace:(r,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(zn,"$1"),n=n.replace(r,i),t},getRegex:()=>new RegExp(n,e)};return t}function Ut(c){try{c=encodeURI(c).replace(/%25/g,"%")}catch{return null}return c}const de={exec:()=>null};function Ft(c,e){const n=c.replace(/\|/g,(o,i,l)=>{let u=!1,m=i;for(;--m>=0&&l[m]==="\\";)u=!u;return u?"|":" |"}),t=n.split(/ \|/);let r=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),e)if(t.length>e)t.splice(e);else for(;t.length<e;)t.push("");for(;r<t.length;r++)t[r]=t[r].trim().replace(/\\\|/g,"|");return t}function Re(c,e,n){const t=c.length;if(t===0)return"";let r=0;for(;r<t&&c.charAt(t-r-1)===e;)r++;return c.slice(0,t-r)}function Pn(c,e){if(c.indexOf(e[1])===-1)return-1;let n=0;for(let t=0;t<c.length;t++)if(c[t]==="\\")t++;else if(c[t]===e[0])n++;else if(c[t]===e[1]&&(n--,n<0))return t;return-1}function Ht(c,e,n,t){const r=e.href,o=e.title?$(e.title):null,i=c[1].replace(/\\([\[\]])/g,"$1");if(c[0].charAt(0)!=="!"){t.state.inLink=!0;const l={type:"link",raw:n,href:r,title:o,text:i,tokens:t.inlineTokens(i)};return t.state.inLink=!1,l}return{type:"image",raw:n,href:r,title:o,text:$(i)}}function $n(c,e){const n=c.match(/^(\s+)(?:```)/);if(n===null)return e;const t=n[1];return e.split(`
`).map(r=>{const o=r.match(/^\s+/);if(o===null)return r;const[i]=o;return i.length>=t.length?r.slice(t.length):r}).join(`
`)}class Ne{options;rules;lexer;constructor(e){this.options=e||K}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const t=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Re(t,`
`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],r=$n(t,n[3]||"");return{type:"code",raw:t,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:r}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let t=n[2].trim();if(/#$/.test(t)){const r=Re(t,"#");(this.options.pedantic||!r||/ $/.test(r))&&(t=r.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`);t=Re(t.replace(/^ *>[ \t]?/gm,""),`
`);const r=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(t);return this.lexer.state.top=r,{type:"blockquote",raw:n[0],tokens:o,text:t}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim();const r=t.length>1,o={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");const i=new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`);let l="",u="",m=!1;for(;e;){let f=!1;if(!(n=i.exec(e))||this.rules.block.hr.test(e))break;l=n[0],e=e.substring(l.length);let d=n[2].split(`
`,1)[0].replace(/^\t+/,re=>" ".repeat(3*re.length)),g=e.split(`
`,1)[0],T=0;this.options.pedantic?(T=2,u=d.trimStart()):(T=n[2].search(/[^ ]/),T=T>4?1:T,u=d.slice(T),T+=n[1].length);let M=!1;if(!d&&/^ *$/.test(g)&&(l+=g+`
`,e=e.substring(g.length+1),f=!0),!f){const re=new RegExp(`^ {0,${Math.min(3,T-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),be=new RegExp(`^ {0,${Math.min(3,T-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),j=new RegExp(`^ {0,${Math.min(3,T-1)}}(?:\`\`\`|~~~)`),E=new RegExp(`^ {0,${Math.min(3,T-1)}}#`);for(;e;){const q=e.split(`
`,1)[0];if(g=q,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),j.test(g)||E.test(g)||re.test(g)||be.test(e))break;if(g.search(/[^ ]/)>=T||!g.trim())u+=`
`+g.slice(T);else{if(M||d.search(/[^ ]/)>=4||j.test(d)||E.test(d)||be.test(d))break;u+=`
`+g}!M&&!g.trim()&&(M=!0),l+=q+`
`,e=e.substring(q.length+1),d=g.slice(T)}}o.loose||(m?o.loose=!0:/\n *\n *$/.test(l)&&(m=!0));let P=null,W;this.options.gfm&&(P=/^\[[ xX]\] /.exec(u),P&&(W=P[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:l,task:!!P,checked:W,loose:!1,text:u,tokens:[]}),o.raw+=l}o.items[o.items.length-1].raw=l.trimEnd(),o.items[o.items.length-1].text=u.trimEnd(),o.raw=o.raw.trimEnd();for(let f=0;f<o.items.length;f++)if(this.lexer.state.top=!1,o.items[f].tokens=this.lexer.blockTokens(o.items[f].text,[]),!o.loose){const d=o.items[f].tokens.filter(T=>T.type==="space"),g=d.length>0&&d.some(T=>/\n.*\n/.test(T.raw));o.loose=g}if(o.loose)for(let f=0;f<o.items.length;f++)o.items[f].loose=!0;return o}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const t=n[1].toLowerCase().replace(/\s+/g," "),r=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:t,raw:n[0],href:r,title:o}}}table(e){const n=this.rules.block.table.exec(e);if(!n||!/[:|]/.test(n[2]))return;const t=Ft(n[1]),r=n[2].replace(/^\||\| *$/g,"").split("|"),o=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
`):[],i={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===r.length){for(const l of r)/^ *-+: *$/.test(l)?i.align.push("right"):/^ *:-+: *$/.test(l)?i.align.push("center"):/^ *:-+ *$/.test(l)?i.align.push("left"):i.align.push(null);for(const l of t)i.header.push({text:l,tokens:this.lexer.inline(l)});for(const l of o)i.rows.push(Ft(l,i.header.length).map(u=>({text:u,tokens:this.lexer.inline(u)})));return i}}lheading(e){const n=this.rules.block.lheading.exec(e);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(e){const n=this.rules.block.paragraph.exec(e);if(n){const t=n[1].charAt(n[1].length-1)===`
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:t,tokens:this.lexer.inline(t)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:$(n[1])}}tag(e){const n=this.rules.inline.tag.exec(e);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:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const t=n[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;const i=Re(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{const i=Pn(n[2],"()");if(i>-1){const u=(n[0].indexOf("!")===0?5:4)+n[1].length+i;n[2]=n[2].substring(0,i),n[0]=n[0].substring(0,u).trim(),n[3]=""}}let r=n[2],o="";if(this.options.pedantic){const i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);i&&(r=i[1],o=i[3])}else o=n[3]?n[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(this.options.pedantic&&!/>$/.test(t)?r=r.slice(1):r=r.slice(1,-1)),Ht(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){const r=(t[2]||t[1]).replace(/\s+/g," "),o=n[r.toLowerCase()];if(!o){const i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return Ht(t,o,t[0],this.lexer)}}emStrong(e,n,t=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&t.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const i=[...r[0]].length-1;let l,u,m=i,f=0;const d=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,n=n.slice(-1*e.length+i);(r=d.exec(n))!=null;){if(l=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!l)continue;if(u=[...l].length,r[3]||r[4]){m+=u;continue}else if((r[5]||r[6])&&i%3&&!((i+u)%3)){f+=u;continue}if(m-=u,m>0)continue;u=Math.min(u,u+m+f);const g=[...r[0]][0].length,T=e.slice(0,i+r.index+g+u);if(Math.min(i,u)%2){const P=T.slice(1,-1);return{type:"em",raw:T,text:P,tokens:this.lexer.inlineTokens(P)}}const M=T.slice(2,-2);return{type:"strong",raw:T,text:M,tokens:this.lexer.inlineTokens(M)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let t=n[2].replace(/\n/g," ");const r=/[^ ]/.test(t),o=/^ /.test(t)&&/ $/.test(t);return r&&o&&(t=t.substring(1,t.length-1)),t=$(t,!0),{type:"codespan",raw:n[0],text:t}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let t,r;return n[2]==="@"?(t=$(n[1]),r="mailto:"+t):(t=$(n[1]),r=t),{type:"link",raw:n[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let t,r;if(n[2]==="@")t=$(n[0]),r="mailto:"+t;else{let o;do o=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(o!==n[0]);t=$(n[0]),n[1]==="www."?r="http://"+n[0]:r=n[0]}return{type:"link",raw:n[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){let t;return this.lexer.state.inRawBlock?t=n[0]:t=$(n[0]),{type:"text",raw:n[0],text:t}}}}const vn=/^(?: *(?:\n|$))+/,Un=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Fn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ke=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,tn=/(?:[*+-]|\d{1,9}[.)])/,nn=x(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,tn).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),lt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Bn=/^[^\n]+/,at=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Gn=x(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",at).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Wn=x(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,tn).getRegex(),Pe="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[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ct=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qn=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",ct).replace("tag",Pe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),sn=x(lt).replace("hr",ke).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pe).getRegex(),Zn=x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",sn).getRegex(),ut={blockquote:Zn,code:Un,def:Gn,fences:Fn,heading:Hn,hr:ke,html:qn,lheading:nn,list:Wn,newline:vn,paragraph:sn,table:de,text:Bn},Bt=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ke).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pe).getRegex(),Yn={...ut,table:Bt,paragraph:x(lt).replace("hr",ke).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Bt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pe).getRegex()},jn={...ut,html:x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ct).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:de,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(lt).replace("hr",ke).replace("heading",` *#{1,6} *[^
]`).replace("lheading",nn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,on=/^( {2,}|\\)\n(?!\s*$)/,Qn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Te="\\p{P}\\p{S}",Vn=x(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Te).getRegex(),Kn=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Jn=x(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Te).getRegex(),ei=x("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Te).getRegex(),ti=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Te).getRegex(),ni=x(/\\([punct])/,"gu").replace(/punct/g,Te).getRegex(),ii=x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),si=x(ct).replace("(?:-->|$)","-->").getRegex(),ri=x("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",si).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Me=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oi=x(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Me).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ln=x(/^!?\[(label)\]\[(ref)\]/).replace("label",Me).replace("ref",at).getRegex(),an=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",at).getRegex(),li=x("reflink|nolink(?!\\()","g").replace("reflink",ln).replace("nolink",an).getRegex(),pt={_backpedal:de,anyPunctuation:ni,autolink:ii,blockSkip:Kn,br:on,code:Xn,del:de,emStrongLDelim:Jn,emStrongRDelimAst:ei,emStrongRDelimUnd:ti,escape:rn,link:oi,nolink:an,punctuation:Vn,reflink:ln,reflinkSearch:li,tag:ri,text:Qn,url:de},ai={...pt,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",Me).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Me).getRegex()},it={...pt,escape:x(rn).replace("])","~|])").getRegex(),url:x(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_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.!#$%&'*+\/=?_`{\|}~-]+@)))/},ci={...it,br:x(on).replace("{2,}","*").getRegex(),text:x(it.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ie={normal:ut,gfm:Yn,pedantic:jn},ue={normal:pt,gfm:it,breaks:ci,pedantic:ai};class B{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||K,this.options.tokenizer=this.options.tokenizer||new Ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Ie.normal,inline:ue.normal};this.options.pedantic?(n.block=Ie.pedantic,n.inline=ue.pedantic):this.options.gfm&&(n.block=Ie.gfm,this.options.breaks?n.inline=ue.breaks:n.inline=ue.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ie,inline:ue}}static lex(e,n){return new B(n).lex(e)}static lexInline(e,n){return new B(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const t=this.inlineQueue[n];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[]){this.options.pedantic?e=e.replace(/\t/g,"    ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,u,m)=>u+"    ".repeat(m.length));let t,r,o,i;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(t=l.call({lexer:this},e,n))?(e=e.substring(t.raw.length),n.push(t),!0):!1))){if(t=this.tokenizer.space(e)){e=e.substring(t.raw.length),t.raw.length===1&&n.length>0?n[n.length-1].raw+=`
`:n.push(t);continue}if(t=this.tokenizer.code(e)){e=e.substring(t.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+t.raw,r.text+=`
`+t.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(t);continue}if(t=this.tokenizer.fences(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.heading(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.hr(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.blockquote(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.list(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.html(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.def(e)){e=e.substring(t.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+t.raw,r.text+=`
`+t.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[t.tag]||(this.tokens.links[t.tag]={href:t.href,title:t.title});continue}if(t=this.tokenizer.table(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.lheading(e)){e=e.substring(t.raw.length),n.push(t);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const u=e.slice(1);let m;this.options.extensions.startBlock.forEach(f=>{m=f.call({lexer:this},u),typeof m=="number"&&m>=0&&(l=Math.min(l,m))}),l<1/0&&l>=0&&(o=e.substring(0,l+1))}if(this.state.top&&(t=this.tokenizer.paragraph(o))){r=n[n.length-1],i&&r.type==="paragraph"?(r.raw+=`
`+t.raw,r.text+=`
`+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(t),i=o.length!==e.length,e=e.substring(t.raw.length);continue}if(t=this.tokenizer.text(e)){e=e.substring(t.raw.length),r=n[n.length-1],r&&r.type==="text"?(r.raw+=`
`+t.raw,r.text+=`
`+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(t);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let t,r,o,i=e,l,u,m;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)f.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(u||(m=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(f=>(t=f.call({lexer:this},e,n))?(e=e.substring(t.raw.length),n.push(t),!0):!1))){if(t=this.tokenizer.escape(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.tag(e)){e=e.substring(t.raw.length),r=n[n.length-1],r&&t.type==="text"&&r.type==="text"?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(t=this.tokenizer.link(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(t.raw.length),r=n[n.length-1],r&&t.type==="text"&&r.type==="text"?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(t=this.tokenizer.emStrong(e,i,m)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.codespan(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.br(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.del(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.autolink(e)){e=e.substring(t.raw.length),n.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(e))){e=e.substring(t.raw.length),n.push(t);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let f=1/0;const d=e.slice(1);let g;this.options.extensions.startInline.forEach(T=>{g=T.call({lexer:this},d),typeof g=="number"&&g>=0&&(f=Math.min(f,g))}),f<1/0&&f>=0&&(o=e.substring(0,f+1))}if(t=this.tokenizer.inlineText(o)){e=e.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(m=t.raw.slice(-1)),u=!0,r=n[n.length-1],r&&r.type==="text"?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}}class ze{options;constructor(e){this.options=e||K}code(e,n,t){const r=(n||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+`
`,r?'<pre><code class="language-'+$(r)+'">'+(t?e:$(e,!0))+`</code></pre>
`:"<pre><code>"+(t?e:$(e,!0))+`</code></pre>
`}blockquote(e){return`<blockquote>
${e}</blockquote>
`}html(e,n){return e}heading(e,n,t){return`<h${n}>${e}</h${n}>
`}hr(){return`<hr>
`}list(e,n,t){const r=n?"ol":"ul",o=n&&t!==1?' start="'+t+'"':"";return"<"+r+o+`>
`+e+"</"+r+`>
`}listitem(e,n,t){return`<li>${e}</li>
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
`}table(e,n){return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+n+`</table>
`}tablerow(e){return`<tr>
${e}</tr>
`}tablecell(e,n){const t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,n,t){const r=Ut(e);if(r===null)return t;e=r;let o='<a href="'+e+'"';return n&&(o+=' title="'+n+'"'),o+=">"+t+"</a>",o}image(e,n,t){const r=Ut(e);if(r===null)return t;e=r;let o=`<img src="${e}" alt="${t}"`;return n&&(o+=` title="${n}"`),o+=">",o}text(e){return e}}class ft{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,t){return""+t}image(e,n,t){return""+t}br(){return""}}class G{options;renderer;textRenderer;constructor(e){this.options=e||K,this.options.renderer=this.options.renderer||new ze,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ft}static parse(e,n){return new G(n).parse(e)}static parseInline(e,n){return new G(n).parseInline(e)}parse(e,n=!0){let t="";for(let r=0;r<e.length;r++){const o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=o,l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){t+=l||"";continue}}switch(o.type){case"space":continue;case"hr":{t+=this.renderer.hr();continue}case"heading":{const i=o;t+=this.renderer.heading(this.parseInline(i.tokens),i.depth,Mn(this.parseInline(i.tokens,this.textRenderer)));continue}case"code":{const i=o;t+=this.renderer.code(i.text,i.lang,!!i.escaped);continue}case"table":{const i=o;let l="",u="";for(let f=0;f<i.header.length;f++)u+=this.renderer.tablecell(this.parseInline(i.header[f].tokens),{header:!0,align:i.align[f]});l+=this.renderer.tablerow(u);let m="";for(let f=0;f<i.rows.length;f++){const d=i.rows[f];u="";for(let g=0;g<d.length;g++)u+=this.renderer.tablecell(this.parseInline(d[g].tokens),{header:!1,align:i.align[g]});m+=this.renderer.tablerow(u)}t+=this.renderer.table(l,m);continue}case"blockquote":{const i=o,l=this.parse(i.tokens);t+=this.renderer.blockquote(l);continue}case"list":{const i=o,l=i.ordered,u=i.start,m=i.loose;let f="";for(let d=0;d<i.items.length;d++){const g=i.items[d],T=g.checked,M=g.task;let P="";if(g.task){const W=this.renderer.checkbox(!!T);m?g.tokens.length>0&&g.tokens[0].type==="paragraph"?(g.tokens[0].text=W+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&g.tokens[0].tokens[0].type==="text"&&(g.tokens[0].tokens[0].text=W+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:W+" "}):P+=W+" "}P+=this.parse(g.tokens,m),f+=this.renderer.listitem(P,M,!!T)}t+=this.renderer.list(f,l,u);continue}case"html":{const i=o;t+=this.renderer.html(i.text,i.block);continue}case"paragraph":{const i=o;t+=this.renderer.paragraph(this.parseInline(i.tokens));continue}case"text":{let i=o,l=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<e.length&&e[r+1].type==="text";)i=e[++r],l+=`
`+(i.tokens?this.parseInline(i.tokens):i.text);t+=n?this.renderer.paragraph(l):l;continue}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,n){n=n||this.renderer;let t="";for(let r=0;r<e.length;r++){const o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){t+=i||"";continue}}switch(o.type){case"escape":{const i=o;t+=n.text(i.text);break}case"html":{const i=o;t+=n.html(i.text);break}case"link":{const i=o;t+=n.link(i.href,i.title,this.parseInline(i.tokens,n));break}case"image":{const i=o;t+=n.image(i.href,i.title,i.text);break}case"strong":{const i=o;t+=n.strong(this.parseInline(i.tokens,n));break}case"em":{const i=o;t+=n.em(this.parseInline(i.tokens,n));break}case"codespan":{const i=o;t+=n.codespan(i.text);break}case"br":{t+=n.br();break}case"del":{const i=o;t+=n.del(this.parseInline(i.tokens,n));break}case"text":{const i=o;t+=n.text(i.text);break}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}}class Ce{options;constructor(e){this.options=e||K}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class ui{defaults=ot();options=this.setOptions;parse=this.#e(B.lex,G.parse);parseInline=this.#e(B.lexInline,G.parseInline);Parser=G;Renderer=ze;TextRenderer=ft;Lexer=B;Tokenizer=Ne;Hooks=Ce;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(const r of e)switch(t=t.concat(n.call(this,r)),r.type){case"table":{const o=r;for(const i of o.header)t=t.concat(this.walkTokens(i.tokens,n));for(const i of o.rows)for(const l of i)t=t.concat(this.walkTokens(l.tokens,n));break}case"list":{const o=r;t=t.concat(this.walkTokens(o.items,n));break}default:{const o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(i=>{const l=o[i].flat(1/0);t=t.concat(this.walkTokens(l,n))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,n)))}}return t}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(t=>{const r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=n.renderers[o.name];i?n.renderers[o.name]=function(...l){let u=o.renderer.apply(this,l);return u===!1&&(u=i.apply(this,l)),u}:n.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=n[o.level];i?i.unshift(o.tokenizer):n[o.level]=[o.tokenizer],o.start&&(o.level==="block"?n.startBlock?n.startBlock.push(o.start):n.startBlock=[o.start]:o.level==="inline"&&(n.startInline?n.startInline.push(o.start):n.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(n.childTokens[o.name]=o.childTokens)}),r.extensions=n),t.renderer){const o=this.defaults.renderer||new ze(this.defaults);for(const i in t.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(i==="options")continue;const l=i,u=t.renderer[l],m=o[l];o[l]=(...f)=>{let d=u.apply(o,f);return d===!1&&(d=m.apply(o,f)),d||""}}r.renderer=o}if(t.tokenizer){const o=this.defaults.tokenizer||new Ne(this.defaults);for(const i in t.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const l=i,u=t.tokenizer[l],m=o[l];o[l]=(...f)=>{let d=u.apply(o,f);return d===!1&&(d=m.apply(o,f)),d}}r.tokenizer=o}if(t.hooks){const o=this.defaults.hooks||new Ce;for(const i in t.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(i==="options")continue;const l=i,u=t.hooks[l],m=o[l];Ce.passThroughHooks.has(i)?o[l]=f=>{if(this.defaults.async)return Promise.resolve(u.call(o,f)).then(g=>m.call(o,g));const d=u.call(o,f);return m.call(o,d)}:o[l]=(...f)=>{let d=u.apply(o,f);return d===!1&&(d=m.apply(o,f)),d}}r.hooks=o}if(t.walkTokens){const o=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(l){let u=[];return u.push(i.call(this,l)),o&&(u=u.concat(o.call(this,l))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return B.lex(e,n??this.defaults)}parser(e,n){return G.parse(e,n??this.defaults)}#e(e,n){return(t,r)=>{const o={...r},i={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const l=this.#t(!!i.silent,!!i.async);if(typeof t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(u=>e(u,i)).then(u=>i.hooks?i.hooks.processAllTokens(u):u).then(u=>i.walkTokens?Promise.all(this.walkTokens(u,i.walkTokens)).then(()=>u):u).then(u=>n(u,i)).then(u=>i.hooks?i.hooks.postprocess(u):u).catch(l);try{i.hooks&&(t=i.hooks.preprocess(t));let u=e(t,i);i.hooks&&(u=i.hooks.processAllTokens(u)),i.walkTokens&&this.walkTokens(u,i.walkTokens);let m=n(u,i);return i.hooks&&(m=i.hooks.postprocess(m)),m}catch(u){return l(u)}}}#t(e,n){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+$(t.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(t);throw t}}}const V=new ui;function b(c,e){return V.parse(c,e)}b.options=b.setOptions=function(c){return V.setOptions(c),b.defaults=V.defaults,Kt(b.defaults),b};b.getDefaults=ot;b.defaults=K;b.use=function(...c){return V.use(...c),b.defaults=V.defaults,Kt(b.defaults),b};b.walkTokens=function(c,e){return V.walkTokens(c,e)};b.parseInline=V.parseInline;b.Parser=G;b.parser=G.parse;b.Renderer=ze;b.TextRenderer=ft;b.Lexer=B;b.lexer=B.lex;b.Tokenizer=Ne;b.Hooks=Ce;b.parse=b;b.options;b.setOptions;b.use;b.walkTokens;b.parseInline;G.parse;B.lex;/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:cn,setPrototypeOf:Gt,isFrozen:pi,getPrototypeOf:fi,getOwnPropertyDescriptor:hi}=Object;let{freeze:D,seal:v,create:un}=Object,{apply:st,construct:rt}=typeof Reflect<"u"&&Reflect;D||(D=function(e){return e});v||(v=function(e){return e});st||(st=function(e,n,t){return e.apply(n,t)});rt||(rt=function(e,n){return new e(...n)});const Le=N(Array.prototype.forEach),gi=N(Array.prototype.lastIndexOf),Wt=N(Array.prototype.pop),pe=N(Array.prototype.push),mi=N(Array.prototype.splice),De=N(String.prototype.toLowerCase),Ke=N(String.prototype.toString),qt=N(String.prototype.match),fe=N(String.prototype.replace),di=N(String.prototype.indexOf),ki=N(String.prototype.trim),U=N(Object.prototype.hasOwnProperty),C=N(RegExp.prototype.test),he=Ti(TypeError);function N(c){return function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return st(c,e,t)}}function Ti(c){return function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return rt(c,n)}}function k(c,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:De;Gt&&Gt(c,null);let t=e.length;for(;t--;){let r=e[t];if(typeof r=="string"){const o=n(r);o!==r&&(pi(e)||(e[t]=o),r=o)}c[r]=!0}return c}function bi(c){for(let e=0;e<c.length;e++)U(c,e)||(c[e]=null);return c}function Q(c){const e=un(null);for(const[n,t]of cn(c))U(c,n)&&(Array.isArray(t)?e[n]=bi(t):t&&typeof t=="object"&&t.constructor===Object?e[n]=Q(t):e[n]=t);return e}function ge(c,e){for(;c!==null;){const t=hi(c,e);if(t){if(t.get)return N(t.get);if(typeof t.value=="function")return N(t.value)}c=fi(c)}function n(){return null}return n}const Zt=D(["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"]),Je=D(["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"]),et=D(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xi=D(["animate","color-profile","cursor","discard","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"]),tt=D(["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","mprescripts"]),_i=D(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yt=D(["#text"]),jt=D(["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","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),nt=D(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),Xt=D(["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"]),Oe=D(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),wi=v(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ei=v(/<%[\w\W]*|[\w\W]*%>/gm),Ai=v(/\$\{[\w\W]*/gm),yi=v(/^data-[\-\w.\u00B7-\uFFFF]+$/),Si=v(/^aria-[\-\w]+$/),pn=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ri=v(/^(?:\w+script|data):/i),Ii=v(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fn=v(/^html$/i),Li=v(/^[a-z][.\w]*(-[.\w]+)+$/i);var Qt=Object.freeze({__proto__:null,ARIA_ATTR:Si,ATTR_WHITESPACE:Ii,CUSTOM_ELEMENT:Li,DATA_ATTR:yi,DOCTYPE_NAME:fn,ERB_EXPR:Ei,IS_ALLOWED_URI:pn,IS_SCRIPT_OR_DATA:Ri,MUSTACHE_EXPR:wi,TMPLIT_EXPR:Ai});const me={element:1,text:3,progressingInstruction:7,comment:8,document:9},Oi=function(){return typeof window>"u"?null:window},Ci=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let t=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(t=n.getAttribute(r));const o="dompurify"+(t?"#"+t:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Vt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hn(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oi();const e=h=>hn(h);if(e.version="3.2.4",e.removed=[],!c||!c.document||c.document.nodeType!==me.document||!c.Element)return e.isSupported=!1,e;let{document:n}=c;const t=n,r=t.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:l,Element:u,NodeFilter:m,NamedNodeMap:f=c.NamedNodeMap||c.MozNamedAttrMap,HTMLFormElement:d,DOMParser:g,trustedTypes:T}=c,M=u.prototype,P=ge(M,"cloneNode"),W=ge(M,"remove"),re=ge(M,"nextSibling"),be=ge(M,"childNodes"),j=ge(M,"parentNode");if(typeof i=="function"){const h=n.createElement("template");h.content&&h.content.ownerDocument&&(n=h.content.ownerDocument)}let E,q="";const{implementation:$e,createNodeIterator:gn,createDocumentFragment:mn,getElementsByTagName:dn}=n,{importNode:kn}=t;let L=Vt();e.isSupported=typeof cn=="function"&&typeof j=="function"&&$e&&$e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ve,ERB_EXPR:Ue,TMPLIT_EXPR:Fe,DATA_ATTR:Tn,ARIA_ATTR:bn,IS_SCRIPT_OR_DATA:xn,ATTR_WHITESPACE:ht,CUSTOM_ELEMENT:_n}=Qt;let{IS_ALLOWED_URI:gt}=Qt,A=null;const mt=k({},[...Zt,...Je,...et,...tt,...Yt]);let S=null;const dt=k({},[...jt,...nt,...Xt,...Oe]);let w=Object.seal(un(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,He=null,kt=!0,Be=!0,Tt=!1,bt=!0,J=!1,Ge=!0,X=!1,We=!1,qe=!1,ee=!1,xe=!1,_e=!1,xt=!0,_t=!1;const wn="user-content-";let Ze=!0,le=!1,te={},ne=null;const wt=k({},["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"]);let Et=null;const At=k({},["audio","video","img","source","image","track"]);let Ye=null;const yt=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),we="http://www.w3.org/1998/Math/MathML",Ee="http://www.w3.org/2000/svg",Z="http://www.w3.org/1999/xhtml";let ie=Z,je=!1,Xe=null;const En=k({},[we,Ee,Z],Ke);let Ae=k({},["mi","mo","mn","ms","mtext"]),ye=k({},["annotation-xml"]);const An=k({},["title","style","font","a","script"]);let ae=null;const yn=["application/xhtml+xml","text/html"],Sn="text/html";let y=null,se=null;const Rn=n.createElement("form"),St=function(s){return s instanceof RegExp||s instanceof Function},Qe=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(se&&se===s)){if((!s||typeof s!="object")&&(s={}),s=Q(s),ae=yn.indexOf(s.PARSER_MEDIA_TYPE)===-1?Sn:s.PARSER_MEDIA_TYPE,y=ae==="application/xhtml+xml"?Ke:De,A=U(s,"ALLOWED_TAGS")?k({},s.ALLOWED_TAGS,y):mt,S=U(s,"ALLOWED_ATTR")?k({},s.ALLOWED_ATTR,y):dt,Xe=U(s,"ALLOWED_NAMESPACES")?k({},s.ALLOWED_NAMESPACES,Ke):En,Ye=U(s,"ADD_URI_SAFE_ATTR")?k(Q(yt),s.ADD_URI_SAFE_ATTR,y):yt,Et=U(s,"ADD_DATA_URI_TAGS")?k(Q(At),s.ADD_DATA_URI_TAGS,y):At,ne=U(s,"FORBID_CONTENTS")?k({},s.FORBID_CONTENTS,y):wt,oe=U(s,"FORBID_TAGS")?k({},s.FORBID_TAGS,y):{},He=U(s,"FORBID_ATTR")?k({},s.FORBID_ATTR,y):{},te=U(s,"USE_PROFILES")?s.USE_PROFILES:!1,kt=s.ALLOW_ARIA_ATTR!==!1,Be=s.ALLOW_DATA_ATTR!==!1,Tt=s.ALLOW_UNKNOWN_PROTOCOLS||!1,bt=s.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=s.SAFE_FOR_TEMPLATES||!1,Ge=s.SAFE_FOR_XML!==!1,X=s.WHOLE_DOCUMENT||!1,ee=s.RETURN_DOM||!1,xe=s.RETURN_DOM_FRAGMENT||!1,_e=s.RETURN_TRUSTED_TYPE||!1,qe=s.FORCE_BODY||!1,xt=s.SANITIZE_DOM!==!1,_t=s.SANITIZE_NAMED_PROPS||!1,Ze=s.KEEP_CONTENT!==!1,le=s.IN_PLACE||!1,gt=s.ALLOWED_URI_REGEXP||pn,ie=s.NAMESPACE||Z,Ae=s.MATHML_TEXT_INTEGRATION_POINTS||Ae,ye=s.HTML_INTEGRATION_POINTS||ye,w=s.CUSTOM_ELEMENT_HANDLING||{},s.CUSTOM_ELEMENT_HANDLING&&St(s.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(w.tagNameCheck=s.CUSTOM_ELEMENT_HANDLING.tagNameCheck),s.CUSTOM_ELEMENT_HANDLING&&St(s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(w.attributeNameCheck=s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),s.CUSTOM_ELEMENT_HANDLING&&typeof s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(w.allowCustomizedBuiltInElements=s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(Be=!1),xe&&(ee=!0),te&&(A=k({},Yt),S=[],te.html===!0&&(k(A,Zt),k(S,jt)),te.svg===!0&&(k(A,Je),k(S,nt),k(S,Oe)),te.svgFilters===!0&&(k(A,et),k(S,nt),k(S,Oe)),te.mathMl===!0&&(k(A,tt),k(S,Xt),k(S,Oe))),s.ADD_TAGS&&(A===mt&&(A=Q(A)),k(A,s.ADD_TAGS,y)),s.ADD_ATTR&&(S===dt&&(S=Q(S)),k(S,s.ADD_ATTR,y)),s.ADD_URI_SAFE_ATTR&&k(Ye,s.ADD_URI_SAFE_ATTR,y),s.FORBID_CONTENTS&&(ne===wt&&(ne=Q(ne)),k(ne,s.FORBID_CONTENTS,y)),Ze&&(A["#text"]=!0),X&&k(A,["html","head","body"]),A.table&&(k(A,["tbody"]),delete oe.tbody),s.TRUSTED_TYPES_POLICY){if(typeof s.TRUSTED_TYPES_POLICY.createHTML!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof s.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=s.TRUSTED_TYPES_POLICY,q=E.createHTML("")}else E===void 0&&(E=Ci(T,r)),E!==null&&typeof q=="string"&&(q=E.createHTML(""));D&&D(s),se=s}},Rt=k({},[...Je,...et,...xi]),It=k({},[...tt,..._i]),In=function(s){let a=j(s);(!a||!a.tagName)&&(a={namespaceURI:ie,tagName:"template"});const p=De(s.tagName),_=De(a.tagName);return Xe[s.namespaceURI]?s.namespaceURI===Ee?a.namespaceURI===Z?p==="svg":a.namespaceURI===we?p==="svg"&&(_==="annotation-xml"||Ae[_]):!!Rt[p]:s.namespaceURI===we?a.namespaceURI===Z?p==="math":a.namespaceURI===Ee?p==="math"&&ye[_]:!!It[p]:s.namespaceURI===Z?a.namespaceURI===Ee&&!ye[_]||a.namespaceURI===we&&!Ae[_]?!1:!It[p]&&(An[p]||!Rt[p]):!!(ae==="application/xhtml+xml"&&Xe[s.namespaceURI]):!1},F=function(s){pe(e.removed,{element:s});try{j(s).removeChild(s)}catch{W(s)}},Se=function(s,a){try{pe(e.removed,{attribute:a.getAttributeNode(s),from:a})}catch{pe(e.removed,{attribute:null,from:a})}if(a.removeAttribute(s),s==="is")if(ee||xe)try{F(a)}catch{}else try{a.setAttribute(s,"")}catch{}},Lt=function(s){let a=null,p=null;if(qe)s="<remove></remove>"+s;else{const R=qt(s,/^[\r\n\t ]+/);p=R&&R[0]}ae==="application/xhtml+xml"&&ie===Z&&(s='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+s+"</body></html>");const _=E?E.createHTML(s):s;if(ie===Z)try{a=new g().parseFromString(_,ae)}catch{}if(!a||!a.documentElement){a=$e.createDocument(ie,"template",null);try{a.documentElement.innerHTML=je?q:_}catch{}}const I=a.body||a.documentElement;return s&&p&&I.insertBefore(n.createTextNode(p),I.childNodes[0]||null),ie===Z?dn.call(a,X?"html":"body")[0]:X?a.documentElement:I},Ot=function(s){return gn.call(s.ownerDocument||s,s,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},Ve=function(s){return s instanceof d&&(typeof s.nodeName!="string"||typeof s.textContent!="string"||typeof s.removeChild!="function"||!(s.attributes instanceof f)||typeof s.removeAttribute!="function"||typeof s.setAttribute!="function"||typeof s.namespaceURI!="string"||typeof s.insertBefore!="function"||typeof s.hasChildNodes!="function")},Ct=function(s){return typeof l=="function"&&s instanceof l};function Y(h,s,a){Le(h,p=>{p.call(e,s,a,se)})}const Dt=function(s){let a=null;if(Y(L.beforeSanitizeElements,s,null),Ve(s))return F(s),!0;const p=y(s.nodeName);if(Y(L.uponSanitizeElement,s,{tagName:p,allowedTags:A}),s.hasChildNodes()&&!Ct(s.firstElementChild)&&C(/<[/\w]/g,s.innerHTML)&&C(/<[/\w]/g,s.textContent)||s.nodeType===me.progressingInstruction||Ge&&s.nodeType===me.comment&&C(/<[/\w]/g,s.data))return F(s),!0;if(!A[p]||oe[p]){if(!oe[p]&&Mt(p)&&(w.tagNameCheck instanceof RegExp&&C(w.tagNameCheck,p)||w.tagNameCheck instanceof Function&&w.tagNameCheck(p)))return!1;if(Ze&&!ne[p]){const _=j(s)||s.parentNode,I=be(s)||s.childNodes;if(I&&_){const R=I.length;for(let z=R-1;z>=0;--z){const H=P(I[z],!0);H.__removalCount=(s.__removalCount||0)+1,_.insertBefore(H,re(s))}}}return F(s),!0}return s instanceof u&&!In(s)||(p==="noscript"||p==="noembed"||p==="noframes")&&C(/<\/no(script|embed|frames)/i,s.innerHTML)?(F(s),!0):(J&&s.nodeType===me.text&&(a=s.textContent,Le([ve,Ue,Fe],_=>{a=fe(a,_," ")}),s.textContent!==a&&(pe(e.removed,{element:s.cloneNode()}),s.textContent=a)),Y(L.afterSanitizeElements,s,null),!1)},Nt=function(s,a,p){if(xt&&(a==="id"||a==="name")&&(p in n||p in Rn))return!1;if(!(Be&&!He[a]&&C(Tn,a))){if(!(kt&&C(bn,a))){if(!S[a]||He[a]){if(!(Mt(s)&&(w.tagNameCheck instanceof RegExp&&C(w.tagNameCheck,s)||w.tagNameCheck instanceof Function&&w.tagNameCheck(s))&&(w.attributeNameCheck instanceof RegExp&&C(w.attributeNameCheck,a)||w.attributeNameCheck instanceof Function&&w.attributeNameCheck(a))||a==="is"&&w.allowCustomizedBuiltInElements&&(w.tagNameCheck instanceof RegExp&&C(w.tagNameCheck,p)||w.tagNameCheck instanceof Function&&w.tagNameCheck(p))))return!1}else if(!Ye[a]){if(!C(gt,fe(p,ht,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&s!=="script"&&di(p,"data:")===0&&Et[s])){if(!(Tt&&!C(xn,fe(p,ht,"")))){if(p)return!1}}}}}}return!0},Mt=function(s){return s!=="annotation-xml"&&qt(s,_n)},zt=function(s){Y(L.beforeSanitizeAttributes,s,null);const{attributes:a}=s;if(!a||Ve(s))return;const p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:S,forceKeepAttr:void 0};let _=a.length;for(;_--;){const I=a[_],{name:R,namespaceURI:z,value:H}=I,ce=y(R);let O=R==="value"?H:ki(H);if(p.attrName=ce,p.attrValue=O,p.keepAttr=!0,p.forceKeepAttr=void 0,Y(L.uponSanitizeAttribute,s,p),O=p.attrValue,_t&&(ce==="id"||ce==="name")&&(Se(R,s),O=wn+O),Ge&&C(/((--!?|])>)|<\/(style|title)/i,O)){Se(R,s);continue}if(p.forceKeepAttr||(Se(R,s),!p.keepAttr))continue;if(!bt&&C(/\/>/i,O)){Se(R,s);continue}J&&Le([ve,Ue,Fe],$t=>{O=fe(O,$t," ")});const Pt=y(s.nodeName);if(Nt(Pt,ce,O)){if(E&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!z)switch(T.getAttributeType(Pt,ce)){case"TrustedHTML":{O=E.createHTML(O);break}case"TrustedScriptURL":{O=E.createScriptURL(O);break}}try{z?s.setAttributeNS(z,R,O):s.setAttribute(R,O),Ve(s)?F(s):Wt(e.removed)}catch{}}}Y(L.afterSanitizeAttributes,s,null)},Ln=function h(s){let a=null;const p=Ot(s);for(Y(L.beforeSanitizeShadowDOM,s,null);a=p.nextNode();)Y(L.uponSanitizeShadowNode,a,null),Dt(a),zt(a),a.content instanceof o&&h(a.content);Y(L.afterSanitizeShadowDOM,s,null)};return e.sanitize=function(h){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,p=null,_=null,I=null;if(je=!h,je&&(h="<!-->"),typeof h!="string"&&!Ct(h))if(typeof h.toString=="function"){if(h=h.toString(),typeof h!="string")throw he("dirty is not a string, aborting")}else throw he("toString is not a function");if(!e.isSupported)return h;if(We||Qe(s),e.removed=[],typeof h=="string"&&(le=!1),le){if(h.nodeName){const H=y(h.nodeName);if(!A[H]||oe[H])throw he("root node is forbidden and cannot be sanitized in-place")}}else if(h instanceof l)a=Lt("<!---->"),p=a.ownerDocument.importNode(h,!0),p.nodeType===me.element&&p.nodeName==="BODY"||p.nodeName==="HTML"?a=p:a.appendChild(p);else{if(!ee&&!J&&!X&&h.indexOf("<")===-1)return E&&_e?E.createHTML(h):h;if(a=Lt(h),!a)return ee?null:_e?q:""}a&&qe&&F(a.firstChild);const R=Ot(le?h:a);for(;_=R.nextNode();)Dt(_),zt(_),_.content instanceof o&&Ln(_.content);if(le)return h;if(ee){if(xe)for(I=mn.call(a.ownerDocument);a.firstChild;)I.appendChild(a.firstChild);else I=a;return(S.shadowroot||S.shadowrootmode)&&(I=kn.call(t,I,!0)),I}let z=X?a.outerHTML:a.innerHTML;return X&&A["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&C(fn,a.ownerDocument.doctype.name)&&(z="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
`+z),J&&Le([ve,Ue,Fe],H=>{z=fe(z,H," ")}),E&&_e?E.createHTML(z):z},e.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qe(h),We=!0},e.clearConfig=function(){se=null,We=!1},e.isValidAttribute=function(h,s,a){se||Qe({});const p=y(h),_=y(s);return Nt(p,_,a)},e.addHook=function(h,s){typeof s=="function"&&pe(L[h],s)},e.removeHook=function(h,s){if(s!==void 0){const a=gi(L[h],s);return a===-1?void 0:mi(L[h],a,1)[0]}return Wt(L[h])},e.removeHooks=function(h){L[h]=[]},e.removeAllHooks=function(){L=Vt()},e}var Di=hn();export{b as m,Di as p};