lee-ai-widget 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ (function(E,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(E=typeof globalThis<"u"?globalThis:E||self,y(E.LeeAI={}))})(this,function(E){"use strict";var Wi=Object.defineProperty;var En=E=>{throw TypeError(E)};var qi=(E,y,P)=>y in E?Wi(E,y,{enumerable:!0,configurable:!0,writable:!0,value:P}):E[y]=P;var b=(E,y,P)=>qi(E,typeof y!="symbol"?y+"":y,P),Zi=(E,y,P)=>y.has(E)||En("Cannot "+P);var yn=(E,y,P)=>y.has(E)?En("Cannot add the same private member more than once"):y instanceof WeakSet?y.add(E):y.set(E,P);var We=(E,y,P)=>(Zi(E,y,"access private method"),P);var ne,Et,An;async function y(c,e,n,t,r,o){const i=`${c.baseUrl}/ai/chat`,l={provider:c.provider||"google",apiKey:c.apiKey,model:c.model,contents:[...e,{role:"user",parts:[{text:n}]}],options:{systemInstruction:c.systemInstruction,enableSearch:c.enableSearch}};try{const a=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!a.ok)throw new Error(`Error: ${a.statusText}`);if(!a.body)throw new Error("ReadableStream not supported");const d=a.body.getReader(),h=new TextDecoder;for(;;){const{done:m,value:g}=await d.read();if(m)break;const T=h.decode(g,{stream:!0});t(T)}r()}catch(a){console.error("Chat API Error:",a),o(a.message||"网络连接失败")}}function P(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ee=P();function yt(c){ee=c}const At=/[&<>"']/,Sn=new RegExp(At.source,"g"),St=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Rn=new RegExp(St.source,"g"),Ln={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Rt=c=>Ln[c];function F(c,e){if(e){if(At.test(c))return c.replace(Sn,Rt)}else if(St.test(c))return c.replace(Rn,Rt);return c}const In=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function On(c){return c.replace(In,(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 Dn=/(^|[^\[])\^/g;function w(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(Dn,"$1"),n=n.replace(r,i),t},getRegex:()=>new RegExp(n,e)};return t}function Lt(c){try{c=encodeURI(c).replace(/%25/g,"%")}catch{return null}return c}const fe={exec:()=>null};function It(c,e){const n=c.replace(/\|/g,(o,i,l)=>{let a=!1,d=i;for(;--d>=0&&l[d]==="\\";)a=!a;return a?"|":" |"}),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 Cn(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 Ot(c,e,n,t){const r=e.href,o=e.title?F(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:F(i)}}function Mn(c,e){const n=c.match(/^(\s+)(?:```)/);if(n===null)return e;const t=n[1];return e.split(`
2
+ `).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(`
3
+ `)}class Le{constructor(e){b(this,"options");b(this,"rules");b(this,"lexer");this.options=e||ee}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,`
4
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],r=Mn(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){const t=Re(n[0].replace(/^ *>[ \t]?/gm,""),`
5
+ `),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="",a="",d=!1;for(;e;){let h=!1;if(!(n=i.exec(e))||this.rules.block.hr.test(e))break;l=n[0],e=e.substring(l.length);let m=n[2].split(`
6
+ `,1)[0].replace(/^\t+/,Ee=>" ".repeat(3*Ee.length)),g=e.split(`
7
+ `,1)[0],T=0;this.options.pedantic?(T=2,a=m.trimStart()):(T=n[2].search(/[^ ]/),T=T>4?1:T,a=m.slice(T),T+=n[1].length);let $=!1;if(!m&&/^ *$/.test(g)&&(l+=g+`
8
+ `,e=e.substring(g.length+1),h=!0),!h){const Ee=new RegExp(`^ {0,${Math.min(3,T-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),ze=new RegExp(`^ {0,${Math.min(3,T-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),ie=new RegExp(`^ {0,${Math.min(3,T-1)}}(?:\`\`\`|~~~)`),L=new RegExp(`^ {0,${Math.min(3,T-1)}}#`);for(;e;){const Q=e.split(`
9
+ `,1)[0];if(g=Q,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),ie.test(g)||L.test(g)||Ee.test(g)||ze.test(e))break;if(g.search(/[^ ]/)>=T||!g.trim())a+=`
10
+ `+g.slice(T);else{if($||m.search(/[^ ]/)>=4||ie.test(m)||L.test(m)||ze.test(m))break;a+=`
11
+ `+g}!$&&!g.trim()&&($=!0),l+=Q+`
12
+ `,e=e.substring(Q.length+1),m=g.slice(T)}}o.loose||(d?o.loose=!0:/\n *\n *$/.test(l)&&(d=!0));let H=null,X;this.options.gfm&&(H=/^\[[ xX]\] /.exec(a),H&&(X=H[0]!=="[ ] ",a=a.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:l,task:!!H,checked:X,loose:!1,text:a,tokens:[]}),o.raw+=l}o.items[o.items.length-1].raw=l.trimEnd(),o.items[o.items.length-1].text=a.trimEnd(),o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){const m=o.items[h].tokens.filter(T=>T.type==="space"),g=m.length>0&&m.some(T=>/\n.*\n/.test(T.raw));o.loose=g}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].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=It(n[1]),r=n[2].replace(/^\||\| *$/g,"").split("|"),o=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
13
+ `):[],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(It(l,i.header.length).map(a=>({text:a,tokens:this.lexer.inline(a)})));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)===`
14
+ `?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:F(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=Cn(n[2],"()");if(i>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+i;n[2]=n[2].substring(0,i),n[0]=n[0].substring(0,a).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)),Ot(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 Ot(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,a,d=i,h=0;const m=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,n=n.slice(-1*e.length+i);(r=m.exec(n))!=null;){if(l=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!l)continue;if(a=[...l].length,r[3]||r[4]){d+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){h+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d+h);const g=[...r[0]][0].length,T=e.slice(0,i+r.index+g+a);if(Math.min(i,a)%2){const H=T.slice(1,-1);return{type:"em",raw:T,text:H,tokens:this.lexer.inlineTokens(H)}}const $=T.slice(2,-2);return{type:"strong",raw:T,text:$,tokens:this.lexer.inlineTokens($)}}}}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=F(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=F(n[1]),r="mailto:"+t):(t=F(n[1]),r=t),{type:"link",raw:n[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let r,o;if(n[2]==="@")r=F(n[0]),o="mailto:"+r;else{let i;do i=n[0],n[0]=((t=this.rules.inline._backpedal.exec(n[0]))==null?void 0:t[0])??"";while(i!==n[0]);r=F(n[0]),n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){let t;return this.lexer.state.inRawBlock?t=n[0]:t=F(n[0]),{type:"text",raw:n[0],text:t}}}}const Nn=/^(?: *(?:\n|$))+/,vn=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,zn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,de=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Dt=/(?:[*+-]|\d{1,9}[.)])/,Ct=w(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Dt).getRegex(),qe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$n=/^[^\n]+/,Ze=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Un=w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fn=w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Dt).getRegex(),Ie="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",je=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Hn=w("^ {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",je).replace("tag",Ie).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mt=w(qe).replace("hr",de).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",Ie).getRegex(),Ye={blockquote:w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Mt).getRegex(),code:vn,def:Un,fences:zn,heading:Pn,hr:de,html:Hn,lheading:Ct,list:Fn,newline:Nn,paragraph:Mt,table:fe,text:$n},Nt=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",de).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",Ie).getRegex(),Bn={...Ye,table:Nt,paragraph:w(qe).replace("hr",de).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Nt).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",Ie).getRegex()},Gn={...Ye,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",je).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:fe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(qe).replace("hr",de).replace("heading",` *#{1,6} *[^
15
+ ]`).replace("lheading",Ct).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Wn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zt=/^( {2,}|\\)\n(?!\s*$)/,qn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ge="\\p{P}$+<=>`^|~",Zn=w(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ge).getRegex(),jn=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Yn=w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ge).getRegex(),Xn=w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ge).getRegex(),Qn=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ge).getRegex(),Vn=w(/\\([punct])/,"gu").replace(/punct/g,ge).getRegex(),Kn=w(/^<(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(),Jn=w(je).replace("(?:-->|$)","-->").getRegex(),ei=w("^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",Jn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Oe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ti=w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Oe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pt=w(/^!?\[(label)\]\[(ref)\]/).replace("label",Oe).replace("ref",Ze).getRegex(),$t=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ze).getRegex(),ni=w("reflink|nolink(?!\\()","g").replace("reflink",Pt).replace("nolink",$t).getRegex(),Xe={_backpedal:fe,anyPunctuation:Vn,autolink:Kn,blockSkip:jn,br:zt,code:Wn,del:fe,emStrongLDelim:Yn,emStrongRDelimAst:Xn,emStrongRDelimUnd:Qn,escape:vt,link:ti,nolink:$t,punctuation:Zn,reflink:Pt,reflinkSearch:ni,tag:ei,text:qn,url:fe},ii={...Xe,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",Oe).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oe).getRegex()},Qe={...Xe,escape:w(vt).replace("])","~|])").getRegex(),url:w(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},si={...Qe,br:w(zt).replace("{2,}","*").getRegex(),text:w(Qe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},De={normal:Ye,gfm:Bn,pedantic:Gn},me={normal:Xe,gfm:Qe,breaks:si,pedantic:ii};class W{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"tokenizer");b(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ee,this.options.tokenizer=this.options.tokenizer||new Le,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:De.normal,inline:me.normal};this.options.pedantic?(n.block=De.pedantic,n.inline=me.pedantic):this.options.gfm&&(n.block=De.gfm,this.options.breaks?n.inline=me.breaks:n.inline=me.gfm),this.tokenizer.rules=n}static get rules(){return{block:De,inline:me}}static lex(e,n){return new W(n).lex(e)}static lexInline(e,n){return new W(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
16
+ `),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,a,d)=>a+" ".repeat(d.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+=`
17
+ `: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+=`
18
+ `+t.raw,r.text+=`
19
+ `+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+=`
20
+ `+t.raw,r.text+=`
21
+ `+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 a=e.slice(1);let d;this.options.extensions.startBlock.forEach(h=>{d=h.call({lexer:this},a),typeof d=="number"&&d>=0&&(l=Math.min(l,d))}),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+=`
22
+ `+t.raw,r.text+=`
23
+ `+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+=`
24
+ `+t.raw,r.text+=`
25
+ `+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,a,d;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)h.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(a||(d=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(t=h.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,d)){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 h=1/0;const m=e.slice(1);let g;this.options.extensions.startInline.forEach(T=>{g=T.call({lexer:this},m),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(o=e.substring(0,h+1))}if(t=this.tokenizer.inlineText(o)){e=e.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(d=t.raw.slice(-1)),a=!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 h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}}class Ce{constructor(e){b(this,"options");this.options=e||ee}code(e,n,t){var o;const r=(o=(n||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
26
+ `,r?'<pre><code class="language-'+F(r)+'">'+(t?e:F(e,!0))+`</code></pre>
27
+ `:"<pre><code>"+(t?e:F(e,!0))+`</code></pre>
28
+ `}blockquote(e){return`<blockquote>
29
+ ${e}</blockquote>
30
+ `}html(e,n){return e}heading(e,n,t){return`<h${n}>${e}</h${n}>
31
+ `}hr(){return`<hr>
32
+ `}list(e,n,t){const r=n?"ol":"ul",o=n&&t!==1?' start="'+t+'"':"";return"<"+r+o+`>
33
+ `+e+"</"+r+`>
34
+ `}listitem(e,n,t){return`<li>${e}</li>
35
+ `}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
36
+ `}table(e,n){return n&&(n=`<tbody>${n}</tbody>`),`<table>
37
+ <thead>
38
+ `+e+`</thead>
39
+ `+n+`</table>
40
+ `}tablerow(e){return`<tr>
41
+ ${e}</tr>
42
+ `}tablecell(e,n){const t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
43
+ `}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=Lt(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=Lt(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 Ve{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 q{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||ee,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ve}static parse(e,n){return new q(n).parse(e)}static parseInline(e,n){return new q(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,On(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="",a="";for(let h=0;h<i.header.length;h++)a+=this.renderer.tablecell(this.parseInline(i.header[h].tokens),{header:!0,align:i.align[h]});l+=this.renderer.tablerow(a);let d="";for(let h=0;h<i.rows.length;h++){const m=i.rows[h];a="";for(let g=0;g<m.length;g++)a+=this.renderer.tablecell(this.parseInline(m[g].tokens),{header:!1,align:i.align[g]});d+=this.renderer.tablerow(a)}t+=this.renderer.table(l,d);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,a=i.start,d=i.loose;let h="";for(let m=0;m<i.items.length;m++){const g=i.items[m],T=g.checked,$=g.task;let H="";if(g.task){const X=this.renderer.checkbox(!!T);d?g.tokens.length>0&&g.tokens[0].type==="paragraph"?(g.tokens[0].text=X+" "+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=X+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:X+" "}):H+=X+" "}H+=this.parse(g.tokens,d),h+=this.renderer.listitem(H,$,!!T)}t+=this.renderer.list(h,l,a);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+=`
44
+ `+(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 ke{constructor(e){b(this,"options");this.options=e||ee}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}b(ke,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class ri{constructor(...e){yn(this,ne);b(this,"defaults",P());b(this,"options",this.setOptions);b(this,"parse",We(this,ne,Et).call(this,W.lex,q.parse));b(this,"parseInline",We(this,ne,Et).call(this,W.lexInline,q.parseInline));b(this,"Parser",q);b(this,"Renderer",Ce);b(this,"TextRenderer",Ve);b(this,"Lexer",W);b(this,"Tokenizer",Le);b(this,"Hooks",ke);this.use(...e)}walkTokens(e,n){var r,o;let t=[];for(const i of e)switch(t=t.concat(n.call(this,i)),i.type){case"table":{const l=i;for(const a of l.header)t=t.concat(this.walkTokens(a.tokens,n));for(const a of l.rows)for(const d of a)t=t.concat(this.walkTokens(d.tokens,n));break}case"list":{const l=i;t=t.concat(this.walkTokens(l.items,n));break}default:{const l=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[l.type]?this.defaults.extensions.childTokens[l.type].forEach(a=>{const d=l[a].flat(1/0);t=t.concat(this.walkTokens(d,n))}):l.tokens&&(t=t.concat(this.walkTokens(l.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 a=o.renderer.apply(this,l);return a===!1&&(a=i.apply(this,l)),a}: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 Ce(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,a=t.renderer[l],d=o[l];o[l]=(...h)=>{let m=a.apply(o,h);return m===!1&&(m=d.apply(o,h)),m||""}}r.renderer=o}if(t.tokenizer){const o=this.defaults.tokenizer||new Le(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,a=t.tokenizer[l],d=o[l];o[l]=(...h)=>{let m=a.apply(o,h);return m===!1&&(m=d.apply(o,h)),m}}r.tokenizer=o}if(t.hooks){const o=this.defaults.hooks||new ke;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,a=t.hooks[l],d=o[l];ke.passThroughHooks.has(i)?o[l]=h=>{if(this.defaults.async)return Promise.resolve(a.call(o,h)).then(g=>d.call(o,g));const m=a.call(o,h);return d.call(o,m)}:o[l]=(...h)=>{let m=a.apply(o,h);return m===!1&&(m=d.apply(o,h)),m}}r.hooks=o}if(t.walkTokens){const o=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),o&&(a=a.concat(o.call(this,l))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return W.lex(e,n??this.defaults)}parser(e,n){return q.parse(e,n??this.defaults)}}ne=new WeakSet,Et=function(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=We(this,ne,An).call(this,!!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(a=>e(a,i)).then(a=>i.hooks?i.hooks.processAllTokens(a):a).then(a=>i.walkTokens?Promise.all(this.walkTokens(a,i.walkTokens)).then(()=>a):a).then(a=>n(a,i)).then(a=>i.hooks?i.hooks.postprocess(a):a).catch(l);try{i.hooks&&(t=i.hooks.preprocess(t));let a=e(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let d=n(a,i);return i.hooks&&(d=i.hooks.postprocess(d)),d}catch(a){return l(a)}}},An=function(e,n){return t=>{if(t.message+=`
45
+ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+F(t.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(t);throw t}};const te=new ri;function x(c,e){return te.parse(c,e)}x.options=x.setOptions=function(c){return te.setOptions(c),x.defaults=te.defaults,yt(x.defaults),x},x.getDefaults=P,x.defaults=ee,x.use=function(...c){return te.use(...c),x.defaults=te.defaults,yt(x.defaults),x},x.walkTokens=function(c,e){return te.walkTokens(c,e)},x.parseInline=te.parseInline,x.Parser=q,x.parser=q.parse,x.Renderer=Ce,x.TextRenderer=Ve,x.Lexer=W,x.lexer=W.lex,x.Tokenizer=Le,x.Hooks=ke,x.parse=x,x.options,x.setOptions,x.use,x.walkTokens,x.parseInline,q.parse,W.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Ut,setPrototypeOf:Ft,isFrozen:oi,getPrototypeOf:li,getOwnPropertyDescriptor:ai}=Object;let{freeze:M,seal:B,create:Ke}=Object,{apply:Je,construct:et}=typeof Reflect<"u"&&Reflect;M||(M=function(e){return e}),B||(B=function(e){return e}),Je||(Je=function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];return e.apply(n,r)}),et||(et=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 new e(...t)});const Me=v(Array.prototype.forEach),ci=v(Array.prototype.lastIndexOf),Ht=v(Array.prototype.pop),Te=v(Array.prototype.push),ui=v(Array.prototype.splice),Ne=v(String.prototype.toLowerCase),tt=v(String.prototype.toString),nt=v(String.prototype.match),be=v(String.prototype.replace),pi=v(String.prototype.indexOf),hi=v(String.prototype.trim),G=v(Object.prototype.hasOwnProperty),N=v(RegExp.prototype.test),xe=fi(TypeError);function v(c){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return Je(c,e,t)}}function fi(c){return function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return et(c,n)}}function k(c,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ne;Ft&&Ft(c,null);let t=e.length;for(;t--;){let r=e[t];if(typeof r=="string"){const o=n(r);o!==r&&(oi(e)||(e[t]=o),r=o)}c[r]=!0}return c}function di(c){for(let e=0;e<c.length;e++)G(c,e)||(c[e]=null);return c}function Z(c){const e=Ke(null);for(const[n,t]of Ut(c))G(c,n)&&(Array.isArray(t)?e[n]=di(t):t&&typeof t=="object"&&t.constructor===Object?e[n]=Z(t):e[n]=t);return e}function we(c,e){for(;c!==null;){const t=ai(c,e);if(t){if(t.get)return v(t.get);if(typeof t.value=="function")return v(t.value)}c=li(c)}function n(){return null}return n}const Bt=M(["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","search","section","select","shadow","slot","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"]),it=M(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),st=M(["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"]),gi=M(["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"]),rt=M(["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"]),mi=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gt=M(["#text"]),Wt=M(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ot=M(["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","mask-type","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"]),qt=M(["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"]),ve=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ki=B(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ti=B(/<%[\w\W]*|[\w\W]*%>/gm),bi=B(/\$\{[\w\W]*/gm),xi=B(/^data-[\-\w.\u00B7-\uFFFF]+$/),wi=B(/^aria-[\-\w]+$/),Zt=B(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_i=B(/^(?:\w+script|data):/i),Ei=B(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jt=B(/^html$/i),yi=B(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yt=Object.freeze({__proto__:null,ARIA_ATTR:wi,ATTR_WHITESPACE:Ei,CUSTOM_ELEMENT:yi,DATA_ATTR:xi,DOCTYPE_NAME:jt,ERB_EXPR:Ti,IS_ALLOWED_URI:Zt,IS_SCRIPT_OR_DATA:_i,MUSTACHE_EXPR:ki,TMPLIT_EXPR:bi});const _e={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ai=function(){return typeof window>"u"?null:window},Si=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}},Xt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Qt(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ai();const e=f=>Qt(f);if(e.version="3.3.1",e.removed=[],!c||!c.document||c.document.nodeType!==_e.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:a,NodeFilter:d,NamedNodeMap:h=c.NamedNodeMap||c.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:T}=c,$=a.prototype,H=we($,"cloneNode"),X=we($,"remove"),Ee=we($,"nextSibling"),ze=we($,"childNodes"),ie=we($,"parentNode");if(typeof i=="function"){const f=n.createElement("template");f.content&&f.content.ownerDocument&&(n=f.content.ownerDocument)}let L,Q="";const{implementation:lt,createNodeIterator:Li,createDocumentFragment:Ii,getElementsByTagName:Oi}=n,{importNode:Di}=t;let z=Xt();e.isSupported=typeof Ut=="function"&&typeof ie=="function"&&lt&&lt.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:at,ERB_EXPR:ct,TMPLIT_EXPR:ut,DATA_ATTR:Ci,ARIA_ATTR:Mi,IS_SCRIPT_OR_DATA:Ni,ATTR_WHITESPACE:Kt,CUSTOM_ELEMENT:vi}=Yt;let{IS_ALLOWED_URI:Jt}=Yt,I=null;const en=k({},[...Bt,...it,...st,...rt,...Gt]);let O=null;const tn=k({},[...Wt,...ot,...qt,...ve]);let A=Object.seal(Ke(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}})),ye=null,pt=null;const oe=Object.seal(Ke(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let nn=!0,ht=!0,sn=!1,rn=!0,le=!1,Pe=!0,se=!1,ft=!1,dt=!1,ae=!1,$e=!1,Ue=!1,on=!0,ln=!1;const zi="user-content-";let gt=!0,Ae=!1,ce={},j=null;const mt=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 an=null;const cn=k({},["audio","video","img","source","image","track"]);let kt=null;const un=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fe="http://www.w3.org/1998/Math/MathML",He="http://www.w3.org/2000/svg",V="http://www.w3.org/1999/xhtml";let ue=V,Tt=!1,bt=null;const Pi=k({},[Fe,He,V],tt);let Be=k({},["mi","mo","mn","ms","mtext"]),Ge=k({},["annotation-xml"]);const $i=k({},["title","style","font","a","script"]);let Se=null;const Ui=["application/xhtml+xml","text/html"],Fi="text/html";let R=null,pe=null;const Hi=n.createElement("form"),pn=function(s){return s instanceof RegExp||s instanceof Function},xt=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pe&&pe===s)){if((!s||typeof s!="object")&&(s={}),s=Z(s),Se=Ui.indexOf(s.PARSER_MEDIA_TYPE)===-1?Fi:s.PARSER_MEDIA_TYPE,R=Se==="application/xhtml+xml"?tt:Ne,I=G(s,"ALLOWED_TAGS")?k({},s.ALLOWED_TAGS,R):en,O=G(s,"ALLOWED_ATTR")?k({},s.ALLOWED_ATTR,R):tn,bt=G(s,"ALLOWED_NAMESPACES")?k({},s.ALLOWED_NAMESPACES,tt):Pi,kt=G(s,"ADD_URI_SAFE_ATTR")?k(Z(un),s.ADD_URI_SAFE_ATTR,R):un,an=G(s,"ADD_DATA_URI_TAGS")?k(Z(cn),s.ADD_DATA_URI_TAGS,R):cn,j=G(s,"FORBID_CONTENTS")?k({},s.FORBID_CONTENTS,R):mt,ye=G(s,"FORBID_TAGS")?k({},s.FORBID_TAGS,R):Z({}),pt=G(s,"FORBID_ATTR")?k({},s.FORBID_ATTR,R):Z({}),ce=G(s,"USE_PROFILES")?s.USE_PROFILES:!1,nn=s.ALLOW_ARIA_ATTR!==!1,ht=s.ALLOW_DATA_ATTR!==!1,sn=s.ALLOW_UNKNOWN_PROTOCOLS||!1,rn=s.ALLOW_SELF_CLOSE_IN_ATTR!==!1,le=s.SAFE_FOR_TEMPLATES||!1,Pe=s.SAFE_FOR_XML!==!1,se=s.WHOLE_DOCUMENT||!1,ae=s.RETURN_DOM||!1,$e=s.RETURN_DOM_FRAGMENT||!1,Ue=s.RETURN_TRUSTED_TYPE||!1,dt=s.FORCE_BODY||!1,on=s.SANITIZE_DOM!==!1,ln=s.SANITIZE_NAMED_PROPS||!1,gt=s.KEEP_CONTENT!==!1,Ae=s.IN_PLACE||!1,Jt=s.ALLOWED_URI_REGEXP||Zt,ue=s.NAMESPACE||V,Be=s.MATHML_TEXT_INTEGRATION_POINTS||Be,Ge=s.HTML_INTEGRATION_POINTS||Ge,A=s.CUSTOM_ELEMENT_HANDLING||{},s.CUSTOM_ELEMENT_HANDLING&&pn(s.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=s.CUSTOM_ELEMENT_HANDLING.tagNameCheck),s.CUSTOM_ELEMENT_HANDLING&&pn(s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=s.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),s.CUSTOM_ELEMENT_HANDLING&&typeof s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=s.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),le&&(ht=!1),$e&&(ae=!0),ce&&(I=k({},Gt),O=[],ce.html===!0&&(k(I,Bt),k(O,Wt)),ce.svg===!0&&(k(I,it),k(O,ot),k(O,ve)),ce.svgFilters===!0&&(k(I,st),k(O,ot),k(O,ve)),ce.mathMl===!0&&(k(I,rt),k(O,qt),k(O,ve))),s.ADD_TAGS&&(typeof s.ADD_TAGS=="function"?oe.tagCheck=s.ADD_TAGS:(I===en&&(I=Z(I)),k(I,s.ADD_TAGS,R))),s.ADD_ATTR&&(typeof s.ADD_ATTR=="function"?oe.attributeCheck=s.ADD_ATTR:(O===tn&&(O=Z(O)),k(O,s.ADD_ATTR,R))),s.ADD_URI_SAFE_ATTR&&k(kt,s.ADD_URI_SAFE_ATTR,R),s.FORBID_CONTENTS&&(j===mt&&(j=Z(j)),k(j,s.FORBID_CONTENTS,R)),s.ADD_FORBID_CONTENTS&&(j===mt&&(j=Z(j)),k(j,s.ADD_FORBID_CONTENTS,R)),gt&&(I["#text"]=!0),se&&k(I,["html","head","body"]),I.table&&(k(I,["tbody"]),delete ye.tbody),s.TRUSTED_TYPES_POLICY){if(typeof s.TRUSTED_TYPES_POLICY.createHTML!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof s.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=s.TRUSTED_TYPES_POLICY,Q=L.createHTML("")}else L===void 0&&(L=Si(T,r)),L!==null&&typeof Q=="string"&&(Q=L.createHTML(""));M&&M(s),pe=s}},hn=k({},[...it,...st,...gi]),fn=k({},[...rt,...mi]),Bi=function(s){let u=ie(s);(!u||!u.tagName)&&(u={namespaceURI:ue,tagName:"template"});const p=Ne(s.tagName),_=Ne(u.tagName);return bt[s.namespaceURI]?s.namespaceURI===He?u.namespaceURI===V?p==="svg":u.namespaceURI===Fe?p==="svg"&&(_==="annotation-xml"||Be[_]):!!hn[p]:s.namespaceURI===Fe?u.namespaceURI===V?p==="math":u.namespaceURI===He?p==="math"&&Ge[_]:!!fn[p]:s.namespaceURI===V?u.namespaceURI===He&&!Ge[_]||u.namespaceURI===Fe&&!Be[_]?!1:!fn[p]&&($i[p]||!hn[p]):!!(Se==="application/xhtml+xml"&&bt[s.namespaceURI]):!1},Y=function(s){Te(e.removed,{element:s});try{ie(s).removeChild(s)}catch{X(s)}},re=function(s,u){try{Te(e.removed,{attribute:u.getAttributeNode(s),from:u})}catch{Te(e.removed,{attribute:null,from:u})}if(u.removeAttribute(s),s==="is")if(ae||$e)try{Y(u)}catch{}else try{u.setAttribute(s,"")}catch{}},dn=function(s){let u=null,p=null;if(dt)s="<remove></remove>"+s;else{const S=nt(s,/^[\r\n\t ]+/);p=S&&S[0]}Se==="application/xhtml+xml"&&ue===V&&(s='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+s+"</body></html>");const _=L?L.createHTML(s):s;if(ue===V)try{u=new g().parseFromString(_,Se)}catch{}if(!u||!u.documentElement){u=lt.createDocument(ue,"template",null);try{u.documentElement.innerHTML=Tt?Q:_}catch{}}const C=u.body||u.documentElement;return s&&p&&C.insertBefore(n.createTextNode(p),C.childNodes[0]||null),ue===V?Oi.call(u,se?"html":"body")[0]:se?u.documentElement:C},gn=function(s){return Li.call(s.ownerDocument||s,s,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wt=function(s){return s instanceof m&&(typeof s.nodeName!="string"||typeof s.textContent!="string"||typeof s.removeChild!="function"||!(s.attributes instanceof h)||typeof s.removeAttribute!="function"||typeof s.setAttribute!="function"||typeof s.namespaceURI!="string"||typeof s.insertBefore!="function"||typeof s.hasChildNodes!="function")},mn=function(s){return typeof l=="function"&&s instanceof l};function K(f,s,u){Me(f,p=>{p.call(e,s,u,pe)})}const kn=function(s){let u=null;if(K(z.beforeSanitizeElements,s,null),wt(s))return Y(s),!0;const p=R(s.nodeName);if(K(z.uponSanitizeElement,s,{tagName:p,allowedTags:I}),Pe&&s.hasChildNodes()&&!mn(s.firstElementChild)&&N(/<[/\w!]/g,s.innerHTML)&&N(/<[/\w!]/g,s.textContent)||s.nodeType===_e.progressingInstruction||Pe&&s.nodeType===_e.comment&&N(/<[/\w]/g,s.data))return Y(s),!0;if(!(oe.tagCheck instanceof Function&&oe.tagCheck(p))&&(!I[p]||ye[p])){if(!ye[p]&&bn(p)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,p)||A.tagNameCheck instanceof Function&&A.tagNameCheck(p)))return!1;if(gt&&!j[p]){const _=ie(s)||s.parentNode,C=ze(s)||s.childNodes;if(C&&_){const S=C.length;for(let U=S-1;U>=0;--U){const J=H(C[U],!0);J.__removalCount=(s.__removalCount||0)+1,_.insertBefore(J,Ee(s))}}}return Y(s),!0}return s instanceof a&&!Bi(s)||(p==="noscript"||p==="noembed"||p==="noframes")&&N(/<\/no(script|embed|frames)/i,s.innerHTML)?(Y(s),!0):(le&&s.nodeType===_e.text&&(u=s.textContent,Me([at,ct,ut],_=>{u=be(u,_," ")}),s.textContent!==u&&(Te(e.removed,{element:s.cloneNode()}),s.textContent=u)),K(z.afterSanitizeElements,s,null),!1)},Tn=function(s,u,p){if(on&&(u==="id"||u==="name")&&(p in n||p in Hi))return!1;if(!(ht&&!pt[u]&&N(Ci,u))){if(!(nn&&N(Mi,u))){if(!(oe.attributeCheck instanceof Function&&oe.attributeCheck(u,s))){if(!O[u]||pt[u]){if(!(bn(s)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,s)||A.tagNameCheck instanceof Function&&A.tagNameCheck(s))&&(A.attributeNameCheck instanceof RegExp&&N(A.attributeNameCheck,u)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(u,s))||u==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,p)||A.tagNameCheck instanceof Function&&A.tagNameCheck(p))))return!1}else if(!kt[u]){if(!N(Jt,be(p,Kt,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&s!=="script"&&pi(p,"data:")===0&&an[s])){if(!(sn&&!N(Ni,be(p,Kt,"")))){if(p)return!1}}}}}}}return!0},bn=function(s){return s!=="annotation-xml"&&nt(s,vi)},xn=function(s){K(z.beforeSanitizeAttributes,s,null);const{attributes:u}=s;if(!u||wt(s))return;const p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0};let _=u.length;for(;_--;){const C=u[_],{name:S,namespaceURI:U,value:J}=C,he=R(S),_t=J;let D=S==="value"?_t:hi(_t);if(p.attrName=he,p.attrValue=D,p.keepAttr=!0,p.forceKeepAttr=void 0,K(z.uponSanitizeAttribute,s,p),D=p.attrValue,ln&&(he==="id"||he==="name")&&(re(S,s),D=zi+D),Pe&&N(/((--!?|])>)|<\/(style|title|textarea)/i,D)){re(S,s);continue}if(he==="attributename"&&nt(D,"href")){re(S,s);continue}if(p.forceKeepAttr)continue;if(!p.keepAttr){re(S,s);continue}if(!rn&&N(/\/>/i,D)){re(S,s);continue}le&&Me([at,ct,ut],_n=>{D=be(D,_n," ")});const wn=R(s.nodeName);if(!Tn(wn,he,D)){re(S,s);continue}if(L&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!U)switch(T.getAttributeType(wn,he)){case"TrustedHTML":{D=L.createHTML(D);break}case"TrustedScriptURL":{D=L.createScriptURL(D);break}}if(D!==_t)try{U?s.setAttributeNS(U,S,D):s.setAttribute(S,D),wt(s)?Y(s):Ht(e.removed)}catch{re(S,s)}}K(z.afterSanitizeAttributes,s,null)},Gi=function f(s){let u=null;const p=gn(s);for(K(z.beforeSanitizeShadowDOM,s,null);u=p.nextNode();)K(z.uponSanitizeShadowNode,u,null),kn(u),xn(u),u.content instanceof o&&f(u.content);K(z.afterSanitizeShadowDOM,s,null)};return e.sanitize=function(f){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=null,p=null,_=null,C=null;if(Tt=!f,Tt&&(f="<!-->"),typeof f!="string"&&!mn(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw xe("dirty is not a string, aborting")}else throw xe("toString is not a function");if(!e.isSupported)return f;if(ft||xt(s),e.removed=[],typeof f=="string"&&(Ae=!1),Ae){if(f.nodeName){const J=R(f.nodeName);if(!I[J]||ye[J])throw xe("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof l)u=dn("<!---->"),p=u.ownerDocument.importNode(f,!0),p.nodeType===_e.element&&p.nodeName==="BODY"||p.nodeName==="HTML"?u=p:u.appendChild(p);else{if(!ae&&!le&&!se&&f.indexOf("<")===-1)return L&&Ue?L.createHTML(f):f;if(u=dn(f),!u)return ae?null:Ue?Q:""}u&&dt&&Y(u.firstChild);const S=gn(Ae?f:u);for(;_=S.nextNode();)kn(_),xn(_),_.content instanceof o&&Gi(_.content);if(Ae)return f;if(ae){if($e)for(C=Ii.call(u.ownerDocument);u.firstChild;)C.appendChild(u.firstChild);else C=u;return(O.shadowroot||O.shadowrootmode)&&(C=Di.call(t,C,!0)),C}let U=se?u.outerHTML:u.innerHTML;return se&&I["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&N(jt,u.ownerDocument.doctype.name)&&(U="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
46
+ `+U),le&&Me([at,ct,ut],J=>{U=be(U,J," ")}),L&&Ue?L.createHTML(U):U},e.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xt(f),ft=!0},e.clearConfig=function(){pe=null,ft=!1},e.isValidAttribute=function(f,s,u){pe||xt({});const p=R(f),_=R(s);return Tn(p,_,u)},e.addHook=function(f,s){typeof s=="function"&&Te(z[f],s)},e.removeHook=function(f,s){if(s!==void 0){const u=ci(z[f],s);return u===-1?void 0:ui(z[f],u,1)[0]}return Ht(z[f])},e.removeHooks=function(f){z[f]=[]},e.removeAllHooks=function(){z=Xt()},e}var Ri=Qt();class Vt{constructor(e){b(this,"container");b(this,"box");b(this,"messagesDiv");b(this,"input");b(this,"sendBtn");b(this,"isOpen",!1);b(this,"history",[]);b(this,"config");this.config={title:"企业智能助手",welcomeMessage:"您好,有什么可以帮您?",provider:"google",...e},this.initDOM()}initDOM(){this.container=document.createElement("div"),this.container.className="lee-ai-container";const e=document.createElement("div");e.className="lee-ai-launcher",e.innerHTML='<svg viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"></path></svg>',e.onclick=()=>this.toggle(),this.box=document.createElement("div"),this.box.className="lee-ai-box",this.box.innerHTML=`
47
+ <div class="lee-ai-header">
48
+ <span>${this.config.title}</span>
49
+ <span style="cursor:pointer;font-size:20px" id="lee-ai-close">×</span>
50
+ </div>
51
+ <div class="lee-ai-messages">
52
+ <div class="lee-ai-msg model">${this.config.welcomeMessage}</div>
53
+ </div>
54
+ <div class="lee-ai-input-area">
55
+ <input type="text" class="lee-ai-input" placeholder="输入您的问题..." />
56
+ <button class="lee-ai-send-btn">发送</button>
57
+ </div>
58
+ `,this.container.appendChild(this.box),this.container.appendChild(e),document.body.appendChild(this.container),this.messagesDiv=this.box.querySelector(".lee-ai-messages"),this.input=this.box.querySelector(".lee-ai-input"),this.sendBtn=this.box.querySelector(".lee-ai-send-btn");const n=this.box.querySelector("#lee-ai-close");n.onclick=()=>this.toggle(!1),this.sendBtn.onclick=()=>this.sendMessage(),this.input.onkeypress=t=>{t.key==="Enter"&&this.sendMessage()}}toggle(e){this.isOpen=e??!this.isOpen,this.box.classList.toggle("open",this.isOpen),this.isOpen&&setTimeout(()=>this.input.focus(),100)}async sendMessage(){const e=this.input.value.trim();if(!e)return;this.input.value="",this.appendMessage(e,"user"),this.setLoading(!0);const n=this.appendMessage("","model");let t="";await y(this.config,this.history,e,r=>{t+=r,n.innerHTML=Ri.sanitize(x.parse(t)),this.scrollToBottom()},()=>{this.setLoading(!1),this.history.push({role:"user",parts:[{text:e}]}),this.history.push({role:"model",parts:[{text:t}]})},r=>{n.innerHTML=`<span style="color:red">错误: ${r}</span>`,this.setLoading(!1)})}appendMessage(e,n){const t=document.createElement("div");return t.className=`lee-ai-msg ${n}`,n==="user"?t.innerText=e:t.innerHTML=e,this.messagesDiv.appendChild(t),this.scrollToBottom(),t}scrollToBottom(){this.messagesDiv.scrollTop=this.messagesDiv.scrollHeight}setLoading(e){this.sendBtn.disabled=e,this.sendBtn.innerText=e?"...":"发送",this.input.disabled=e}}window.LeeAI={init:c=>new Vt(c)},E.Widget=Vt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "lee-ai-widget",
3
- "version": "1.0.5",
4
- "private": false,
5
- "description": "AI Widget",
6
- "type": "module",
3
+ "version": "1.0.7",
4
+ "description": "Enterprise AI Agent Widget",
7
5
  "files": [
8
6
  "dist"
9
7
  ],
@@ -19,8 +17,9 @@
19
17
  "marked": "^11.0.0"
20
18
  },
21
19
  "devDependencies": {
20
+ "@types/node": "^25.0.3",
22
21
  "typescript": "^5.0.0",
23
22
  "vite": "^5.0.0",
24
23
  "vite-plugin-dts": "^3.0.0"
25
24
  }
26
- }
25
+ }
@@ -1,17 +0,0 @@
1
- (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))o(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function r(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function o(e){if(e.ep)return;e.ep=!0;const t=r(e);fetch(e.href,t)}})();const n="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20aria-hidden='true'%20role='img'%20class='iconify%20iconify--logos'%20width='32'%20height='32'%20preserveAspectRatio='xMidYMid%20meet'%20viewBox='0%200%20256%20256'%3e%3cpath%20fill='%23007ACC'%20d='M0%20128v128h256V0H0z'%3e%3c/path%3e%3cpath%20fill='%23FFF'%20d='m56.612%20128.85l-.081%2010.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121%2010.443Zm149.955-10.742c6.501%201.625%2011.459%204.51%2016.01%209.224c2.357%202.52%205.851%207.111%206.136%208.208c.08.325-11.053%207.802-17.798%2011.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759%203.535-12.718%2010.321c0%201.992.284%203.17%201.097%204.795c1.707%203.536%204.876%205.649%2014.832%209.956c18.326%207.883%2026.168%2013.084%2031.045%2020.48c5.445%208.249%206.664%2021.415%202.966%2031.208c-4.063%2010.646-14.14%2017.879-28.323%2020.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163%201.178-.813%202.356-1.504c1.138-.65%205.446-3.129%209.509-5.485l7.355-4.267l1.544%202.276c2.154%203.29%206.867%207.801%209.712%209.305c8.167%204.307%2019.383%203.698%2024.909-1.26c2.357-2.153%203.332-4.388%203.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76%2012.353-21.659%2026.25-24.3c4.51-.853%2014.994-.528%2019.424.569Z'%3e%3c/path%3e%3c/svg%3e",l="/vite.svg";function a(i){let c=0;const r=o=>{c=o,i.innerHTML=`count is ${c}`};i.addEventListener("click",()=>r(c+1)),r(0)}document.querySelector("#app").innerHTML=`
2
- <div>
3
- <a href="https://vite.dev" target="_blank">
4
- <img src="${l}" class="logo" alt="Vite logo" />
5
- </a>
6
- <a href="https://www.typescriptlang.org/" target="_blank">
7
- <img src="${n}" class="logo vanilla" alt="TypeScript logo" />
8
- </a>
9
- <h1>Vite + TypeScript</h1>
10
- <div class="card">
11
- <button id="counter" type="button"></button>
12
- </div>
13
- <p class="read-the-docs">
14
- Click on the Vite and TypeScript logos to learn more
15
- </p>
16
- </div>
17
- `;a(document.querySelector("#counter"));
package/dist/index.html DELETED
@@ -1,14 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>lee-ai-widget</title>
8
- <script type="module" crossorigin src="/assets/index-DjcVY4no.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-Cic1nWVv.css">
10
- </head>
11
- <body>
12
- <div id="app"></div>
13
- </body>
14
- </html>
File without changes