@lelouchhe/webagent 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/config.toml +12 -3
- package/dist/fonts/temml/Temml.woff2 +0 -0
- package/dist/index.html +4 -4
- package/dist/js/app.3OEVQXHK.js +4 -0
- package/dist/js/chunk.IJM5DBCO.js +173 -0
- package/dist/js/viewer.FCSSTUVY.js +1 -0
- package/dist/login.html +1 -1
- package/dist/share-viewer.html +4 -3
- package/dist/{styles.012p32dz.css → styles.00xfh3e6.css} +408 -3
- package/lib/auth-middleware.js +3 -0
- package/lib/bridge-event-config.js +29 -0
- package/lib/client-registry.js +104 -15
- package/lib/config.js +12 -5
- package/lib/image-dimensions.js +64 -0
- package/lib/model-picker.js +17 -0
- package/lib/preflight.js +41 -22
- package/lib/push-service.js +21 -69
- package/lib/routes.js +124 -12
- package/lib/server.js +19 -23
- package/lib/startup-checks.js +1 -0
- package/lib/store.js +15 -3
- package/lib/title-service.js +3 -19
- package/package.json +2 -1
- package/dist/js/app.GSAIYHML.js +0 -4
- package/dist/js/chunk.CGWFHJI2.js +0 -76
- package/dist/js/viewer.6DT53STL.js +0 -1
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var dr=null,gr=()=>dr??=import("./chunk.VZXGXFNN.js").then(t=>t.default);async function mr(t){let e=await gr();for(let n of t.querySelectorAll("pre code"))n.dataset.highlighted||e.highlightElement(n)}function kr(t){let e=t.querySelectorAll("pre");for(let n of e){if(!n.querySelector("code")||n.parentElement?.classList.contains("code-block-wrapper"))continue;let s=document.createElement("div");s.className="code-block-wrapper";let i=document.createElement("div");i.className="code-toolbar";let l=document.createElement("button");l.className="copy-btn",l.textContent="cp",l.type="button",i.appendChild(l),n.replaceWith(s),s.appendChild(i),s.appendChild(n)}}var pt=new WeakMap;function Xs(t){let e=t.target.closest(".copy-btn");if(!e)return;let r=e.closest(".code-block-wrapper")?.querySelector("code");if(!r)return;let s=r.textContent||"";navigator.clipboard.writeText(s).then(()=>{let i=pt.get(e);i&&clearTimeout(i),e.textContent="\u2713",e.classList.add("copied");let l=setTimeout(()=>{e.textContent="cp",e.classList.remove("copied"),pt.delete(e)},1500);pt.set(e,l)}).catch(()=>{let i=document.createRange();i.selectNodeContents(r);let l=window.getSelection();l?.removeAllRanges(),l?.addRange(i)})}function Zs(t){t.querySelector("pre code")&&(kr(t),mr(t))}function Vs(){}function gt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ae=gt();function un(t){ae=t}var oe={exec:()=>null};function k(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(M.caret,"$1"),n=n.replace(s,l),r},getRegex:()=>new RegExp(n,e)};return r}var br=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),M={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},xr=/^(?:[ \t]*(?:\n|$))+/,Tr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Er=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ae=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,pn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hn=k(pn).replace(/bull/g,mt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).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/).replace(/\|table/g,"").getRegex(),_r=k(pn).replace(/bull/g,mt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).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/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),kt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ar=/^[^\n]+/,bt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,wr=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Sr=k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mt).getRegex(),je="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",xt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rr=k("^ {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",xt).replace("tag",je).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fn=k(kt).replace("hr",Ae).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",je).getRegex(),Lr=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fn).getRegex(),Tt={blockquote:Lr,code:Tr,def:wr,fences:Er,heading:yr,hr:Ae,html:Rr,lheading:hn,list:Sr,newline:xr,paragraph:fn,table:oe,text:Ar},nn=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ae).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",je).getRegex(),Cr={...Tt,lheading:_r,table:nn,paragraph:k(kt).replace("hr",Ae).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",nn).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",je).getRegex()},Ir={...Tt,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xt).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:oe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(kt).replace("hr",Ae).replace("heading",` *#{1,6} *[^
|
|
2
|
-
]`).replace("lheading",hn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Or=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Dr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dn=/^( {2,}|\\)\n(?!\s*$)/,Nr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,de=/[\p{P}\p{S}]/u,Ye=/[\s\p{P}\p{S}]/u,Et=/[^\s\p{P}\p{S}]/u,Mr=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ye).getRegex(),gn=/(?!~)[\p{P}\p{S}]/u,Pr=/(?!~)[\s\p{P}\p{S}]/u,vr=/(?:[^\s\p{P}\p{S}]|~)/u,$r=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",br?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,zr=k(mn,"u").replace(/punct/g,de).getRegex(),Hr=k(mn,"u").replace(/punct/g,gn).getRegex(),kn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Br=k(kn,"gu").replace(/notPunctSpace/g,Et).replace(/punctSpace/g,Ye).replace(/punct/g,de).getRegex(),Ur=k(kn,"gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Pr).replace(/punct/g,gn).getRegex(),Fr=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Et).replace(/punctSpace/g,Ye).replace(/punct/g,de).getRegex(),qr=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,de).getRegex(),Gr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Wr=k(Gr,"gu").replace(/notPunctSpace/g,Et).replace(/punctSpace/g,Ye).replace(/punct/g,de).getRegex(),jr=k(/\\(punct)/,"gu").replace(/punct/g,de).getRegex(),Yr=k(/^<(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(),Xr=k(xt).replace("(?:-->|$)","-->").getRegex(),Zr=k("^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",Xr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Vr=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",qe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bn=k(/^!?\[(label)\]\[(ref)\]/).replace("label",qe).replace("ref",bt).getRegex(),xn=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",bt).getRegex(),Qr=k("reflink|nolink(?!\\()","g").replace("reflink",bn).replace("nolink",xn).getRegex(),rn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,yt={_backpedal:oe,anyPunctuation:jr,autolink:Yr,blockSkip:$r,br:dn,code:Dr,del:oe,delLDelim:oe,delRDelim:oe,emStrongLDelim:zr,emStrongRDelimAst:Br,emStrongRDelimUnd:Fr,escape:Or,link:Vr,nolink:xn,punctuation:Mr,reflink:bn,reflinkSearch:Qr,tag:Zr,text:Nr,url:oe},Kr={...yt,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",qe).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qe).getRegex()},ht={...yt,emStrongRDelimAst:Ur,emStrongLDelim:Hr,delLDelim:qr,delRDelim:Wr,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",rn).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\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",rn).getRegex()},Jr={...ht,br:k(dn).replace("{2,}","*").getRegex(),text:k(ht.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fe={normal:Tt,gfm:Cr,pedantic:Ir},ye={normal:yt,gfm:ht,breaks:Jr,pedantic:Kr},es={"&":"&","<":"<",">":">",'"':""","'":"'"},sn=t=>es[t];function V(t,e){if(e){if(M.escapeTest.test(t))return t.replace(M.escapeReplace,sn)}else if(M.escapeTestNoEncode.test(t))return t.replace(M.escapeReplaceNoEncode,sn);return t}function on(t){try{t=encodeURI(t).replace(M.percentDecode,"%")}catch{return null}return t}function ln(t,e){let n=t.replace(M.findPipe,(i,l,a)=>{let p=!1,c=l;for(;--c>=0&&a[c]==="\\";)p=!p;return p?"|":" |"}),r=n.split(M.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(M.slashPipe,"|");return r}function ne(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r;){let i=t.charAt(r-s-1);if(i===e&&!n)s++;else if(i!==e&&n)s++;else break}return t.slice(0,r-s)}function an(t){let e=t.split(`
|
|
3
|
-
`),n=e.length-1;for(;n>=0&&M.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`
|
|
4
|
-
`)}function ts(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function ns(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function cn(t,e,n,r,s){let i=e.href,l=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let p={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:l,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,p}function rs(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
5
|
-
`).map(i=>{let l=i.match(n.other.beginningSpace);if(l===null)return i;let[a]=l;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
6
|
-
`)}var Ge=class{options;rules;lexer;constructor(t){this.options=t||ae}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=this.options.pedantic?e[0]:an(e[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=rs(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=ne(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:ne(e[0],`
|
|
7
|
-
`),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ne(e[0],`
|
|
8
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=ne(e[0],`
|
|
9
|
-
`).split(`
|
|
10
|
-
`),r="",s="",i=[];for(;n.length>0;){let l=!1,a=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))a.push(n[p]),l=!0;else if(!l)a.push(n[p]);else break;n=n.slice(p);let c=a.join(`
|
|
11
|
-
`),f=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
13
|
-
${c}`:c,s=s?`${s}
|
|
14
|
-
${f}`:f;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,i,!0),this.lexer.state.top=h,n.length===0)break;let b=i.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let E=b,T=E.raw+`
|
|
15
|
-
`+n.join(`
|
|
16
|
-
`),q=this.blockquote(T);i[i.length-1]=q,r=r.substring(0,r.length-E.raw.length)+q.raw,s=s.substring(0,s.length-E.text.length)+q.text;break}else if(b?.type==="list"){let E=b,T=E.raw+`
|
|
17
|
-
`+n.join(`
|
|
18
|
-
`),q=this.list(T);i[i.length-1]=q,r=r.substring(0,r.length-b.raw.length)+q.raw,s=s.substring(0,s.length-E.raw.length)+q.raw,n=T.substring(i.at(-1).raw.length).split(`
|
|
19
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),l=!1;for(;t;){let p=!1,c="",f="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=ns(e[2].split(`
|
|
20
|
-
`,1)[0],e[1].length),b=t.split(`
|
|
21
|
-
`,1)[0],E=!h.trim(),T=0;if(this.options.pedantic?(T=2,f=h.trimStart()):E?T=e[1].length+1:(T=h.search(this.rules.other.nonSpaceChar),T=T>4?1:T,f=h.slice(T),T+=e[1].length),E&&this.rules.other.blankLine.test(b)&&(c+=b+`
|
|
22
|
-
`,t=t.substring(b.length+1),p=!0),!p){let q=this.rules.other.nextBulletRegex(T),Oe=this.rules.other.hrRegex(T),De=this.rules.other.fencesBeginRegex(T),Ne=this.rules.other.headingBeginRegex(T),ce=this.rules.other.htmlBeginRegex(T),I=this.rules.other.blockquoteBeginRegex(T);for(;t;){let Q=t.split(`
|
|
23
|
-
`,1)[0],K;if(b=Q,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),K=b):K=b.replace(this.rules.other.tabCharGlobal," "),De.test(b)||Ne.test(b)||ce.test(b)||I.test(b)||q.test(b)||Oe.test(b))break;if(K.search(this.rules.other.nonSpaceChar)>=T||!b.trim())f+=`
|
|
24
|
-
`+K.slice(T);else{if(E||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||De.test(h)||Ne.test(h)||Oe.test(h))break;f+=`
|
|
25
|
-
`+b}E=!b.trim(),c+=Q+`
|
|
26
|
-
`,t=t.substring(Q.length+1),h=K.slice(T)}}s.loose||(l?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(l=!0)),s.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),s.raw+=c}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let p of s.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),p.tokens[0]?.type==="text"||p.tokens[0]?.type==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(p.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};p.checked=f.checked,s.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=f.raw+p.tokens[0].raw,p.tokens[0].text=f.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(f)):p.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):p.tokens.unshift(f)}}if(!s.loose){let c=p.tokens.filter(h=>h.type==="space"),f=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=f}}if(s.loose)for(let p of s.items){p.loose=!0;for(let c of p.tokens)c.type==="text"&&(c.type="paragraph")}return s}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=an(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:ne(e[0],`
|
|
27
|
-
`),href:r,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=ln(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
28
|
-
`):[],i={type:"table",raw:ne(e[0],`
|
|
29
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of s)i.rows.push(ln(l,i.header.length).map((a,p)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[p]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:ne(e[0],`
|
|
30
|
-
`),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
31
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=ne(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ts(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),cn(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return cn(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,l,a=s,p=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(l=[...i].length,r[3]||r[4]){a+=l;continue}else if((r[5]||r[6])&&s%3&&!((s+l)%3)){p+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a+p);let f=[...r[0]][0].length,h=t.slice(0,s+r.index+f+l);if(Math.min(s,l)%2){let E=h.slice(1,-1);return{type:"em",raw:h,text:E,tokens:this.lexer.inlineTokens(E)}}let b=h.slice(2,-2);return{type:"strong",raw:h,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,l,a=s,p=this.rules.inline.delRDelim;for(p.lastIndex=0,e=e.slice(-1*t.length+s);(r=p.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(l=[...i].length,l!==s))continue;if(r[3]||r[4]){a+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a);let c=[...r[0]][0].length,f=t.slice(0,s+r.index+c+l),h=f.slice(s,-s);return{type:"del",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},j=class ft{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ae,this.options.tokenizer=this.options.tokenizer||new Ge,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:M,block:Fe.normal,inline:ye.normal};this.options.pedantic?(n.block=Fe.pedantic,n.inline=ye.pedantic):this.options.gfm&&(n.block=Fe.gfm,this.options.breaks?n.inline=ye.breaks:n.inline=ye.gfm),this.tokenizer.rules=n}static get rules(){return{block:Fe,inline:ye}}static lex(e,n){return new ft(n).lex(e)}static lexInline(e,n){return new ft(n).inlineTokens(e)}lex(e){e=e.replace(M.carriageReturn,`
|
|
32
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(M.tabCharGlobal," ").replace(M.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(a=>(i=a.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=n.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
|
|
33
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
34
|
-
`)?"":`
|
|
35
|
-
`)+i.raw,a.text+=`
|
|
36
|
-
`+i.text,this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
37
|
-
`)?"":`
|
|
38
|
-
`)+i.raw,a.text+=`
|
|
39
|
-
`+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let l=e;if(this.options.extensions?.startBlock){let a=1/0,p=e.slice(1),c;this.options.extensions.startBlock.forEach(f=>{c=f.call({lexer:this},p),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(l=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let a=n.at(-1);r&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
40
|
-
`)?"":`
|
|
41
|
-
`)+i.raw,a.text+=`
|
|
42
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i),r=l.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
43
|
-
`)?"":`
|
|
44
|
-
`)+i.raw,a.text+=`
|
|
45
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)c.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let l=!1,a="",p=1/0;for(;e;){if(e.length<p)p=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}l||(a=""),l=!1;let c;if(this.options.extensions?.inline?.some(h=>(c=h.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let h=n.at(-1);c.type==="text"&&h?.type==="text"?(h.raw+=c.raw,h.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(e,r,a)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(e,r,a)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);continue}let f=e;if(this.options.extensions?.startInline){let h=1/0,b=e.slice(1),E;this.options.extensions.startInline.forEach(T=>{E=T.call({lexer:this},b),typeof E=="number"&&E>=0&&(h=Math.min(h,E))}),h<1/0&&h>=0&&(f=e.substring(0,h+1))}if(c=this.tokenizer.inlineText(f)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(a=c.raw.slice(-1)),l=!0;let h=n.at(-1);h?.type==="text"?(h.raw+=c.raw,h.text+=c.text):n.push(c);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},We=class{options;parser;constructor(t){this.options=t||ae}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(M.notSpaceStart)?.[0],s=t.replace(M.endingNewline,"")+`
|
|
46
|
-
`;return r?'<pre><code class="language-'+V(r)+'">'+(n?s:V(s,!0))+`</code></pre>
|
|
47
|
-
`:"<pre><code>"+(n?s:V(s,!0))+`</code></pre>
|
|
48
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
49
|
-
${this.parser.parse(t)}</blockquote>
|
|
50
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
51
|
-
`}hr(t){return`<hr>
|
|
52
|
-
`}list(t){let e=t.ordered,n=t.start,r="";for(let l=0;l<t.items.length;l++){let a=t.items[l];r+=this.listitem(a)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
53
|
-
`+r+"</"+s+`>
|
|
54
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
55
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
56
|
-
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let l=0;l<i.length;l++)n+=this.tablecell(i[l]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
57
|
-
<thead>
|
|
58
|
-
`+e+`</thead>
|
|
59
|
-
`+r+`</table>
|
|
60
|
-
`}tablerow({text:t}){return`<tr>
|
|
61
|
-
${t}</tr>
|
|
62
|
-
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
63
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${V(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=on(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+V(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=on(t);if(s===null)return V(n);t=s;let i=`<img src="${t}" alt="${V(n)}"`;return e&&(i+=` title="${V(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:V(t.text)}},_t=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Y=class dt{options;renderer;textRenderer;constructor(e){this.options=e||ae,this.options.renderer=this.options.renderer||new We,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _t}static parse(e,n){return new dt(n).parse(e)}static parseInline(e,n){return new dt(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let s=e[r];if(this.options.extensions?.renderers?.[s.type]){let l=s,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=a||"";continue}}let i=s;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=a||"";continue}}let l=i;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},_e=class{options;block;constructor(t){this.options=t||ae}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?j.lex:j.lexInline}provideParser(t=this.block){return t?Y.parse:Y.parseInline}},ss=class{defaults=gt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=We;TextRenderer=_t;Lexer=j;Tokenizer=Ge;Hooks=_e;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let s=r;for(let i of s.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of s.rows)for(let l of i)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let s=r;n=n.concat(this.walkTokens(s.items,e));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(i=>{let l=s[i].flat(1/0);n=n.concat(this.walkTokens(l,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...l){let a=s.renderer.apply(this,l);return a===!1&&(a=i.apply(this,l)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new We(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,a=n.renderer[l],p=s[l];s[l]=(...c)=>{let f=a.apply(s,c);return f===!1&&(f=p.apply(s,c)),f||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ge(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,a=n.tokenizer[l],p=s[l];s[l]=(...c)=>{let f=a.apply(s,c);return f===!1&&(f=p.apply(s,c)),f}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new _e;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,a=n.hooks[l],p=s[l];_e.passThroughHooks.has(i)?s[l]=c=>{if(this.defaults.async&&_e.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await a.call(s,c);return p.call(s,h)})();let f=a.call(s,c);return p.call(s,f)}:s[l]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(s,c);return h===!1&&(h=await p.apply(s,c)),h})();let f=a.apply(s,c);return f===!1&&(f=p.apply(s,c)),f}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),s&&(a=a.concat(s.call(this,l))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return j.lex(t,e??this.defaults)}parser(t,e){return Y.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?j.lex:j.lexInline)(l,s),p=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(p,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?Y.parse:Y.parseInline)(p,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let l=(s.hooks?s.hooks.provideLexer(t):t?j.lex:j.lexInline)(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?Y.parse:Y.parseInline)(l,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(l){return i(l)}}}onError(t,e){return n=>{if(n.message+=`
|
|
64
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+V(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},le=new ss;function x(t,e){return le.parse(t,e)}x.options=x.setOptions=function(t){return le.setOptions(t),x.defaults=le.defaults,un(x.defaults),x};x.getDefaults=gt;x.defaults=ae;x.use=function(...t){return le.use(...t),x.defaults=le.defaults,un(x.defaults),x};x.walkTokens=function(t,e){return le.walkTokens(t,e)};x.parseInline=le.parseInline;x.Parser=Y;x.parser=Y.parse;x.Renderer=We;x.TextRenderer=_t;x.Lexer=j;x.lexer=j.lex;x.Tokenizer=Ge;x.Hooks=_e;x.parse=x;var Ks=x.options,Js=x.setOptions,ei=x.use,ti=x.walkTokens,ni=x.parseInline;var ri=Y.parse,si=j.lex;var{entries:Dn,setPrototypeOf:Tn,isFrozen:is,getPrototypeOf:os,getOwnPropertyDescriptor:ls}=Object,{freeze:$,seal:U,create:me}=Object,{apply:Ct,construct:It}=typeof Reflect<"u"&&Reflect;$||($=function(e){return e});U||(U=function(e){return e});Ct||(Ct=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});It||(It=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});var we=S(Array.prototype.forEach),as=S(Array.prototype.lastIndexOf),En=S(Array.prototype.pop),Se=S(Array.prototype.push),cs=S(Array.prototype.splice),v=Array.isArray,Ce=S(String.prototype.toLowerCase),At=S(String.prototype.toString),yn=S(String.prototype.match),ge=S(String.prototype.replace),_n=S(String.prototype.indexOf),us=S(String.prototype.trim),ps=S(Number.prototype.toString),hs=S(Boolean.prototype.toString),An=typeof BigInt>"u"?null:S(BigInt.prototype.toString),wn=typeof Symbol>"u"?null:S(Symbol.prototype.toString),_=S(Object.prototype.hasOwnProperty),Re=S(Object.prototype.toString),D=S(RegExp.prototype.test),Xe=fs(TypeError);function S(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return Ct(t,e,r)}}function fs(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return It(t,n)}}function m(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ce;if(Tn&&Tn(t,null),!v(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let i=n(s);i!==s&&(is(e)||(e[r]=i),s=i)}t[s]=!0}return t}function ds(t){for(let e=0;e<t.length;e++)_(t,e)||(t[e]=null);return t}function H(t){let e=me(null);for(let[n,r]of Dn(t))_(t,n)&&(v(r)?e[n]=ds(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=H(r):e[n]=r);return e}function gs(t){switch(typeof t){case"string":return t;case"number":return ps(t);case"boolean":return hs(t);case"bigint":return An?An(t):"0";case"symbol":return wn?wn(t):"Symbol()";case"undefined":return Re(t);case"function":case"object":{if(t===null)return Re(t);let e=t,n=ke(e,"toString");if(typeof n=="function"){let r=n(e);return typeof r=="string"?r:Re(r)}return Re(t)}default:return Re(t)}}function ke(t,e){for(;t!==null;){let r=ls(t,e);if(r){if(r.get)return S(r.get);if(typeof r.value=="function")return S(r.value)}t=os(t)}function n(){return null}return n}function ms(t){try{return D(t,""),!0}catch{return!1}}var Sn=$(["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"]),wt=$(["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=$(["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"]),ks=$(["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=$(["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"]),bs=$(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rn=$(["#text"]),Ln=$(["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"]),Lt=$(["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"]),Cn=$(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Ze=$(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xs=U(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ts=U(/<%[\w\W]*|[\w\W]*%>/gm),Es=U(/\$\{[\w\W]*/gm),ys=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),_s=U(/^aria-[\-\w]+$/),Nn=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),As=U(/^(?:\w+script|data):/i),ws=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Mn=U(/^html$/i),Ss=U(/^[a-z][.\w]*(-[.\w]+)+$/i),In=Object.freeze({__proto__:null,ARIA_ATTR:_s,ATTR_WHITESPACE:ws,CUSTOM_ELEMENT:Ss,DATA_ATTR:ys,DOCTYPE_NAME:Mn,ERB_EXPR:Ts,IS_ALLOWED_URI:Nn,IS_SCRIPT_OR_DATA:As,MUSTACHE_EXPR:xs,TMPLIT_EXPR:Es}),Le={element:1,text:3,progressingInstruction:7,comment:8,document:9},Rs=function(){return typeof window>"u"?null:window},Ls=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));let i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},On=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Pn(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rs(),e=g=>Pn(g);if(e.version="3.4.1",e.removed=[],!t||!t.document||t.document.nodeType!==Le.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t,r=n,s=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:l,Node:a,Element:p,NodeFilter:c,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:b,trustedTypes:E}=t,T=p.prototype,q=ke(T,"cloneNode"),Oe=ke(T,"remove"),De=ke(T,"nextSibling"),Ne=ke(T,"childNodes"),ce=ke(T,"parentNode");if(typeof l=="function"){let g=n.createElement("template");g.content&&g.content.ownerDocument&&(n=g.content.ownerDocument)}let I,Q="",{implementation:K,createNodeIterator:Jn,createDocumentFragment:er,getElementsByTagName:tr}=n,{importNode:nr}=r,P=On();e.isSupported=typeof Dn=="function"&&typeof ce=="function"&&K&&K.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Me,ERB_EXPR:Pe,TMPLIT_EXPR:ve,DATA_ATTR:rr,ARIA_ATTR:sr,IS_SCRIPT_OR_DATA:ir,ATTR_WHITESPACE:Ot,CUSTOM_ELEMENT:or}=In,{IS_ALLOWED_URI:Dt}=In,L=null,Nt=m({},[...Sn,...wt,...St,...Rt,...Rn]),O=null,Mt=m({},[...Ln,...Lt,...Cn,...Ze]),A=Object.seal(me(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}})),be=null,$e=null,te=Object.seal(me(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Pt=!0,Qe=!0,vt=!1,$t=!0,re=!1,xe=!0,se=!1,Ke=!1,Je=!1,ue=!1,ze=!1,He=!1,zt=!0,Ht=!1,Bt="user-content-",et=!0,Te=!1,pe={},X=null,tt=m({},["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"]),Ut=null,Ft=m({},["audio","video","img","source","image","track"]),nt=null,qt=m({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Be="http://www.w3.org/1998/Math/MathML",Ue="http://www.w3.org/2000/svg",Z="http://www.w3.org/1999/xhtml",he=Z,rt=!1,st=null,lr=m({},[Be,Ue,Z],At),it=m({},["mi","mo","mn","ms","mtext"]),ot=m({},["annotation-xml"]),ar=m({},["title","style","font","a","script"]),Ee=null,cr=["application/xhtml+xml","text/html"],ur="text/html",R=null,fe=null,pr=n.createElement("form"),Gt=function(o){return o instanceof RegExp||o instanceof Function},lt=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(fe&&fe===o)return;(!o||typeof o!="object")&&(o={}),o=H(o),Ee=cr.indexOf(o.PARSER_MEDIA_TYPE)===-1?ur:o.PARSER_MEDIA_TYPE,R=Ee==="application/xhtml+xml"?At:Ce,L=_(o,"ALLOWED_TAGS")&&v(o.ALLOWED_TAGS)?m({},o.ALLOWED_TAGS,R):Nt,O=_(o,"ALLOWED_ATTR")&&v(o.ALLOWED_ATTR)?m({},o.ALLOWED_ATTR,R):Mt,st=_(o,"ALLOWED_NAMESPACES")&&v(o.ALLOWED_NAMESPACES)?m({},o.ALLOWED_NAMESPACES,At):lr,nt=_(o,"ADD_URI_SAFE_ATTR")&&v(o.ADD_URI_SAFE_ATTR)?m(H(qt),o.ADD_URI_SAFE_ATTR,R):qt,Ut=_(o,"ADD_DATA_URI_TAGS")&&v(o.ADD_DATA_URI_TAGS)?m(H(Ft),o.ADD_DATA_URI_TAGS,R):Ft,X=_(o,"FORBID_CONTENTS")&&v(o.FORBID_CONTENTS)?m({},o.FORBID_CONTENTS,R):tt,be=_(o,"FORBID_TAGS")&&v(o.FORBID_TAGS)?m({},o.FORBID_TAGS,R):H({}),$e=_(o,"FORBID_ATTR")&&v(o.FORBID_ATTR)?m({},o.FORBID_ATTR,R):H({}),pe=_(o,"USE_PROFILES")?o.USE_PROFILES&&typeof o.USE_PROFILES=="object"?H(o.USE_PROFILES):o.USE_PROFILES:!1,Pt=o.ALLOW_ARIA_ATTR!==!1,Qe=o.ALLOW_DATA_ATTR!==!1,vt=o.ALLOW_UNKNOWN_PROTOCOLS||!1,$t=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=o.SAFE_FOR_TEMPLATES||!1,xe=o.SAFE_FOR_XML!==!1,se=o.WHOLE_DOCUMENT||!1,ue=o.RETURN_DOM||!1,ze=o.RETURN_DOM_FRAGMENT||!1,He=o.RETURN_TRUSTED_TYPE||!1,Je=o.FORCE_BODY||!1,zt=o.SANITIZE_DOM!==!1,Ht=o.SANITIZE_NAMED_PROPS||!1,et=o.KEEP_CONTENT!==!1,Te=o.IN_PLACE||!1,Dt=ms(o.ALLOWED_URI_REGEXP)?o.ALLOWED_URI_REGEXP:Nn,he=typeof o.NAMESPACE=="string"?o.NAMESPACE:Z,it=_(o,"MATHML_TEXT_INTEGRATION_POINTS")&&o.MATHML_TEXT_INTEGRATION_POINTS&&typeof o.MATHML_TEXT_INTEGRATION_POINTS=="object"?H(o.MATHML_TEXT_INTEGRATION_POINTS):m({},["mi","mo","mn","ms","mtext"]),ot=_(o,"HTML_INTEGRATION_POINTS")&&o.HTML_INTEGRATION_POINTS&&typeof o.HTML_INTEGRATION_POINTS=="object"?H(o.HTML_INTEGRATION_POINTS):m({},["annotation-xml"]);let u=_(o,"CUSTOM_ELEMENT_HANDLING")&&o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING=="object"?H(o.CUSTOM_ELEMENT_HANDLING):me(null);if(A=me(null),_(u,"tagNameCheck")&&Gt(u.tagNameCheck)&&(A.tagNameCheck=u.tagNameCheck),_(u,"attributeNameCheck")&&Gt(u.attributeNameCheck)&&(A.attributeNameCheck=u.attributeNameCheck),_(u,"allowCustomizedBuiltInElements")&&typeof u.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=u.allowCustomizedBuiltInElements),re&&(Qe=!1),ze&&(ue=!0),pe&&(L=m({},Rn),O=me(null),pe.html===!0&&(m(L,Sn),m(O,Ln)),pe.svg===!0&&(m(L,wt),m(O,Lt),m(O,Ze)),pe.svgFilters===!0&&(m(L,St),m(O,Lt),m(O,Ze)),pe.mathMl===!0&&(m(L,Rt),m(O,Cn),m(O,Ze))),te.tagCheck=null,te.attributeCheck=null,_(o,"ADD_TAGS")&&(typeof o.ADD_TAGS=="function"?te.tagCheck=o.ADD_TAGS:v(o.ADD_TAGS)&&(L===Nt&&(L=H(L)),m(L,o.ADD_TAGS,R))),_(o,"ADD_ATTR")&&(typeof o.ADD_ATTR=="function"?te.attributeCheck=o.ADD_ATTR:v(o.ADD_ATTR)&&(O===Mt&&(O=H(O)),m(O,o.ADD_ATTR,R))),_(o,"ADD_URI_SAFE_ATTR")&&v(o.ADD_URI_SAFE_ATTR)&&m(nt,o.ADD_URI_SAFE_ATTR,R),_(o,"FORBID_CONTENTS")&&v(o.FORBID_CONTENTS)&&(X===tt&&(X=H(X)),m(X,o.FORBID_CONTENTS,R)),_(o,"ADD_FORBID_CONTENTS")&&v(o.ADD_FORBID_CONTENTS)&&(X===tt&&(X=H(X)),m(X,o.ADD_FORBID_CONTENTS,R)),et&&(L["#text"]=!0),se&&m(L,["html","head","body"]),L.table&&(m(L,["tbody"]),delete be.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,Q=I.createHTML("")}else I===void 0&&(I=Ls(E,s)),I!==null&&typeof Q=="string"&&(Q=I.createHTML(""));$&&$(o),fe=o},Wt=m({},[...wt,...St,...ks]),jt=m({},[...Rt,...bs]),hr=function(o){let u=ce(o);(!u||!u.tagName)&&(u={namespaceURI:he,tagName:"template"});let d=Ce(o.tagName),y=Ce(u.tagName);return st[o.namespaceURI]?o.namespaceURI===Ue?u.namespaceURI===Z?d==="svg":u.namespaceURI===Be?d==="svg"&&(y==="annotation-xml"||it[y]):!!Wt[d]:o.namespaceURI===Be?u.namespaceURI===Z?d==="math":u.namespaceURI===Ue?d==="math"&&ot[y]:!!jt[d]:o.namespaceURI===Z?u.namespaceURI===Ue&&!ot[y]||u.namespaceURI===Be&&!it[y]?!1:!jt[d]&&(ar[d]||!Wt[d]):!!(Ee==="application/xhtml+xml"&&st[o.namespaceURI]):!1},G=function(o){Se(e.removed,{element:o});try{ce(o).removeChild(o)}catch{Oe(o)}},ie=function(o,u){try{Se(e.removed,{attribute:u.getAttributeNode(o),from:u})}catch{Se(e.removed,{attribute:null,from:u})}if(u.removeAttribute(o),o==="is")if(ue||ze)try{G(u)}catch{}else try{u.setAttribute(o,"")}catch{}},Yt=function(o){let u=null,d=null;if(Je)o="<remove></remove>"+o;else{let w=yn(o,/^[\r\n\t ]+/);d=w&&w[0]}Ee==="application/xhtml+xml"&&he===Z&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");let y=I?I.createHTML(o):o;if(he===Z)try{u=new b().parseFromString(y,Ee)}catch{}if(!u||!u.documentElement){u=K.createDocument(he,"template",null);try{u.documentElement.innerHTML=rt?Q:y}catch{}}let N=u.body||u.documentElement;return o&&d&&N.insertBefore(n.createTextNode(d),N.childNodes[0]||null),he===Z?tr.call(u,se?"html":"body")[0]:se?u.documentElement:N},Xt=function(o){return Jn.call(o.ownerDocument||o,o,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},at=function(o){return o instanceof h&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof f)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},ct=function(o){return typeof a=="function"&&o instanceof a};function J(g,o,u){we(g,d=>{d.call(e,o,u,fe)})}let Zt=function(o){let u=null;if(J(P.beforeSanitizeElements,o,null),at(o))return G(o),!0;let d=R(o.nodeName);if(J(P.uponSanitizeElement,o,{tagName:d,allowedTags:L}),xe&&o.hasChildNodes()&&!ct(o.firstElementChild)&&D(/<[/\w!]/g,o.innerHTML)&&D(/<[/\w!]/g,o.textContent)||xe&&o.namespaceURI===Z&&d==="style"&&ct(o.firstElementChild)||o.nodeType===Le.progressingInstruction||xe&&o.nodeType===Le.comment&&D(/<[/\w]/g,o.data))return G(o),!0;if(be[d]||!(te.tagCheck instanceof Function&&te.tagCheck(d))&&!L[d]){if(!be[d]&&Qt(d)&&(A.tagNameCheck instanceof RegExp&&D(A.tagNameCheck,d)||A.tagNameCheck instanceof Function&&A.tagNameCheck(d)))return!1;if(et&&!X[d]){let y=ce(o)||o.parentNode,N=Ne(o)||o.childNodes;if(N&&y){let w=N.length;for(let z=w-1;z>=0;--z){let B=q(N[z],!0);y.insertBefore(B,De(o))}}}return G(o),!0}return o instanceof p&&!hr(o)||(d==="noscript"||d==="noembed"||d==="noframes")&&D(/<\/no(script|embed|frames)/i,o.innerHTML)?(G(o),!0):(re&&o.nodeType===Le.text&&(u=o.textContent,we([Me,Pe,ve],y=>{u=ge(u,y," ")}),o.textContent!==u&&(Se(e.removed,{element:o.cloneNode()}),o.textContent=u)),J(P.afterSanitizeElements,o,null),!1)},Vt=function(o,u,d){if($e[u]||zt&&(u==="id"||u==="name")&&(d in n||d in pr))return!1;if(!(Qe&&!$e[u]&&D(rr,u))){if(!(Pt&&D(sr,u))){if(!(te.attributeCheck instanceof Function&&te.attributeCheck(u,o))){if(!O[u]||$e[u]){if(!(Qt(o)&&(A.tagNameCheck instanceof RegExp&&D(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&D(A.attributeNameCheck,u)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(u,o))||u==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&D(A.tagNameCheck,d)||A.tagNameCheck instanceof Function&&A.tagNameCheck(d))))return!1}else if(!nt[u]){if(!D(Dt,ge(d,Ot,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&o!=="script"&&_n(d,"data:")===0&&Ut[o])){if(!(vt&&!D(ir,ge(d,Ot,"")))){if(d)return!1}}}}}}}return!0},fr=m({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Qt=function(o){return!fr[Ce(o)]&&D(or,o)},Kt=function(o){J(P.beforeSanitizeAttributes,o,null);let{attributes:u}=o;if(!u||at(o))return;let d={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0},y=u.length;for(;y--;){let N=u[y],{name:w,namespaceURI:z,value:B}=N,W=R(w),ut=B,C=w==="value"?ut:us(ut);if(d.attrName=W,d.attrValue=C,d.keepAttr=!0,d.forceKeepAttr=void 0,J(P.uponSanitizeAttribute,o,d),C=d.attrValue,Ht&&(W==="id"||W==="name")&&_n(C,Bt)!==0&&(ie(w,o),C=Bt+C),xe&&D(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,C)){ie(w,o);continue}if(W==="attributename"&&yn(C,"href")){ie(w,o);continue}if(d.forceKeepAttr)continue;if(!d.keepAttr){ie(w,o);continue}if(!$t&&D(/\/>/i,C)){ie(w,o);continue}re&&we([Me,Pe,ve],tn=>{C=ge(C,tn," ")});let en=R(o.nodeName);if(!Vt(en,W,C)){ie(w,o);continue}if(I&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!z)switch(E.getAttributeType(en,W)){case"TrustedHTML":{C=I.createHTML(C);break}case"TrustedScriptURL":{C=I.createScriptURL(C);break}}if(C!==ut)try{z?o.setAttributeNS(z,w,C):o.setAttribute(w,C),at(o)?G(o):En(e.removed)}catch{ie(w,o)}}J(P.afterSanitizeAttributes,o,null)},Jt=function(o){let u=null,d=Xt(o);for(J(P.beforeSanitizeShadowDOM,o,null);u=d.nextNode();)J(P.uponSanitizeShadowNode,u,null),Zt(u),Kt(u),u.content instanceof i&&Jt(u.content);J(P.afterSanitizeShadowDOM,o,null)};return e.sanitize=function(g){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=null,d=null,y=null,N=null;if(rt=!g,rt&&(g="<!-->"),typeof g!="string"&&!ct(g)&&(g=gs(g),typeof g!="string"))throw Xe("dirty is not a string, aborting");if(!e.isSupported)return g;if(Ke||lt(o),e.removed=[],typeof g=="string"&&(Te=!1),Te){let B=g.nodeName;if(typeof B=="string"){let W=R(B);if(!L[W]||be[W])throw Xe("root node is forbidden and cannot be sanitized in-place")}}else if(g instanceof a)u=Yt("<!---->"),d=u.ownerDocument.importNode(g,!0),d.nodeType===Le.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?u=d:u.appendChild(d);else{if(!ue&&!re&&!se&&g.indexOf("<")===-1)return I&&He?I.createHTML(g):g;if(u=Yt(g),!u)return ue?null:He?Q:""}u&&Je&&G(u.firstChild);let w=Xt(Te?g:u);for(;y=w.nextNode();)Zt(y),Kt(y),y.content instanceof i&&Jt(y.content);if(Te)return g;if(ue){if(re){u.normalize();let B=u.innerHTML;we([Me,Pe,ve],W=>{B=ge(B,W," ")}),u.innerHTML=B}if(ze)for(N=er.call(u.ownerDocument);u.firstChild;)N.appendChild(u.firstChild);else N=u;return(O.shadowroot||O.shadowrootmode)&&(N=nr.call(r,N,!0)),N}let z=se?u.outerHTML:u.innerHTML;return se&&L["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&D(Mn,u.ownerDocument.doctype.name)&&(z="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
|
|
65
|
-
`+z),re&&we([Me,Pe,ve],B=>{z=ge(z,B," ")}),I&&He?I.createHTML(z):z},e.setConfig=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(g),Ke=!0},e.clearConfig=function(){fe=null,Ke=!1},e.isValidAttribute=function(g,o,u){fe||lt({});let d=R(g),y=R(o);return Vt(d,y,u)},e.addHook=function(g,o){typeof o=="function"&&Se(P[g],o)},e.removeHook=function(g,o){if(o!==void 0){let u=as(P[g],o);return u===-1?void 0:cs(P[g],u,1)[0]}return En(P[g])},e.removeHooks=function(g){P[g]=[]},e.removeAllHooks=function(){P=On()},e}var vn=Pn();var $n={task_complete:"\u2714",read:"cat",edit:"edit",execute:"exec",search:"find",delete:"rm"},zn="run",Hn={pending:"\u25CB",in_progress:"\u25C9",completed:"\u25CF"};function Bn(t,e,n){let r=$n[t]||zn,s,i;return n&&typeof n=="object"&&(n.command?(s=n.command,i="$ "):n.path&&(s=n.path)),{icon:r,title:e,detail:s,detailPrefix:i,showDiff:t==="edit"}}function Un(t){return t.map(e=>e.type==="terminal"?`[terminal ${e.terminalId}]`:e.content&&!Array.isArray(e.content)&&e.content.text?e.content.text:Array.isArray(e.content)?e.content.map(n=>n.text??"").join(""):"").filter(Boolean).join(`
|
|
66
|
-
`)}function Fn(t){return{icon:t==="completed"?"\u2713":t==="failed"?"\u2717":"\u2026",className:`tool-call ${t}`}}function qn(t){let e=t||"",n=e.includes("allow")?"allow":"deny",r=e.includes("reject")||e.includes("deny")?"deny":"resolve";return{cssClass:n,apiAction:r}}function Gn(t,e){return t??(e?"denied":"allowed")}function Wn(t){return t.map(e=>({symbol:Hn[e.status]||"?",content:e.content}))}function jn(t){if(typeof t=="string"&&t.includes("*** Begin Patch")){let e=t.split(`
|
|
67
|
-
`),n=[];for(let r of e)r.startsWith("*** Begin Patch")||r.startsWith("*** End Patch")||(r.startsWith("*** Update File:")||r.startsWith("*** Add File:")||r.startsWith("*** Delete File:")?n.push({kind:"file",text:r}):r.startsWith("@@")?n.push({kind:"hunk",text:r}):r.startsWith("-")?n.push({kind:"del",text:r}):r.startsWith("+")?n.push({kind:"add",text:r}):n.push({kind:"context",text:r}));return n}if(t&&typeof t=="object"){let e=[];if(t.path&&e.push({kind:"file",text:`*** ${t.path}`}),t.old_str!=null)for(let n of String(t.old_str).split(`
|
|
68
|
-
`))e.push({kind:"del",text:`- ${n}`});if(t.new_str!=null)for(let n of String(t.new_str).split(`
|
|
69
|
-
`))e.push({kind:"add",text:`+ ${n}`});if(t.file_text!=null)for(let n of String(t.file_text).split(`
|
|
70
|
-
`))e.push({kind:"add",text:`+ ${n}`});return e.length>(t.path?1:0)?e:null}return null}function di(t){if(Array.isArray(t))return{events:t,streaming:{thinking:!1,assistant:!1}};let e=t;return{events:e.events??[],streaming:e.streaming??{thinking:!1,assistant:!1},total:typeof e.total=="number"?e.total:void 0,hasMore:typeof e.hasMore=="boolean"?e.hasMore:void 0}}function gi(t,e,n){return t&&e===0&&n===0}x.setOptions({breaks:!0,gfm:!0});function F(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}function Cs(t){return vn.sanitize(x.parse(t))}var Is={file:"diff-file",hunk:"diff-hunk",add:"diff-add",del:"diff-del",context:null};function Os(t){let e=jn(t);return e?e.map(n=>{let r=Is[n.kind];return r?`<span class="${r}">${F(n.text)}</span>`:F(n.text)}).join(`
|
|
71
|
-
`):null}var Ds=["user_message","assistant_message","thinking","tool_call","tool_call_update","plan","permission_request","permission_response","bash_command","bash_result"];function Ti(t){return Ds.includes(t)}function Ei(t,e,n){switch(t){case"user_message":return Ns(e,n);case"assistant_message":return Ms(e,n);case"thinking":return Ps(e);case"tool_call":return vs(e);case"tool_call_update":return $s(e,n),null;case"plan":return zs(e);case"permission_request":return Hs(e,n);case"permission_response":return Bs(e,n),null;case"bash_command":return Us(e);case"bash_result":return Fs(e,n),null;default:return t}}function Ns(t,e){let n=typeof t.text=="string"?t.text:"",r=document.createElement("div");r.className="msg user",r.innerHTML=F(n).replace(/\n/g,"<br>");let s=Array.isArray(t.attachments)?t.attachments:[];for(let i of s){if(!i||typeof i!="object")continue;let l=i,a=typeof l.displayName=="string"?l.displayName:"file",p=l.kind==="image"?"image":"file",c=typeof l.path=="string"?l.path:"",f=c?e.rewriteAttachmentSrc?e.rewriteAttachmentSrc(c):c:"";if(p==="image"&&f){let h=document.createElement("img");h.className="user-image",h.src=f,h.alt=a,r.appendChild(h)}else if(p==="file"&&f){let h=document.createElement("a");h.className="user-file",h.href=f,h.target="_blank",h.rel="noopener",h.download=a,h.textContent=a,r.appendChild(h)}else{let h=document.createElement("div");h.className="user-attachment",h.textContent=`[${p}: ${a}]`,r.appendChild(h)}}return r}function Ms(t,e){let n=typeof t.text=="string"?t.text:"",r=document.createElement("div");return r.className="msg assistant",r.setAttribute("data-raw",n),r.innerHTML=Cs(n),e.enhanceMarkdown?.(r),r}function Ps(t){let e=typeof t.text=="string"?t.text:"",n=document.createElement("details");return n.className="thinking",n.setAttribute("data-raw",e),n.innerHTML=`<summary>\u283F thought</summary><div class="thinking-content">${F(e)}</div>`,n}function vs(t){let e=typeof t.id=="string"?t.id:"",n=typeof t.kind=="string"?t.kind:"",r=typeof t.title=="string"?t.title:"",s=t.rawInput,i=Bn(n,r,s),l=document.createElement("div");l.className="tool-call",l.id=`tc-${e}`,l.dataset.kind=n;let a=`<span class="icon">${i.icon}</span> ${F(i.title)}`;if(i.detail&&(a+=`<span class="tc-detail">${i.detailPrefix??""}${F(i.detail)}</span>`),l.innerHTML=a,i.showDiff){let c=Os(s);if(c){let f=document.createElement("details");f.innerHTML=`<summary>diff</summary><div class="diff-view">${c}</div>`,l.appendChild(f)}}let p=l.querySelector(".tc-detail");return p&&l.addEventListener("click",c=>{c.target.closest("details")||p.classList.toggle("expanded")}),l}function $s(t,e){let n=typeof t.id=="string"?t.id:"",r=e.findToolCallEl(n);if(!r)return;let s=typeof t.status=="string"?t.status:"pending",i=Fn(s);r.className=i.className;let l=r.querySelector(".icon");l&&(l.textContent=i.icon);let a=Array.isArray(t.content)?t.content:[];if(a.length&&!r.querySelector("details")&&!r.querySelector(".tc-summary")){let p=Un(a);if(p)if(r.dataset.kind==="task_complete"){let c=document.createElement("div");c.className="tc-summary",c.textContent=p,r.appendChild(c)}else{let c=document.createElement("details");c.innerHTML=`<summary>output</summary><div class="tc-content">${F(p)}</div>`,r.appendChild(c)}}}function zs(t){let e=Array.isArray(t.entries)?t.entries:[],n=Wn(e),r=document.createElement("div");return r.className="plan",r.innerHTML='<div class="plan-title">\u2015 plan</div>'+n.map(s=>`<div class="plan-entry">${s.symbol} ${F(s.content)}</div>`).join(""),r}function Hs(t,e){let n=typeof t.requestId=="string"?t.requestId:"",r=typeof t.title=="string"?t.title:"",s=document.createElement("div");s.className="permission",s.dataset.requestId=n,s.dataset.title=r;let i=e.isPermissionResolved?.(n)??!1,l=i?"title dim":"title";if(s.innerHTML=`<span class="${l}">\u26BF ${F(r)}</span> `,!i){let a=Array.isArray(t.options)?t.options:[];for(let p of a){let c=document.createElement("button"),f=qn(p.kind??"");c.className=f.cssClass,c.textContent=p.name,c.dataset.optionId=p.optionId,c.dataset.optionKind=p.kind??"",s.appendChild(c)}}return s}function Bs(t,e){let n=typeof t.requestId=="string"?t.requestId:"",r=e.findPermissionEl(n);if(!r)return;let s=r.dataset.title,i=s?`\u26BF ${s}`:"\u26BF",l=Gn(typeof t.optionName=="string"?t.optionName:void 0,typeof t.denied=="boolean"?t.denied:void 0);r.innerHTML=`<span class="dim">${F(i)} \u2014 ${F(l)}</span>`}function Us(t){let e=typeof t.command=="string"?t.command:"",n=document.createElement("div");return n.className="bash-block",n.innerHTML=`<span class="bash-cmd">${F(e)}</span><div class="bash-output"></div>`,n.querySelector(".bash-cmd").addEventListener("click",()=>{let r=n.querySelector(".bash-output");r.style.display==="none"?r.style.display="block":r.classList.contains("has-content")&&(r.style.display="none")}),n}function Fs(t,e){let n=e.findBashEl();if(!n)return;let r=typeof t.output=="string"?t.output:"";if(r){let p=n.querySelector(".bash-output");p&&(p.textContent=r,p.classList.add("has-content"))}let s=n.querySelector(".bash-cmd");s&&s.classList.remove("running");let i=typeof t.code=="number"?t.code:null,l=typeof t.signal=="string"?t.signal:null,a="";if(l?a=`[signal: ${l}]`:i!==0&&i!=null&&(a=`[exit: ${i}]`),a&&s){let p=document.createElement("span");p.className=`bash-exit ${i===0?"ok":"fail"}`,p.textContent=a,s.after(p)}}var qs={auto:"\u25D1",light:"\u2600",dark:"\u263E"},Yn=["auto","light","dark"];function Zn(){return localStorage.getItem("theme")??"auto"}var Vn=[];function _i(t){Vn.push(t)}function Qn(t){document.documentElement.setAttribute("data-theme",t);let e=document.getElementById("theme-btn");e&&(e.textContent=qs[t],e.title=`Theme: ${t}`),localStorage.setItem("theme",t);for(let n of Vn)n()}var Xn=document.getElementById("theme-btn");Xn&&Xn.addEventListener("click",()=>{let t=Zn(),e=Yn[(Yn.indexOf(t)+1)%3];Qn(e)});Qn(Zn());var ee=document.createElement("div");ee.id="lightbox-overlay";var Ie=document.createElement("img");ee.appendChild(Ie);document.body.appendChild(ee);var Ve=1,Gs=.5,Ws=5;function js(){return ee.classList.contains("active")}function Ys(t){Ie.src=t,Ve=1,Ie.style.transform="",ee.classList.add("active")}function Kn(){ee.classList.remove("active"),Ie.src=""}document.getElementById("messages").addEventListener("click",t=>{let e=t.target;e.tagName==="IMG"&&e.classList.contains("user-image")&&Ys(e.src)});ee.addEventListener("click",t=>{t.target===ee&&Kn()});document.addEventListener("keydown",t=>{t.key==="Escape"&&js()&&Kn()});ee.addEventListener("wheel",t=>{t.preventDefault();let e=t.deltaY>0?-.15:.15;Ve=Math.min(Ws,Math.max(Gs,Ve+e)),Ie.style.transform=`scale(${Ve})`},{passive:!1});export{Xs as a,Zs as b,Vs as c,qn as d,di as e,gi as f,F as g,Cs as h,Ti as i,Ei as j,_i as k};
|
|
72
|
-
/*! Bundled license information:
|
|
73
|
-
|
|
74
|
-
dompurify/dist/purify.es.mjs:
|
|
75
|
-
(*! @license DOMPurify 3.4.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.4.1/LICENSE *)
|
|
76
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as m,i as f,j as g}from"./chunk.CGWFHJI2.js";import"./chunk.AJZBJBMO.js";var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function u(t){return String(t).padStart(2,"0")}function h(t,r){if(!t)return"";let s=new Date(t),a=s.getTime();if(isNaN(a))return"";let l=Math.floor((r.getTime()-a)/1e3);if(l<60)return"just now";let i=Math.floor(l/60);if(i<60)return`${i}m ago`;let o=Math.floor(i/60);if(o<24)return`${o}h ago`;let e=Math.floor(o/24);if(e<7)return`${e}d ago`;let n=s.getUTCFullYear()===r.getUTCFullYear(),c=C[s.getUTCMonth()],d=s.getUTCDate();return n?`${c} ${d}`:`${c} ${d}, ${s.getUTCFullYear()}`}function p(t){if(!t)return"";let r=new Date(t);return isNaN(r.getTime())?"":`${r.getUTCFullYear()}-${u(r.getUTCMonth()+1)}-${u(r.getUTCDate())} ${u(r.getUTCHours())}:${u(r.getUTCMinutes())} UTC`}function y(t){let r=/^\/api\/v1\/sessions\/[^/]+\/attachments\/([A-Za-z0-9._-]+)(?:\?.*)?$/;return s=>{let a=r.exec(s);return a?`/s/${encodeURIComponent(t)}/attachments/${a[1]}`:s}}function E(t){if(typeof t.data=="string")try{return JSON.parse(t.data)}catch{return{}}return t.data}function T(t,r,s){let a=new Set;for(let n of t)if(n.type==="permission_response")try{let c=JSON.parse(n.data);typeof c.requestId=="string"&&a.add(c.requestId)}catch{}let l=new Map,i=new Map,o=null,e={rewriteAttachmentSrc:y(s),enhanceMarkdown:m,findToolCallEl:n=>l.get(n)??null,findPermissionEl:n=>i.get(n)??null,findBashEl:()=>o,isPermissionResolved:n=>a.has(n)};for(let n of t){if(!f(n.type))continue;let c=E(n),d=g(n.type,c,e);d?(r.appendChild(d),n.type==="tool_call"&&typeof c.id=="string"?l.set(c.id,d):n.type==="permission_request"&&typeof c.requestId=="string"?i.set(c.requestId,d):n.type==="bash_command"&&(o=d)):n.type==="bash_result"&&(o=null)}}async function v(){try{let e=localStorage.getItem("theme")??"auto";document.documentElement.setAttribute("data-theme",e)}catch{}let t=/^\/s\/([A-Za-z0-9_-]{24})(?:[/?#]|$)/.exec(location.pathname);if(!t){document.body.textContent="invalid share URL";return}let r=t[1],s=document.getElementById("session-info"),a=document.getElementById("messages"),l=document.querySelector(".share-footer-author"),i=document.querySelector(".share-footer-meta");if(!a)return;let o;try{let e=await fetch(`/api/v1/shared/${encodeURIComponent(r)}/events`,{headers:{Accept:"application/json"},credentials:"omit"});if(e.status===410){document.body.innerHTML="<div class='share-gone'>\u6B64\u94FE\u63A5\u5DF2\u64A4\u9500\u6216\u8FC7\u671F\u3002</div>";return}if(!e.ok){document.body.textContent=`error ${e.status}`;return}o=await e.json()}catch(e){document.body.textContent=`failed to load: ${String(e)}`;return}if(document.title=o.share.session_title?`${o.share.session_title} \u2014 shared`:"shared session",s&&(s.textContent=o.share.session_title??"(untitled)"),l){let e=o.share.display_name??"";l.textContent=e?`by ${e}`:""}if(T(o.events,a,r),i){let e=o.share.shared_at??o.share.created_at;i.textContent=h(e,new Date),i instanceof HTMLElement&&(i.title=p(e))}}v();
|