@liip/liipgpt 0.0.24 → 1.0.0-rc.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.
@@ -1,64 +1,59 @@
1
- (function(F,V){typeof exports=="object"&&typeof module<"u"?V(exports):typeof define=="function"&&define.amd?define(["exports"],V):(F=typeof globalThis<"u"?globalThis:F||self,V(F.LiipGPTClient={}))})(this,function(F){"use strict";var ma=Object.defineProperty;var ga=(F,V,ze)=>V in F?ma(F,V,{enumerable:!0,configurable:!0,writable:!0,value:ze}):F[V]=ze;var O=(F,V,ze)=>ga(F,typeof V!="symbol"?V+"":V,ze);const V=new Map;class ze{get length(){return V.size}clear(){V.clear()}getItem(e){return V.get(e)||null}key(e){return Array.from(V.keys())[e]||null}removeItem(e){V.delete(e)}setItem(e,t){V.set(e,String(t))}}const vn=globalThis.localStorage??new ze;function Ut(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Oe=Ut();function _n(s){Oe=s}const Ke={exec:()=>null};function N(s,e=""){let t=typeof s=="string"?s:s.source;const n={replace:(r,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(Q.caret,"$1"),t=t.replace(r,i),n},getRegex:()=>new RegExp(t,e)};return n}const Q={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,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ 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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i")},pr=/^(?:[ \t]*(?:\n|$))+/,mr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,et=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vt=/(?:[*+-]|\d{1,9}[.)])/,kn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bn=N(kn).replace(/bull/g,Vt).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(),vr=N(kn).replace(/bull/g,Vt).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(),Ht=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_r=/^[^\n]+/,Gt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,kr=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Gt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),br=N(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Vt).getRegex(),Et="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",Wt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xr=N("^ {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",Wt).replace("tag",Et).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xn=N(Ht).replace("hr",et).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",Et).getRegex(),Qt={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xn).getRegex(),code:mr,def:kr,fences:gr,heading:yr,hr:et,html:xr,lheading:bn,list:br,newline:pr,paragraph:xn,table:Ke,text:_r},wn=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",et).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Et).getRegex(),wr={...Qt,lheading:vr,table:wn,paragraph:N(Ht).replace("hr",et).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wn).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",Et).getRegex()},Tr={...Qt,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wt).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:Ke,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(Ht).replace("hr",et).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",bn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Sr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tn=/^( {2,}|\\)\n(?!\s*$)/,Er=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ct=/[\p{P}\p{S}]/u,Xt=/[\s\p{P}\p{S}]/u,Sn=/[^\s\p{P}\p{S}]/u,Cr=N(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xt).getRegex(),Rn=/(?!~)[\p{P}\p{S}]/u,Ar=/(?!~)[\s\p{P}\p{S}]/u,Ir=/(?:[^\s\p{P}\p{S}]|~)/u,$r=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,En=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Or=N(En,"u").replace(/punct/g,Ct).getRegex(),Nr=N(En,"u").replace(/punct/g,Rn).getRegex(),Cn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zr=N(Cn,"gu").replace(/notPunctSpace/g,Sn).replace(/punctSpace/g,Xt).replace(/punct/g,Ct).getRegex(),jr=N(Cn,"gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Ar).replace(/punct/g,Rn).getRegex(),Lr=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Sn).replace(/punctSpace/g,Xt).replace(/punct/g,Ct).getRegex(),Dr=N(/\\(punct)/,"gu").replace(/punct/g,Ct).getRegex(),Pr=N(/^<(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(),zr=N(Wt).replace("(?:-->|$)","-->").getRegex(),Mr=N("^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",zr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),At=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Br=N(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",At).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),An=N(/^!?\[(label)\]\[(ref)\]/).replace("label",At).replace("ref",Gt).getRegex(),In=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",Gt).getRegex(),qr=N("reflink|nolink(?!\\()","g").replace("reflink",An).replace("nolink",In).getRegex(),Jt={_backpedal:Ke,anyPunctuation:Dr,autolink:Pr,blockSkip:$r,br:Tn,code:Rr,del:Ke,emStrongLDelim:Or,emStrongRDelimAst:Zr,emStrongRDelimUnd:Lr,escape:Sr,link:Br,nolink:In,punctuation:Cr,reflink:An,reflinkSearch:qr,tag:Mr,text:Er,url:Ke},Fr={...Jt,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",At).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",At).getRegex()},Yt={...Jt,emStrongRDelimAst:jr,emStrongLDelim:Nr,url:N(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ur={...Yt,br:N(Tn).replace("{2,}","*").getRegex(),text:N(Yt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},It={normal:Qt,gfm:wr,pedantic:Tr},tt={normal:Jt,gfm:Yt,breaks:Ur,pedantic:Fr},Vr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$n=s=>Vr[s];function fe(s,e){if(e){if(Q.escapeTest.test(s))return s.replace(Q.escapeReplace,$n)}else if(Q.escapeTestNoEncode.test(s))return s.replace(Q.escapeReplaceNoEncode,$n);return s}function On(s){try{s=encodeURI(s).replace(Q.percentDecode,"%")}catch{return null}return s}function Nn(s,e){var a;const t=s.replace(Q.findPipe,(i,o,c)=>{let l=!1,u=o;for(;--u>=0&&c[u]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Q.splitPipe);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!((a=n.at(-1))!=null&&a.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Q.slashPipe,"|");return n}function nt(s,e,t){const n=s.length;if(n===0)return"";let r=0;for(;r<n&&s.charAt(n-r-1)===e;)r++;return s.slice(0,n-r)}function Hr(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function Zn(s,e,t,n,r){const a=e.href,i=e.title||null,o=s[1].replace(r.other.outputLinkReplace,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const c={type:"link",raw:t,href:a,title:i,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,c}return{type:"image",raw:t,href:a,title:i,text:o}}function Gr(s,e,t){const n=s.match(t.other.indentCodeCompensation);if(n===null)return e;const r=n[1];return e.split(`
3
- `).map(a=>{const i=a.match(t.other.beginningSpace);if(i===null)return a;const[o]=i;return o.length>=r.length?a.slice(r.length):a}).join(`
4
- `)}class $t{constructor(e){O(this,"options");O(this,"rules");O(this,"lexer");this.options=e||Oe}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:nt(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],r=Gr(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const r=nt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:nt(t[0],`
6
- `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=nt(t[0],`
1
+ (function($,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):($=typeof globalThis<"u"?globalThis:$||self,z($.LiipGPTClient={}))})(this,function($){"use strict";var Za=Object.defineProperty;var ja=($,z,Me)=>z in $?Za($,z,{enumerable:!0,configurable:!0,writable:!0,value:Me}):$[z]=Me;var A=($,z,Me)=>ja($,typeof z!="symbol"?z+"":z,Me);const z=new Map;class Me{get length(){return z.size}clear(){z.clear()}getItem(e){return z.get(e)||null}key(e){return Array.from(z.keys())[e]||null}removeItem(e){z.delete(e)}setItem(e,t){z.set(e,String(t))}}const Zn=globalThis.localStorage??new Me;/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:jn,setPrototypeOf:Un,isFrozen:ds,getPrototypeOf:hs,getOwnPropertyDescriptor:fs}=Object;let{freeze:V,seal:ne,create:Fn}=Object,{apply:Kt,construct:en}=typeof Reflect<"u"&&Reflect;V||(V=function(e){return e}),ne||(ne=function(e){return e}),Kt||(Kt=function(e,t,n){return e.apply(t,n)}),en||(en=function(e,t){return new e(...t)});const Rt=W(Array.prototype.forEach),ps=W(Array.prototype.lastIndexOf),Bn=W(Array.prototype.pop),Ye=W(Array.prototype.push),ms=W(Array.prototype.splice),It=W(String.prototype.toLowerCase),tn=W(String.prototype.toString),qn=W(String.prototype.match),Xe=W(String.prototype.replace),gs=W(String.prototype.indexOf),ys=W(String.prototype.trim),ie=W(Object.prototype.hasOwnProperty),G=W(RegExp.prototype.test),Qe=_s(TypeError);function W(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Kt(s,e,n)}}function _s(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return en(s,t)}}function E(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:It;Un&&Un(s,null);let n=e.length;for(;n--;){let r=e[n];if(typeof r=="string"){const i=t(r);i!==r&&(ds(e)||(e[n]=i),r=i)}s[r]=!0}return s}function ks(s){for(let e=0;e<s.length;e++)ie(s,e)||(s[e]=null);return s}function Se(s){const e=Fn(null);for(const[t,n]of jn(s))ie(s,t)&&(Array.isArray(n)?e[t]=ks(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Se(n):e[t]=n);return e}function Je(s,e){for(;s!==null;){const n=fs(s,e);if(n){if(n.get)return W(n.get);if(typeof n.value=="function")return W(n.value)}s=hs(s)}function t(){return null}return t}const Hn=V(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),nn=V(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),rn=V(["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"]),bs=V(["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"]),sn=V(["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"]),vs=V(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Vn=V(["#text"]),Gn=V(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),an=V(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Wn=V(["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"]),Ct=V(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xs=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ws=ne(/<%[\w\W]*|[\w\W]*%>/gm),Ts=ne(/\$\{[\w\W]*/gm),Ss=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),Es=ne(/^aria-[\-\w]+$/),Yn=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),As=ne(/^(?:\w+script|data):/i),Rs=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xn=ne(/^html$/i),Is=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var Qn=Object.freeze({__proto__:null,ARIA_ATTR:Es,ATTR_WHITESPACE:Rs,CUSTOM_ELEMENT:Is,DATA_ATTR:Ss,DOCTYPE_NAME:Xn,ERB_EXPR:ws,IS_ALLOWED_URI:Yn,IS_SCRIPT_OR_DATA:As,MUSTACHE_EXPR:xs,TMPLIT_EXPR:Ts});const Ke={element:1,text:3,progressingInstruction:7,comment:8,document:9},Cs=function(){return typeof window>"u"?null:window},Os=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Jn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Kn(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cs();const e=k=>Kn(k);if(e.version="3.2.4",e.removed=[],!s||!s.document||s.document.nodeType!==Ke.document||!s.Element)return e.isSupported=!1,e;let{document:t}=s;const n=t,r=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:o,Element:u,NodeFilter:l,NamedNodeMap:d=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:g,DOMParser:b,trustedTypes:w}=s,L=u.prototype,N=Je(L,"cloneNode"),K=Je(L,"remove"),Ht=Je(L,"nextSibling"),vt=Je(L,"childNodes"),Ne=Je(L,"parentNode");if(typeof a=="function"){const k=t.createElement("template");k.content&&k.content.ownerDocument&&(t=k.content.ownerDocument)}let Z,Te="";const{implementation:xt,createNodeIterator:wt,createDocumentFragment:Le,getElementsByTagName:Sa}=t,{importNode:Ea}=n;let Q=Jn();e.isSupported=typeof jn=="function"&&typeof Ne=="function"&&xt&&xt.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Sn,ERB_EXPR:En,TMPLIT_EXPR:An,DATA_ATTR:Aa,ARIA_ATTR:Ra,IS_SCRIPT_OR_DATA:Ia,ATTR_WHITESPACE:jr,CUSTOM_ELEMENT:Ca}=Qn;let{IS_ALLOWED_URI:Ur}=Qn,j=null;const Fr=E({},[...Hn,...nn,...rn,...sn,...Vn]);let F=null;const Br=E({},[...Gn,...an,...Wn,...Ct]);let P=Object.seal(Fn(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}})),Tt=null,Rn=null,qr=!0,In=!0,Hr=!1,Vr=!0,Be=!1,Cn=!0,De=!1,On=!1,Nn=!1,qe=!1,Vt=!1,Gt=!1,Gr=!0,Wr=!1;const Oa="user-content-";let Ln=!0,St=!1,He={},Ve=null;const Yr=E({},["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 Xr=null;const Qr=E({},["audio","video","img","source","image","track"]);let Dn=null;const Jr=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Wt="http://www.w3.org/1998/Math/MathML",Yt="http://www.w3.org/2000/svg",_e="http://www.w3.org/1999/xhtml";let Ge=_e,Mn=!1,Pn=null;const Na=E({},[Wt,Yt,_e],tn);let Xt=E({},["mi","mo","mn","ms","mtext"]),Qt=E({},["annotation-xml"]);const La=E({},["title","style","font","a","script"]);let Et=null;const Da=["application/xhtml+xml","text/html"],Ma="text/html";let U=null,We=null;const Pa=t.createElement("form"),Kr=function(c){return c instanceof RegExp||c instanceof Function},$n=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(We&&We===c)){if((!c||typeof c!="object")&&(c={}),c=Se(c),Et=Da.indexOf(c.PARSER_MEDIA_TYPE)===-1?Ma:c.PARSER_MEDIA_TYPE,U=Et==="application/xhtml+xml"?tn:It,j=ie(c,"ALLOWED_TAGS")?E({},c.ALLOWED_TAGS,U):Fr,F=ie(c,"ALLOWED_ATTR")?E({},c.ALLOWED_ATTR,U):Br,Pn=ie(c,"ALLOWED_NAMESPACES")?E({},c.ALLOWED_NAMESPACES,tn):Na,Dn=ie(c,"ADD_URI_SAFE_ATTR")?E(Se(Jr),c.ADD_URI_SAFE_ATTR,U):Jr,Xr=ie(c,"ADD_DATA_URI_TAGS")?E(Se(Qr),c.ADD_DATA_URI_TAGS,U):Qr,Ve=ie(c,"FORBID_CONTENTS")?E({},c.FORBID_CONTENTS,U):Yr,Tt=ie(c,"FORBID_TAGS")?E({},c.FORBID_TAGS,U):{},Rn=ie(c,"FORBID_ATTR")?E({},c.FORBID_ATTR,U):{},He=ie(c,"USE_PROFILES")?c.USE_PROFILES:!1,qr=c.ALLOW_ARIA_ATTR!==!1,In=c.ALLOW_DATA_ATTR!==!1,Hr=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Vr=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Be=c.SAFE_FOR_TEMPLATES||!1,Cn=c.SAFE_FOR_XML!==!1,De=c.WHOLE_DOCUMENT||!1,qe=c.RETURN_DOM||!1,Vt=c.RETURN_DOM_FRAGMENT||!1,Gt=c.RETURN_TRUSTED_TYPE||!1,Nn=c.FORCE_BODY||!1,Gr=c.SANITIZE_DOM!==!1,Wr=c.SANITIZE_NAMED_PROPS||!1,Ln=c.KEEP_CONTENT!==!1,St=c.IN_PLACE||!1,Ur=c.ALLOWED_URI_REGEXP||Yn,Ge=c.NAMESPACE||_e,Xt=c.MATHML_TEXT_INTEGRATION_POINTS||Xt,Qt=c.HTML_INTEGRATION_POINTS||Qt,P=c.CUSTOM_ELEMENT_HANDLING||{},c.CUSTOM_ELEMENT_HANDLING&&Kr(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=c.CUSTOM_ELEMENT_HANDLING.tagNameCheck),c.CUSTOM_ELEMENT_HANDLING&&Kr(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(P.allowCustomizedBuiltInElements=c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Be&&(In=!1),Vt&&(qe=!0),He&&(j=E({},Vn),F=[],He.html===!0&&(E(j,Hn),E(F,Gn)),He.svg===!0&&(E(j,nn),E(F,an),E(F,Ct)),He.svgFilters===!0&&(E(j,rn),E(F,an),E(F,Ct)),He.mathMl===!0&&(E(j,sn),E(F,Wn),E(F,Ct))),c.ADD_TAGS&&(j===Fr&&(j=Se(j)),E(j,c.ADD_TAGS,U)),c.ADD_ATTR&&(F===Br&&(F=Se(F)),E(F,c.ADD_ATTR,U)),c.ADD_URI_SAFE_ATTR&&E(Dn,c.ADD_URI_SAFE_ATTR,U),c.FORBID_CONTENTS&&(Ve===Yr&&(Ve=Se(Ve)),E(Ve,c.FORBID_CONTENTS,U)),Ln&&(j["#text"]=!0),De&&E(j,["html","head","body"]),j.table&&(E(j,["tbody"]),delete Tt.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Z=c.TRUSTED_TYPES_POLICY,Te=Z.createHTML("")}else Z===void 0&&(Z=Os(w,r)),Z!==null&&typeof Te=="string"&&(Te=Z.createHTML(""));V&&V(c),We=c}},es=E({},[...nn,...rn,...bs]),ts=E({},[...sn,...vs]),$a=function(c){let f=Ne(c);(!f||!f.tagName)&&(f={namespaceURI:Ge,tagName:"template"});const _=It(c.tagName),D=It(f.tagName);return Pn[c.namespaceURI]?c.namespaceURI===Yt?f.namespaceURI===_e?_==="svg":f.namespaceURI===Wt?_==="svg"&&(D==="annotation-xml"||Xt[D]):!!es[_]:c.namespaceURI===Wt?f.namespaceURI===_e?_==="math":f.namespaceURI===Yt?_==="math"&&Qt[D]:!!ts[_]:c.namespaceURI===_e?f.namespaceURI===Yt&&!Qt[D]||f.namespaceURI===Wt&&!Xt[D]?!1:!ts[_]&&(La[_]||!es[_]):!!(Et==="application/xhtml+xml"&&Pn[c.namespaceURI]):!1},fe=function(c){Ye(e.removed,{element:c});try{Ne(c).removeChild(c)}catch{K(c)}},Jt=function(c,f){try{Ye(e.removed,{attribute:f.getAttributeNode(c),from:f})}catch{Ye(e.removed,{attribute:null,from:f})}if(f.removeAttribute(c),c==="is")if(qe||Vt)try{fe(f)}catch{}else try{f.setAttribute(c,"")}catch{}},ns=function(c){let f=null,_=null;if(Nn)c="<remove></remove>"+c;else{const B=qn(c,/^[\r\n\t ]+/);_=B&&B[0]}Et==="application/xhtml+xml"&&Ge===_e&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");const D=Z?Z.createHTML(c):c;if(Ge===_e)try{f=new b().parseFromString(D,Et)}catch{}if(!f||!f.documentElement){f=xt.createDocument(Ge,"template",null);try{f.documentElement.innerHTML=Mn?Te:D}catch{}}const H=f.body||f.documentElement;return c&&_&&H.insertBefore(t.createTextNode(_),H.childNodes[0]||null),Ge===_e?Sa.call(f,De?"html":"body")[0]:De?f.documentElement:H},rs=function(c){return wt.call(c.ownerDocument||c,c,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},zn=function(c){return c instanceof g&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof d)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},ss=function(c){return typeof o=="function"&&c instanceof o};function ke(k,c,f){Rt(k,_=>{_.call(e,c,f,We)})}const is=function(c){let f=null;if(ke(Q.beforeSanitizeElements,c,null),zn(c))return fe(c),!0;const _=U(c.nodeName);if(ke(Q.uponSanitizeElement,c,{tagName:_,allowedTags:j}),c.hasChildNodes()&&!ss(c.firstElementChild)&&G(/<[/\w]/g,c.innerHTML)&&G(/<[/\w]/g,c.textContent)||c.nodeType===Ke.progressingInstruction||Cn&&c.nodeType===Ke.comment&&G(/<[/\w]/g,c.data))return fe(c),!0;if(!j[_]||Tt[_]){if(!Tt[_]&&os(_)&&(P.tagNameCheck instanceof RegExp&&G(P.tagNameCheck,_)||P.tagNameCheck instanceof Function&&P.tagNameCheck(_)))return!1;if(Ln&&!Ve[_]){const D=Ne(c)||c.parentNode,H=vt(c)||c.childNodes;if(H&&D){const B=H.length;for(let ee=B-1;ee>=0;--ee){const pe=N(H[ee],!0);pe.__removalCount=(c.__removalCount||0)+1,D.insertBefore(pe,Ht(c))}}}return fe(c),!0}return c instanceof u&&!$a(c)||(_==="noscript"||_==="noembed"||_==="noframes")&&G(/<\/no(script|embed|frames)/i,c.innerHTML)?(fe(c),!0):(Be&&c.nodeType===Ke.text&&(f=c.textContent,Rt([Sn,En,An],D=>{f=Xe(f,D," ")}),c.textContent!==f&&(Ye(e.removed,{element:c.cloneNode()}),c.textContent=f)),ke(Q.afterSanitizeElements,c,null),!1)},as=function(c,f,_){if(Gr&&(f==="id"||f==="name")&&(_ in t||_ in Pa))return!1;if(!(In&&!Rn[f]&&G(Aa,f))){if(!(qr&&G(Ra,f))){if(!F[f]||Rn[f]){if(!(os(c)&&(P.tagNameCheck instanceof RegExp&&G(P.tagNameCheck,c)||P.tagNameCheck instanceof Function&&P.tagNameCheck(c))&&(P.attributeNameCheck instanceof RegExp&&G(P.attributeNameCheck,f)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(f))||f==="is"&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&G(P.tagNameCheck,_)||P.tagNameCheck instanceof Function&&P.tagNameCheck(_))))return!1}else if(!Dn[f]){if(!G(Ur,Xe(_,jr,""))){if(!((f==="src"||f==="xlink:href"||f==="href")&&c!=="script"&&gs(_,"data:")===0&&Xr[c])){if(!(Hr&&!G(Ia,Xe(_,jr,"")))){if(_)return!1}}}}}}return!0},os=function(c){return c!=="annotation-xml"&&qn(c,Ca)},ls=function(c){ke(Q.beforeSanitizeAttributes,c,null);const{attributes:f}=c;if(!f||zn(c))return;const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let D=f.length;for(;D--;){const H=f[D],{name:B,namespaceURI:ee,value:pe}=H,At=U(B);let J=B==="value"?pe:ys(pe);if(_.attrName=At,_.attrValue=J,_.keepAttr=!0,_.forceKeepAttr=void 0,ke(Q.uponSanitizeAttribute,c,_),J=_.attrValue,Wr&&(At==="id"||At==="name")&&(Jt(B,c),J=Oa+J),Cn&&G(/((--!?|])>)|<\/(style|title)/i,J)){Jt(B,c);continue}if(_.forceKeepAttr||(Jt(B,c),!_.keepAttr))continue;if(!Vr&&G(/\/>/i,J)){Jt(B,c);continue}Be&&Rt([Sn,En,An],us=>{J=Xe(J,us," ")});const cs=U(c.nodeName);if(as(cs,At,J)){if(Z&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!ee)switch(w.getAttributeType(cs,At)){case"TrustedHTML":{J=Z.createHTML(J);break}case"TrustedScriptURL":{J=Z.createScriptURL(J);break}}try{ee?c.setAttributeNS(ee,B,J):c.setAttribute(B,J),zn(c)?fe(c):Bn(e.removed)}catch{}}}ke(Q.afterSanitizeAttributes,c,null)},za=function k(c){let f=null;const _=rs(c);for(ke(Q.beforeSanitizeShadowDOM,c,null);f=_.nextNode();)ke(Q.uponSanitizeShadowNode,f,null),is(f),ls(f),f.content instanceof i&&k(f.content);ke(Q.afterSanitizeShadowDOM,c,null)};return e.sanitize=function(k){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,_=null,D=null,H=null;if(Mn=!k,Mn&&(k="<!-->"),typeof k!="string"&&!ss(k))if(typeof k.toString=="function"){if(k=k.toString(),typeof k!="string")throw Qe("dirty is not a string, aborting")}else throw Qe("toString is not a function");if(!e.isSupported)return k;if(On||$n(c),e.removed=[],typeof k=="string"&&(St=!1),St){if(k.nodeName){const pe=U(k.nodeName);if(!j[pe]||Tt[pe])throw Qe("root node is forbidden and cannot be sanitized in-place")}}else if(k instanceof o)f=ns("<!---->"),_=f.ownerDocument.importNode(k,!0),_.nodeType===Ke.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?f=_:f.appendChild(_);else{if(!qe&&!Be&&!De&&k.indexOf("<")===-1)return Z&&Gt?Z.createHTML(k):k;if(f=ns(k),!f)return qe?null:Gt?Te:""}f&&Nn&&fe(f.firstChild);const B=rs(St?k:f);for(;D=B.nextNode();)is(D),ls(D),D.content instanceof i&&za(D.content);if(St)return k;if(qe){if(Vt)for(H=Le.call(f.ownerDocument);f.firstChild;)H.appendChild(f.firstChild);else H=f;return(F.shadowroot||F.shadowrootmode)&&(H=Ea.call(n,H,!0)),H}let ee=De?f.outerHTML:f.innerHTML;return De&&j["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&G(Xn,f.ownerDocument.doctype.name)&&(ee="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
2
+ `+ee),Be&&Rt([Sn,En,An],pe=>{ee=Xe(ee,pe," ")}),Z&&Gt?Z.createHTML(ee):ee},e.setConfig=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$n(k),On=!0},e.clearConfig=function(){We=null,On=!1},e.isValidAttribute=function(k,c,f){We||$n({});const _=U(k),D=U(c);return as(_,D,f)},e.addHook=function(k,c){typeof c=="function"&&Ye(Q[k],c)},e.removeHook=function(k,c){if(c!==void 0){const f=ps(Q[k],c);return f===-1?void 0:ms(Q[k],f,1)[0]}return Bn(Q[k])},e.removeHooks=function(k){Q[k]=[]},e.removeAllHooks=function(){Q=Jn()},e}var Ns=Kn();function on(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Ee=on();function er(s){Ee=s}const et={exec:()=>null};function I(s,e=""){let t=typeof s=="string"?s:s.source;const n={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Y.caret,"$1"),t=t.replace(r,a),n},getRegex:()=>new RegExp(t,e)};return n}const Y={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,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ 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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i")},Ls=/^(?:[ \t]*(?:\n|$))+/,Ds=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ms=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ps=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ln=/(?:[*+-]|\d{1,9}[.)])/,tr=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nr=I(tr).replace(/bull/g,ln).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(),$s=I(tr).replace(/bull/g,ln).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(),cn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,zs=/^[^\n]+/,un=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Zs=I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",un).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),js=I(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ln).getRegex(),Ot="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",dn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Us=I("^ {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",dn).replace("tag",Ot).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rr=I(cn).replace("hr",tt).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",Ot).getRegex(),hn={blockquote:I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rr).getRegex(),code:Ds,def:Zs,fences:Ms,heading:Ps,hr:tt,html:Us,lheading:nr,list:js,newline:Ls,paragraph:rr,table:et,text:zs},sr=I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tt).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ot).getRegex(),Fs={...hn,lheading:$s,table:sr,paragraph:I(cn).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sr).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",Ot).getRegex()},Bs={...hn,html:I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dn).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:et,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:I(cn).replace("hr",tt).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",nr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},qs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Hs=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ir=/^( {2,}|\\)\n(?!\s*$)/,Vs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Nt=/[\p{P}\p{S}]/u,fn=/[\s\p{P}\p{S}]/u,ar=/[^\s\p{P}\p{S}]/u,Gs=I(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,fn).getRegex(),or=/(?!~)[\p{P}\p{S}]/u,Ws=/(?!~)[\s\p{P}\p{S}]/u,Ys=/(?:[^\s\p{P}\p{S}]|~)/u,Xs=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,lr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Qs=I(lr,"u").replace(/punct/g,Nt).getRegex(),Js=I(lr,"u").replace(/punct/g,or).getRegex(),cr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ks=I(cr,"gu").replace(/notPunctSpace/g,ar).replace(/punctSpace/g,fn).replace(/punct/g,Nt).getRegex(),ei=I(cr,"gu").replace(/notPunctSpace/g,Ys).replace(/punctSpace/g,Ws).replace(/punct/g,or).getRegex(),ti=I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ar).replace(/punctSpace/g,fn).replace(/punct/g,Nt).getRegex(),ni=I(/\\(punct)/,"gu").replace(/punct/g,Nt).getRegex(),ri=I(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),si=I(dn).replace("(?:-->|$)","-->").getRegex(),ii=I("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",si).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Lt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ai=I(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Lt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ur=I(/^!?\[(label)\]\[(ref)\]/).replace("label",Lt).replace("ref",un).getRegex(),dr=I(/^!?\[(ref)\](?:\[\])?/).replace("ref",un).getRegex(),oi=I("reflink|nolink(?!\\()","g").replace("reflink",ur).replace("nolink",dr).getRegex(),pn={_backpedal:et,anyPunctuation:ni,autolink:ri,blockSkip:Xs,br:ir,code:Hs,del:et,emStrongLDelim:Qs,emStrongRDelimAst:Ks,emStrongRDelimUnd:ti,escape:qs,link:ai,nolink:dr,punctuation:Gs,reflink:ur,reflinkSearch:oi,tag:ii,text:Vs,url:et},li={...pn,link:I(/^!?\[(label)\]\((.*?)\)/).replace("label",Lt).getRegex(),reflink:I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Lt).getRegex()},mn={...pn,emStrongRDelimAst:ei,emStrongLDelim:Js,url:I(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ci={...mn,br:I(ir).replace("{2,}","*").getRegex(),text:I(mn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Dt={normal:hn,gfm:Fs,pedantic:Bs},nt={normal:pn,gfm:mn,breaks:ci,pedantic:li},ui={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hr=s=>ui[s];function ce(s,e){if(e){if(Y.escapeTest.test(s))return s.replace(Y.escapeReplace,hr)}else if(Y.escapeTestNoEncode.test(s))return s.replace(Y.escapeReplaceNoEncode,hr);return s}function fr(s){try{s=encodeURI(s).replace(Y.percentDecode,"%")}catch{return null}return s}function pr(s,e){var i;const t=s.replace(Y.findPipe,(a,o,u)=>{let l=!1,d=o;for(;--d>=0&&u[d]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Y.splitPipe);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Y.slashPipe,"|");return n}function rt(s,e,t){const n=s.length;if(n===0)return"";let r=0;for(;r<n&&s.charAt(n-r-1)===e;)r++;return s.slice(0,n-r)}function di(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function mr(s,e,t,n,r){const i=e.href,a=e.title||null,o=s[1].replace(r.other.outputLinkReplace,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const u={type:"link",raw:t,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,u}return{type:"image",raw:t,href:i,title:a,text:o}}function hi(s,e,t){const n=s.match(t.other.indentCodeCompensation);if(n===null)return e;const r=n[1];return e.split(`
4
+ `).map(i=>{const a=i.match(t.other.beginningSpace);if(a===null)return i;const[o]=a;return o.length>=r.length?i.slice(r.length):i}).join(`
5
+ `)}class Mt{constructor(e){A(this,"options");A(this,"rules");A(this,"lexer");this.options=e||Ee}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:rt(n,`
6
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],r=hi(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const r=rt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:rt(t[0],`
7
+ `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=rt(t[0],`
7
8
  `).split(`
8
- `),r="",a="";const i=[];for(;n.length>0;){let o=!1;const c=[];let l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))c.push(n[l]),o=!0;else if(!o)c.push(n[l]);else break;n=n.slice(l);const u=c.join(`
9
- `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
9
+ `),r="",i="";const a=[];for(;n.length>0;){let o=!1;const u=[];let l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))u.push(n[l]),o=!0;else if(!o)u.push(n[l]);else break;n=n.slice(l);const d=u.join(`
10
+ `),g=d.replace(this.rules.other.blockquoteSetextReplace,`
10
11
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
11
- ${u}`:u,a=a?`${a}
12
- ${f}`:f;const v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,i,!0),this.lexer.state.top=v,n.length===0)break;const T=i.at(-1);if((T==null?void 0:T.type)==="code")break;if((T==null?void 0:T.type)==="blockquote"){const M=T,j=M.raw+`
12
+ ${d}`:d,i=i?`${i}
13
+ ${g}`:g;const b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,a,!0),this.lexer.state.top=b,n.length===0)break;const w=a.at(-1);if((w==null?void 0:w.type)==="code")break;if((w==null?void 0:w.type)==="blockquote"){const L=w,N=L.raw+`
13
14
  `+n.join(`
14
- `),ee=this.blockquote(j);i[i.length-1]=ee,r=r.substring(0,r.length-M.raw.length)+ee.raw,a=a.substring(0,a.length-M.text.length)+ee.text;break}else if((T==null?void 0:T.type)==="list"){const M=T,j=M.raw+`
15
+ `),K=this.blockquote(N);a[a.length-1]=K,r=r.substring(0,r.length-L.raw.length)+K.raw,i=i.substring(0,i.length-L.text.length)+K.text;break}else if((w==null?void 0:w.type)==="list"){const L=w,N=L.raw+`
15
16
  `+n.join(`
16
- `),ee=this.list(j);i[i.length-1]=ee,r=r.substring(0,r.length-T.raw.length)+ee.raw,a=a.substring(0,a.length-M.raw.length)+ee.raw,n=j.substring(i.at(-1).raw.length).split(`
17
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,a={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:"[*+-]");const i=this.rules.other.listItemRegex(n);let o=!1;for(;e;){let l=!1,u="",f="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let v=t[2].split(`
18
- `,1)[0].replace(this.rules.other.listReplaceTabs,bt=>" ".repeat(3*bt.length)),T=e.split(`
19
- `,1)[0],M=!v.trim(),j=0;if(this.options.pedantic?(j=2,f=v.trimStart()):M?j=t[1].length+1:(j=t[2].search(this.rules.other.nonSpaceChar),j=j>4?1:j,f=v.slice(j),j+=t[1].length),M&&this.rules.other.blankLine.test(T)&&(u+=T+`
20
- `,e=e.substring(T.length+1),l=!0),!l){const bt=this.rules.other.nextBulletRegex(j),te=this.rules.other.hrRegex(j),ye=this.rules.other.fencesBeginRegex(j),xt=this.rules.other.headingBeginRegex(j),Bt=this.rules.other.htmlBeginRegex(j);for(;e;){const Ge=e.split(`
21
- `,1)[0];let Ae;if(T=Ge,this.options.pedantic?(T=T.replace(this.rules.other.listReplaceNesting," "),Ae=T):Ae=T.replace(this.rules.other.tabCharGlobal," "),ye.test(T)||xt.test(T)||Bt.test(T)||bt.test(T)||te.test(T))break;if(Ae.search(this.rules.other.nonSpaceChar)>=j||!T.trim())f+=`
22
- `+Ae.slice(j);else{if(M||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ye.test(v)||xt.test(v)||te.test(v))break;f+=`
23
- `+T}!M&&!T.trim()&&(M=!0),u+=Ge+`
24
- `,e=e.substring(Ge.length+1),v=Ae.slice(j)}}a.loose||(o?a.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let ee=null,kt;this.options.gfm&&(ee=this.rules.other.listIsTask.exec(f),ee&&(kt=ee[0]!=="[ ] ",f=f.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:u,task:!!ee,checked:kt,loose:!1,text:f,tokens:[]}),a.raw+=u}const c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let l=0;l<a.items.length;l++)if(this.lexer.state.top=!1,a.items[l].tokens=this.lexer.blockTokens(a.items[l].text,[]),!a.loose){const u=a.items[l].tokens.filter(v=>v.type==="space"),f=u.length>0&&u.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=f}if(a.loose)for(let l=0;l<a.items.length;l++)a.items[l].loose=!0;return a}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:a}}}table(e){var o;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=Nn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
- `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const c of r)this.rules.other.tableAlignRight.test(c)?i.align.push("right"):this.rules.other.tableAlignCenter.test(c)?i.align.push("center"):this.rules.other.tableAlignLeft.test(c)?i.align.push("left"):i.align.push(null);for(let c=0;c<n.length;c++)i.header.push({text:n[c],tokens:this.lexer.inline(n[c]),header:!0,align:i.align[c]});for(const c of a)i.rows.push(Nn(c,i.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[u]})));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
26
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const i=nt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=Hr(t[2],"()");if(i>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let r=t[2],a="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],a=i[3])}else a=t[3]?t[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)),Zn(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[r.toLowerCase()];if(!a){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Zn(n,a,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const i=[...r[0]].length-1;let o,c,l=i,u=0;const f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+i);(r=f.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(c=[...o].length,r[3]||r[4]){l+=c;continue}else if((r[5]||r[6])&&i%3&&!((i+c)%3)){u+=c;continue}if(l-=c,l>0)continue;c=Math.min(c,c+l+u);const v=[...r[0]][0].length,T=e.slice(0,i+r.index+v+c);if(Math.min(i,c)%2){const j=T.slice(1,-1);return{type:"em",raw:T,text:j,tokens:this.lexer.inlineTokens(j)}}const M=T.slice(2,-2);return{type:"strong",raw:T,text:M,tokens:this.lexer.inlineTokens(M)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),a=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&a&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,a;if(t[2]==="@")r=t[0],a="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}}class ie{constructor(e){O(this,"tokens");O(this,"options");O(this,"state");O(this,"tokenizer");O(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oe,this.options.tokenizer=this.options.tokenizer||new $t,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 t={other:Q,block:It.normal,inline:tt.normal};this.options.pedantic?(t.block=It.pedantic,t.inline=tt.pedantic):this.options.gfm&&(t.block=It.gfm,this.options.breaks?t.inline=tt.breaks:t.inline=tt.gfm),this.tokenizer.rules=t}static get rules(){return{block:It,inline:tt}}static lex(e,t){return new ie(t).lex(e)}static lexInline(e,t){return new ie(t).inlineTokens(e)}lex(e){e=e.replace(Q.carriageReturn,`
27
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var r,a,i;for(this.options.pedantic&&(e=e.replace(Q.tabCharGlobal," ").replace(Q.spaceLine,""));e;){let o;if((a=(r=this.options.extensions)==null?void 0:r.block)!=null&&a.some(l=>(o=l.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const l=t.at(-1);o.raw.length===1&&l!==void 0?l.raw+=`
17
+ `),K=this.list(N);a[a.length-1]=K,r=r.substring(0,r.length-w.raw.length)+K.raw,i=i.substring(0,i.length-L.raw.length)+K.raw,n=N.substring(a.at(-1).raw.length).split(`
18
+ `);continue}}return{type:"blockquote",raw:r,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,i={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:"[*+-]");const a=this.rules.other.listItemRegex(n);let o=!1;for(;e;){let l=!1,d="",g="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let b=t[2].split(`
19
+ `,1)[0].replace(this.rules.other.listReplaceTabs,vt=>" ".repeat(3*vt.length)),w=e.split(`
20
+ `,1)[0],L=!b.trim(),N=0;if(this.options.pedantic?(N=2,g=b.trimStart()):L?N=t[1].length+1:(N=t[2].search(this.rules.other.nonSpaceChar),N=N>4?1:N,g=b.slice(N),N+=t[1].length),L&&this.rules.other.blankLine.test(w)&&(d+=w+`
21
+ `,e=e.substring(w.length+1),l=!0),!l){const vt=this.rules.other.nextBulletRegex(N),Ne=this.rules.other.hrRegex(N),Z=this.rules.other.fencesBeginRegex(N),Te=this.rules.other.headingBeginRegex(N),xt=this.rules.other.htmlBeginRegex(N);for(;e;){const wt=e.split(`
22
+ `,1)[0];let Le;if(w=wt,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),Le=w):Le=w.replace(this.rules.other.tabCharGlobal," "),Z.test(w)||Te.test(w)||xt.test(w)||vt.test(w)||Ne.test(w))break;if(Le.search(this.rules.other.nonSpaceChar)>=N||!w.trim())g+=`
23
+ `+Le.slice(N);else{if(L||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Z.test(b)||Te.test(b)||Ne.test(b))break;g+=`
24
+ `+w}!L&&!w.trim()&&(L=!0),d+=wt+`
25
+ `,e=e.substring(wt.length+1),b=Le.slice(N)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0));let K=null,Ht;this.options.gfm&&(K=this.rules.other.listIsTask.exec(g),K&&(Ht=K[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:d,task:!!K,checked:Ht,loose:!1,text:g,tokens:[]}),i.raw+=d}const u=i.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;l<i.items.length;l++)if(this.lexer.state.top=!1,i.items[l].tokens=this.lexer.blockTokens(i.items[l].text,[]),!i.loose){const d=i.items[l].tokens.filter(b=>b.type==="space"),g=d.length>0&&d.some(b=>this.rules.other.anyLine.test(b.raw));i.loose=g}if(i.loose)for(let l=0;l<i.items.length;l++)i.items[l].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){var o;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=pr(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
26
+ `):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const u of r)this.rules.other.tableAlignRight.test(u)?a.align.push("right"):this.rules.other.tableAlignCenter.test(u)?a.align.push("center"):this.rules.other.tableAlignLeft.test(u)?a.align.push("left"):a.align.push(null);for(let u=0;u<n.length;u++)a.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:a.align[u]});for(const u of i)a.rows.push(pr(u,a.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[d]})));return a}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
27
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const a=rt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=di(t[2],"()");if(a>-1){const u=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){const a=this.rules.other.pedanticHrefTitle.exec(r);a&&(r=a[1],i=a[3])}else i=t[3]?t[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)),mr(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return mr(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const a=[...r[0]].length-1;let o,u,l=a,d=0;const g=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+a);(r=g.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(u=[...o].length,r[3]||r[4]){l+=u;continue}else if((r[5]||r[6])&&a%3&&!((a+u)%3)){d+=u;continue}if(l-=u,l>0)continue;u=Math.min(u,u+l+d);const b=[...r[0]][0].length,w=e.slice(0,a+r.index+b+u);if(Math.min(a,u)%2){const N=w.slice(1,-1);return{type:"em",raw:w,text:N,tokens:this.lexer.inlineTokens(N)}}const L=w.slice(2,-2);return{type:"strong",raw:w,text:L,tokens:this.lexer.inlineTokens(L)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let a;do a=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(a!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}}class re{constructor(e){A(this,"tokens");A(this,"options");A(this,"state");A(this,"tokenizer");A(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ee,this.options.tokenizer=this.options.tokenizer||new Mt,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 t={other:Y,block:Dt.normal,inline:nt.normal};this.options.pedantic?(t.block=Dt.pedantic,t.inline=nt.pedantic):this.options.gfm&&(t.block=Dt.gfm,this.options.breaks?t.inline=nt.breaks:t.inline=nt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Dt,inline:nt}}static lex(e,t){return new re(t).lex(e)}static lexInline(e,t){return new re(t).inlineTokens(e)}lex(e){e=e.replace(Y.carriageReturn,`
28
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var r,i,a;for(this.options.pedantic&&(e=e.replace(Y.tabCharGlobal," ").replace(Y.spaceLine,""));e;){let o;if((i=(r=this.options.extensions)==null?void 0:r.block)!=null&&i.some(l=>(o=l.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const l=t.at(-1);o.raw.length===1&&l!==void 0?l.raw+=`
28
29
  `:t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
29
30
  `+o.raw,l.text+=`
30
31
  `+o.text,this.inlineQueue.at(-1).src=l.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
31
32
  `+o.raw,l.text+=`
32
- `+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let c=e;if((i=this.options.extensions)!=null&&i.startBlock){let l=1/0;const u=e.slice(1);let f;this.options.extensions.startBlock.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(l=Math.min(l,f))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){const l=t.at(-1);n&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
33
+ `+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let u=e;if((a=this.options.extensions)!=null&&a.startBlock){let l=1/0;const d=e.slice(1);let g;this.options.extensions.startBlock.forEach(b=>{g=b.call({lexer:this},d),typeof g=="number"&&g>=0&&(l=Math.min(l,g))}),l<1/0&&l>=0&&(u=e.substring(0,l+1))}if(this.state.top&&(o=this.tokenizer.paragraph(u))){const l=t.at(-1);n&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
33
34
  `+o.raw,l.text+=`
34
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o),n=c.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
35
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o),n=u.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
35
36
  `+o.raw,l.text+=`
36
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o);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,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,c,l;let n=e,r=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a=!1,i="";for(;e;){a||(i=""),a=!1;let u;if((c=(o=this.options.extensions)==null?void 0:o.inline)!=null&&c.some(v=>(u=v.call({lexer:this},e,t))?(e=e.substring(u.raw.length),t.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const v=t.at(-1);u.type==="text"&&(v==null?void 0:v.type)==="text"?(v.raw+=u.raw,v.text+=u.text):t.push(u);continue}if(u=this.tokenizer.emStrong(e,n,i)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),t.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),t.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),t.push(u);continue}let f=e;if((l=this.options.extensions)!=null&&l.startInline){let v=1/0;const T=e.slice(1);let M;this.options.extensions.startInline.forEach(j=>{M=j.call({lexer:this},T),typeof M=="number"&&M>=0&&(v=Math.min(v,M))}),v<1/0&&v>=0&&(f=e.substring(0,v+1))}if(u=this.tokenizer.inlineText(f)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(i=u.raw.slice(-1)),a=!0;const v=t.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=u.raw,v.text+=u.text):t.push(u);continue}if(e){const v="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(v);break}else throw new Error(v)}}return t}}class Ot{constructor(e){O(this,"options");O(this,"parser");this.options=e||Oe}space(e){return""}code({text:e,lang:t,escaped:n}){var i;const r=(i=(t||"").match(Q.notSpaceStart))==null?void 0:i[0],a=e.replace(Q.endingNewline,"")+`
37
- `;return r?'<pre><code class="language-'+fe(r)+'">'+(n?a:fe(a,!0))+`</code></pre>
38
- `:"<pre><code>"+(n?a:fe(a,!0))+`</code></pre>
37
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o);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,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,u,l;let n=e,r=null;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)d.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i=!1,a="";for(;e;){i||(a=""),i=!1;let d;if((u=(o=this.options.extensions)==null?void 0:o.inline)!=null&&u.some(b=>(d=b.call({lexer:this},e,t))?(e=e.substring(d.raw.length),t.push(d),!0):!1))continue;if(d=this.tokenizer.escape(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.tag(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.link(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(d.raw.length);const b=t.at(-1);d.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=d.raw,b.text+=d.text):t.push(d);continue}if(d=this.tokenizer.emStrong(e,n,a)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.codespan(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.br(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.del(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.autolink(e)){e=e.substring(d.raw.length),t.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(e))){e=e.substring(d.raw.length),t.push(d);continue}let g=e;if((l=this.options.extensions)!=null&&l.startInline){let b=1/0;const w=e.slice(1);let L;this.options.extensions.startInline.forEach(N=>{L=N.call({lexer:this},w),typeof L=="number"&&L>=0&&(b=Math.min(b,L))}),b<1/0&&b>=0&&(g=e.substring(0,b+1))}if(d=this.tokenizer.inlineText(g)){e=e.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(a=d.raw.slice(-1)),i=!0;const b=t.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=d.raw,b.text+=d.text):t.push(d);continue}if(e){const b="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return t}}class Pt{constructor(e){A(this,"options");A(this,"parser");this.options=e||Ee}space(e){return""}code({text:e,lang:t,escaped:n}){var a;const r=(a=(t||"").match(Y.notSpaceStart))==null?void 0:a[0],i=e.replace(Y.endingNewline,"")+`
38
+ `;return r?'<pre><code class="language-'+ce(r)+'">'+(n?i:ce(i,!0))+`</code></pre>
39
+ `:"<pre><code>"+(n?i:ce(i,!0))+`</code></pre>
39
40
  `}blockquote({tokens:e}){return`<blockquote>
40
41
  ${this.parser.parse(e)}</blockquote>
41
42
  `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
42
43
  `}hr(e){return`<hr>
43
- `}list(e){const t=e.ordered,n=e.start;let r="";for(let o=0;o<e.items.length;o++){const c=e.items[o];r+=this.listitem(c)}const a=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+a+i+`>
44
- `+r+"</"+a+`>
45
- `}listitem(e){var n;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+fe(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
44
+ `}list(e){const t=e.ordered,n=e.start;let r="";for(let o=0;o<e.items.length;o++){const u=e.items[o];r+=this.listitem(u)}const i=t?"ol":"ul",a=t&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
45
+ `+r+"</"+i+`>
46
+ `}listitem(e){var n;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+ce(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
46
47
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
47
- `}table(e){let t="",n="";for(let a=0;a<e.header.length;a++)n+=this.tablecell(e.header[a]);t+=this.tablerow({text:n});let r="";for(let a=0;a<e.rows.length;a++){const i=e.rows[a];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
48
+ `}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){const a=e.rows[i];n="";for(let o=0;o<a.length;o++)n+=this.tablecell(a[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
48
49
  <thead>
49
50
  `+t+`</thead>
50
51
  `+r+`</table>
51
52
  `}tablerow({text:e}){return`<tr>
52
53
  ${e}</tr>
53
54
  `}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
54
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${fe(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),a=On(e);if(a===null)return r;e=a;let i='<a href="'+e+'"';return t&&(i+=' title="'+fe(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n}){const r=On(e);if(r===null)return fe(n);e=r;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${fe(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:fe(e.text)}}class Kt{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class oe{constructor(e){O(this,"options");O(this,"renderer");O(this,"textRenderer");this.options=e||Oe,this.options.renderer=this.options.renderer||new Ot,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Kt}static parse(e,t){return new oe(t).parse(e)}static parseInline(e,t){return new oe(t).parseInline(e)}parse(e,t=!0){var r,a;let n="";for(let i=0;i<e.length;i++){const o=e[i];if((a=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&a[o.type]){const l=o,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=u||"";continue}}const c=o;switch(c.type){case"space":{n+=this.renderer.space(c);continue}case"hr":{n+=this.renderer.hr(c);continue}case"heading":{n+=this.renderer.heading(c);continue}case"code":{n+=this.renderer.code(c);continue}case"table":{n+=this.renderer.table(c);continue}case"blockquote":{n+=this.renderer.blockquote(c);continue}case"list":{n+=this.renderer.list(c);continue}case"html":{n+=this.renderer.html(c);continue}case"paragraph":{n+=this.renderer.paragraph(c);continue}case"text":{let l=c,u=this.renderer.text(l);for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],u+=`
55
- `+this.renderer.text(l);t?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t=this.renderer){var r,a;let n="";for(let i=0;i<e.length;i++){const o=e[i];if((a=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&a[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}const c=o;switch(c.type){case"escape":{n+=t.text(c);break}case"html":{n+=t.html(c);break}case"link":{n+=t.link(c);break}case"image":{n+=t.image(c);break}case"strong":{n+=t.strong(c);break}case"em":{n+=t.em(c);break}case"codespan":{n+=t.codespan(c);break}case"br":{n+=t.br(c);break}case"del":{n+=t.del(c);break}case"text":{n+=t.text(c);break}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class rt{constructor(e){O(this,"options");O(this,"block");this.options=e||Oe}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ie.lex:ie.lexInline}provideParser(){return this.block?oe.parse:oe.parseInline}}O(rt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class jn{constructor(...e){O(this,"defaults",Ut());O(this,"options",this.setOptions);O(this,"parse",this.parseMarkdown(!0));O(this,"parseInline",this.parseMarkdown(!1));O(this,"Parser",oe);O(this,"Renderer",Ot);O(this,"TextRenderer",Kt);O(this,"Lexer",ie);O(this,"Tokenizer",$t);O(this,"Hooks",rt);this.use(...e)}walkTokens(e,t){var r,a;let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const o=i;for(const c of o.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of o.rows)for(const l of c)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{const o=i;n=n.concat(this.walkTokens(o.items,t));break}default:{const o=i;(a=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&a[o.type]?this.defaults.extensions.childTokens[o.type].forEach(c=>{const l=o[c].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const i=t.renderers[a.name];i?t.renderers[a.name]=function(...o){let c=a.renderer.apply(this,o);return c===!1&&(c=i.apply(this,o)),c}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=t[a.level];i?i.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),r.extensions=t),n.renderer){const a=this.defaults.renderer||new Ot(this.defaults);for(const i in n.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,c=n.renderer[o],l=a[o];a[o]=(...u)=>{let f=c.apply(a,u);return f===!1&&(f=l.apply(a,u)),f||""}}r.renderer=a}if(n.tokenizer){const a=this.defaults.tokenizer||new $t(this.defaults);for(const i in n.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,c=n.tokenizer[o],l=a[o];a[o]=(...u)=>{let f=c.apply(a,u);return f===!1&&(f=l.apply(a,u)),f}}r.tokenizer=a}if(n.hooks){const a=this.defaults.hooks||new rt;for(const i in n.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,c=n.hooks[o],l=a[o];rt.passThroughHooks.has(i)?a[o]=u=>{if(this.defaults.async)return Promise.resolve(c.call(a,u)).then(v=>l.call(a,v));const f=c.call(a,u);return l.call(a,f)}:a[o]=(...u)=>{let f=c.apply(a,u);return f===!1&&(f=l.apply(a,u)),f}}r.hooks=a}if(n.walkTokens){const a=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let c=[];return c.push(i.call(this,o)),a&&(c=c.concat(a.call(this,o))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ie.lex(e,t??this.defaults)}parser(e,t){return oe.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{const a={...r},i={...this.defaults,...a},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return o(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 n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const c=i.hooks?i.hooks.provideLexer():e?ie.lex:ie.lexInline,l=i.hooks?i.hooks.provideParser():e?oe.parse:oe.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(u=>c(u,i)).then(u=>i.hooks?i.hooks.processAllTokens(u):u).then(u=>i.walkTokens?Promise.all(this.walkTokens(u,i.walkTokens)).then(()=>u):u).then(u=>l(u,i)).then(u=>i.hooks?i.hooks.postprocess(u):u).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let u=c(n,i);i.hooks&&(u=i.hooks.processAllTokens(u)),i.walkTokens&&this.walkTokens(u,i.walkTokens);let f=l(u,i);return i.hooks&&(f=i.hooks.postprocess(f)),f}catch(u){return o(u)}}}onError(e,t){return n=>{if(n.message+=`
56
- Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+fe(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}}const Ne=new jn;function D(s,e){return Ne.parse(s,e)}D.options=D.setOptions=function(s){return Ne.setOptions(s),D.defaults=Ne.defaults,_n(D.defaults),D},D.getDefaults=Ut,D.defaults=Oe,D.use=function(...s){return Ne.use(...s),D.defaults=Ne.defaults,_n(D.defaults),D},D.walkTokens=function(s,e){return Ne.walkTokens(s,e)},D.parseInline=Ne.parseInline,D.Parser=oe,D.parser=oe.parse,D.Renderer=Ot,D.TextRenderer=Kt,D.Lexer=ie,D.lexer=ie.lex,D.Tokenizer=$t,D.Hooks=rt,D.parse=D,D.options,D.setOptions,D.use,D.walkTokens,D.parseInline,oe.parse,ie.lex;const Wr=s=>({extensions:[{name:"footnote",level:"inline",start(e){var t;return(t=e.match(/\[\^(\d+)\]/))==null?void 0:t.index},tokenizer(e){const n=/^\[\^(\d+)\]/.exec(e);if(n){const[r,a]=n;return{type:"footnote",raw:r,refNumber:a}}},renderer(e){if(e.type==="footnote"){const t=parseInt(e.refNumber),n=s.sources.all.find(a=>a.referenceNumber==t);n||console.error("Could not find ref with number",t);let r;return n!=null&&n.usedNumber?r=n.usedNumber:(r=s.sources.used.push(n),n.usedNumber=r),` <liipgpt-reference-number data-ref-number="${e.refNumber}" data-used-number="${r}" data-source="${JSON.stringify(n).replace(/"/g,"&quot;")}"></liipgpt-reference-number>`}}}]}),Qr={hr(){return""}},Ln=(s,e)=>new jn().use(Wr(e)).use({renderer:Qr}).parse(s);var I;(function(s){s.assertEqual=r=>r;function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},s.getValidEnumValues=r=>{const a=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return s.objectValues(i)},s.objectValues=r=>s.objectKeys(r).map(function(a){return r[a]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},s.find=(r,a)=>{for(const i of r)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=n,s.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(I||(I={}));var en;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(en||(en={}));const y=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ve=s=>{switch(typeof s){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(s)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(s)?y.array:s===null?y.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?y.promise:typeof Map<"u"&&s instanceof Map?y.map:typeof Set<"u"&&s instanceof Set?y.set:typeof Date<"u"&&s instanceof Date?y.date:y.object;default:return y.unknown}},h=I.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Xr=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class ne extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),n}static assert(e){if(!(e instanceof ne))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ne.create=s=>new ne(s);const Me=(s,e)=>{let t;switch(s.code){case h.invalid_type:s.received===y.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case h.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,I.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:t=`Unrecognized key(s) in object: ${I.joinValues(s.keys,", ")}`;break;case h.invalid_union:t="Invalid input";break;case h.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${I.joinValues(s.options)}`;break;case h.invalid_enum_value:t=`Invalid enum value. Expected ${I.joinValues(s.options)}, received '${s.received}'`;break;case h.invalid_arguments:t="Invalid function arguments";break;case h.invalid_return_type:t="Invalid function return type";break;case h.invalid_date:t="Invalid date";break;case h.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:I.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case h.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case h.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case h.custom:t="Invalid input";break;case h.invalid_intersection_types:t="Intersection results could not be merged";break;case h.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case h.not_finite:t="Number must be finite";break;default:t=e.defaultError,I.assertNever(s)}return{message:t}};let Dn=Me;function Jr(s){Dn=s}function Nt(){return Dn}const Zt=s=>{const{data:e,path:t,errorMaps:n,issueData:r}=s,a=[...t,...r.path||[]],i={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...r,path:a,message:o}},Yr=[];function p(s,e){const t=Nt(),n=Zt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Me?void 0:Me].filter(r=>!!r)});s.common.issues.push(n)}class W{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const a=await r.key,i=await r.value;n.push({key:a,value:i})}return W.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return w;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),Be=s=>({status:"dirty",value:s}),X=s=>({status:"valid",value:s}),tn=s=>s.status==="aborted",nn=s=>s.status==="dirty",Ze=s=>s.status==="valid",st=s=>typeof Promise<"u"&&s instanceof Promise;function jt(s,e,t,n){if(typeof e=="function"?s!==e||!0:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(s)}function Pn(s,e,t,n,r){if(typeof e=="function"?s!==e||!0:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(s,t),t}typeof SuppressedError=="function"&&SuppressedError;var _;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));var at,it;class pe{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const zn=(s,e)=>{if(Ze(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ne(s.common.issues);return this._error=t,this._error}}};function E(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,l;const{message:u}=s;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(c=u??n)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(l=u??t)!==null&&l!==void 0?l:o.defaultError}},description:r}}class C{get description(){return this._def.description}_getType(e){return ve(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new W,ctx:{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(st(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},a=this._parseSync({data:e,path:r.path,parent:r});return zn(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Ze(a)?{value:a.value}:{issues:r.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Ze(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(st(r)?r:Promise.resolve(r));return zn(n,a)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new ue({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ge.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ce.create(this)}promise(){return Ve.create(this,this._def)}or(e){return ut.create([this,e],this._def)}and(e){return dt.create(this,e,this._def)}transform(e){return new ue({...E(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new gt({...E(this._def),innerType:this,defaultValue:t,typeName:x.ZodDefault})}brand(){return new an({typeName:x.ZodBranded,type:this,...E(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new yt({...E(this._def),innerType:this,catchValue:t,typeName:x.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return vt.create(this,e)}readonly(){return _t.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Kr=/^c[^\s-]{8,}$/i,es=/^[0-9a-z]+$/,ts=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ns=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rs=/^[a-z0-9_-]{21}$/i,ss=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,as=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,is=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,os="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rn;const ls=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,us=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ds=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ps=new RegExp(`^${Mn}$`);function Bn(s){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ms(s){return new RegExp(`^${Bn(s)}$`)}function qn(s){let e=`${Mn}T${Bn(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function gs(s,e){return!!((e==="v4"||!e)&&ls.test(s)||(e==="v6"||!e)&&us.test(s))}function ys(s,e){if(!ss.test(s))return!1;try{const[t]=s.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch{return!1}}function vs(s,e){return!!((e==="v4"||!e)&&cs.test(s)||(e==="v6"||!e)&&ds.test(s))}class le extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){const a=this._getOrReturnCtx(e);return p(a,{code:h.invalid_type,expected:y.string,received:a.parsedType}),w}const n=new W;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?p(r,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&p(r,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")is.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")rn||(rn=new RegExp(os,"u")),rn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ns.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")rs.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"nanoid",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Kr.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")es.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ts.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qn(a).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ps.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ms(a).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?as.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"duration",code:h.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?gs(e.data,a.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ys(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"jwt",code:h.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?vs(e.data,a.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cidr",code:h.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?hs.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64",code:h.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?fs.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64url",code:h.invalid_string,message:a.message}),n.dirty()):I.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:h.invalid_string,..._.errToObj(n)})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,..._.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,..._.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new le({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new le({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new le({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}le.create=s=>{var e;return new le({checks:[],typeName:x.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...E(s)})};function _s(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,a=parseInt(s.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class Se extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==y.number){const a=this._getOrReturnCtx(e);return p(a,{code:h.invalid_type,expected:y.number,received:a.parsedType}),w}let n;const r=new W;for(const a of this._def.checks)a.kind==="int"?I.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?_s(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:a.message}),r.dirty()):I.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,r){return new Se({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(r)}]})}_addCheck(e){return new Se({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&I.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Se.create=s=>new Se({checks:[],typeName:x.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...E(s)});class Re extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==y.bigint)return this._getInvalidInput(e);let n;const r=new W;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):I.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return p(t,{code:h.invalid_type,expected:y.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,r){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(r)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Re.create=s=>{var e;return new Re({checks:[],typeName:x.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...E(s)})};class ot extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.boolean,received:n.parsedType}),w}return X(e.data)}}ot.create=s=>new ot({typeName:x.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...E(s)});class je extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){const a=this._getOrReturnCtx(e);return p(a,{code:h.invalid_type,expected:y.date,received:a.parsedType}),w}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return p(a,{code:h.invalid_date}),w}const n=new W;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):I.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}je.create=s=>new je({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:x.ZodDate,...E(s)});class Lt extends C{_parse(e){if(this._getType(e)!==y.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.symbol,received:n.parsedType}),w}return X(e.data)}}Lt.create=s=>new Lt({typeName:x.ZodSymbol,...E(s)});class lt extends C{_parse(e){if(this._getType(e)!==y.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.undefined,received:n.parsedType}),w}return X(e.data)}}lt.create=s=>new lt({typeName:x.ZodUndefined,...E(s)});class ct extends C{_parse(e){if(this._getType(e)!==y.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.null,received:n.parsedType}),w}return X(e.data)}}ct.create=s=>new ct({typeName:x.ZodNull,...E(s)});class qe extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return X(e.data)}}qe.create=s=>new qe({typeName:x.ZodAny,...E(s)});class Le extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return X(e.data)}}Le.create=s=>new Le({typeName:x.ZodUnknown,...E(s)});class _e extends C{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:h.invalid_type,expected:y.never,received:t.parsedType}),w}}_e.create=s=>new _e({typeName:x.ZodNever,...E(s)});class Dt extends C{_parse(e){if(this._getType(e)!==y.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.void,received:n.parsedType}),w}return X(e.data)}}Dt.create=s=>new Dt({typeName:x.ZodVoid,...E(s)});class ce extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==y.array)return p(t,{code:h.invalid_type,expected:y.array,received:t.parsedType}),w;if(r.exactLength!==null){const i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(p(t,{code:i?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(p(t,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(p(t,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new pe(t,i,t.path,o)))).then(i=>W.mergeArray(n,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new pe(t,i,t.path,o)));return W.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new ce({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new ce({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new ce({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}ce.create=(s,e)=>new ce({type:s,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...E(e)});function Fe(s){if(s instanceof z){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=ge.create(Fe(n))}return new z({...s._def,shape:()=>e})}else return s instanceof ce?new ce({...s._def,type:Fe(s.element)}):s instanceof ge?ge.create(Fe(s.unwrap())):s instanceof Ce?Ce.create(Fe(s.unwrap())):s instanceof me?me.create(s.items.map(e=>Fe(e))):s}class z extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=I.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==y.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:y.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof _e&&this._def.unknownKeys==="strip"))for(const l in r.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const u=a[l],f=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new pe(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof _e){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const f=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new pe(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const f=await u.key,v=await u.value;l.push({key:f,value:v,alwaysSet:u.alwaysSet})}return l}).then(l=>W.mergeObjectSync(n,l)):W.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var r,a,i,o;const c=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=_.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new z({...this._def,unknownKeys:"strip"})}passthrough(){return new z({...this._def,unknownKeys:"passthrough"})}extend(e){return new z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new z({...this._def,catchall:e})}pick(e){const t={};return I.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new z({...this._def,shape:()=>t})}omit(e){const t={};return I.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new z({...this._def,shape:()=>t})}deepPartial(){return Fe(this)}partial(e){const t={};return I.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new z({...this._def,shape:()=>t})}required(e){const t={};return I.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ge;)a=a._def.innerType;t[n]=a}}),new z({...this._def,shape:()=>t})}keyof(){return Fn(I.objectKeys(this.shape))}}z.create=(s,e)=>new z({shape:()=>s,unknownKeys:"strip",catchall:_e.create(),typeName:x.ZodObject,...E(e)}),z.strictCreate=(s,e)=>new z({shape:()=>s,unknownKeys:"strict",catchall:_e.create(),typeName:x.ZodObject,...E(e)}),z.lazycreate=(s,e)=>new z({shape:s,unknownKeys:"strip",catchall:_e.create(),typeName:x.ZodObject,...E(e)});class ut extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new ne(o.ctx.common.issues));return p(t,{code:h.invalid_union,unionErrors:i}),w}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let a;const i=[];for(const c of n){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new ne(c));return p(t,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}ut.create=(s,e)=>new ut({options:s,typeName:x.ZodUnion,...E(e)});const ke=s=>s instanceof ft?ke(s.schema):s instanceof ue?ke(s.innerType()):s instanceof pt?[s.value]:s instanceof Ee?s.options:s instanceof mt?I.objectValues(s.enum):s instanceof gt?ke(s._def.innerType):s instanceof lt?[void 0]:s instanceof ct?[null]:s instanceof ge?[void 0,...ke(s.unwrap())]:s instanceof Ce?[null,...ke(s.unwrap())]:s instanceof an||s instanceof _t?ke(s.unwrap()):s instanceof yt?ke(s._def.innerType):[];class Pt extends C{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.object)return p(t,{code:h.invalid_type,expected:y.object,received:t.parsedType}),w;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const i=ke(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new Pt({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...E(n)})}}function sn(s,e){const t=ve(s),n=ve(e);if(s===e)return{valid:!0,data:s};if(t===y.object&&n===y.object){const r=I.objectKeys(e),a=I.objectKeys(s).filter(o=>r.indexOf(o)!==-1),i={...s,...e};for(const o of a){const c=sn(s[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===y.array&&n===y.array){if(s.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<s.length;a++){const i=s[a],o=e[a],c=sn(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===y.date&&n===y.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class dt extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(tn(a)||tn(i))return w;const o=sn(a.value,i.value);return o.valid?((nn(a)||nn(i))&&t.dirty(),{status:t.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}dt.create=(s,e,t)=>new dt({left:s,right:e,typeName:x.ZodIntersection,...E(t)});class me extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return p(n,{code:h.invalid_type,expected:y.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new pe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>W.mergeArray(t,i)):W.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new me({...this._def,rest:e})}}me.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new me({items:s,typeName:x.ZodTuple,rest:null,...E(e)})};class ht extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return p(n,{code:h.invalid_type,expected:y.object,received:n.parsedType}),w;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)r.push({key:a._parse(new pe(n,o,n.path,o)),value:i._parse(new pe(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?W.mergeObjectAsync(t,r):W.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof C?new ht({keyType:e,valueType:t,typeName:x.ZodRecord,...E(n)}):new ht({keyType:le.create(),valueType:e,typeName:x.ZodRecord,...E(t)})}}class zt extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return p(n,{code:h.invalid_type,expected:y.map,received:n.parsedType}),w;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:r._parse(new pe(n,o,n.path,[l,"key"])),value:a._parse(new pe(n,c,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return w;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return w;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}}zt.create=(s,e,t)=>new zt({valueType:e,keyType:s,typeName:x.ZodMap,...E(t)});class De extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return p(n,{code:h.invalid_type,expected:y.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const u of c){if(u.status==="aborted")return w;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const o=[...n.data.values()].map((c,l)=>a._parse(new pe(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new De({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new De({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}De.create=(s,e)=>new De({valueType:s,minSize:null,maxSize:null,typeName:x.ZodSet,...E(e)});class Ue extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.function)return p(t,{code:h.invalid_type,expected:y.function,received:t.parsedType}),w;function n(o,c){return Zt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Me].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:c}})}function r(o,c){return Zt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Me].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ve){const o=this;return X(async function(...c){const l=new ne([]),u=await o._def.args.parseAsync(c,a).catch(T=>{throw l.addIssue(n(c,T)),l}),f=await Reflect.apply(i,this,u);return await o._def.returns._def.type.parseAsync(f,a).catch(T=>{throw l.addIssue(r(f,T)),l})})}else{const o=this;return X(function(...c){const l=o._def.args.safeParse(c,a);if(!l.success)throw new ne([n(c,l.error)]);const u=Reflect.apply(i,this,l.data),f=o._def.returns.safeParse(u,a);if(!f.success)throw new ne([r(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ue({...this._def,args:me.create(e).rest(Le.create())})}returns(e){return new Ue({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ue({args:e||me.create([]).rest(Le.create()),returns:t||Le.create(),typeName:x.ZodFunction,...E(n)})}}class ft extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ft.create=(s,e)=>new ft({getter:s,typeName:x.ZodLazy,...E(e)});class pt extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}pt.create=(s,e)=>new pt({value:s,typeName:x.ZodLiteral,...E(e)});function Fn(s,e){return new Ee({values:s,typeName:x.ZodEnum,...E(e)})}class Ee extends C{constructor(){super(...arguments),at.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:I.joinValues(n),received:t.parsedType,code:h.invalid_type}),w}if(jt(this,at)||Pn(this,at,new Set(this._def.values)),!jt(this,at).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:h.invalid_enum_value,options:n}),w}return X(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ee.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ee.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}at=new WeakMap,Ee.create=Fn;class mt extends C{constructor(){super(...arguments),it.set(this,void 0)}_parse(e){const t=I.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const r=I.objectValues(t);return p(n,{expected:I.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(jt(this,it)||Pn(this,it,new Set(I.getValidEnumValues(this._def.values))),!jt(this,it).has(e.data)){const r=I.objectValues(t);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return X(e.data)}get enum(){return this._def.values}}it=new WeakMap,mt.create=(s,e)=>new mt({values:s,typeName:x.ZodNativeEnum,...E(e)});class Ve extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.promise&&t.common.async===!1)return p(t,{code:h.invalid_type,expected:y.promise,received:t.parsedType}),w;const n=t.parsedType===y.promise?t.data:Promise.resolve(t.data);return X(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ve.create=(s,e)=>new Ve({type:s,typeName:x.ZodPromise,...E(e)});class ue extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{p(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return w;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?w:c.status==="dirty"||t.value==="dirty"?Be(c.value):c});{if(t.value==="aborted")return w;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?w:o.status==="dirty"||t.value==="dirty"?Be(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ze(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ze(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);I.assertNever(r)}}ue.create=(s,e,t)=>new ue({schema:s,typeName:x.ZodEffects,effect:e,...E(t)}),ue.createWithPreprocess=(s,e,t)=>new ue({schema:e,effect:{type:"preprocess",transform:s},typeName:x.ZodEffects,...E(t)});class ge extends C{_parse(e){return this._getType(e)===y.undefined?X(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ge.create=(s,e)=>new ge({innerType:s,typeName:x.ZodOptional,...E(e)});class Ce extends C{_parse(e){return this._getType(e)===y.null?X(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ce.create=(s,e)=>new Ce({innerType:s,typeName:x.ZodNullable,...E(e)});class gt extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}gt.create=(s,e)=>new gt({innerType:s,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});class yt extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return st(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}yt.create=(s,e)=>new yt({innerType:s,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});class Mt extends C{_parse(e){if(this._getType(e)!==y.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:y.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Mt.create=s=>new Mt({typeName:x.ZodNaN,...E(s)});const ks=Symbol("zod_brand");class an extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class vt extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?w:a.status==="dirty"?(t.dirty(),Be(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new vt({in:e,out:t,typeName:x.ZodPipeline})}}class _t extends C{_parse(e){const t=this._def.innerType._parse(e),n=r=>(Ze(r)&&(r.value=Object.freeze(r.value)),r);return st(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}_t.create=(s,e)=>new _t({innerType:s,typeName:x.ZodReadonly,...E(e)});function Un(s,e){const t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Vn(s,e={},t){return s?qe.create().superRefine((n,r)=>{var a,i;const o=s(n);if(o instanceof Promise)return o.then(c=>{var l,u;if(!c){const f=Un(e,n),v=(u=(l=f.fatal)!==null&&l!==void 0?l:t)!==null&&u!==void 0?u:!0;r.addIssue({code:"custom",...f,fatal:v})}});if(!o){const c=Un(e,n),l=(i=(a=c.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0;r.addIssue({code:"custom",...c,fatal:l})}}):qe.create()}const bs={object:z.lazycreate};var x;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(x||(x={}));const xs=(s,e={message:`Input not instance of ${s.name}`})=>Vn(t=>t instanceof s,e),Hn=le.create,Gn=Se.create,ws=Mt.create,Ts=Re.create,Wn=ot.create,Ss=je.create,Rs=Lt.create,Es=lt.create,Cs=ct.create,As=qe.create,Is=Le.create,$s=_e.create,Os=Dt.create,Ns=ce.create,Zs=z.create,js=z.strictCreate,Ls=ut.create,Ds=Pt.create,Ps=dt.create,zs=me.create,Ms=ht.create,Bs=zt.create,qs=De.create,Fs=Ue.create,Us=ft.create,Vs=pt.create,Hs=Ee.create,Gs=mt.create,Ws=Ve.create,Qn=ue.create,Qs=ge.create,Xs=Ce.create,Js=ue.createWithPreprocess,Ys=vt.create;var Z=Object.freeze({__proto__:null,defaultErrorMap:Me,setErrorMap:Jr,getErrorMap:Nt,makeIssue:Zt,EMPTY_PATH:Yr,addIssueToContext:p,ParseStatus:W,INVALID:w,DIRTY:Be,OK:X,isAborted:tn,isDirty:nn,isValid:Ze,isAsync:st,get util(){return I},get objectUtil(){return en},ZodParsedType:y,getParsedType:ve,ZodType:C,datetimeRegex:qn,ZodString:le,ZodNumber:Se,ZodBigInt:Re,ZodBoolean:ot,ZodDate:je,ZodSymbol:Lt,ZodUndefined:lt,ZodNull:ct,ZodAny:qe,ZodUnknown:Le,ZodNever:_e,ZodVoid:Dt,ZodArray:ce,ZodObject:z,ZodUnion:ut,ZodDiscriminatedUnion:Pt,ZodIntersection:dt,ZodTuple:me,ZodRecord:ht,ZodMap:zt,ZodSet:De,ZodFunction:Ue,ZodLazy:ft,ZodLiteral:pt,ZodEnum:Ee,ZodNativeEnum:mt,ZodPromise:Ve,ZodEffects:ue,ZodTransformer:ue,ZodOptional:ge,ZodNullable:Ce,ZodDefault:gt,ZodCatch:yt,ZodNaN:Mt,BRAND:ks,ZodBranded:an,ZodPipeline:vt,ZodReadonly:_t,custom:Vn,Schema:C,ZodSchema:C,late:bs,get ZodFirstPartyTypeKind(){return x},coerce:{string:s=>le.create({...s,coerce:!0}),number:s=>Se.create({...s,coerce:!0}),boolean:s=>ot.create({...s,coerce:!0}),bigint:s=>Re.create({...s,coerce:!0}),date:s=>je.create({...s,coerce:!0})},any:As,array:Ns,bigint:Ts,boolean:Wn,date:Ss,discriminatedUnion:Ds,effect:Qn,enum:Hs,function:Fs,instanceof:xs,intersection:Ps,lazy:Us,literal:Vs,map:Bs,nan:ws,nativeEnum:Gs,never:$s,null:Cs,nullable:Xs,number:Gn,object:Zs,oboolean:()=>Wn().optional(),onumber:()=>Gn().optional(),optional:Qs,ostring:()=>Hn().optional(),pipeline:Ys,preprocess:Js,promise:Ws,record:Ms,set:qs,strictObject:js,string:Hn,symbol:Rs,transformer:Qn,tuple:zs,undefined:Es,union:Ls,unknown:Is,void:Os,NEVER:w,ZodIssueCode:h,quotelessJson:Xr,ZodError:ne});const Xn=Z.object({label:Z.string(),options:Z.array(Z.object({label:Z.string(),value:Z.number()}))}),on=Z.object({enabled:Z.boolean(),impact:Xn,quality:Xn}),Jn=Z.object({classification:on.optional()}),Yn=Z.object({label:Z.string(),icon:Z.string(),url:Z.string(),target:Z.string()}),Kn=Z.object({menu:Z.record(Z.array(Yn)).optional(),supportedLanguages:Z.array(Z.enum(["en","de","fr","it"])).optional(),classification:on.optional()}),er=Z.object({label:Z.string().nullable(),question:Z.string()}),tr=Z.object({predefinedQuestions:Z.array(er)}),nr=Z.union([Z.object({maintenance:Z.literal(!0)}),Z.object({id:Z.string(),cID:Z.string()})]);var Ks=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ln={exports:{}};/** @license
57
- * eventsource.js
58
- * Available under MIT License (MIT)
59
- * https://github.com/Yaffle/EventSource/
60
- */(function(s,e){(function(t){var n=t.setTimeout,r=t.clearTimeout,a=t.XMLHttpRequest,i=t.XDomainRequest,o=t.ActiveXObject,c=t.EventSource,l=t.document,u=t.Promise,f=t.fetch,v=t.Response,T=t.TextDecoder,M=t.TextEncoder,j=t.AbortController;if(typeof window<"u"&&typeof l<"u"&&!("readyState"in l)&&l.body==null&&(l.readyState="loading",window.addEventListener("load",function(d){l.readyState="complete"},!1)),a==null&&o!=null&&(a=function(){return new o("Microsoft.XMLHTTP")}),Object.create==null&&(Object.create=function(d){function g(){}return g.prototype=d,new g}),Date.now||(Date.now=function(){return new Date().getTime()}),j==null){var ee=f;f=function(d,g){var k=g.signal;return ee(d,{headers:g.headers,credentials:g.credentials,cache:g.cache}).then(function(m){var S=m.body.getReader();return k._reader=S,k._aborted&&k._reader.cancel(),{status:m.status,statusText:m.statusText,headers:m.headers,body:{getReader:function(){return S}}}})},j=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){this.signal._reader!=null&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function kt(){this.bitsNeeded=0,this.codePoint=0}kt.prototype.decode=function(d){function g(L,P,R){if(R===1)return L>=128>>P&&L<<P<=2047;if(R===2)return L>=2048>>P&&L<<P<=55295||L>=57344>>P&&L<<P<=65535;if(R===3)return L>=65536>>P&&L<<P<=1114111;throw new Error}function k(L,P){if(L===6*1)return P>>6>15?3:P>31?2:1;if(L===6*2)return P>15?3:2;if(L===6*3)return 3;throw new Error}for(var m=65533,S="",b=this.bitsNeeded,A=this.codePoint,B=0;B<d.length;B+=1){var $=d[B];b!==0&&($<128||$>191||!g(A<<6|$&63,b-6,k(b,A)))&&(b=0,A=m,S+=String.fromCharCode(A)),b===0?($>=0&&$<=127?(b=0,A=$):$>=192&&$<=223?(b=6*1,A=$&31):$>=224&&$<=239?(b=6*2,A=$&15):$>=240&&$<=247?(b=6*3,A=$&7):(b=0,A=m),b!==0&&!g(A,b,k(b,A))&&(b=0,A=m)):(b-=6,A=A<<6|$&63),b===0&&(A<=65535?S+=String.fromCharCode(A):(S+=String.fromCharCode(55296+(A-65535-1>>10)),S+=String.fromCharCode(56320+(A-65535-1&1023))))}return this.bitsNeeded=b,this.codePoint=A,S};var bt=function(){try{return new T().decode(new M().encode("test"),{stream:!0})==="test"}catch(d){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+d)}return!1};(T==null||M==null||!bt())&&(T=kt);var te=function(){};function ye(d){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=te,this.onload=te,this.onerror=te,this.onreadystatechange=te,this._contentType="",this._xhr=d,this._sendTimeout=0,this._abort=te}ye.prototype.open=function(d,g){this._abort(!0);var k=this,m=this._xhr,S=1,b=0;this._abort=function(R){k._sendTimeout!==0&&(r(k._sendTimeout),k._sendTimeout=0),(S===1||S===2||S===3)&&(S=4,m.onload=te,m.onerror=te,m.onabort=te,m.onprogress=te,m.onreadystatechange=te,m.abort(),b!==0&&(r(b),b=0),R||(k.readyState=4,k.onabort(null),k.onreadystatechange())),S=0};var A=function(){if(S===1){var R=0,q="",be=void 0;if("contentType"in m)R=200,q="OK",be=m.contentType;else try{R=m.status,q=m.statusText,be=m.getResponseHeader("Content-Type")}catch{R=0,q="",be=void 0}R!==0&&(S=2,k.readyState=2,k.status=R,k.statusText=q,k._contentType=be,k.onreadystatechange())}},B=function(){if(A(),S===2||S===3){S=3;var R="";try{R=m.responseText}catch{}k.readyState=3,k.responseText=R,k.onprogress()}},$=function(R,q){if((q==null||q.preventDefault==null)&&(q={preventDefault:te}),B(),S===1||S===2||S===3){if(S=4,b!==0&&(r(b),b=0),k.readyState=4,R==="load")k.onload(q);else if(R==="error")k.onerror(q);else if(R==="abort")k.onabort(q);else throw new TypeError;k.onreadystatechange()}},L=function(R){m!=null&&(m.readyState===4?(!("onload"in m)||!("onerror"in m)||!("onabort"in m))&&$(m.responseText===""?"error":"load",R):m.readyState===3?"onprogress"in m||B():m.readyState===2&&A())},P=function(){b=n(function(){P()},500),m.readyState===3&&B()};"onload"in m&&(m.onload=function(R){$("load",R)}),"onerror"in m&&(m.onerror=function(R){$("error",R)}),"onabort"in m&&(m.onabort=function(R){$("abort",R)}),"onprogress"in m&&(m.onprogress=B),"onreadystatechange"in m&&(m.onreadystatechange=function(R){L(R)}),("contentType"in m||!("ontimeout"in a.prototype))&&(g+=(g.indexOf("?")===-1?"?":"&")+"padding=true"),m.open(d,g,!0),"readyState"in m&&(b=n(function(){P()},0))},ye.prototype.abort=function(){this._abort(!1)},ye.prototype.getResponseHeader=function(d){return this._contentType},ye.prototype.setRequestHeader=function(d,g){var k=this._xhr;"setRequestHeader"in k&&k.setRequestHeader(d,g)},ye.prototype.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders!=null&&this._xhr.getAllResponseHeaders()||""},ye.prototype.send=function(){if((!("ontimeout"in a.prototype)||!("sendAsBinary"in a.prototype)&&!("mozAnon"in a.prototype))&&l!=null&&l.readyState!=null&&l.readyState!=="complete"){var d=this;d._sendTimeout=n(function(){d._sendTimeout=0,d.send()},4);return}var g=this._xhr;"withCredentials"in g&&(g.withCredentials=this.withCredentials);try{g.send(void 0)}catch(k){throw k}};function xt(d){return d.replace(/[A-Z]/g,function(g){return String.fromCharCode(g.charCodeAt(0)+32)})}function Bt(d){for(var g=Object.create(null),k=d.split(`\r
61
- `),m=0;m<k.length;m+=1){var S=k[m],b=S.split(": "),A=b.shift(),B=b.join(": ");g[xt(A)]=B}this._map=g}Bt.prototype.get=function(d){return this._map[xt(d)]},a!=null&&a.HEADERS_RECEIVED==null&&(a.HEADERS_RECEIVED=2);function Ge(){}Ge.prototype.open=function(d,g,k,m,S,b,A){d.open("GET",S);var B=0;d.onprogress=function(){var L=d.responseText,P=L.slice(B);B+=P.length,k(P)},d.onerror=function(L){L.preventDefault(),m(new Error("NetworkError"))},d.onload=function(){m(null)},d.onabort=function(){m(null)},d.onreadystatechange=function(){if(d.readyState===a.HEADERS_RECEIVED){var L=d.status,P=d.statusText,R=d.getResponseHeader("Content-Type"),q=d.getAllResponseHeaders();g(L,P,R,new Bt(q))}},d.withCredentials=b;for(var $ in A)Object.prototype.hasOwnProperty.call(A,$)&&d.setRequestHeader($,A[$]);return d.send(),d};function Ae(d){this._headers=d}Ae.prototype.get=function(d){return this._headers.get(d)};function or(){}or.prototype.open=function(d,g,k,m,S,b,A){var B=null,$=new j,L=$.signal,P=new T;return f(S,{headers:A,credentials:b?"include":"same-origin",signal:L,cache:"no-store"}).then(function(R){return B=R.body.getReader(),g(R.status,R.statusText,R.headers.get("Content-Type"),new Ae(R.headers)),new u(function(q,be){var St=function(){B.read().then(function(re){if(re.done)q(void 0);else{var J=P.decode(re.value,{stream:!0});k(J),St()}}).catch(function(re){be(re)})};St()})}).catch(function(R){if(R.name!=="AbortError")return R}).then(function(R){m(R)}),{abort:function(){B!=null&&B.cancel(),$.abort()}}};function wt(){this._listeners=Object.create(null)}function lr(d){n(function(){throw d},0)}wt.prototype.dispatchEvent=function(d){d.target=this;var g=this._listeners[d.type];if(g!=null)for(var k=g.length,m=0;m<k;m+=1){var S=g[m];try{typeof S.handleEvent=="function"?S.handleEvent(d):S.call(this,d)}catch(b){lr(b)}}},wt.prototype.addEventListener=function(d,g){d=String(d);var k=this._listeners,m=k[d];m==null&&(m=[],k[d]=m);for(var S=!1,b=0;b<m.length;b+=1)m[b]===g&&(S=!0);S||m.push(g)},wt.prototype.removeEventListener=function(d,g){d=String(d);var k=this._listeners,m=k[d];if(m!=null){for(var S=[],b=0;b<m.length;b+=1)m[b]!==g&&S.push(m[b]);S.length===0?delete k[d]:k[d]=S}};function We(d){this.type=d,this.target=void 0}function cr(d,g){We.call(this,d),this.data=g.data,this.lastEventId=g.lastEventId}cr.prototype=Object.create(We.prototype);function un(d,g){We.call(this,d),this.status=g.status,this.statusText=g.statusText,this.headers=g.headers}un.prototype=Object.create(We.prototype);function ur(d,g){We.call(this,d),this.error=g.error}ur.prototype=Object.create(We.prototype);var dn=-1,Ie=0,Qe=1,Tt=2,hn=-1,$e=0,fn=1,dr=2,ia=3,oa=/^text\/event\-stream(;.*)?$/i,la=1e3,ca=18e6,pn=function(d,g){var k=d==null?g:parseInt(d,10);return k!==k&&(k=g),mn(k)},mn=function(d){return Math.min(Math.max(d,la),ca)},Xe=function(d,g,k){try{typeof g=="function"&&g.call(d,k)}catch(m){lr(m)}};function de(d,g){wt.call(this),g=g||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,ha(this,d,g)}function ua(){return a!=null&&"withCredentials"in a.prototype||i==null?new a:new i}var da=f!=null&&v!=null&&"body"in v.prototype;function ha(d,g,k){g=String(g);var m=!!k.withCredentials,S=k.lastEventIdQueryParameterName||"lastEventId",b=mn(1e3),A=pn(k.heartbeatTimeout,45e3),B="",$=b,L=!1,P=0,R=k.headers||{},q=k.Transport,be=da&&q==null?void 0:new ye(q!=null?new q:ua()),St=q!=null&&typeof q!="string"?new q:be==null?new or:new Ge,re=void 0,J=0,he=dn,Je="",qt="",xe="",Ft="",Y=$e,gn=0,Pe=0,fa=function(H,U,se,ae){if(he===Ie)if(H===200&&se!=null&&oa.test(se)){he=Qe,L=Date.now(),$=b,d.readyState=Qe;var K=new un("open",{status:H,statusText:U,headers:ae});d.dispatchEvent(K),Xe(d,d.onopen,K)}else{var G="";H!==200?(U&&(U=U.replace(/\s+/g," ")),G="EventSource's response has a status "+H+" "+U+" that is not 200. Aborting the connection."):G="EventSource's response has a Content-Type specifying an unsupported type: "+(se==null?"-":se.replace(/\s+/g," "))+". Aborting the connection.",yn();var K=new un("error",{status:H,statusText:U,headers:ae});d.dispatchEvent(K),Xe(d,d.onerror,K),console.error(G)}},pa=function(H){if(he===Qe){for(var U=-1,se=0;se<H.length;se+=1){var ae=H.charCodeAt(se);(ae===10||ae===13)&&(U=se)}var K=(U!==-1?Ft:"")+H.slice(0,U+1);Ft=(U===-1?Ft:"")+H.slice(U+1),H!==""&&(L=Date.now(),P+=H.length);for(var G=0;G<K.length;G+=1){var ae=K.charCodeAt(G);if(Y===hn&&ae===10)Y=$e;else if(Y===hn&&(Y=$e),ae===13||ae===10){if(Y!==$e){Y===fn&&(Pe=G+1);var we=K.slice(gn,Pe-1),Te=K.slice(Pe+(Pe<G&&K.charCodeAt(Pe)===32?1:0),G);we==="data"?(Je+=`
62
- `,Je+=Te):we==="id"?qt=Te:we==="event"?xe=Te:we==="retry"?(b=pn(Te,b),$=b):we==="heartbeatTimeout"&&(A=pn(Te,A),J!==0&&(r(J),J=n(function(){Rt()},A)))}if(Y===$e){if(Je!==""){B=qt,xe===""&&(xe="message");var Ye=new cr(xe,{data:Je.slice(1),lastEventId:qt});if(d.dispatchEvent(Ye),xe==="open"?Xe(d,d.onopen,Ye):xe==="message"?Xe(d,d.onmessage,Ye):xe==="error"&&Xe(d,d.onerror,Ye),he===Tt)return}Je="",xe=""}Y=ae===13?hn:$e}else Y===$e&&(gn=G,Y=fn),Y===fn?ae===58&&(Pe=G+1,Y=dr):Y===dr&&(Y=ia)}}},fr=function(H){if(he===Qe||he===Ie){he=dn,J!==0&&(r(J),J=0),J=n(function(){Rt()},$),$=mn(Math.min(b*16,$*2)),d.readyState=Ie;var U=new ur("error",{error:H});d.dispatchEvent(U),Xe(d,d.onerror,U),H!=null&&console.error(H)}},yn=function(){he=Tt,re!=null&&(re.abort(),re=void 0),J!==0&&(r(J),J=0),d.readyState=Tt},Rt=function(){if(J=0,he!==dn){if(!L&&re!=null)fr(new Error("No activity within "+A+" milliseconds. "+(he===Ie?"No response received.":P+" chars received.")+" Reconnecting.")),re!=null&&(re.abort(),re=void 0);else{var H=Math.max((L||Date.now())+A-Date.now(),1);L=!1,J=n(function(){Rt()},H)}return}L=!1,P=0,J=n(function(){Rt()},A),he=Ie,Je="",xe="",qt=B,Ft="",gn=0,Pe=0,Y=$e;var U=g;if(g.slice(0,5)!=="data:"&&g.slice(0,5)!=="blob:"&&B!==""){var se=g.indexOf("?");U=se===-1?g:g.slice(0,se+1)+g.slice(se+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(Te,Ye){return Ye===S?"":Te}),U+=(g.indexOf("?")===-1?"?":"&")+S+"="+encodeURIComponent(B)}var ae=d.withCredentials,K={};K.Accept="text/event-stream";var G=d.headers;if(G!=null)for(var we in G)Object.prototype.hasOwnProperty.call(G,we)&&(K[we]=G[we]);try{re=St.open(be,fa,pa,fr,U,ae,K)}catch(Te){throw yn(),Te}};d.url=g,d.readyState=Ie,d.withCredentials=m,d.headers=R,d._close=yn,Rt()}de.prototype=Object.create(wt.prototype),de.prototype.CONNECTING=Ie,de.prototype.OPEN=Qe,de.prototype.CLOSED=Tt,de.prototype.close=function(){this._close()},de.CONNECTING=Ie,de.OPEN=Qe,de.CLOSED=Tt,de.prototype.withCredentials=void 0;var hr=c;a!=null&&(c==null||!("withCredentials"in c.prototype))&&(hr=de),function(d){{var g=d(e);g!==void 0&&(s.exports=g)}}(function(d){d.EventSourcePolyfill=de,d.NativeEventSource=c,d.EventSource=hr})})(typeof globalThis>"u"?typeof window<"u"?window:typeof self<"u"?self:Ks:globalThis)})(ln,ln.exports);var rr=ln.exports;const cn=()=>{};function ea(s,e){return s!=s?e==e:s!==e||s!==null&&typeof s=="object"||typeof s=="function"}const He=[];function ta(s,e=cn){let t=null;const n=new Set;function r(o){if(ea(s,o)&&(s=o,t)){const c=!He.length;for(const l of n)l[1](),He.push(l,s);if(c){for(let l=0;l<He.length;l+=2)He[l][0](He[l+1]);He.length=0}}}function a(o){r(o(s))}function i(o,c=cn){const l=[o,c];return n.add(l),n.size===1&&(t=e(r,a)||cn),o(s),()=>{n.delete(l),n.size===0&&t&&(t(),t=null)}}return{set:r,update:a,subscribe:i}}const sr=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!=null)),na=s=>{try{return new URL(s).hostname}catch{return s}},ra=s=>{let e=[],t=s.usedLinks.title??"";return t.includes(">")&&(e=t.split(">").map(n=>n.trim()),t=e.pop()??""),{url:s.usedLinks.url,title:s.usedLinks.title,referenceNumber:s.usedLinks.number,domainName:na(s.usedLinks.url),breadcrumb:e,generated:{summary:s.usedLinks.description??s.usedLinks.summary??""}}},ar=(s,e)=>{const t=s.all.length,n=ra(e);return n.referenceNumber=t+1,s.all.push(n),s},sa=rr.NativeEventSource||rr.EventSourcePolyfill;let ir;class aa{constructor({apiUrl:e,apiKey:t="X9hL4Gp5W2D7eRtF",strict:n}){O(this,"apiUrl");O(this,"apiKey");O(this,"strict");O(this,"lastRequestId");O(this,"idToQuestionsMap",new Map);O(this,"metadata");this.apiUrl=e,this.apiKey=t,this.strict=n??!1,this.metadata=this.getUserData(),ir=this}async getUserData(){var e;try{const t=vn.getItem("uID"),n=await this.fetchData("/log",nr,{},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:((e=globalThis==null?void 0:globalThis.document)==null?void 0:e.referrer)||null,uID:t})});if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return vn.setItem("uID",n.id),{mode:"ready",userId:n.id,conversationId:n.cID}}catch(t){throw t instanceof Response?new Error(`Failed to initialize client: ${t.status} - ${await t.text()}`):new Error(`Failed to initialize client: ${t instanceof Error?t.message:"Unknown error"}`)}}static getInstance(){return ir}async postData(e,t,n){const r=await fetch(`${this.apiUrl}${e}`,{method:"POST",headers:{"Content-Type":"application/json","api-key":this.apiKey},body:JSON.stringify(t)});if(!r.ok){const a=await r.text();throw new Error(`${n}: ${r.status} - ${a}`)}return r}async fetchData(e,t,n={},r={}){const a=`${this.apiUrl}${e}?${new URLSearchParams(sr(n)).toString()}`,i={...r,headers:{...(r==null?void 0:r.headers)||{},"api-key":this.apiKey}},o=await fetch(a,i);if(!o.ok){const v=await o.text();throw new Error(`API request failed: ${o.status} - ${v}`)}const c=await o.json(),{success:l,data:u,error:f}=t.safeParse(c);if(this.strict){if(!l)throw console.error(`Server response has wrong type:
63
- `,{error:f,url:a,opts:i,data:c}),new Error(`Server response has wrong type: ${f.message}`);return u}else return l||console.warn(`Server response has wrong type:
64
- `,{error:f,url:a,opts:i,data:c}),c}async fetchSSE(e,t={}){return new sa(`${this.apiUrl}${e}?${new URLSearchParams({...sr(t),key:this.apiKey}).toString()}`)}async quickFeedback(e){const t=e.messageId??this.lastRequestId,n={...e,rID:t,query:this.idToQuestionsMap.get(t)};return this.postData("/quickfeedback",n,"Got an error when trying to post quick feedback")}async feedback(e){try{const t=await this.metadata;if(t.mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");const n=e.messageId??this.lastRequestId,r={body:e.body,email:e.email,rID:n,uID:t.userId,query:this.idToQuestionsMap.get(n)};return this.postData("/feedback",r,"Got an error when trying to post feedback")}catch(t){throw t instanceof Response?new Error(`Feedback submission failed: ${t.status} - ${await t.text()}`):new Error(`Feedback submission failed: ${t instanceof Error?t.message:"Unknown error"}`)}}async getClassification(e={}){return(await this.fetchData("/chatconfig",Jn,e)).classification}async classification({impact:e,quality:t,messageId:n}){return this.postData("/classification",{impact:e,quality:t,rID:n??this.lastRequestId},"Got an error when trying to post feedback classification")}async getPredefinedQuestions(e){return(await this.fetchData("/topics/questions",tr,e)).predefinedQuestions}async getChatConfig(){return this.fetchData("/chatconfig",Kn)}async getMenu(e){var t;try{return((t=(await this.getChatConfig()).menu)==null?void 0:t[e.language])??[]}catch(n){throw new Error(`Failed to load menu: ${n instanceof Error?n.message:"Unknown error"}`)}}async getUsedLanguages(){try{const e=await this.getChatConfig();return Object.keys(e.menu??{})}catch(e){throw new Error(`Failed to load languages: ${e instanceof Error?e.message:"Unknown error"}`)}}async chatInternal(e,t={}){const n=await this.metadata;let r="";if(t.modes&&(r=`mode:${t.modes.join(",")} `),n.mode==="maintenance")throw new Error("Can not chat in maintenance mode");return this.fetchSSE("/assistant/sse",{query:r+e,uID:n.userId,cID:n.conversationId,lang:t.lang,model:t.model,chat:"true"})}chat(e,t={}){const n=ta({state:"loading"});let r=!0,a=!1;const i=new Date().toISOString();return this.chatInternal(e,t).then(o=>{let c;o.onmessage=l=>{const u=JSON.parse(l.data);"id"in u&&(this.lastRequestId=u.id,c=u.id,this.idToQuestionsMap.set(u.id,e)),"response"in u?u.response==="__CLR__"?r=!1:(u.response==="__THIS_IS_THE_ANSWER_END__"||u.response==="__THIS_IS_THE_END__")&&!a?(a=!0,n.update(f=>f.state!=="streaming"?(console.warn(`State transition: ${f.state} => done.`,"There is probably an issue with the message"),{payload:{id:c,type:"bot",time:new Date().toISOString(),sources:{all:[],used:[]},partial:!1,message:{markdown:"",html:""}},state:"done"}):{payload:{...f.payload,partial:!1},state:"done"})):r===!1&&a===!1&&n.update(f=>{if(f.state==="streaming"){const v=f.payload.message.markdown+u.response;return{state:"streaming",payload:{...f.payload,partial:!0,id:c,message:{markdown:v,html:Ln(v,f.payload)}}}}if(f.state==="loading"){const v=u.response;return{state:"streaming",payload:{type:"bot",id:c,time:i,partial:!0,sources:{all:[],used:[]},message:{markdown:v,html:Ln(v,{sources:{all:[],used:[]}})}}}}else throw console.error("Invalid message state",f),new Error("Invalid message state")}):"usedLinks"in u&&n.update(f=>{var v;if(f.state==="loading")return{state:"streaming",payload:{type:"bot",id:c,time:i,partial:!0,message:{markdown:"",html:""},sources:ar({all:[],used:[]},u)}};if(f.state==="streaming")return{state:"streaming",payload:{...f.payload,id:c,partial:!0,sources:ar((v=f.payload)==null?void 0:v.sources,u)}};throw console.error("Invalid source state",f),new Error("Invalid source state")})},o.onerror=()=>{o.close(),n.set({state:"error",errorMessage:"EventSource error"})}}).catch(o=>{console.error(o),n.set({state:"error",errorMessage:o.message})}),n}search(e,t={}){return this.metadata=this.getUserData(),this.chat(`prompt:SEARCH ${e}`,t)}transformURL(e){if(e.startsWith("file://")){const t=e.replace("file://",`${this.apiUrl}/files/`),n=new URL(t);return n.searchParams.append("key",this.apiKey),n.toString()}return e}}F.LiipGPTClient=aa,F.chatConfigSchema=Kn,F.classificationConfigSchema=on,F.classificationResponseSchema=Jn,F.menuItemSchema=Yn,F.predefinedQuestionSchema=er,F.predefinedQuestionsResponseSchema=tr,F.userDataResponseSchema=nr,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
55
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ce(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),i=fr(e);if(i===null)return r;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+ce(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n}){const r=fr(e);if(r===null)return ce(n);e=r;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${ce(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ce(e.text)}}class gn{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class se{constructor(e){A(this,"options");A(this,"renderer");A(this,"textRenderer");this.options=e||Ee,this.options.renderer=this.options.renderer||new Pt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new gn}static parse(e,t){return new se(t).parse(e)}static parseInline(e,t){return new se(t).parseInline(e)}parse(e,t=!0){var r,i;let n="";for(let a=0;a<e.length;a++){const o=e[a];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const l=o,d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=d||"";continue}}const u=o;switch(u.type){case"space":{n+=this.renderer.space(u);continue}case"hr":{n+=this.renderer.hr(u);continue}case"heading":{n+=this.renderer.heading(u);continue}case"code":{n+=this.renderer.code(u);continue}case"table":{n+=this.renderer.table(u);continue}case"blockquote":{n+=this.renderer.blockquote(u);continue}case"list":{n+=this.renderer.list(u);continue}case"html":{n+=this.renderer.html(u);continue}case"paragraph":{n+=this.renderer.paragraph(u);continue}case"text":{let l=u,d=this.renderer.text(l);for(;a+1<e.length&&e[a+1].type==="text";)l=e[++a],d+=`
56
+ `+this.renderer.text(l);t?n+=this.renderer.paragraph({type:"paragraph",raw:d,text:d,tokens:[{type:"text",raw:d,text:d,escaped:!0}]}):n+=d;continue}default:{const l='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t=this.renderer){var r,i;let n="";for(let a=0;a<e.length;a++){const o=e[a];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}const u=o;switch(u.type){case"escape":{n+=t.text(u);break}case"html":{n+=t.html(u);break}case"link":{n+=t.link(u);break}case"image":{n+=t.image(u);break}case"strong":{n+=t.strong(u);break}case"em":{n+=t.em(u);break}case"codespan":{n+=t.codespan(u);break}case"br":{n+=t.br(u);break}case"del":{n+=t.del(u);break}case"text":{n+=t.text(u);break}default:{const l='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class st{constructor(e){A(this,"options");A(this,"block");this.options=e||Ee}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?re.lex:re.lexInline}provideParser(){return this.block?se.parse:se.parseInline}}A(st,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class gr{constructor(...e){A(this,"defaults",on());A(this,"options",this.setOptions);A(this,"parse",this.parseMarkdown(!0));A(this,"parseInline",this.parseMarkdown(!1));A(this,"Parser",se);A(this,"Renderer",Pt);A(this,"TextRenderer",gn);A(this,"Lexer",re);A(this,"Tokenizer",Mt);A(this,"Hooks",st);this.use(...e)}walkTokens(e,t){var r,i;let n=[];for(const a of e)switch(n=n.concat(t.call(this,a)),a.type){case"table":{const o=a;for(const u of o.header)n=n.concat(this.walkTokens(u.tokens,t));for(const u of o.rows)for(const l of u)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{const o=a;n=n.concat(this.walkTokens(o.items,t));break}default:{const o=a;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(u=>{const l=o[u].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let u=i.renderer.apply(this,o);return u===!1&&(u=a.apply(this,o)),u}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){const i=this.defaults.renderer||new Pt(this.defaults);for(const a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;const o=a,u=n.renderer[o],l=i[o];i[o]=(...d)=>{let g=u.apply(i,d);return g===!1&&(g=l.apply(i,d)),g||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new Mt(this.defaults);for(const a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const o=a,u=n.tokenizer[o],l=i[o];i[o]=(...d)=>{let g=u.apply(i,d);return g===!1&&(g=l.apply(i,d)),g}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new st;for(const a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;const o=a,u=n.hooks[o],l=i[o];st.passThroughHooks.has(a)?i[o]=d=>{if(this.defaults.async)return Promise.resolve(u.call(i,d)).then(b=>l.call(i,b));const g=u.call(i,d);return l.call(i,g)}:i[o]=(...d)=>{let g=u.apply(i,d);return g===!1&&(g=l.apply(i,d)),g}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,a=n.walkTokens;r.walkTokens=function(o){let u=[];return u.push(a.call(this,o)),i&&(u=u.concat(i.call(this,o))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return re.lex(e,t??this.defaults)}parser(e,t){return se.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{const i={...r},a={...this.defaults,...i},o=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return o(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 n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));a.hooks&&(a.hooks.options=a,a.hooks.block=e);const u=a.hooks?a.hooks.provideLexer():e?re.lex:re.lexInline,l=a.hooks?a.hooks.provideParser():e?se.parse:se.parseInline;if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(d=>u(d,a)).then(d=>a.hooks?a.hooks.processAllTokens(d):d).then(d=>a.walkTokens?Promise.all(this.walkTokens(d,a.walkTokens)).then(()=>d):d).then(d=>l(d,a)).then(d=>a.hooks?a.hooks.postprocess(d):d).catch(o);try{a.hooks&&(n=a.hooks.preprocess(n));let d=u(n,a);a.hooks&&(d=a.hooks.processAllTokens(d)),a.walkTokens&&this.walkTokens(d,a.walkTokens);let g=l(d,a);return a.hooks&&(g=a.hooks.postprocess(g)),g}catch(d){return o(d)}}}onError(e,t){return n=>{if(n.message+=`
57
+ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+ce(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}}const Ae=new gr;function O(s,e){return Ae.parse(s,e)}O.options=O.setOptions=function(s){return Ae.setOptions(s),O.defaults=Ae.defaults,er(O.defaults),O},O.getDefaults=on,O.defaults=Ee,O.use=function(...s){return Ae.use(...s),O.defaults=Ae.defaults,er(O.defaults),O},O.walkTokens=function(s,e){return Ae.walkTokens(s,e)},O.parseInline=Ae.parseInline,O.Parser=se,O.parser=se.parse,O.Renderer=Pt,O.TextRenderer=gn,O.Lexer=re,O.lexer=re.lex,O.Tokenizer=Mt,O.Hooks=st,O.parse=O,O.options,O.setOptions,O.use,O.walkTokens,O.parseInline,se.parse,re.lex;const fi=s=>({extensions:[{name:"footnote",level:"inline",start(e){var t;return(t=e.match(/\[\^(\d+)\]/))==null?void 0:t.index},tokenizer(e){const n=/^\[\^(\d+)\]/.exec(e);if(n){const[r,i]=n;return{type:"footnote",raw:r,refNumber:i}}},renderer(e){if(e.type==="footnote"){const t=parseInt(e.refNumber)-1,n=s.all[t];n||console.error("Could not find ref with index:",t);let r;return n!=null&&n.referencesIndex.used?r=n.referencesIndex.used:(r=s.used.push(n),n.referencesIndex.used=r),` <liipgpt-reference-number data-all-index="${t}" data-used-index="${r}" data-source="${JSON.stringify(n).replace(/"/g,"&quot;")}"></liipgpt-reference-number>`}}}]}),pi=new gr({async:!1}),mi=(s,e)=>Ns.sanitize(pi.use(fi(e)).parse(s),{USE_PROFILES:{html:!0},ADD_TAGS:["liipgpt-reference-number"],FORBID_TAGS:["hr"]}),yr=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!=null)),gi=s=>{try{return new URL(s).hostname}catch{return s}},yn=()=>{};function yi(s,e){return s!=s?e==e:s!==e||s!==null&&typeof s=="object"||typeof s=="function"}const Pe=[];function _i(s,e=yn){let t=null;const n=new Set;function r(o){if(yi(s,o)&&(s=o,t)){const u=!Pe.length;for(const l of n)l[1](),Pe.push(l,s);if(u){for(let l=0;l<Pe.length;l+=2)Pe[l][0](Pe[l+1]);Pe.length=0}}}function i(o){r(o(s))}function a(o,u=yn){const l=[o,u];return n.add(l),n.size===1&&(t=e(r,i)||yn),o(s),()=>{n.delete(l),n.size===0&&t&&(t(),t=null)}}return{set:r,update:i,subscribe:a}}const _r=s=>!!s.id,ki=({url:s,considered:e,title:t,description:n,summary:r})=>{const i=gi(s);return{url:s,considered:e,referencesIndex:{},display:{card:{title:t,description:n||r,badge:s},listItem:{title:t,badge:i}}}};class bi{constructor(e){A(this,"store",_i({state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:""},references:{all:[],used:[]}}));this.onError=e}pushError(e){var t;(t=this.onError)==null||t.call(this,e),this.store.update(n=>({...n,errors:[...n.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{const n=t.message.markdown+e,r=mi(n,t.references);return _r(t)?{...t,state:"streaming",message:{markdown:n,html:r}}:(console.error("Incomplete: Message must have an id before adding text"),{...t,incomplete:!0,state:"streaming",message:{markdown:n,html:r}})})}finishMessage(){this.store.update(e=>_r(e)?{...e,state:"done"}:(console.error("Incomplete: Message must have an id finishing"),this.pushError("incomplete-error"),{...e,state:"done",incomplete:!0}))}addReference(e){const t=ki(e);this.store.update(n=>{const r=n.references.all,i=r.length,a=[...r,{...t,referencesIndex:{all:i}}];return{...n,references:{used:n.references.used,all:a}}})}getReadable(){return{subscribe:this.store.subscribe}}}var R;(function(s){s.assertEqual=r=>r;function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},s.getValidEnumValues=r=>{const i=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return s.objectValues(a)},s.objectValues=r=>s.objectKeys(r).map(function(i){return r[i]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},s.find=(r,i)=>{for(const a of r)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=n,s.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(R||(R={}));var _n;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(_n||(_n={}));const m=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),me=s=>{switch(typeof s){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(s)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(s)?m.array:s===null?m.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?m.promise:typeof Map<"u"&&s instanceof Map?m.map:typeof Set<"u"&&s instanceof Set?m.set:typeof Date<"u"&&s instanceof Date?m.date:m.object;default:return m.unknown}},h=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vi=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class te extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}static assert(e){if(!(e instanceof te))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}te.create=s=>new te(s);const $e=(s,e)=>{let t;switch(s.code){case h.invalid_type:s.received===m.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case h.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,R.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:t=`Unrecognized key(s) in object: ${R.joinValues(s.keys,", ")}`;break;case h.invalid_union:t="Invalid input";break;case h.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${R.joinValues(s.options)}`;break;case h.invalid_enum_value:t=`Invalid enum value. Expected ${R.joinValues(s.options)}, received '${s.received}'`;break;case h.invalid_arguments:t="Invalid function arguments";break;case h.invalid_return_type:t="Invalid function return type";break;case h.invalid_date:t="Invalid date";break;case h.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:R.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case h.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case h.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case h.custom:t="Invalid input";break;case h.invalid_intersection_types:t="Intersection results could not be merged";break;case h.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case h.not_finite:t="Number must be finite";break;default:t=e.defaultError,R.assertNever(s)}return{message:t}};let kr=$e;function xi(s){kr=s}function $t(){return kr}const zt=s=>{const{data:e,path:t,errorMaps:n,issueData:r}=s,i=[...t,...r.path||[]],a={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:o}},wi=[];function p(s,e){const t=$t(),n=zt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===$e?void 0:$e].filter(r=>!!r)});s.common.issues.push(n)}class q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return x;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const i=await r.key,a=await r.value;n.push({key:i,value:a})}return q.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return x;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const x=Object.freeze({status:"aborted"}),ze=s=>({status:"dirty",value:s}),X=s=>({status:"valid",value:s}),kn=s=>s.status==="aborted",bn=s=>s.status==="dirty",Re=s=>s.status==="valid",it=s=>typeof Promise<"u"&&s instanceof Promise;function Zt(s,e,t,n){if(typeof e=="function"?s!==e||!0:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(s)}function br(s,e,t,n,r){if(typeof e=="function"?s!==e||!0:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(s,t),t}typeof SuppressedError=="function"&&SuppressedError;var y;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));var at,ot;class ue{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const vr=(s,e)=>{if(Re(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new te(s.common.issues);return this._error=t,this._error}}};function T(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{var u,l;const{message:d}=s;return a.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:(u=d??n)!==null&&u!==void 0?u:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=d??t)!==null&&l!==void 0?l:o.defaultError}},description:r}}class S{get description(){return this._def.description}_getType(e){return me(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(it(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},i=this._parseSync({data:e,path:r.path,parent:r});return vr(r,i)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return Re(i)?{value:i.value}:{issues:r.common.issues}}catch(i){!((n=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>Re(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(it(r)?r:Promise.resolve(r));return vr(n,i)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new le({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return he.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oe.create(this)}promise(){return Fe.create(this,this._def)}or(e){return dt.create([this,e],this._def)}and(e){return ht.create(this,e,this._def)}transform(e){return new le({...T(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new yt({...T(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new wn({typeName:v.ZodBranded,type:this,...T(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new _t({...T(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return kt.create(this,e)}readonly(){return bt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ti=/^c[^\s-]{8,}$/i,Si=/^[0-9a-z]+$/,Ei=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ai=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ri=/^[a-z0-9_-]{21}$/i,Ii=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ci=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Oi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ni="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vn;const Li=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Di=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Mi=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pi=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$i=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Zi=new RegExp(`^${xr}$`);function wr(s){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ji(s){return new RegExp(`^${wr(s)}$`)}function Tr(s){let e=`${xr}T${wr(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ui(s,e){return!!((e==="v4"||!e)&&Li.test(s)||(e==="v6"||!e)&&Mi.test(s))}function Fi(s,e){if(!Ii.test(s))return!1;try{const[t]=s.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch{return!1}}function Bi(s,e){return!!((e==="v4"||!e)&&Di.test(s)||(e==="v6"||!e)&&Pi.test(s))}class ae extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.string,received:i.parsedType}),x}const n=new q;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Oi.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")vn||(vn=new RegExp(Ni,"u")),vn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ri.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"nanoid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Ti.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Si.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ei.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Tr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Zi.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ji(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"duration",code:h.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Ui(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Fi(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"jwt",code:h.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Bi(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cidr",code:h.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?$i.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64",code:h.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?zi.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64url",code:h.invalid_string,message:i.message}),n.dirty()):R.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:h.invalid_string,...y.errToObj(n)})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new ae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ae({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ae.create=s=>{var e;return new ae({checks:[],typeName:v.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...T(s)})};function qi(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=parseInt(s.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class be extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.number,received:i.parsedType}),x}let n;const r=new q;for(const i of this._def.checks)i.kind==="int"?R.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?qi(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:i.message}),r.dirty()):R.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new be({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new be({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}be.create=s=>new be({checks:[],typeName:v.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...T(s)});class ve extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const r=new q;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):R.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return p(t,{code:h.invalid_type,expected:m.bigint,received:t.parsedType}),x}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new ve({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ve.create=s=>{var e;return new ve({checks:[],typeName:v.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...T(s)})};class lt extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.boolean,received:n.parsedType}),x}return X(e.data)}}lt.create=s=>new lt({typeName:v.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...T(s)});class Ie extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.date,received:i.parsedType}),x}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_date}),x}const n=new q;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):R.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Ie.create=s=>new Ie({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:v.ZodDate,...T(s)});class jt extends S{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.symbol,received:n.parsedType}),x}return X(e.data)}}jt.create=s=>new jt({typeName:v.ZodSymbol,...T(s)});class ct extends S{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.undefined,received:n.parsedType}),x}return X(e.data)}}ct.create=s=>new ct({typeName:v.ZodUndefined,...T(s)});class ut extends S{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.null,received:n.parsedType}),x}return X(e.data)}}ut.create=s=>new ut({typeName:v.ZodNull,...T(s)});class Ze extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return X(e.data)}}Ze.create=s=>new Ze({typeName:v.ZodAny,...T(s)});class Ce extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return X(e.data)}}Ce.create=s=>new Ce({typeName:v.ZodUnknown,...T(s)});class ge extends S{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:h.invalid_type,expected:m.never,received:t.parsedType}),x}}ge.create=s=>new ge({typeName:v.ZodNever,...T(s)});class Ut extends S{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.void,received:n.parsedType}),x}return X(e.data)}}Ut.create=s=>new Ut({typeName:v.ZodVoid,...T(s)});class oe extends S{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return p(t,{code:h.invalid_type,expected:m.array,received:t.parsedType}),x;if(r.exactLength!==null){const a=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(a||o)&&(p(t,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(p(t,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(p(t,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>r.type._parseAsync(new ue(t,a,t.path,o)))).then(a=>q.mergeArray(n,a));const i=[...t.data].map((a,o)=>r.type._parseSync(new ue(t,a,t.path,o)));return q.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new oe({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new oe({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new oe({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}oe.create=(s,e)=>new oe({type:s,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...T(e)});function je(s){if(s instanceof M){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=he.create(je(n))}return new M({...s._def,shape:()=>e})}else return s instanceof oe?new oe({...s._def,type:je(s.element)}):s instanceof he?he.create(je(s.unwrap())):s instanceof we?we.create(je(s.unwrap())):s instanceof de?de.create(s.items.map(e=>je(e))):s}class M extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:m.object,received:l.parsedType}),x}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof ge&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const d=i[l],g=r.data[l];u.push({key:{status:"valid",value:l},value:d._parse(new ue(r,g,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof ge){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of o)u.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of o){const g=r.data[d];u.push({key:{status:"valid",value:d},value:l._parse(new ue(r,g,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of u){const g=await d.key,b=await d.value;l.push({key:g,value:b,alwaysSet:d.alwaysSet})}return l}).then(l=>q.mergeObjectSync(n,l)):q.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new M({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new M({...this._def,unknownKeys:"strip"})}passthrough(){return new M({...this._def,unknownKeys:"passthrough"})}extend(e){return new M({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new M({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new M({...this._def,catchall:e})}pick(e){const t={};return R.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new M({...this._def,shape:()=>t})}omit(e){const t={};return R.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new M({...this._def,shape:()=>t})}deepPartial(){return je(this)}partial(e){const t={};return R.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new M({...this._def,shape:()=>t})}required(e){const t={};return R.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof he;)i=i._def.innerType;t[n]=i}}),new M({...this._def,shape:()=>t})}keyof(){return Sr(R.objectKeys(this.shape))}}M.create=(s,e)=>new M({shape:()=>s,unknownKeys:"strip",catchall:ge.create(),typeName:v.ZodObject,...T(e)}),M.strictCreate=(s,e)=>new M({shape:()=>s,unknownKeys:"strict",catchall:ge.create(),typeName:v.ZodObject,...T(e)}),M.lazycreate=(s,e)=>new M({shape:s,unknownKeys:"strip",catchall:ge.create(),typeName:v.ZodObject,...T(e)});class dt extends S{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new te(o.ctx.common.issues));return p(t,{code:h.invalid_union,unionErrors:a}),x}if(t.common.async)return Promise.all(n.map(async i=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...t,common:{...t.common,issues:[]},parent:null},d=u._parseSync({data:t.data,path:t.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new te(u));return p(t,{code:h.invalid_union,unionErrors:o}),x}}get options(){return this._def.options}}dt.create=(s,e)=>new dt({options:s,typeName:v.ZodUnion,...T(e)});const ye=s=>s instanceof pt?ye(s.schema):s instanceof le?ye(s.innerType()):s instanceof mt?[s.value]:s instanceof xe?s.options:s instanceof gt?R.objectValues(s.enum):s instanceof yt?ye(s._def.innerType):s instanceof ct?[void 0]:s instanceof ut?[null]:s instanceof he?[void 0,...ye(s.unwrap())]:s instanceof we?[null,...ye(s.unwrap())]:s instanceof wn||s instanceof bt?ye(s.unwrap()):s instanceof _t?ye(s._def.innerType):[];class Ft extends S{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return p(t,{code:h.invalid_type,expected:m.object,received:t.parsedType}),x;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const i of t){const a=ye(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new Ft({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...T(n)})}}function xn(s,e){const t=me(s),n=me(e);if(s===e)return{valid:!0,data:s};if(t===m.object&&n===m.object){const r=R.objectKeys(e),i=R.objectKeys(s).filter(o=>r.indexOf(o)!==-1),a={...s,...e};for(const o of i){const u=xn(s[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(t===m.array&&n===m.array){if(s.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<s.length;i++){const a=s[i],o=e[i],u=xn(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===m.date&&n===m.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class ht extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(kn(i)||kn(a))return x;const o=xn(i.value,a.value);return o.valid?((bn(i)||bn(a))&&t.dirty(),{status:t.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),x)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ht.create=(s,e,t)=>new ht({left:s,right:e,typeName:v.ZodIntersection,...T(t)});class de extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:h.invalid_type,expected:m.array,received:n.parsedType}),x;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new ue(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>q.mergeArray(t,a)):q.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new de({...this._def,rest:e})}}de.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new de({items:s,typeName:v.ZodTuple,rest:null,...T(e)})};class ft extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:h.invalid_type,expected:m.object,received:n.parsedType}),x;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new ue(n,o,n.path,o)),value:a._parse(new ue(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?q.mergeObjectAsync(t,r):q.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof S?new ft({keyType:e,valueType:t,typeName:v.ZodRecord,...T(n)}):new ft({keyType:ae.create(),valueType:e,typeName:v.ZodRecord,...T(t)})}}class Bt extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:h.invalid_type,expected:m.map,received:n.parsedType}),x;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new ue(n,o,n.path,[l,"key"])),value:i._parse(new ue(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,d=await u.value;if(l.status==="aborted"||d.status==="aborted")return x;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(l.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,d=u.value;if(l.status==="aborted"||d.status==="aborted")return x;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(l.value,d.value)}return{status:t.value,value:o}}}}Bt.create=(s,e,t)=>new Bt({valueType:e,keyType:s,typeName:v.ZodMap,...T(t)});class Oe extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:h.invalid_type,expected:m.set,received:n.parsedType}),x;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const d of u){if(d.status==="aborted")return x;d.status==="dirty"&&t.dirty(),l.add(d.value)}return{status:t.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new ue(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,t){return new Oe({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new Oe({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Oe.create=(s,e)=>new Oe({valueType:s,minSize:null,maxSize:null,typeName:v.ZodSet,...T(e)});class Ue extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return p(t,{code:h.invalid_type,expected:m.function,received:t.parsedType}),x;function n(o,u){return zt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$t(),$e].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return zt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$t(),$e].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Fe){const o=this;return X(async function(...u){const l=new te([]),d=await o._def.args.parseAsync(u,i).catch(w=>{throw l.addIssue(n(u,w)),l}),g=await Reflect.apply(a,this,d);return await o._def.returns._def.type.parseAsync(g,i).catch(w=>{throw l.addIssue(r(g,w)),l})})}else{const o=this;return X(function(...u){const l=o._def.args.safeParse(u,i);if(!l.success)throw new te([n(u,l.error)]);const d=Reflect.apply(a,this,l.data),g=o._def.returns.safeParse(d,i);if(!g.success)throw new te([r(d,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ue({...this._def,args:de.create(e).rest(Ce.create())})}returns(e){return new Ue({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ue({args:e||de.create([]).rest(Ce.create()),returns:t||Ce.create(),typeName:v.ZodFunction,...T(n)})}}class pt extends S{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pt.create=(s,e)=>new pt({getter:s,typeName:v.ZodLazy,...T(e)});class mt extends S{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}mt.create=(s,e)=>new mt({value:s,typeName:v.ZodLiteral,...T(e)});function Sr(s,e){return new xe({values:s,typeName:v.ZodEnum,...T(e)})}class xe extends S{constructor(){super(...arguments),at.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:R.joinValues(n),received:t.parsedType,code:h.invalid_type}),x}if(Zt(this,at)||br(this,at,new Set(this._def.values)),!Zt(this,at).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:h.invalid_enum_value,options:n}),x}return X(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xe.create(e,{...this._def,...t})}exclude(e,t=this._def){return xe.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}at=new WeakMap,xe.create=Sr;class gt extends S{constructor(){super(...arguments),ot.set(this,void 0)}_parse(e){const t=R.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=R.objectValues(t);return p(n,{expected:R.joinValues(r),received:n.parsedType,code:h.invalid_type}),x}if(Zt(this,ot)||br(this,ot,new Set(R.getValidEnumValues(this._def.values))),!Zt(this,ot).has(e.data)){const r=R.objectValues(t);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),x}return X(e.data)}get enum(){return this._def.values}}ot=new WeakMap,gt.create=(s,e)=>new gt({values:s,typeName:v.ZodNativeEnum,...T(e)});class Fe extends S{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return p(t,{code:h.invalid_type,expected:m.promise,received:t.parsedType}),x;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return X(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Fe.create=(s,e)=>new Fe({type:s,typeName:v.ZodPromise,...T(e)});class le extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:a=>{p(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const a=r.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return x;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?x:u.status==="dirty"||t.value==="dirty"?ze(u.value):u});{if(t.value==="aborted")return x;const o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?x:o.status==="dirty"||t.value==="dirty"?ze(o.value):o}}if(r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Re(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Re(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:t.value,value:o})):a);R.assertNever(r)}}le.create=(s,e,t)=>new le({schema:s,typeName:v.ZodEffects,effect:e,...T(t)}),le.createWithPreprocess=(s,e,t)=>new le({schema:e,effect:{type:"preprocess",transform:s},typeName:v.ZodEffects,...T(t)});class he extends S{_parse(e){return this._getType(e)===m.undefined?X(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(s,e)=>new he({innerType:s,typeName:v.ZodOptional,...T(e)});class we extends S{_parse(e){return this._getType(e)===m.null?X(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}we.create=(s,e)=>new we({innerType:s,typeName:v.ZodNullable,...T(e)});class yt extends S{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}yt.create=(s,e)=>new yt({innerType:s,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});class _t extends S{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return it(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}_t.create=(s,e)=>new _t({innerType:s,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});class qt extends S{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.nan,received:n.parsedType}),x}return{status:"valid",value:e.data}}}qt.create=s=>new qt({typeName:v.ZodNaN,...T(s)});const Hi=Symbol("zod_brand");class wn extends S{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class kt extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?x:i.status==="dirty"?(t.dirty(),ze(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?x:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new kt({in:e,out:t,typeName:v.ZodPipeline})}}class bt extends S{_parse(e){const t=this._def.innerType._parse(e),n=r=>(Re(r)&&(r.value=Object.freeze(r.value)),r);return it(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}bt.create=(s,e)=>new bt({innerType:s,typeName:v.ZodReadonly,...T(e)});function Er(s,e){const t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Ar(s,e={},t){return s?Ze.create().superRefine((n,r)=>{var i,a;const o=s(n);if(o instanceof Promise)return o.then(u=>{var l,d;if(!u){const g=Er(e,n),b=(d=(l=g.fatal)!==null&&l!==void 0?l:t)!==null&&d!==void 0?d:!0;r.addIssue({code:"custom",...g,fatal:b})}});if(!o){const u=Er(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:t)!==null&&a!==void 0?a:!0;r.addIssue({code:"custom",...u,fatal:l})}}):Ze.create()}const Vi={object:M.lazycreate};var v;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(v||(v={}));const Gi=(s,e={message:`Input not instance of ${s.name}`})=>Ar(t=>t instanceof s,e),Rr=ae.create,Ir=be.create,Wi=qt.create,Yi=ve.create,Cr=lt.create,Xi=Ie.create,Qi=jt.create,Ji=ct.create,Ki=ut.create,ea=Ze.create,ta=Ce.create,na=ge.create,ra=Ut.create,sa=oe.create,ia=M.create,aa=M.strictCreate,oa=dt.create,la=Ft.create,ca=ht.create,ua=de.create,da=ft.create,ha=Bt.create,fa=Oe.create,pa=Ue.create,ma=pt.create,ga=mt.create,ya=xe.create,_a=gt.create,ka=Fe.create,Or=le.create,ba=he.create,va=we.create,xa=le.createWithPreprocess,wa=kt.create;var C=Object.freeze({__proto__:null,defaultErrorMap:$e,setErrorMap:xi,getErrorMap:$t,makeIssue:zt,EMPTY_PATH:wi,addIssueToContext:p,ParseStatus:q,INVALID:x,DIRTY:ze,OK:X,isAborted:kn,isDirty:bn,isValid:Re,isAsync:it,get util(){return R},get objectUtil(){return _n},ZodParsedType:m,getParsedType:me,ZodType:S,datetimeRegex:Tr,ZodString:ae,ZodNumber:be,ZodBigInt:ve,ZodBoolean:lt,ZodDate:Ie,ZodSymbol:jt,ZodUndefined:ct,ZodNull:ut,ZodAny:Ze,ZodUnknown:Ce,ZodNever:ge,ZodVoid:Ut,ZodArray:oe,ZodObject:M,ZodUnion:dt,ZodDiscriminatedUnion:Ft,ZodIntersection:ht,ZodTuple:de,ZodRecord:ft,ZodMap:Bt,ZodSet:Oe,ZodFunction:Ue,ZodLazy:pt,ZodLiteral:mt,ZodEnum:xe,ZodNativeEnum:gt,ZodPromise:Fe,ZodEffects:le,ZodTransformer:le,ZodOptional:he,ZodNullable:we,ZodDefault:yt,ZodCatch:_t,ZodNaN:qt,BRAND:Hi,ZodBranded:wn,ZodPipeline:kt,ZodReadonly:bt,custom:Ar,Schema:S,ZodSchema:S,late:Vi,get ZodFirstPartyTypeKind(){return v},coerce:{string:s=>ae.create({...s,coerce:!0}),number:s=>be.create({...s,coerce:!0}),boolean:s=>lt.create({...s,coerce:!0}),bigint:s=>ve.create({...s,coerce:!0}),date:s=>Ie.create({...s,coerce:!0})},any:ea,array:sa,bigint:Yi,boolean:Cr,date:Xi,discriminatedUnion:la,effect:Or,enum:ya,function:pa,instanceof:Gi,intersection:ca,lazy:ma,literal:ga,map:ha,nan:Wi,nativeEnum:_a,never:na,null:Ki,nullable:va,number:Ir,object:ia,oboolean:()=>Cr().optional(),onumber:()=>Ir().optional(),optional:ba,ostring:()=>Rr().optional(),pipeline:wa,preprocess:xa,promise:ka,record:da,set:fa,strictObject:aa,string:Rr,symbol:Qi,transformer:Or,tuple:ua,undefined:Ji,union:oa,unknown:ta,void:ra,NEVER:x,ZodIssueCode:h,quotelessJson:vi,ZodError:te});const Nr=C.object({label:C.string(),options:C.array(C.object({label:C.string(),value:C.number()}))}),Tn=C.object({impact:Nr.optional(),quality:Nr.optional()}),Lr=C.object({classification:Tn.optional()}),Dr=C.object({label:C.string(),icon:C.string(),url:C.string(),target:C.string()}),Mr=C.object({menu:C.record(C.array(Dr)).optional(),supportedLanguages:C.array(C.enum(["en","de","fr","it"])).optional(),classification:Tn.optional()}),Pr=C.object({label:C.string().nullable(),question:C.string()}),$r=C.object({predefinedQuestions:C.array(Pr)}),zr=C.union([C.object({maintenance:C.literal(!0)}),C.object({id:C.string(),cID:C.string()})]);let Zr;class Ta{constructor({apiUrl:e,apiKey:t="X9hL4Gp5W2D7eRtF",strict:n,EventSource:r}){A(this,"apiUrl");A(this,"apiKey");A(this,"strict");A(this,"EventSource");A(this,"lastRequestId");A(this,"idToQuestionsMap",new Map);A(this,"metadata");this.apiUrl=e,this.apiKey=t,this.strict=n??!1,this.EventSource=r??EventSource,this.metadata=this.getUserData(),Zr=this}async getUserData(){var e;try{const t=Zn.getItem("uID"),n=await this.fetchData("/log",zr,{},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:((e=globalThis==null?void 0:globalThis.document)==null?void 0:e.referrer)||null,uID:t})});if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return Zn.setItem("uID",n.id),{mode:"ready",userId:n.id,conversationId:n.cID}}catch(t){throw t instanceof Response?new Error(`Failed to initialize client: ${t.status} - ${await t.text()}`):new Error(`Failed to initialize client: ${t instanceof Error?t.message:"Unknown error"}`)}}static getInstance(){return Zr}async postData(e,t,n){const r=await fetch(`${this.apiUrl}${e}`,{method:"POST",headers:{"Content-Type":"application/json","api-key":this.apiKey},body:JSON.stringify(t)});if(!r.ok){const i=await r.text();throw new Error(`${n}: ${r.status} - ${i}`)}return r}async fetchData(e,t,n={},r={}){const i=`${this.apiUrl}${e}?${new URLSearchParams(yr(n)).toString()}`,a={...r,headers:{...(r==null?void 0:r.headers)||{},"api-key":this.apiKey}},o=await fetch(i,a);if(!o.ok){const b=await o.text();throw new Error(`API request failed: ${o.status} - ${b}`)}const u=await o.json(),{success:l,data:d,error:g}=t.safeParse(u);if(this.strict){if(!l)throw console.error(`Server response has wrong type:
58
+ `,{error:g,url:i,opts:a,data:u}),new Error(`Server response has wrong type: ${g.message}`);return d}else return l||console.warn(`Server response has wrong type:
59
+ `,{error:g,url:i,opts:a,data:u}),u}async fetchSSE(e,t={}){return new this.EventSource(`${this.apiUrl}${e}?${new URLSearchParams({...yr(t),key:this.apiKey}).toString()}`)}async quickFeedback(e){const t=e.messageId??this.lastRequestId,n={...e,rID:t,query:this.idToQuestionsMap.get(t)};return this.postData("/quickfeedback",n,"Got an error when trying to post quick feedback")}async feedback(e){try{const t=await this.metadata;if(t.mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");const n=e.messageId??this.lastRequestId,r={body:e.body,email:e.email,rID:n,uID:t.userId,query:this.idToQuestionsMap.get(n)};return this.postData("/feedback",r,"Got an error when trying to post feedback")}catch(t){throw t instanceof Response?new Error(`Feedback submission failed: ${t.status} - ${await t.text()}`):new Error(`Feedback submission failed: ${t instanceof Error?t.message:"Unknown error"}`)}}async getClassification(e={}){return(await this.fetchData("/chatconfig",Lr,e)).classification}async classification({impact:e,quality:t,messageId:n}){return this.postData("/classification",{impact:e,quality:t,rID:n??this.lastRequestId},"Got an error when trying to post feedback classification")}async getPredefinedQuestions(e){return(await this.fetchData("/topics/questions",$r,e)).predefinedQuestions}async getChatConfig(){return this.fetchData("/chatconfig",Mr)}async getMenu(e){var t;try{return((t=(await this.getChatConfig()).menu)==null?void 0:t[e.language])??[]}catch(n){throw new Error(`Failed to load menu: ${n instanceof Error?n.message:"Unknown error"}`)}}async getUsedLanguages(){try{const e=await this.getChatConfig();return Object.keys(e.menu??{})}catch(e){throw new Error(`Failed to load languages: ${e instanceof Error?e.message:"Unknown error"}`)}}async chatInternal(e,t={}){const n=await this.metadata;let r="";if(t.modes&&(r=`mode:${t.modes.join(",")} `),n.mode==="maintenance")throw new Error("Can not chat in maintenance mode");return this.fetchSSE("/assistant/sse",{query:r+e,uID:n.userId,cID:n.conversationId,lang:t.lang,model:t.model,version:t.version,chat:"true"})}chat(e,t={}){const n=new bi;return this.chatInternal(e,{...t,version:"2"}).then(r=>{r.onerror=i=>{console.error("sse-error:",i),n.pushError("sse-error"),n.finishMessage()},r.onmessage=i=>{const a=JSON.parse(i.data);switch(a.type){case"error":n.pushError(a.error);break;case"id":a.for==="request"&&(n.updateRequestId(a.id),this.lastRequestId=a.id);break;case"text":n.updateText(a.text);break;case"done":case"answer-done":n.finishMessage(),r.close();break;case"unexpected-call":console.error("unexpected-call:",a),n.pushError("unexpected-call");break;case"reference":n.addReference(a.reference);break}}}).catch(r=>{console.error("client-error:",r),n.pushError("client-error"),n.finishMessage()}),n.getReadable()}search(e,t={}){return this.metadata=this.getUserData(),this.chat(`prompt:SEARCH ${e}`,t)}}$.LiipGPTClient=Ta,$.chatConfigSchema=Mr,$.classificationConfigSchema=Tn,$.classificationResponseSchema=Lr,$.menuItemSchema=Dr,$.predefinedQuestionSchema=Pr,$.predefinedQuestionsResponseSchema=$r,$.userDataResponseSchema=zr,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});