@intelliweave/embedded 1.9.69-beta.4 → 2.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/component.d.ts +34 -0
- package/dist/component/component.js +22 -14
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.d.ts +34 -0
- package/dist/node/node.js +4 -4
- package/dist/react/react.d.ts +42 -0
- package/dist/react/react.js +33 -25
- package/dist/script-tag/script-tag.js +120 -79
- package/dist/webpack/index.d.ts +42 -0
- package/dist/webpack/index.js +23 -15
- package/examples/react-test/index.html +14 -0
- package/examples/react-test/package-lock.json +1844 -0
- package/examples/react-test/package.json +25 -0
- package/examples/react-test/src/App.tsx +69 -0
- package/examples/react-test/src/main.tsx +10 -0
- package/examples/react-test/vite.config.ts +8 -0
- package/package.json +2 -2
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import{b as ie,c as uc,d as dc,e as Ne}from"./chunk-AIYMQX7V.js";var Ch=ie((Po,kh)=>{"use strict";(function(r,e){typeof Po=="object"&&typeof kh<"u"?e(Po):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(Po,function(r){"use strict";function e(){for(var w=arguments.length,v=Array(w),C=0;C<w;C++)v[C]=arguments[C];if(v.length>1){v[0]=v[0].slice(0,-1);for(var D=v.length-1,M=1;M<D;++M)v[M]=v[M].slice(1,-1);return v[D]=v[D].slice(1),v.join("")}else return v[0]}function t(w){return"(?:"+w+")"}function i(w){return w===void 0?"undefined":w===null?"null":Object.prototype.toString.call(w).split(" ").pop().split("]").shift().toLowerCase()}function n(w){return w.toUpperCase()}function a(w){return w!=null?w instanceof Array?w:typeof w.length!="number"||w.split||w.setInterval||w.call?[w]:Array.prototype.slice.call(w):[]}function s(w,v){var C=w;if(v)for(var D in v)C[D]=v[D];return C}function o(w){var v="[A-Za-z]",C="[\\x0D]",D="[0-9]",M="[\\x22]",$=e(D,"[A-Fa-f]"),pe="[\\x0A]",Ee="[\\x20]",Te=t(t("%[EFef]"+$+"%"+$+$+"%"+$+$)+"|"+t("%[89A-Fa-f]"+$+"%"+$+$)+"|"+t("%"+$+$)),Qe="[\\:\\/\\?\\#\\[\\]\\@]",Se="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ue=e(Qe,Se),et=w?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Fe=w?"[\\uE000-\\uF8FF]":"[]",we=e(v,D,"[\\-\\.\\_\\~]",et),He=t(v+e(v,D,"[\\+\\-\\.]")+"*"),Pe=t(t(Te+"|"+e(we,Se,"[\\:]"))+"*"),Sn=t(t("25[0-5]")+"|"+t("2[0-4]"+D)+"|"+t("1"+D+D)+"|"+t("[1-9]"+D)+"|"+D),Nt=t(t("25[0-5]")+"|"+t("2[0-4]"+D)+"|"+t("1"+D+D)+"|"+t("0?[1-9]"+D)+"|0?0?"+D),$t=t(Nt+"\\."+Nt+"\\."+Nt+"\\."+Nt),De=t($+"{1,4}"),Lt=t(t(De+"\\:"+De)+"|"+$t),Kt=t(t(De+"\\:")+"{6}"+Lt),yr=t("\\:\\:"+t(De+"\\:")+"{5}"+Lt),En=t(t(De)+"?\\:\\:"+t(De+"\\:")+"{4}"+Lt),Ir=t(t(t(De+"\\:")+"{0,1}"+De)+"?\\:\\:"+t(De+"\\:")+"{3}"+Lt),ha=t(t(t(De+"\\:")+"{0,2}"+De)+"?\\:\\:"+t(De+"\\:")+"{2}"+Lt),ks=t(t(t(De+"\\:")+"{0,3}"+De)+"?\\:\\:"+De+"\\:"+Lt),Cs=t(t(t(De+"\\:")+"{0,4}"+De)+"?\\:\\:"+Lt),li=t(t(t(De+"\\:")+"{0,5}"+De)+"?\\:\\:"+De),ci=t(t(t(De+"\\:")+"{0,6}"+De)+"?\\:\\:"),Rr=t([Kt,yr,En,Ir,ha,ks,Cs,li,ci].join("|")),ui=t(t(we+"|"+Te)+"+"),lc=t(Rr+"\\%25"+ui),wn=t(Rr+t("\\%25|\\%(?!"+$+"{2})")+ui),Ev=t("[vV]"+$+"+\\."+e(we,Se,"[\\:]")+"+"),wv=t("\\["+t(wn+"|"+Rr+"|"+Ev)+"\\]"),bp=t(t(Te+"|"+e(we,Se))+"*"),ga=t(wv+"|"+$t+"(?!"+bp+")|"+bp),fa=t(D+"*"),vp=t(t(Pe+"@")+"?"+ga+t("\\:"+fa)+"?"),ya=t(Te+"|"+e(we,Se,"[\\:\\@]")),kv=t(ya+"*"),_p=t(ya+"+"),Cv=t(t(Te+"|"+e(we,Se,"[\\@]"))+"+"),Pr=t(t("\\/"+kv)+"*"),di=t("\\/"+t(_p+Pr)+"?"),cc=t(Cv+Pr),xs=t(_p+Pr),pi="(?!"+ya+")",vI=t(Pr+"|"+di+"|"+cc+"|"+xs+"|"+pi),mi=t(t(ya+"|"+e("[\\/\\?]",Fe))+"*"),ba=t(t(ya+"|[\\/\\?]")+"*"),Sp=t(t("\\/\\/"+vp+Pr)+"|"+di+"|"+xs+"|"+pi),xv=t(He+"\\:"+Sp+t("\\?"+mi)+"?"+t("\\#"+ba)+"?"),Tv=t(t("\\/\\/"+vp+Pr)+"|"+di+"|"+cc+"|"+pi),Av=t(Tv+t("\\?"+mi)+"?"+t("\\#"+ba)+"?"),_I=t(xv+"|"+Av),SI=t(He+"\\:"+Sp+t("\\?"+mi)+"?"),EI="^("+He+")\\:"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+Pr+"|"+di+"|"+xs+"|"+pi+")")+t("\\?("+mi+")")+"?"+t("\\#("+ba+")")+"?$",wI="^(){0}"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+Pr+"|"+di+"|"+cc+"|"+pi+")")+t("\\?("+mi+")")+"?"+t("\\#("+ba+")")+"?$",kI="^("+He+")\\:"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+Pr+"|"+di+"|"+xs+"|"+pi+")")+t("\\?("+mi+")")+"?$",CI="^"+t("\\#("+ba+")")+"?$",xI="^"+t("("+Pe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",v,D,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",we,Se),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",we,Se),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",we,Se),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",we,Se),"g"),NOT_QUERY:new RegExp(e("[^\\%]",we,Se,"[\\:\\@\\/\\?]",Fe),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",we,Se,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",we,Se),"g"),UNRESERVED:new RegExp(we,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",we,Ue),"g"),PCT_ENCODED:new RegExp(Te,"g"),IPV4ADDRESS:new RegExp("^("+$t+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Rr+")"+t(t("\\%25|\\%(?!"+$+"{2})")+"("+ui+")")+"?\\]?$")}}var l=o(!1),c=o(!0),u=function(){function w(v,C){var D=[],M=!0,$=!1,pe=void 0;try{for(var Ee=v[Symbol.iterator](),Te;!(M=(Te=Ee.next()).done)&&(D.push(Te.value),!(C&&D.length===C));M=!0);}catch(Qe){$=!0,pe=Qe}finally{try{!M&&Ee.return&&Ee.return()}finally{if($)throw pe}}return D}return function(v,C){if(Array.isArray(v))return v;if(Symbol.iterator in Object(v))return w(v,C);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(w){if(Array.isArray(w)){for(var v=0,C=Array(w.length);v<w.length;v++)C[v]=w[v];return C}else return Array.from(w)},m=2147483647,d=36,g=1,f=26,y=38,b=700,x=72,S=128,A="-",R=/^xn--/,k=/[^\0-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=d-g,G=Math.floor,U=String.fromCharCode;function N(w){throw new RangeError(B[w])}function T(w,v){for(var C=[],D=w.length;D--;)C[D]=v(w[D]);return C}function I(w,v){var C=w.split("@"),D="";C.length>1&&(D=C[0]+"@",w=C[1]),w=w.replace(O,".");var M=w.split("."),$=T(M,v).join(".");return D+$}function F(w){for(var v=[],C=0,D=w.length;C<D;){var M=w.charCodeAt(C++);if(M>=55296&&M<=56319&&C<D){var $=w.charCodeAt(C++);($&64512)==56320?v.push(((M&1023)<<10)+($&1023)+65536):(v.push(M),C--)}else v.push(M)}return v}var Y=function(v){return String.fromCodePoint.apply(String,p(v))},K=function(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:d},ee=function(v,C){return v+22+75*(v<26)-((C!=0)<<5)},Z=function(v,C,D){var M=0;for(v=D?G(v/b):v>>1,v+=G(v/C);v>P*f>>1;M+=d)v=G(v/P);return G(M+(P+1)*v/(v+y))},_=function(v){var C=[],D=v.length,M=0,$=S,pe=x,Ee=v.lastIndexOf(A);Ee<0&&(Ee=0);for(var Te=0;Te<Ee;++Te)v.charCodeAt(Te)>=128&&N("not-basic"),C.push(v.charCodeAt(Te));for(var Qe=Ee>0?Ee+1:0;Qe<D;){for(var Se=M,Ue=1,et=d;;et+=d){Qe>=D&&N("invalid-input");var Fe=K(v.charCodeAt(Qe++));(Fe>=d||Fe>G((m-M)/Ue))&&N("overflow"),M+=Fe*Ue;var we=et<=pe?g:et>=pe+f?f:et-pe;if(Fe<we)break;var He=d-we;Ue>G(m/He)&&N("overflow"),Ue*=He}var Pe=C.length+1;pe=Z(M-Se,Pe,Se==0),G(M/Pe)>m-$&&N("overflow"),$+=G(M/Pe),M%=Pe,C.splice(M++,0,$)}return String.fromCodePoint.apply(String,C)},ve=function(v){var C=[];v=F(v);var D=v.length,M=S,$=0,pe=x,Ee=!0,Te=!1,Qe=void 0;try{for(var Se=v[Symbol.iterator](),Ue;!(Ee=(Ue=Se.next()).done);Ee=!0){var et=Ue.value;et<128&&C.push(U(et))}}catch(wn){Te=!0,Qe=wn}finally{try{!Ee&&Se.return&&Se.return()}finally{if(Te)throw Qe}}var Fe=C.length,we=Fe;for(Fe&&C.push(A);we<D;){var He=m,Pe=!0,Sn=!1,Nt=void 0;try{for(var $t=v[Symbol.iterator](),De;!(Pe=(De=$t.next()).done);Pe=!0){var Lt=De.value;Lt>=M&&Lt<He&&(He=Lt)}}catch(wn){Sn=!0,Nt=wn}finally{try{!Pe&&$t.return&&$t.return()}finally{if(Sn)throw Nt}}var Kt=we+1;He-M>G((m-$)/Kt)&&N("overflow"),$+=(He-M)*Kt,M=He;var yr=!0,En=!1,Ir=void 0;try{for(var ha=v[Symbol.iterator](),ks;!(yr=(ks=ha.next()).done);yr=!0){var Cs=ks.value;if(Cs<M&&++$>m&&N("overflow"),Cs==M){for(var li=$,ci=d;;ci+=d){var Rr=ci<=pe?g:ci>=pe+f?f:ci-pe;if(li<Rr)break;var ui=li-Rr,lc=d-Rr;C.push(U(ee(Rr+ui%lc,0))),li=G(ui/lc)}C.push(U(ee(li,0))),pe=Z($,Kt,we==Fe),$=0,++we}}}catch(wn){En=!0,Ir=wn}finally{try{!yr&&ha.return&&ha.return()}finally{if(En)throw Ir}}++$,++M}return C.join("")},Me=function(v){return I(v,function(C){return R.test(C)?_(C.slice(4).toLowerCase()):C})},E=function(v){return I(v,function(C){return k.test(C)?"xn--"+ve(C):C})},se={version:"2.1.0",ucs2:{decode:F,encode:Y},decode:_,encode:ve,toASCII:E,toUnicode:Me},Re={};function We(w){var v=w.charCodeAt(0),C=void 0;return v<16?C="%0"+v.toString(16).toUpperCase():v<128?C="%"+v.toString(16).toUpperCase():v<2048?C="%"+(v>>6|192).toString(16).toUpperCase()+"%"+(v&63|128).toString(16).toUpperCase():C="%"+(v>>12|224).toString(16).toUpperCase()+"%"+(v>>6&63|128).toString(16).toUpperCase()+"%"+(v&63|128).toString(16).toUpperCase(),C}function Ye(w){for(var v="",C=0,D=w.length;C<D;){var M=parseInt(w.substr(C+1,2),16);if(M<128)v+=String.fromCharCode(M),C+=3;else if(M>=194&&M<224){if(D-C>=6){var $=parseInt(w.substr(C+4,2),16);v+=String.fromCharCode((M&31)<<6|$&63)}else v+=w.substr(C,6);C+=6}else if(M>=224){if(D-C>=9){var pe=parseInt(w.substr(C+4,2),16),Ee=parseInt(w.substr(C+7,2),16);v+=String.fromCharCode((M&15)<<12|(pe&63)<<6|Ee&63)}else v+=w.substr(C,9);C+=9}else v+=w.substr(C,3),C+=3}return v}function Oe(w,v){function C(D){var M=Ye(D);return M.match(v.UNRESERVED)?M:D}return w.scheme&&(w.scheme=String(w.scheme).replace(v.PCT_ENCODED,C).toLowerCase().replace(v.NOT_SCHEME,"")),w.userinfo!==void 0&&(w.userinfo=String(w.userinfo).replace(v.PCT_ENCODED,C).replace(v.NOT_USERINFO,We).replace(v.PCT_ENCODED,n)),w.host!==void 0&&(w.host=String(w.host).replace(v.PCT_ENCODED,C).toLowerCase().replace(v.NOT_HOST,We).replace(v.PCT_ENCODED,n)),w.path!==void 0&&(w.path=String(w.path).replace(v.PCT_ENCODED,C).replace(w.scheme?v.NOT_PATH:v.NOT_PATH_NOSCHEME,We).replace(v.PCT_ENCODED,n)),w.query!==void 0&&(w.query=String(w.query).replace(v.PCT_ENCODED,C).replace(v.NOT_QUERY,We).replace(v.PCT_ENCODED,n)),w.fragment!==void 0&&(w.fragment=String(w.fragment).replace(v.PCT_ENCODED,C).replace(v.NOT_FRAGMENT,We).replace(v.PCT_ENCODED,n)),w}function St(w){return w.replace(/^0*(.*)/,"$1")||"0"}function Ce(w,v){var C=w.match(v.IPV4ADDRESS)||[],D=u(C,2),M=D[1];return M?M.split(".").map(St).join("."):w}function Ae(w,v){var C=w.match(v.IPV6ADDRESS)||[],D=u(C,3),M=D[1],$=D[2];if(M){for(var pe=M.toLowerCase().split("::").reverse(),Ee=u(pe,2),Te=Ee[0],Qe=Ee[1],Se=Qe?Qe.split(":").map(St):[],Ue=Te.split(":").map(St),et=v.IPV4ADDRESS.test(Ue[Ue.length-1]),Fe=et?7:8,we=Ue.length-Fe,He=Array(Fe),Pe=0;Pe<Fe;++Pe)He[Pe]=Se[Pe]||Ue[we+Pe]||"";et&&(He[Fe-1]=Ce(He[Fe-1],v));var Sn=He.reduce(function(Kt,yr,En){if(!yr||yr==="0"){var Ir=Kt[Kt.length-1];Ir&&Ir.index+Ir.length===En?Ir.length++:Kt.push({index:En,length:1})}return Kt},[]),Nt=Sn.sort(function(Kt,yr){return yr.length-Kt.length})[0],$t=void 0;if(Nt&&Nt.length>1){var De=He.slice(0,Nt.index),Lt=He.slice(Nt.index+Nt.length);$t=De.join(":")+"::"+Lt.join(":")}else $t=He.join(":");return $&&($t+="%"+$),$t}else return w}var xt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Je="".match(/(){0}/)[1]===void 0;function _e(w){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C={},D=v.iri!==!1?c:l;v.reference==="suffix"&&(w=(v.scheme?v.scheme+":":"")+"//"+w);var M=w.match(xt);if(M){Je?(C.scheme=M[1],C.userinfo=M[3],C.host=M[4],C.port=parseInt(M[5],10),C.path=M[6]||"",C.query=M[7],C.fragment=M[8],isNaN(C.port)&&(C.port=M[5])):(C.scheme=M[1]||void 0,C.userinfo=w.indexOf("@")!==-1?M[3]:void 0,C.host=w.indexOf("//")!==-1?M[4]:void 0,C.port=parseInt(M[5],10),C.path=M[6]||"",C.query=w.indexOf("?")!==-1?M[7]:void 0,C.fragment=w.indexOf("#")!==-1?M[8]:void 0,isNaN(C.port)&&(C.port=w.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?M[4]:void 0)),C.host&&(C.host=Ae(Ce(C.host,D),D)),C.scheme===void 0&&C.userinfo===void 0&&C.host===void 0&&C.port===void 0&&!C.path&&C.query===void 0?C.reference="same-document":C.scheme===void 0?C.reference="relative":C.fragment===void 0?C.reference="absolute":C.reference="uri",v.reference&&v.reference!=="suffix"&&v.reference!==C.reference&&(C.error=C.error||"URI is not a "+v.reference+" reference.");var $=Re[(v.scheme||C.scheme||"").toLowerCase()];if(!v.unicodeSupport&&(!$||!$.unicodeSupport)){if(C.host&&(v.domainHost||$&&$.domainHost))try{C.host=se.toASCII(C.host.replace(D.PCT_ENCODED,Ye).toLowerCase())}catch(pe){C.error=C.error||"Host's domain name can not be converted to ASCII via punycode: "+pe}Oe(C,l)}else Oe(C,D);$&&$.parse&&$.parse(C,v)}else C.error=C.error||"URI can not be parsed.";return C}function sr(w,v){var C=v.iri!==!1?c:l,D=[];return w.userinfo!==void 0&&(D.push(w.userinfo),D.push("@")),w.host!==void 0&&D.push(Ae(Ce(String(w.host),C),C).replace(C.IPV6ADDRESS,function(M,$,pe){return"["+$+(pe?"%25"+pe:"")+"]"})),(typeof w.port=="number"||typeof w.port=="string")&&(D.push(":"),D.push(String(w.port))),D.length?D.join(""):void 0}var Wt=/^\.\.?\//,Ar=/^\/\.(\/|$)/,fr=/^\/\.\.(\/|$)/,Ze=/^\/?(?:.|\n)*?(?=\/|$)/;function Tt(w){for(var v=[];w.length;)if(w.match(Wt))w=w.replace(Wt,"");else if(w.match(Ar))w=w.replace(Ar,"/");else if(w.match(fr))w=w.replace(fr,"/"),v.pop();else if(w==="."||w==="..")w="";else{var C=w.match(Ze);if(C){var D=C[0];w=w.slice(D.length),v.push(D)}else throw new Error("Unexpected dot segment condition")}return v.join("")}function ht(w){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=v.iri?c:l,D=[],M=Re[(v.scheme||w.scheme||"").toLowerCase()];if(M&&M.serialize&&M.serialize(w,v),w.host&&!C.IPV6ADDRESS.test(w.host)){if(v.domainHost||M&&M.domainHost)try{w.host=v.iri?se.toUnicode(w.host):se.toASCII(w.host.replace(C.PCT_ENCODED,Ye).toLowerCase())}catch(Ee){w.error=w.error||"Host's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}Oe(w,C),v.reference!=="suffix"&&w.scheme&&(D.push(w.scheme),D.push(":"));var $=sr(w,v);if($!==void 0&&(v.reference!=="suffix"&&D.push("//"),D.push($),w.path&&w.path.charAt(0)!=="/"&&D.push("/")),w.path!==void 0){var pe=w.path;!v.absolutePath&&(!M||!M.absolutePath)&&(pe=Tt(pe)),$===void 0&&(pe=pe.replace(/^\/\//,"/%2F")),D.push(pe)}return w.query!==void 0&&(D.push("?"),D.push(w.query)),w.fragment!==void 0&&(D.push("#"),D.push(w.fragment)),D.join("")}function lt(w,v){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=arguments[3],M={};return D||(w=_e(ht(w,C),C),v=_e(ht(v,C),C)),C=C||{},!C.tolerant&&v.scheme?(M.scheme=v.scheme,M.userinfo=v.userinfo,M.host=v.host,M.port=v.port,M.path=Tt(v.path||""),M.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(M.userinfo=v.userinfo,M.host=v.host,M.port=v.port,M.path=Tt(v.path||""),M.query=v.query):(v.path?(v.path.charAt(0)==="/"?M.path=Tt(v.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?M.path="/"+v.path:w.path?M.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+v.path:M.path=v.path,M.path=Tt(M.path)),M.query=v.query):(M.path=w.path,v.query!==void 0?M.query=v.query:M.query=w.query),M.userinfo=w.userinfo,M.host=w.host,M.port=w.port),M.scheme=w.scheme),M.fragment=v.fragment,M}function jt(w,v,C){var D=s({scheme:"null"},C);return ht(lt(_e(w,D),_e(v,D),D,!0),D)}function Et(w,v){return typeof w=="string"?w=ht(_e(w,v),v):i(w)==="object"&&(w=_e(ht(w,v),v)),w}function L(w,v,C){return typeof w=="string"?w=ht(_e(w,C),C):i(w)==="object"&&(w=ht(w,C)),typeof v=="string"?v=ht(_e(v,C),C):i(v)==="object"&&(v=ht(v,C)),w===v}function W(w,v){return w&&w.toString().replace(!v||!v.iri?l.ESCAPE:c.ESCAPE,We)}function Q(w,v){return w&&w.toString().replace(!v||!v.iri?l.PCT_ENCODED:c.PCT_ENCODED,Ye)}var de={scheme:"http",domainHost:!0,parse:function(v,C){return v.host||(v.error=v.error||"HTTP URIs must have a host."),v},serialize:function(v,C){var D=String(v.scheme).toLowerCase()==="https";return(v.port===(D?443:80)||v.port==="")&&(v.port=void 0),v.path||(v.path="/"),v}},xe={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function At(w){return typeof w.secure=="boolean"?w.secure:String(w.scheme).toLowerCase()==="wss"}var Ot={scheme:"ws",domainHost:!0,parse:function(v,C){var D=v;return D.secure=At(D),D.resourceName=(D.path||"/")+(D.query?"?"+D.query:""),D.path=void 0,D.query=void 0,D},serialize:function(v,C){if((v.port===(At(v)?443:80)||v.port==="")&&(v.port=void 0),typeof v.secure=="boolean"&&(v.scheme=v.secure?"wss":"ws",v.secure=void 0),v.resourceName){var D=v.resourceName.split("?"),M=u(D,2),$=M[0],pe=M[1];v.path=$&&$!=="/"?$:void 0,v.query=pe,v.resourceName=void 0}return v.fragment=void 0,v}},qt={scheme:"wss",domainHost:Ot.domainHost,parse:Ot.parse,serialize:Ot.serialize},vn={},_n=!0,gt="[A-Za-z0-9\\-\\.\\_\\~"+(_n?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ct="[0-9A-Fa-f]",or=t(t("%[EFef]"+ct+"%"+ct+ct+"%"+ct+ct)+"|"+t("%[89A-Fa-f]"+ct+"%"+ct+ct)+"|"+t("%"+ct+ct)),mv="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",hv="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",gv=e(hv,'[\\"\\\\]'),fv="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",yv=new RegExp(gt,"g"),oi=new RegExp(or,"g"),bv=new RegExp(e("[^]",mv,"[\\.]",'[\\"]',gv),"g"),hp=new RegExp(e("[^]",gt,fv),"g"),vv=hp;function oc(w){var v=Ye(w);return v.match(yv)?v:w}var gp={scheme:"mailto",parse:function(v,C){var D=v,M=D.to=D.path?D.path.split(","):[];if(D.path=void 0,D.query){for(var $=!1,pe={},Ee=D.query.split("&"),Te=0,Qe=Ee.length;Te<Qe;++Te){var Se=Ee[Te].split("=");switch(Se[0]){case"to":for(var Ue=Se[1].split(","),et=0,Fe=Ue.length;et<Fe;++et)M.push(Ue[et]);break;case"subject":D.subject=Q(Se[1],C);break;case"body":D.body=Q(Se[1],C);break;default:$=!0,pe[Q(Se[0],C)]=Q(Se[1],C);break}}$&&(D.headers=pe)}D.query=void 0;for(var we=0,He=M.length;we<He;++we){var Pe=M[we].split("@");if(Pe[0]=Q(Pe[0]),C.unicodeSupport)Pe[1]=Q(Pe[1],C).toLowerCase();else try{Pe[1]=se.toASCII(Q(Pe[1],C).toLowerCase())}catch(Sn){D.error=D.error||"Email address's domain name can not be converted to ASCII via punycode: "+Sn}M[we]=Pe.join("@")}return D},serialize:function(v,C){var D=v,M=a(v.to);if(M){for(var $=0,pe=M.length;$<pe;++$){var Ee=String(M[$]),Te=Ee.lastIndexOf("@"),Qe=Ee.slice(0,Te).replace(oi,oc).replace(oi,n).replace(bv,We),Se=Ee.slice(Te+1);try{Se=C.iri?se.toUnicode(Se):se.toASCII(Q(Se,C).toLowerCase())}catch(we){D.error=D.error||"Email address's domain name can not be converted to "+(C.iri?"Unicode":"ASCII")+" via punycode: "+we}M[$]=Qe+"@"+Se}D.path=M.join(",")}var Ue=v.headers=v.headers||{};v.subject&&(Ue.subject=v.subject),v.body&&(Ue.body=v.body);var et=[];for(var Fe in Ue)Ue[Fe]!==vn[Fe]&&et.push(Fe.replace(oi,oc).replace(oi,n).replace(hp,We)+"="+Ue[Fe].replace(oi,oc).replace(oi,n).replace(vv,We));return et.length&&(D.query=et.join("&")),D}},_v=/^([^\:]+)\:(.*)/,fp={scheme:"urn",parse:function(v,C){var D=v.path&&v.path.match(_v),M=v;if(D){var $=C.scheme||M.scheme||"urn",pe=D[1].toLowerCase(),Ee=D[2],Te=$+":"+(C.nid||pe),Qe=Re[Te];M.nid=pe,M.nss=Ee,M.path=void 0,Qe&&(M=Qe.parse(M,C))}else M.error=M.error||"URN can not be parsed.";return M},serialize:function(v,C){var D=C.scheme||v.scheme||"urn",M=v.nid,$=D+":"+(C.nid||M),pe=Re[$];pe&&(v=pe.serialize(v,C));var Ee=v,Te=v.nss;return Ee.path=(M||C.nid)+":"+Te,Ee}},Sv=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,yp={scheme:"urn:uuid",parse:function(v,C){var D=v;return D.uuid=D.nss,D.nss=void 0,!C.tolerant&&(!D.uuid||!D.uuid.match(Sv))&&(D.error=D.error||"UUID is not valid."),D},serialize:function(v,C){var D=v;return D.nss=(v.uuid||"").toLowerCase(),D}};Re[de.scheme]=de,Re[xe.scheme]=xe,Re[Ot.scheme]=Ot,Re[qt.scheme]=qt,Re[gp.scheme]=gp,Re[fp.scheme]=fp,Re[yp.scheme]=yp,r.SCHEMES=Re,r.pctEncChar=We,r.pctDecChars=Ye,r.parse=_e,r.removeDotSegments=Tt,r.serialize=ht,r.resolveComponents=lt,r.resolve=jt,r.normalize=Et,r.equal=L,r.escapeComponent=W,r.unescapeComponent=Q,Object.defineProperty(r,"__esModule",{value:!0})})});var Do=ie((q1,xh)=>{"use strict";xh.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var i,n,a;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(n=i;n--!==0;)if(!r(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(a=Object.keys(e),i=a.length,i!==Object.keys(t).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;for(n=i;n--!==0;){var s=a[n];if(!r(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}});var Ah=ie(($1,Th)=>{"use strict";Th.exports=function(e){for(var t=0,i=e.length,n=0,a;n<i;)t++,a=e.charCodeAt(n++),a>=55296&&a<=56319&&n<i&&(a=e.charCodeAt(n),(a&64512)==56320&&n++);return t}});var $n=ie((K1,Ph)=>{"use strict";Ph.exports={copy:Pw,checkDataType:bu,checkDataTypes:Dw,coerceToTypes:Mw,toHash:_u,getProperty:Su,escapeQuotes:Eu,equal:Do(),ucs2length:Ah(),varOccurences:Lw,varReplace:Bw,schemaHasRules:Fw,schemaHasRulesExcept:Gw,schemaUnknownRules:zw,toQuotedString:vu,getPathExpr:Uw,getPath:Hw,getData:jw,unescapeFragment:qw,unescapeJsonPointer:ku,escapeFragment:$w,escapeJsonPointer:wu};function Pw(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function bu(r,e,t,i){var n=i?" !== ":" === ",a=i?" || ":" && ",s=i?"!":"",o=i?"":"!";switch(r){case"null":return e+n+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+a+"typeof "+e+n+'"object"'+a+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+a+o+"("+e+" % 1)"+a+e+n+e+(t?a+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+r+'"'+(t?a+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+r+'"'}}function Dw(r,e,t){switch(r.length){case 1:return bu(r[0],e,t,!0);default:var i="",n=_u(r);n.array&&n.object&&(i=n.null?"(":"(!"+e+" || ",i+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var a in n)i+=(i?" && ":"")+bu(a,e,t,!0);return i}}var Ih=_u(["string","number","integer","boolean","null"]);function Mw(r,e){if(Array.isArray(e)){for(var t=[],i=0;i<e.length;i++){var n=e[i];(Ih[n]||r==="array"&&n==="array")&&(t[t.length]=n)}if(t.length)return t}else{if(Ih[e])return[e];if(r==="array"&&e==="array")return["array"]}}function _u(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var Ow=/^[a-z$_][a-z$_0-9]*$/i,Nw=/'|\\/g;function Su(r){return typeof r=="number"?"["+r+"]":Ow.test(r)?"."+r:"['"+Eu(r)+"']"}function Eu(r){return r.replace(Nw,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Lw(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function Bw(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function Fw(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function Gw(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var i in r)if(i!=t&&e[i])return!0}function zw(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function vu(r){return"'"+Eu(r)+"'"}function Uw(r,e,t,i){var n=t?"'/' + "+e+(i?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):i?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Rh(r,n)}function Hw(r,e,t){var i=vu(t?"/"+wu(e):Su(e));return Rh(r,i)}var Vw=/^\/(?:[^~]|~0|~1)*$/,Ww=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function jw(r,e,t){var i,n,a,s;if(r==="")return"rootData";if(r[0]=="/"){if(!Vw.test(r))throw new Error("Invalid JSON-pointer: "+r);n=r,a="rootData"}else{if(s=r.match(Ww),!s)throw new Error("Invalid JSON-pointer: "+r);if(i=+s[1],n=s[2],n=="#"){if(i>=e)throw new Error("Cannot access property/index "+i+" levels up, current level is "+e);return t[e-i]}if(i>e)throw new Error("Cannot access data "+i+" levels up, current level is "+e);if(a="data"+(e-i||""),!n)return a}for(var o=a,l=n.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(a+=Su(ku(u)),o+=" && "+a)}return o}function Rh(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function qw(r){return ku(decodeURIComponent(r))}function $w(r){return encodeURIComponent(wu(r))}function wu(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function ku(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var Cu=ie((X1,Dh)=>{"use strict";var Kw=$n();Dh.exports=Xw;function Xw(r){Kw.copy(r,this)}});var Oh=ie((Y1,Mh)=>{"use strict";var cn=Mh.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var i=typeof t=="function"?t:t.pre||function(){},n=t.post||function(){};Mo(e,i,n,r,"",r)};cn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};cn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};cn.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};cn.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Mo(r,e,t,i,n,a,s,o,l,c){if(i&&typeof i=="object"&&!Array.isArray(i)){e(i,n,a,s,o,l,c);for(var u in i){var p=i[u];if(Array.isArray(p)){if(u in cn.arrayKeywords)for(var m=0;m<p.length;m++)Mo(r,e,t,p[m],n+"/"+u+"/"+m,a,n,u,i,m)}else if(u in cn.propsKeywords){if(p&&typeof p=="object")for(var d in p)Mo(r,e,t,p[d],n+"/"+u+"/"+Yw(d),a,n,u,i,d)}else(u in cn.keywords||r.allKeys&&!(u in cn.skipKeywords))&&Mo(r,e,t,p,n+"/"+u,a,n,u,i)}t(i,n,a,s,o,l,c)}}function Yw(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var Go=ie((J1,Fh)=>{"use strict";var Wa=Ch(),Nh=Do(),Bo=$n(),Oo=Cu(),Jw=Oh();Fh.exports=dn;dn.normalizeId=un;dn.fullPath=No;dn.url=Lo;dn.ids=rk;dn.inlineRef=xu;dn.schema=Fo;function dn(r,e,t){var i=this._refs[t];if(typeof i=="string")if(this._refs[i])i=this._refs[i];else return dn.call(this,r,e,i);if(i=i||this._schemas[t],i instanceof Oo)return xu(i.schema,this._opts.inlineRefs)?i.schema:i.validate||this._compile(i);var n=Fo.call(this,e,t),a,s,o;return n&&(a=n.schema,e=n.root,o=n.baseId),a instanceof Oo?s=a.validate||r.call(this,a.schema,e,void 0,o):a!==void 0&&(s=xu(a,this._opts.inlineRefs)?a:r.call(this,a,e,void 0,o)),s}function Fo(r,e){var t=Wa.parse(e),i=Bh(t),n=No(this._getId(r.schema));if(Object.keys(r.schema).length===0||i!==n){var a=un(i),s=this._refs[a];if(typeof s=="string")return Zw.call(this,r,s,t);if(s instanceof Oo)s.validate||this._compile(s),r=s;else if(s=this._schemas[a],s instanceof Oo){if(s.validate||this._compile(s),a==un(e))return{schema:s,root:r,baseId:n};r=s}else return;if(!r.schema)return;n=No(this._getId(r.schema))}return Lh.call(this,t,n,r.schema,r)}function Zw(r,e,t){var i=Fo.call(this,r,e);if(i){var n=i.schema,a=i.baseId;r=i.root;var s=this._getId(n);return s&&(a=Lo(a,s)),Lh.call(this,t,a,n,r)}}var Qw=Bo.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Lh(r,e,t,i){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var n=r.fragment.split("/"),a=1;a<n.length;a++){var s=n[a];if(s){if(s=Bo.unescapeFragment(s),t=t[s],t===void 0)break;var o;if(!Qw[s]&&(o=this._getId(t),o&&(e=Lo(e,o)),t.$ref)){var l=Lo(e,t.$ref),c=Fo.call(this,i,l);c&&(t=c.schema,i=c.root,e=c.baseId)}}}if(t!==void 0&&t!==i.schema)return{schema:t,root:i,baseId:e}}}var ek=Bo.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function xu(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return Tu(r);if(e)return Au(r)<=e}function Tu(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!Tu(e))return!1}else for(var i in r)if(i=="$ref"||(e=r[i],typeof e=="object"&&!Tu(e)))return!1;return!0}function Au(r){var e=0,t;if(Array.isArray(r)){for(var i=0;i<r.length;i++)if(t=r[i],typeof t=="object"&&(e+=Au(t)),e==1/0)return 1/0}else for(var n in r){if(n=="$ref")return 1/0;if(ek[n])e++;else if(t=r[n],typeof t=="object"&&(e+=Au(t)+1),e==1/0)return 1/0}return e}function No(r,e){e!==!1&&(r=un(r));var t=Wa.parse(r);return Bh(t)}function Bh(r){return Wa.serialize(r).split("#")[0]+"#"}var tk=/#\/?$/;function un(r){return r?r.replace(tk,""):""}function Lo(r,e){return e=un(e),Wa.resolve(r,e)}function rk(r){var e=un(this._getId(r)),t={"":e},i={"":No(e,!1)},n={},a=this;return Jw(r,{allKeys:!0},function(s,o,l,c,u,p,m){if(o!==""){var d=a._getId(s),g=t[c],f=i[c]+"/"+u;if(m!==void 0&&(f+="/"+(typeof m=="number"?m:Bo.escapeFragment(m))),typeof d=="string"){d=g=un(g?Wa.resolve(g,d):d);var y=a._refs[d];if(typeof y=="string"&&(y=a._refs[y]),y&&y.schema){if(!Nh(s,y.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=un(f))if(d[0]=="#"){if(n[d]&&!Nh(s,n[d]))throw new Error('id "'+d+'" resolves to more than one schema');n[d]=s}else a._refs[d]=f}t[o]=g,i[o]=f}}),n}});var zo=ie((Z1,zh)=>{"use strict";var Iu=Go();zh.exports={Validation:Gh(nk),MissingRef:Gh(Ru)};function nk(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}Ru.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function Ru(r,e,t){this.message=t||Ru.message(r,e),this.missingRef=Iu.url(r,e),this.missingSchema=Iu.normalizeId(Iu.fullPath(this.missingRef))}function Gh(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var Pu=ie((Q1,Uh)=>{"use strict";Uh.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,i=e.cmp&&function(a){return function(s){return function(o,l){var c={key:o,value:s[o]},u={key:l,value:s[l]};return a(c,u)}}}(e.cmp),n=[];return function a(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var o,l;if(Array.isArray(s)){for(l="[",o=0;o<s.length;o++)o&&(l+=","),l+=a(s[o])||"null";return l+"]"}if(s===null)return"null";if(n.indexOf(s)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=n.push(s)-1,u=Object.keys(s).sort(i&&i(s));for(l="",o=0;o<u.length;o++){var p=u[o],m=a(s[p]);m&&(l&&(l+=","),l+=JSON.stringify(p)+":"+m)}return n.splice(c,1),"{"+l+"}"}}(r)}});var Du=ie((eM,Hh)=>{"use strict";Hh.exports=function(e,t,i){var n="",a=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(n+=" var validate = ",a&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var t="false schema",u=e.level,p=e.dataLevel,m=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,R=!e.opts.allErrors,B,f="data"+(p||""),A="valid"+u;if(e.schema===!1){e.isTop?R=!0:n+=" var "+A+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+A+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var x=e.isTop,u=e.level=0,p=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,f="data"+(p||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),a&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+u+" = errors;"}var A="valid"+u,R=!e.opts.allErrors,k="",O="",B,P=e.schema.type,G=Array.isArray(P);if(P&&e.opts.nullable&&e.schema.nullable===!0&&(G?P.indexOf("null")==-1&&(P=P.concat("null")):P!="null"&&(P=[P,"null"],G=!0)),G&&P.length==1&&(P=P[0],G=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),P){if(e.opts.coerceTypes)var U=e.util.coerceToTypes(e.opts.coerceTypes,P);var N=e.RULES.types[P];if(U||G||N===!0||N&&!Ze(N)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",T=G?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[T](P,f,e.opts.strictNumbers,!0)+") { ",U){var I="dataType"+u,F="coerced"+u;n+=" var "+I+" = typeof "+f+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+I+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+I+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+F+" = "+f+"; } "),n+=" if ("+F+" !== undefined) ; ";var Y=U;if(Y)for(var K,ee=-1,Z=Y.length-1;ee<Z;)K=Y[ee+=1],K=="string"?n+=" else if ("+I+" == 'number' || "+I+" == 'boolean') "+F+" = '' + "+f+"; else if ("+f+" === null) "+F+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+I+" == 'boolean' || "+f+" === null || ("+I+" == 'string' && "+f+" && "+f+" == +"+f+" ",K=="integer"&&(n+=" && !("+f+" % 1)"),n+=")) "+F+" = +"+f+"; "):K=="boolean"?n+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+F+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+F+" = true; ":K=="null"?n+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+F+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+I+" == 'string' || "+I+" == 'number' || "+I+" == 'boolean' || "+f+" == null) "+F+" = ["+f+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+F+" !== undefined) { ";var _=p?"data"+(p-1||""):"parentData",ve=p?e.dataPathArr[p]:"parentDataProperty";n+=" "+f+" = "+F+"; ",p||(n+="if ("+_+" !== undefined)"),n+=" "+_+"["+ve+"] = "+F+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!s)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",R&&(n+=" } if (errors === ",x?n+="0":n+="errs_"+u,n+=") { ",O+="}");else{var Me=e.RULES;if(Me){for(var N,E=-1,se=Me.length-1;E<se;)if(N=Me[E+=1],Ze(N)){if(N.type&&(n+=" if ("+e.util.checkDataType(N.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(N.type=="object"&&e.schema.properties){var m=e.schema.properties,Re=Object.keys(m),We=Re;if(We)for(var Ye,Oe=-1,St=We.length-1;Oe<St;){Ye=We[Oe+=1];var Ce=m[Ye];if(Ce.default!==void 0){var Ae=f+e.util.getProperty(Ye);if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+Ae;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else n+=" if ("+Ae+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ae+" === null || "+Ae+" === '' "),n+=" ) "+Ae+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Ce.default)+" ":n+=" "+JSON.stringify(Ce.default)+" ",n+="; "}}}else if(N.type=="array"&&Array.isArray(e.schema.items)){var xt=e.schema.items;if(xt){for(var Ce,ee=-1,Je=xt.length-1;ee<Je;)if(Ce=xt[ee+=1],Ce.default!==void 0){var Ae=f+"["+ee+"]";if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+Ae;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else n+=" if ("+Ae+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ae+" === null || "+Ae+" === '' "),n+=" ) "+Ae+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Ce.default)+" ":n+=" "+JSON.stringify(Ce.default)+" ",n+="; "}}}}var _e=N.rules;if(_e){for(var sr,Wt=-1,Ar=_e.length-1;Wt<Ar;)if(sr=_e[Wt+=1],Tt(sr)){var fr=sr.code(e,sr.keyword,N.type);fr&&(n+=" "+fr+" ",R&&(k+="}"))}}if(R&&(n+=" "+k+" ",k=""),N.type&&(n+=" } ",P&&P===N.type&&!U)){n+=" else { ";var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}R&&(n+=" if (errors === ",x?n+="0":n+="errs_"+u,n+=") { ",O+="}")}}}R&&(n+=" "+O+" "),x?(a?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+A+" = errors === errs_"+u+";";function Ze(lt){for(var jt=lt.rules,Et=0;Et<jt.length;Et++)if(Tt(jt[Et]))return!0}function Tt(lt){return e.schema[lt.keyword]!==void 0||lt.implements&&ht(lt)}function ht(lt){for(var jt=lt.implements,Et=0;Et<jt.length;Et++)if(e.schema[jt[Et]]!==void 0)return!0}return n}});var $h=ie((tM,qh)=>{"use strict";var Uo=Go(),Vo=$n(),Wh=zo(),ik=Pu(),Vh=Du(),ak=Vo.ucs2length,sk=Do(),ok=Wh.Validation;qh.exports=Mu;function Mu(r,e,t,i){var n=this,a=this._opts,s=[void 0],o={},l=[],c={},u=[],p={},m=[];e=e||{schema:r,refVal:s,refs:o};var d=lk.call(this,r,e,i),g=this._compilations[d.index];if(d.compiling)return g.callValidate=S;var f=this._formats,y=this.RULES;try{var b=A(r,e,t,i);g.validate=b;var x=g.callValidate;return x&&(x.schema=b.schema,x.errors=null,x.refs=b.refs,x.refVal=b.refVal,x.root=b.root,x.$async=b.$async,a.sourceCode&&(x.source=b.source)),b}finally{ck.call(this,r,e,i)}function S(){var T=g.validate,I=T.apply(this,arguments);return S.errors=T.errors,I}function A(T,I,F,Y){var K=!I||I&&I.schema==T;if(I.schema!=e.schema)return Mu.call(n,T,I,F,Y);var ee=T.$async===!0,Z=Vh({isTop:!0,schema:T,isRoot:K,baseId:Y,root:I,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Wh.MissingRef,RULES:y,validate:Vh,util:Vo,resolve:Uo,resolveRef:R,usePattern:G,useDefault:U,useCustomRule:N,opts:a,formats:f,logger:n.logger,self:n});Z=Ho(s,pk)+Ho(l,uk)+Ho(u,dk)+Ho(m,mk)+Z,a.processCode&&(Z=a.processCode(Z,T));var _;try{var ve=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);_=ve(n,y,f,e,s,u,m,sk,ak,ok),s[0]=_}catch(Me){throw n.logger.error("Error compiling schema, function code:",Z),Me}return _.schema=T,_.errors=null,_.refs=o,_.refVal=s,_.root=K?_:I,ee&&(_.$async=!0),a.sourceCode===!0&&(_.source={code:Z,patterns:l,defaults:u}),_}function R(T,I,F){I=Uo.url(T,I);var Y=o[I],K,ee;if(Y!==void 0)return K=s[Y],ee="refVal["+Y+"]",P(K,ee);if(!F&&e.refs){var Z=e.refs[I];if(Z!==void 0)return K=e.refVal[Z],ee=k(I,K),P(K,ee)}ee=k(I);var _=Uo.call(n,A,e,I);if(_===void 0){var ve=t&&t[I];ve&&(_=Uo.inlineRef(ve,a.inlineRefs)?ve:Mu.call(n,ve,e,t,T))}if(_===void 0)O(I);else return B(I,_),P(_,ee)}function k(T,I){var F=s.length;return s[F]=I,o[T]=F,"refVal"+F}function O(T){delete o[T]}function B(T,I){var F=o[T];s[F]=I}function P(T,I){return typeof T=="object"||typeof T=="boolean"?{code:I,schema:T,inline:!0}:{code:I,$async:T&&!!T.$async}}function G(T){var I=c[T];return I===void 0&&(I=c[T]=l.length,l[I]=T),"pattern"+I}function U(T){switch(typeof T){case"boolean":case"number":return""+T;case"string":return Vo.toQuotedString(T);case"object":if(T===null)return"null";var I=ik(T),F=p[I];return F===void 0&&(F=p[I]=u.length,u[F]=T),"default"+F}}function N(T,I,F,Y){if(n._opts.validateSchema!==!1){var K=T.definition.dependencies;if(K&&!K.every(function(We){return Object.prototype.hasOwnProperty.call(F,We)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var ee=T.definition.validateSchema;if(ee){var Z=ee(I);if(!Z){var _="keyword schema is invalid: "+n.errorsText(ee.errors);if(n._opts.validateSchema=="log")n.logger.error(_);else throw new Error(_)}}}var ve=T.definition.compile,Me=T.definition.inline,E=T.definition.macro,se;if(ve)se=ve.call(n,I,F,Y);else if(E)se=E.call(n,I,F,Y),a.validateSchema!==!1&&n.validateSchema(se,!0);else if(Me)se=Me.call(n,Y,T.keyword,I,F);else if(se=T.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+T.keyword+'"failed to compile');var Re=m.length;return m[Re]=se,{code:"customRule"+Re,validate:se}}}function lk(r,e,t){var i=jh.call(this,r,e,t);return i>=0?{index:i,compiling:!0}:(i=this._compilations.length,this._compilations[i]={schema:r,root:e,baseId:t},{index:i,compiling:!1})}function ck(r,e,t){var i=jh.call(this,r,e,t);i>=0&&this._compilations.splice(i,1)}function jh(r,e,t){for(var i=0;i<this._compilations.length;i++){var n=this._compilations[i];if(n.schema==r&&n.root==e&&n.baseId==t)return i}return-1}function uk(r,e){return"var pattern"+r+" = new RegExp("+Vo.toQuotedString(e[r])+");"}function dk(r){return"var default"+r+" = defaults["+r+"];"}function pk(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function mk(r){return"var customRule"+r+" = customRules["+r+"];"}function Ho(r,e){if(!r.length)return"";for(var t="",i=0;i<r.length;i++)t+=e(i,r);return t}});var Xh=ie((rM,Kh)=>{"use strict";var Wo=Kh.exports=function(){this._cache={}};Wo.prototype.put=function(e,t){this._cache[e]=t};Wo.prototype.get=function(e){return this._cache[e]};Wo.prototype.del=function(e){delete this._cache[e]};Wo.prototype.clear=function(){this._cache={}}});var og=ie((nM,sg)=>{"use strict";var hk=$n(),gk=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fk=[0,31,28,31,30,31,30,31,31,30,31,30,31],yk=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Yh=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,bk=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,vk=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Jh=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Zh=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Qh=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,eg=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tg=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,rg=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;sg.exports=jo;function jo(r){return r=r=="full"?"full":"fast",hk.copy(jo[r])}jo.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Jh,url:Zh,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Yh,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ag,uuid:Qh,"json-pointer":eg,"json-pointer-uri-fragment":tg,"relative-json-pointer":rg};jo.full={date:ng,time:ig,"date-time":Ek,uri:kk,"uri-reference":vk,"uri-template":Jh,url:Zh,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Yh,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ag,uuid:Qh,"json-pointer":eg,"json-pointer-uri-fragment":tg,"relative-json-pointer":rg};function _k(r){return r%4===0&&(r%100!==0||r%400===0)}function ng(r){var e=r.match(gk);if(!e)return!1;var t=+e[1],i=+e[2],n=+e[3];return i>=1&&i<=12&&n>=1&&n<=(i==2&&_k(t)?29:fk[i])}function ig(r,e){var t=r.match(yk);if(!t)return!1;var i=t[1],n=t[2],a=t[3],s=t[5];return(i<=23&&n<=59&&a<=59||i==23&&n==59&&a==60)&&(!e||s)}var Sk=/t|\s/i;function Ek(r){var e=r.split(Sk);return e.length==2&&ng(e[0])&&ig(e[1],!0)}var wk=/\/|:/;function kk(r){return wk.test(r)&&bk.test(r)}var Ck=/[^\\]\\Z/;function ag(r){if(Ck.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var cg=ie((iM,lg)=>{"use strict";lg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),p="valid"+a,m,d;if(o=="#"||o=="#/")e.isRoot?(m=e.async,d="validate"):(m=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===void 0){var f=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(f);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(f),c&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,f)}else if(g.inline){var x=e.util.copy(e);x.level++;var S="valid"+x.level;x.schema=g.schema,x.schemaPath="",x.errSchemaPath=o;var A=e.validate(x).replace(/validate\.schema/g,g.code);n+=" "+A+" ",c&&(n+=" if ("+S+") { ")}else m=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+d+".call(this, ":n+=" "+d+"( ",n+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var R=s?"data"+(s-1||""):"parentData",k=s?e.dataPathArr[s]:"parentDataProperty";n+=" , "+R+" , "+k+", rootData) ";var O=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(n+=" var "+p+"; "),n+=" try { await "+O+"; ",c&&(n+=" "+p+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(n+=" "+p+" = false; "),n+=" } ",c&&(n+=" if ("+p+") { ")}else n+=" if (!"+O+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(n+=" else { ")}return n}});var dg=ie((aM,ug)=>{"use strict";ug.exports=function(e,t,i){var n=" ",a=e.schema[t],s=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,m=c.baseId,d=!0,g=a;if(g)for(var f,y=-1,b=g.length-1;y<b;)f=g[y+=1],(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all))&&(d=!1,c.schema=f,c.schemaPath=s+"["+y+"]",c.errSchemaPath=o+"/"+y,n+=" "+e.validate(c)+" ",c.baseId=m,l&&(n+=" if ("+p+") { ",u+="}"));return l&&(d?n+=" if (true) { ":n+=" "+u.slice(0,-1)+" "),n}});var mg=ie((sM,pg)=>{"use strict";pg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d="errs__"+a,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b=o.every(function(B){return e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all)});if(b){var x=g.baseId;n+=" var "+d+" = errors; var "+m+" = false; ";var S=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=o;if(A)for(var R,k=-1,O=A.length-1;k<O;)R=A[k+=1],g.schema=R,g.schemaPath=l+"["+k+"]",g.errSchemaPath=c+"/"+k,n+=" "+e.validate(g)+" ",g.baseId=x,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",f+="}";e.compositeRule=g.compositeRule=S,n+=" "+f+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else u&&(n+=" if (true) { ");return n}});var gg=ie((oM,hg)=>{"use strict";hg.exports=function(e,t,i){var n=" ",a=e.schema[t],s=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,l=e.util.toQuotedString(a);return e.opts.$comment===!0?n+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+e.util.toQuotedString(s)+", validate.root.schema);"),n}});var yg=ie((lM,fg)=>{"use strict";fg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+a):g=o,d||(n+=" var schema"+a+" = validate.schema"+l+";"),n+="var "+m+" = equal("+p+", schema"+a+"); if (!"+m+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var vg=ie((cM,bg)=>{"use strict";bg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d="errs__"+a,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b="i"+a,x=g.dataLevel=e.dataLevel+1,S="data"+x,A=e.baseId,R=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(n+="var "+d+" = errors;var "+m+";",R){var k=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+y+" = false; for (var "+b+" = 0; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var O=p+"["+b+"]";g.dataPathArr[x]=b;var B=e.validate(g);g.baseId=A,e.util.varOccurences(B,S)<2?n+=" "+e.util.varReplace(B,S,O)+" ":n+=" var "+S+" = "+O+"; "+B+" ",n+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=k,n+=" "+f+" if (!"+y+") {"}else n+=" if ("+p+".length == 0) {";var P=P||[];P.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var G=n;return n=P.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+G+"]); ":n+=" validate.errors = ["+G+"]; return false; ":n+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",R&&(n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n}});var Sg=ie((uM,_g)=>{"use strict";_g.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+a,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y={},b={},x=e.opts.ownProperties;for(k in o)if(k!="__proto__"){var S=o[k],A=Array.isArray(S)?b:y;A[k]=S}n+="var "+m+" = errors;";var R=e.errorPath;n+="var missing"+a+";";for(var k in b)if(A=b[k],A.length){if(n+=" if ( "+p+e.util.getProperty(k)+" !== undefined ",x&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),u){n+=" && ( ";var O=A;if(O)for(var B,P=-1,G=O.length-1;P<G;){B=O[P+=1],P&&(n+=" || ");var U=e.util.getProperty(B),N=p+U;n+=" ( ( "+N+" === undefined ",x&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?B:U)+") ) "}n+=")) { ";var T="missing"+a,I="' + "+T+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(R,T,!0):R+" + "+T);var F=F||[];F.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+I+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",A.length==1?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Y=n;n=F.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Y+"]); ":n+=" validate.errors = ["+Y+"]; return false; ":n+=" var err = "+Y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=A;if(K)for(var B,ee=-1,Z=K.length-1;ee<Z;){B=K[ee+=1];var U=e.util.getProperty(B),I=e.util.escapeQuotes(B),N=p+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(R,B,e.opts.jsonPointers)),n+=" if ( "+N+" === undefined ",x&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+I+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",A.length==1?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",u&&(g+="}",n+=" else { ")}e.errorPath=R;var _=d.baseId;for(var k in y){var S=y[k];(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(n+=" "+f+" = true; if ( "+p+e.util.getProperty(k)+" !== undefined ",x&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),n+=") { ",d.schema=S,d.schemaPath=l+e.util.getProperty(k),d.errSchemaPath=c+"/"+e.util.escapeFragment(k),n+=" "+e.validate(d)+" ",d.baseId=_,n+=" } ",u&&(n+=" if ("+f+") { ",g+="}"))}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var wg=ie((dM,Eg)=>{"use strict";Eg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+a):g=o;var f="i"+a,y="schema"+a;d||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+m+";",d&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+f+"=0; "+f+"<"+y+".length; "+f+"++) if (equal("+p+", "+y+"["+f+"])) { "+m+" = true; break; }",d&&(n+=" } "),n+=" if (!"+m+") { ";var b=b||[];b.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+a+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;return n=b.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var Cg=ie((pM,kg)=>{"use strict";kg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||"");if(e.opts.format===!1)return u&&(n+=" if (true) { "),n;var m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o;var g=e.opts.unknownFormats,f=Array.isArray(g);if(m){var y="format"+a,b="isObject"+a,x="formatType"+a;n+=" var "+y+" = formats["+d+"]; var "+b+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+x+" = "+b+" && "+y+".type || 'string'; if ("+b+") { ",e.async&&(n+=" var async"+a+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+d+" && !"+y+" ",f&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+y+" && "+x+" == '"+i+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+a+" ? await "+y+"("+p+") : "+y+"("+p+")) ":n+=" "+y+"("+p+") ",n+=" : "+y+".test("+p+"))))) {"}else{var y=e.formats[o];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(n+=" if (true) { "),n;if(f&&g.indexOf(o)>=0)return u&&(n+=" if (true) { "),n;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var b=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,x=b&&y.type||"string";if(b){var S=y.async===!0;y=y.validate}if(x!=i)return u&&(n+=" if (true) { "),n;if(S){if(!e.async)throw new Error("async format in sync schema");var A="formats"+e.util.getProperty(o)+".validate";n+=" if (!(await "+A+"("+p+"))) { "}else{n+=" if (! ";var A="formats"+e.util.getProperty(o);b&&(A+=".validate"),typeof y=="function"?n+=" "+A+"("+p+") ":n+=" "+A+".test("+p+") ",n+=") { "}}var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",m?n+=""+d:n+=""+e.util.toQuotedString(o),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(o),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(o),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var k=n;return n=R.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Tg=ie((mM,xg)=>{"use strict";xg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d="errs__"+a,g=e.util.copy(e);g.level++;var f="valid"+g.level,y=e.schema.then,b=e.schema.else,x=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),S=b!==void 0&&(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all)),A=g.baseId;if(x||S){var R;g.createErrors=!1,g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+d+" = errors; var "+m+" = true; ";var k=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=A,g.createErrors=!0,n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=k,x?(n+=" if ("+f+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+m+" = "+f+"; ",x&&S?(R="ifClause"+a,n+=" var "+R+" = 'then'; "):R="'then'",n+=" } ",S&&(n+=" else { ")):n+=" if (!"+f+") { ",S&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+m+" = "+f+"; ",x&&S?(R="ifClause"+a,n+=" var "+R+" = 'else'; "):R="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+R+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+R+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Ig=ie((hM,Ag)=>{"use strict";Ag.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d="errs__"+a,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b="i"+a,x=g.dataLevel=e.dataLevel+1,S="data"+x,A=e.baseId;if(n+="var "+d+" = errors;var "+m+";",Array.isArray(o)){var R=e.schema.additionalItems;if(R===!1){n+=" "+m+" = "+p+".length <= "+o.length+"; ";var k=c;c=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var B=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+B+"]); ":n+=" validate.errors = ["+B+"]; return false; ":n+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c=k,u&&(f+="}",n+=" else { ")}var P=o;if(P){for(var G,U=-1,N=P.length-1;U<N;)if(G=P[U+=1],e.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:e.util.schemaHasRules(G,e.RULES.all)){n+=" "+y+" = true; if ("+p+".length > "+U+") { ";var T=p+"["+U+"]";g.schema=G,g.schemaPath=l+"["+U+"]",g.errSchemaPath=c+"/"+U,g.errorPath=e.util.getPathExpr(e.errorPath,U,e.opts.jsonPointers,!0),g.dataPathArr[x]=U;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",n+=" } ",u&&(n+=" if ("+y+") { ",f+="}")}}if(typeof R=="object"&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))){g.schema=R,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+p+".length > "+o.length+") { for (var "+b+" = "+o.length+"; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var T=p+"["+b+"]";g.dataPathArr[x]=b;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",u&&(n+=" if (!"+y+") break; "),n+=" } } ",u&&(n+=" if ("+y+") { ",f+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" for (var "+b+" = 0; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var T=p+"["+b+"]";g.dataPathArr[x]=b;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",u&&(n+=" if (!"+y+") break; "),n+=" }"}return u&&(n+=" "+f+" if ("+d+" == errors) {"),n}});var Ou=ie((gM,Rg)=>{"use strict";Rg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,A,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o;var g=t=="maximum",f=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[f],b=e.opts.$data&&y&&y.$data,x=g?"<":">",S=g?">":"<",A=void 0;if(!(m||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(b||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(f+" must be number or boolean");if(b){var R=e.util.getData(y.$data,s,e.dataPathArr),k="exclusive"+a,O="exclType"+a,B="exclIsNumber"+a,P="op"+a,G="' + "+P+" + '";n+=" var schemaExcl"+a+" = "+R+"; ",R="schemaExcl"+a,n+=" var "+k+"; var "+O+" = typeof "+R+"; if ("+O+" != 'boolean' && "+O+" != 'undefined' && "+O+" != 'number') { ";var A=f,U=U||[];U.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(A||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var N=n;n=U.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+N+"]); ":n+=" validate.errors = ["+N+"]; return false; ":n+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+O+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+R+" "+x+"= "+d+") ? "+p+" "+S+"= "+R+" : "+p+" "+S+" "+d+" ) : ( ("+k+" = "+R+" === true) ? "+p+" "+S+"= "+d+" : "+p+" "+S+" "+d+" ) || "+p+" !== "+p+") { var op"+a+" = "+k+" ? '"+x+"' : '"+x+"='; ",o===void 0&&(A=f,c=e.errSchemaPath+"/"+f,d=R,m=b)}else{var B=typeof y=="number",G=x;if(B&&m){var P="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" ( "+d+" === undefined || "+y+" "+x+"= "+d+" ? "+p+" "+S+"= "+y+" : "+p+" "+S+" "+d+" ) || "+p+" !== "+p+") { "}else{B&&o===void 0?(k=!0,A=f,c=e.errSchemaPath+"/"+f,d=y,S+="="):(B&&(d=Math[g?"min":"max"](y,o)),y===(B?d:!0)?(k=!0,A=f,c=e.errSchemaPath+"/"+f,S+="="):(k=!1,G+="="));var P="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+" "+S+" "+d+" || "+p+" !== "+p+") { "}}A=A||t;var U=U||[];U.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(A||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+P+", limit: "+d+", exclusive: "+k+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+G+" ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var N=n;return n=U.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+N+"]); ":n+=" validate.errors = ["+N+"]; return false; ":n+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Nu=ie((fM,Pg)=>{"use strict";Pg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+".length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Lu=ie((yM,Dg)=>{"use strict";Dg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?n+=" "+p+".length ":n+=" ucs2length("+p+") ",n+=" "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",t=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Bu=ie((bM,Mg)=>{"use strict";Mg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" Object.keys("+p+").length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Ng=ie((vM,Og)=>{"use strict";Og.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");n+="var division"+a+";if (",m&&(n+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),n+=" (division"+a+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var f=n;return n=g.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+f+"]); ":n+=" validate.errors = ["+f+"]; return false; ":n+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Bg=ie((_M,Lg)=>{"use strict";Lg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+a,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c,n+=" var "+m+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var y;d.opts.allErrors&&(y=d.opts.allErrors,d.opts.allErrors=!1),n+=" "+e.validate(d)+" ",d.createErrors=!0,y&&(d.opts.allErrors=y),e.compositeRule=d.compositeRule=f,n+=" if ("+g+") { ";var b=b||[];b.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=b.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ");return n}});var Gg=ie((SM,Fg)=>{"use strict";Fg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d="errs__"+a,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b=g.baseId,x="prevValid"+a,S="passingSchemas"+a;n+="var "+d+" = errors , "+x+" = false , "+m+" = false , "+S+" = null; ";var A=e.compositeRule;e.compositeRule=g.compositeRule=!0;var R=o;if(R)for(var k,O=-1,B=R.length-1;O<B;)k=R[O+=1],(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))?(g.schema=k,g.schemaPath=l+"["+O+"]",g.errSchemaPath=c+"/"+O,n+=" "+e.validate(g)+" ",g.baseId=b):n+=" var "+y+" = true; ",O&&(n+=" if ("+y+" && "+x+") { "+m+" = false; "+S+" = ["+S+", "+O+"]; } else { ",f+="}"),n+=" if ("+y+") { "+m+" = "+x+" = true; "+S+" = "+O+"; }";return e.compositeRule=g.compositeRule=A,n+=""+f+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+S+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}});var Ug=ie((EM,zg)=>{"use strict";zg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+a):d=o;var g=m?"(new RegExp("+d+"))":e.usePattern(o);n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" !"+g+".test("+p+") ) { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",m?n+=""+d:n+=""+e.util.toQuotedString(o),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(o),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(o),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Vg=ie((wM,Hg)=>{"use strict";Hg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+a,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y="key"+a,b="idx"+a,x=d.dataLevel=e.dataLevel+1,S="data"+x,A="dataProperties"+a,R=Object.keys(o||{}).filter(ee),k=e.schema.patternProperties||{},O=Object.keys(k).filter(ee),B=e.schema.additionalProperties,P=R.length||O.length,G=B===!1,U=typeof B=="object"&&Object.keys(B).length,N=e.opts.removeAdditional,T=G||U||N,I=e.opts.ownProperties,F=e.baseId,Y=e.schema.required;if(Y&&!(e.opts.$data&&Y.$data)&&Y.length<e.opts.loopRequired)var K=e.util.toHash(Y);function ee(Q){return Q!=="__proto__"}if(n+="var "+m+" = errors;var "+f+" = true;",I&&(n+=" var "+A+" = undefined;"),T){if(I?n+=" "+A+" = "+A+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+A+".length; "+b+"++) { var "+y+" = "+A+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",P){if(n+=" var isAdditional"+a+" = !(false ",R.length)if(R.length>8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var Z=R;if(Z)for(var _,ve=-1,Me=Z.length-1;ve<Me;)_=Z[ve+=1],n+=" || "+y+" == "+e.util.toQuotedString(_)+" "}if(O.length){var E=O;if(E)for(var se,Re=-1,We=E.length-1;Re<We;)se=E[Re+=1],n+=" || "+e.usePattern(se)+".test("+y+") "}n+=" ); if (isAdditional"+a+") { "}if(N=="all")n+=" delete "+p+"["+y+"]; ";else{var Ye=e.errorPath,Oe="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),G)if(N)n+=" delete "+p+"["+y+"]; ";else{n+=" "+f+" = false; ";var St=c;c=e.errSchemaPath+"/additionalProperties";var Ce=Ce||[];Ce.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Oe+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ae=n;n=Ce.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ae+"]); ":n+=" validate.errors = ["+Ae+"]; return false; ":n+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=St,u&&(n+=" break; ")}else if(U)if(N=="failing"){n+=" var "+m+" = errors; ";var xt=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=B,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Je=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Je)+" ":n+=" var "+S+" = "+Je+"; "+_e+" ",n+=" if (!"+f+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+y+"]; } ",e.compositeRule=d.compositeRule=xt}else{d.schema=B,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Je=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Je)+" ":n+=" var "+S+" = "+Je+"; "+_e+" ",u&&(n+=" if (!"+f+") break; ")}e.errorPath=Ye}P&&(n+=" } "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}var sr=e.opts.useDefaults&&!e.compositeRule;if(R.length){var Wt=R;if(Wt)for(var _,Ar=-1,fr=Wt.length-1;Ar<fr;){_=Wt[Ar+=1];var Ze=o[_];if(e.opts.strictKeywords?typeof Ze=="object"&&Object.keys(Ze).length>0||Ze===!1:e.util.schemaHasRules(Ze,e.RULES.all)){var Tt=e.util.getProperty(_),Je=p+Tt,ht=sr&&Ze.default!==void 0;d.schema=Ze,d.schemaPath=l+Tt,d.errSchemaPath=c+"/"+e.util.escapeFragment(_),d.errorPath=e.util.getPath(e.errorPath,_,e.opts.jsonPointers),d.dataPathArr[x]=e.util.toQuotedString(_);var _e=e.validate(d);if(d.baseId=F,e.util.varOccurences(_e,S)<2){_e=e.util.varReplace(_e,S,Je);var lt=Je}else{var lt=S;n+=" var "+S+" = "+Je+"; "}if(ht)n+=" "+_e+" ";else{if(K&&K[_]){n+=" if ( "+lt+" === undefined ",I&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = false; ";var Ye=e.errorPath,St=c,jt=e.util.escapeQuotes(_);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ye,_,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Ce=Ce||[];Ce.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+jt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+jt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ae=n;n=Ce.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ae+"]); ":n+=" validate.errors = ["+Ae+"]; return false; ":n+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=St,e.errorPath=Ye,n+=" } else { "}else u?(n+=" if ( "+lt+" === undefined ",I&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = true; } else { "):(n+=" if ("+lt+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=" ) { ");n+=" "+_e+" } "}}u&&(n+=" if ("+f+") { ",g+="}")}}if(O.length){var Et=O;if(Et)for(var se,L=-1,W=Et.length-1;L<W;){se=Et[L+=1];var Ze=k[se];if(e.opts.strictKeywords?typeof Ze=="object"&&Object.keys(Ze).length>0||Ze===!1:e.util.schemaHasRules(Ze,e.RULES.all)){d.schema=Ze,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),I?n+=" "+A+" = "+A+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+A+".length; "+b+"++) { var "+y+" = "+A+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" if ("+e.usePattern(se)+".test("+y+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Je=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Je)+" ":n+=" var "+S+" = "+Je+"; "+_e+" ",u&&(n+=" if (!"+f+") break; "),n+=" } ",u&&(n+=" else "+f+" = true; "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}}}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var jg=ie((kM,Wg)=>{"use strict";Wg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+a,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c;var y="key"+a,b="idx"+a,x="i"+a,S="' + "+y+" + '",A=d.dataLevel=e.dataLevel+1,R="data"+A,k="dataProperties"+a,O=e.opts.ownProperties,B=e.baseId;O&&(n+=" var "+k+" = undefined; "),O?n+=" "+k+" = "+k+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+k+".length; "+b+"++) { var "+y+" = "+k+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" var startErrs"+a+" = errors; ";var P=y,G=e.compositeRule;e.compositeRule=d.compositeRule=!0;var U=e.validate(d);d.baseId=B,e.util.varOccurences(U,R)<2?n+=" "+e.util.varReplace(U,R,P)+" ":n+=" var "+R+" = "+P+"; "+U+" ",e.compositeRule=d.compositeRule=G,n+=" if (!"+f+") { for (var "+x+"=startErrs"+a+"; "+x+"<errors; "+x+"++) { vErrors["+x+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+S+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+S+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),u&&(n+=" break; "),n+=" } }"}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var $g=ie((CM,qg)=>{"use strict";qg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+a):g=o;var f="schema"+a;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],b=o;if(b)for(var x,S=-1,A=b.length-1;S<A;){x=b[S+=1];var R=e.schema.properties[x];R&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))||(y[y.length]=x)}}else var y=o;if(d||y.length){var k=e.errorPath,O=d||y.length>=e.opts.loopRequired,B=e.opts.ownProperties;if(u)if(n+=" var missing"+a+"; ",O){d||(n+=" var "+f+" = validate.schema"+l+"; ");var P="i"+a,G="schema"+a+"["+P+"]",U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,G,e.opts.jsonPointers)),n+=" var "+m+" = true; ",d&&(n+=" if (schema"+a+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+a+")) "+m+" = false; else {"),n+=" for (var "+P+" = 0; "+P+" < "+f+".length; "+P+"++) { "+m+" = "+p+"["+f+"["+P+"]] !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", "+f+"["+P+"]) "),n+="; if (!"+m+") break; } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var N=N||[];N.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=N.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var I=y;if(I)for(var F,P=-1,Y=I.length-1;P<Y;){F=I[P+=1],P&&(n+=" || ");var K=e.util.getProperty(F),ee=p+K;n+=" ( ( "+ee+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") && (missing"+a+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:K)+") ) "}n+=") { ";var G="missing"+a,U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,G,!0):k+" + "+G);var N=N||[];N.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=N.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(O){d||(n+=" var "+f+" = validate.schema"+l+"; ");var P="i"+a,G="schema"+a+"["+P+"]",U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,G,e.opts.jsonPointers)),d&&(n+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),n+=" for (var "+P+" = 0; "+P+" < "+f+".length; "+P+"++) { if ("+p+"["+f+"["+P+"]] === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+f+"["+P+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(n+=" } ")}else{var Z=y;if(Z)for(var F,_=-1,ve=Z.length-1;_<ve;){F=Z[_+=1];var K=e.util.getProperty(F),U=e.util.escapeQuotes(F),ee=p+K;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,F,e.opts.jsonPointers)),n+=" if ( "+ee+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=k}else u&&(n+=" if (true) {");return n}});var Xg=ie((xM,Kg)=>{"use strict";Kg.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+a,d=e.opts.$data&&o&&o.$data,g;if(d?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+a):g=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(n+=" var "+m+"; if ("+g+" === false || "+g+" === undefined) "+m+" = true; else if (typeof "+g+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+p+".length , "+m+" = true , j; if (i > 1) { ";var f=e.schema.items&&e.schema.items.type,y=Array.isArray(f);if(!f||f=="object"||f=="array"||y&&(f.indexOf("object")>=0||f.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var b="checkDataType"+(y?"s":"");n+=" if ("+e.util[b](f,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var x=x||[];x.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",d?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var S=n;n=x.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+S+"]); ":n+=" validate.errors = ["+S+"]; return false; ":n+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Jg=ie((TM,Yg)=>{"use strict";Yg.exports={$ref:cg(),allOf:dg(),anyOf:mg(),$comment:gg(),const:yg(),contains:vg(),dependencies:Sg(),enum:wg(),format:Cg(),if:Tg(),items:Ig(),maximum:Ou(),minimum:Ou(),maxItems:Nu(),minItems:Nu(),maxLength:Lu(),minLength:Lu(),maxProperties:Bu(),minProperties:Bu(),multipleOf:Ng(),not:Bg(),oneOf:Gg(),pattern:Ug(),properties:Vg(),propertyNames:jg(),required:$g(),uniqueItems:Xg(),validate:Du()}});var ef=ie((AM,Qg)=>{"use strict";var Zg=Jg(),Fu=$n().toHash;Qg.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],i=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Fu(t),e.types=Fu(n),e.forEach(function(a){a.rules=a.rules.map(function(s){var o;if(typeof s=="object"){var l=Object.keys(s)[0];o=s[l],s=l,o.forEach(function(u){t.push(u),e.all[u]=!0})}t.push(s);var c=e.all[s]={keyword:s,code:Zg[s],implements:o};return c}),e.all.$comment={keyword:"$comment",code:Zg.$comment},a.type&&(e.types[a.type]=a)}),e.keywords=Fu(t.concat(i)),e.custom={},e}});var nf=ie((IM,rf)=>{"use strict";var tf=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];rf.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var i=e[t].split("/"),n=r,a;for(a=1;a<i.length;a++)n=n[i[a]];for(a=0;a<tf.length;a++){var s=tf[a],o=n[s];o&&(n[s]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var of=ie((RM,sf)=>{"use strict";var xk=zo().MissingRef;sf.exports=af;function af(r,e,t){var i=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var n=a(r).then(function(){var o=i._addSchema(r,void 0,e);return o.validate||s(o)});return t&&n.then(function(o){t(null,o)},t),n;function a(o){var l=o.$schema;return l&&!i.getSchema(l)?af.call(i,{$ref:l},!0):Promise.resolve()}function s(o){try{return i._compile(o)}catch(c){if(c instanceof xk)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=i._loadingSchemas[u];return p||(p=i._loadingSchemas[u]=i._opts.loadSchema(u),p.then(m,m)),p.then(function(g){if(!d(u))return a(g).then(function(){d(u)||i.addSchema(g,u,void 0,e)})}).then(function(){return s(o)});function m(){delete i._loadingSchemas[u]}function d(g){return i._refs[g]||i._schemas[g]}}}}});var cf=ie((PM,lf)=>{"use strict";lf.exports=function(e,t,i){var n=" ",a=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p,m="data"+(s||""),d="valid"+a,g="errs__"+a,f=e.opts.$data&&o&&o.$data,y;f?(n+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",y="schema"+a):y=o;var b=this,x="definition"+a,S=b.definition,A="",R,k,O,B,P;if(f&&S.$data){P="keywordValidate"+a;var G=S.validateSchema;n+=" var "+x+" = RULES.custom['"+t+"'].definition; var "+P+" = "+x+".validate;"}else{if(B=e.useCustomRule(b,o,e.schema,e),!B)return;y="validate.schema"+l,P=B.code,R=S.compile,k=S.inline,O=S.macro}var U=P+".errors",N="i"+a,T="ruleErr"+a,I=S.async;if(I&&!e.async)throw new Error("async keyword in sync schema");if(k||O||(n+=""+U+" = null;"),n+="var "+g+" = errors;var "+d+";",f&&S.$data&&(A+="}",n+=" if ("+y+" === undefined) { "+d+" = true; } else { ",G&&(A+="}",n+=" "+d+" = "+x+".validateSchema("+y+"); if ("+d+") { ")),k)S.statements?n+=" "+B.validate+" ":n+=" "+d+" = "+B.validate+"; ";else if(O){var F=e.util.copy(e),A="";F.level++;var Y="valid"+F.level;F.schema=B.validate,F.schemaPath="";var K=e.compositeRule;e.compositeRule=F.compositeRule=!0;var ee=e.validate(F).replace(/validate\.schema/g,P);e.compositeRule=F.compositeRule=K,n+=" "+ee}else{var Z=Z||[];Z.push(n),n="",n+=" "+P+".call( ",e.opts.passContext?n+="this":n+="self",R||S.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var _=s?"data"+(s-1||""):"parentData",ve=s?e.dataPathArr[s]:"parentDataProperty";n+=" , "+_+" , "+ve+" , rootData ) ";var Me=n;n=Z.pop(),S.errors===!1?(n+=" "+d+" = ",I&&(n+="await "),n+=""+Me+"; "):I?(U="customErrors"+a,n+=" var "+U+" = null; try { "+d+" = await "+Me+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+U+" = e.errors; else throw e; } "):n+=" "+U+" = null; "+d+" = "+Me+"; "}if(S.modifying&&(n+=" if ("+_+") "+m+" = "+_+"["+ve+"];"),n+=""+A,S.valid)u&&(n+=" if (true) { ");else{n+=" if ( ",S.valid===void 0?(n+=" !",O?n+=""+Y:n+=""+d):n+=" "+!S.valid+" ",n+=") { ",p=b.keyword;var Z=Z||[];Z.push(n),n="";var Z=Z||[];Z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+b.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var E=n;n=Z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+E+"]); ":n+=" validate.errors = ["+E+"]; return false; ":n+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=n;n=Z.pop(),k?S.errors?S.errors!="full"&&(n+=" for (var "+N+"="+g+"; "+N+"<errors; "+N+"++) { var "+T+" = vErrors["+N+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } "):S.errors===!1?n+=" "+se+" ":(n+=" if ("+g+" == errors) { "+se+" } else { for (var "+N+"="+g+"; "+N+"<errors; "+N+"++) { var "+T+" = vErrors["+N+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } } "):O?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+b.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):S.errors===!1?n+=" "+se+" ":(n+=" if (Array.isArray("+U+")) { if (vErrors === null) vErrors = "+U+"; else vErrors = vErrors.concat("+U+"); errors = vErrors.length; for (var "+N+"="+g+"; "+N+"<errors; "+N+"++) { var "+T+" = vErrors["+N+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; "+T+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } } else { "+se+" } "),n+=" } ",u&&(n+=" else { ")}return n}});var Gu=ie((DM,Tk)=>{Tk.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var pf=ie((MM,df)=>{"use strict";var uf=Gu();df.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:uf.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:uf.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var hf=ie((OM,mf)=>{"use strict";var Ak=/^[a-z_$][a-z0-9_$-]*$/i,Ik=cf(),Rk=pf();mf.exports={add:Pk,get:Dk,remove:Mk,validate:zu};function Pk(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!Ak.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var i=e.type;if(Array.isArray(i))for(var n=0;n<i.length;n++)s(r,i[n],e);else s(r,i,e);var a=e.metaSchema;a&&(e.$data&&this._opts.$data&&(a={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(a,!0))}t.keywords[r]=t.all[r]=!0;function s(o,l,c){for(var u,p=0;p<t.length;p++){var m=t[p];if(m.type==l){u=m;break}}u||(u={type:l,rules:[]},t.push(u));var d={keyword:o,definition:c,custom:!0,code:Ik,implements:c.implements};u.rules.push(d),t.custom[o]=d}return this}function Dk(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function Mk(r){var e=this.RULES;delete e.keywords[r],delete e.all[r],delete e.custom[r];for(var t=0;t<e.length;t++)for(var i=e[t].rules,n=0;n<i.length;n++)if(i[n].keyword==r){i.splice(n,1);break}return this}function zu(r,e){zu.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Rk,!0);if(t(r))return!0;if(zu.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var gf=ie((NM,Ok)=>{Ok.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Cf=ie((LM,kf)=>{"use strict";var yf=$h(),Kn=Go(),Nk=Xh(),bf=Cu(),Lk=Pu(),Bk=og(),Fk=ef(),vf=nf(),_f=$n();kf.exports=je;je.prototype.validate=zk;je.prototype.compile=Uk;je.prototype.addSchema=Hk;je.prototype.addMetaSchema=Vk;je.prototype.validateSchema=Wk;je.prototype.getSchema=qk;je.prototype.removeSchema=Kk;je.prototype.addFormat=rC;je.prototype.errorsText=tC;je.prototype._addSchema=Xk;je.prototype._compile=Yk;je.prototype.compileAsync=of();var Ko=hf();je.prototype.addKeyword=Ko.add;je.prototype.getKeyword=Ko.get;je.prototype.removeKeyword=Ko.remove;je.prototype.validateKeyword=Ko.validate;var Sf=zo();je.ValidationError=Sf.Validation;je.MissingRefError=Sf.MissingRef;je.$dataMetaSchema=vf;var $o="http://json-schema.org/draft-07/schema",ff=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Gk=["/properties"];function je(r){if(!(this instanceof je))return new je(r);r=this._opts=_f.copy(r)||{},lC(this),this._schemas={},this._refs={},this._fragments={},this._formats=Bk(r.format),this._cache=r.cache||new Nk,this._loadingSchemas={},this._compilations=[],this.RULES=Fk(),this._getId=Jk(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=Lk),this._metaOpts=oC(this),r.formats&&aC(this),r.keywords&&sC(this),nC(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),iC(this)}function zk(r,e){var t;if(typeof r=="string"){if(t=this.getSchema(r),!t)throw new Error('no schema with key or ref "'+r+'"')}else{var i=this._addSchema(r);t=i.validate||this._compile(i)}var n=t(e);return t.$async!==!0&&(this.errors=t.errors),n}function Uk(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function Hk(r,e,t,i){if(Array.isArray(r)){for(var n=0;n<r.length;n++)this.addSchema(r[n],void 0,t,i);return this}var a=this._getId(r);if(a!==void 0&&typeof a!="string")throw new Error("schema id must be string");return e=Kn.normalizeId(e||a),wf(this,e),this._schemas[e]=this._addSchema(r,t,i,!0),this}function Vk(r,e,t){return this.addSchema(r,e,t,!0),this}function Wk(r,e){var t=r.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||jk(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var i=this.validate(t,r);if(!i&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return i}function jk(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema($o)?$o:void 0,r._opts.defaultMeta}function qk(r){var e=Ef(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return $k(this,r)}}function $k(r,e){var t=Kn.schema.call(r,{schema:{}},e);if(t){var i=t.schema,n=t.root,a=t.baseId,s=yf.call(r,i,n,void 0,a);return r._fragments[e]=new bf({ref:e,fragment:!0,schema:i,root:n,baseId:a,validate:s}),s}}function Ef(r,e){return e=Kn.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function Kk(r){if(r instanceof RegExp)return qo(this,this._schemas,r),qo(this,this._refs,r),this;switch(typeof r){case"undefined":return qo(this,this._schemas),qo(this,this._refs),this._cache.clear(),this;case"string":var e=Ef(this,r);return e&&this._cache.del(e.cacheKey),delete this._schemas[r],delete this._refs[r],this;case"object":var t=this._opts.serialize,i=t?t(r):r;this._cache.del(i);var n=this._getId(r);n&&(n=Kn.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function qo(r,e,t){for(var i in e){var n=e[i];!n.meta&&(!t||t.test(i))&&(r._cache.del(n.cacheKey),delete e[i])}}function Xk(r,e,t,i){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,a=n?n(r):r,s=this._cache.get(a);if(s)return s;i=i||this._opts.addUsedSchema!==!1;var o=Kn.normalizeId(this._getId(r));o&&i&&wf(this,o);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=o&&o==Kn.normalizeId(r.$schema))&&this.validateSchema(r,!0);var u=Kn.ids.call(this,r),p=new bf({id:o,schema:r,localRefs:u,cacheKey:a,meta:t});return o[0]!="#"&&i&&(this._refs[o]=p),this._cache.put(a,p),l&&c&&this.validateSchema(r,!0),p}function Yk(r,e){if(r.compiling)return r.validate=n,n.schema=r.schema,n.errors=null,n.root=e||n,r.schema.$async===!0&&(n.$async=!0),n;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var i;try{i=yf.call(this,r.schema,e,r.localRefs)}catch(a){throw delete r.validate,a}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=i,r.refs=i.refs,r.refVal=i.refVal,r.root=i.root,i;function n(){var a=r.validate,s=a.apply(this,arguments);return n.errors=a.errors,s}}function Jk(r){switch(r.schemaId){case"auto":return eC;case"id":return Zk;default:return Qk}}function Zk(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function Qk(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function eC(r){if(r.$id&&r.id&&r.$id!=r.id)throw new Error("schema $id is different from id");return r.$id||r.id}function tC(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,i=e.dataVar===void 0?"data":e.dataVar,n="",a=0;a<r.length;a++){var s=r[a];s&&(n+=i+s.dataPath+" "+s.message+t)}return n.slice(0,-t.length)}function rC(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function nC(r){var e;if(r._opts.$data&&(e=gf(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=Gu();r._opts.$data&&(t=vf(t,Gk)),r.addMetaSchema(t,$o,!0),r._refs["http://json-schema.org/schema"]=$o}}function iC(r){var e=r._opts.schemas;if(e)if(Array.isArray(e))r.addSchema(e);else for(var t in e)r.addSchema(e[t],t)}function aC(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function sC(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function wf(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function oC(r){for(var e=_f.copy(r._opts),t=0;t<ff.length;t++)delete e[ff[t]];return e}function lC(r){var e=r._opts.logger;if(e===!1)r.logger={log:Uu,warn:Uu,error:Uu};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");r.logger=e}}function Uu(){}});var Ub=ie((E3,zb)=>{"use strict";var Wl=Object.prototype.hasOwnProperty,Gb=Object.prototype.toString,Mb=Object.defineProperty,Ob=Object.getOwnPropertyDescriptor,Nb=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Gb.call(e)==="[object Array]"},Lb=function(e){if(!e||Gb.call(e)!=="[object Object]")return!1;var t=Wl.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&Wl.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!i)return!1;var n;for(n in e);return typeof n>"u"||Wl.call(e,n)},Bb=function(e,t){Mb&&t.name==="__proto__"?Mb(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Fb=function(e,t){if(t==="__proto__")if(Wl.call(e,t)){if(Ob)return Ob(e,t).value}else return;return e[t]};zb.exports=function r(){var e,t,i,n,a,s,o=arguments[0],l=1,c=arguments.length,u=!1;for(typeof o=="boolean"&&(u=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<c;++l)if(e=arguments[l],e!=null)for(t in e)i=Fb(o,t),n=Fb(e,t),o!==n&&(u&&n&&(Lb(n)||(a=Nb(n)))?(a?(a=!1,s=i&&Nb(i)?i:[]):s=i&&Lb(i)?i:{},Bb(o,{name:t,newValue:r(u,s,n)})):typeof n<"u"&&Bb(o,{name:t,newValue:n}));return o}});var uv=ie(be=>{"use strict";var ws=Symbol.for("react.element"),iI=Symbol.for("react.portal"),aI=Symbol.for("react.fragment"),sI=Symbol.for("react.strict_mode"),oI=Symbol.for("react.profiler"),lI=Symbol.for("react.provider"),cI=Symbol.for("react.context"),uI=Symbol.for("react.forward_ref"),dI=Symbol.for("react.suspense"),pI=Symbol.for("react.memo"),mI=Symbol.for("react.lazy"),Qb=Symbol.iterator;function hI(r){return r===null||typeof r!="object"?null:(r=Qb&&r[Qb]||r["@@iterator"],typeof r=="function"?r:null)}var rv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nv=Object.assign,iv={};function ma(r,e,t){this.props=r,this.context=e,this.refs=iv,this.updater=t||rv}ma.prototype.isReactComponent={};ma.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};ma.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function av(){}av.prototype=ma.prototype;function up(r,e,t){this.props=r,this.context=e,this.refs=iv,this.updater=t||rv}var dp=up.prototype=new av;dp.constructor=up;nv(dp,ma.prototype);dp.isPureReactComponent=!0;var ev=Array.isArray,sv=Object.prototype.hasOwnProperty,pp={current:null},ov={key:!0,ref:!0,__self:!0,__source:!0};function lv(r,e,t){var i,n={},a=null,s=null;if(e!=null)for(i in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(a=""+e.key),e)sv.call(e,i)&&!ov.hasOwnProperty(i)&&(n[i]=e[i]);var o=arguments.length-2;if(o===1)n.children=t;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];n.children=l}if(r&&r.defaultProps)for(i in o=r.defaultProps,o)n[i]===void 0&&(n[i]=o[i]);return{$$typeof:ws,type:r,key:a,ref:s,props:n,_owner:pp.current}}function gI(r,e){return{$$typeof:ws,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function mp(r){return typeof r=="object"&&r!==null&&r.$$typeof===ws}function fI(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var tv=/\/+/g;function cp(r,e){return typeof r=="object"&&r!==null&&r.key!=null?fI(""+r.key):e.toString(36)}function ac(r,e,t,i,n){var a=typeof r;(a==="undefined"||a==="boolean")&&(r=null);var s=!1;if(r===null)s=!0;else switch(a){case"string":case"number":s=!0;break;case"object":switch(r.$$typeof){case ws:case iI:s=!0}}if(s)return s=r,n=n(s),r=i===""?"."+cp(s,0):i,ev(n)?(t="",r!=null&&(t=r.replace(tv,"$&/")+"/"),ac(n,e,t,"",function(c){return c})):n!=null&&(mp(n)&&(n=gI(n,t+(!n.key||s&&s.key===n.key?"":(""+n.key).replace(tv,"$&/")+"/")+r)),e.push(n)),1;if(s=0,i=i===""?".":i+":",ev(r))for(var o=0;o<r.length;o++){a=r[o];var l=i+cp(a,o);s+=ac(a,e,t,l,n)}else if(l=hI(r),typeof l=="function")for(r=l.call(r),o=0;!(a=r.next()).done;)a=a.value,l=i+cp(a,o++),s+=ac(a,e,t,l,n);else if(a==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function ic(r,e,t){if(r==null)return r;var i=[],n=0;return ac(r,i,"","",function(a){return e.call(t,a,n++)}),i}function yI(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var Ct={current:null},sc={transition:null},bI={ReactCurrentDispatcher:Ct,ReactCurrentBatchConfig:sc,ReactCurrentOwner:pp};function cv(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:ic,forEach:function(r,e,t){ic(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return ic(r,function(){e++}),e},toArray:function(r){return ic(r,function(e){return e})||[]},only:function(r){if(!mp(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};be.Component=ma;be.Fragment=aI;be.Profiler=oI;be.PureComponent=up;be.StrictMode=sI;be.Suspense=dI;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bI;be.act=cv;be.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var i=nv({},r.props),n=r.key,a=r.ref,s=r._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,s=pp.current),e.key!==void 0&&(n=""+e.key),r.type&&r.type.defaultProps)var o=r.type.defaultProps;for(l in e)sv.call(e,l)&&!ov.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];i.children=o}return{$$typeof:ws,type:r.type,key:n,ref:a,props:i,_owner:s}};be.createContext=function(r){return r={$$typeof:cI,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:lI,_context:r},r.Consumer=r};be.createElement=lv;be.createFactory=function(r){var e=lv.bind(null,r);return e.type=r,e};be.createRef=function(){return{current:null}};be.forwardRef=function(r){return{$$typeof:uI,render:r}};be.isValidElement=mp;be.lazy=function(r){return{$$typeof:mI,_payload:{_status:-1,_result:r},_init:yI}};be.memo=function(r,e){return{$$typeof:pI,type:r,compare:e===void 0?null:e}};be.startTransition=function(r){var e=sc.transition;sc.transition={};try{r()}finally{sc.transition=e}};be.unstable_act=cv;be.useCallback=function(r,e){return Ct.current.useCallback(r,e)};be.useContext=function(r){return Ct.current.useContext(r)};be.useDebugValue=function(){};be.useDeferredValue=function(r){return Ct.current.useDeferredValue(r)};be.useEffect=function(r,e){return Ct.current.useEffect(r,e)};be.useId=function(){return Ct.current.useId()};be.useImperativeHandle=function(r,e,t){return Ct.current.useImperativeHandle(r,e,t)};be.useInsertionEffect=function(r,e){return Ct.current.useInsertionEffect(r,e)};be.useLayoutEffect=function(r,e){return Ct.current.useLayoutEffect(r,e)};be.useMemo=function(r,e){return Ct.current.useMemo(r,e)};be.useReducer=function(r,e,t){return Ct.current.useReducer(r,e,t)};be.useRef=function(r){return Ct.current.useRef(r)};be.useState=function(r){return Ct.current.useState(r)};be.useSyncExternalStore=function(r,e,t){return Ct.current.useSyncExternalStore(r,e,t)};be.useTransition=function(){return Ct.current.useTransition()};be.version="18.3.1"});var pv=ie((eV,dv)=>{"use strict";dv.exports=uv()});var ut=[];for(Ts=0;Ts<256;++Ts)ut.push((Ts+256).toString(16).slice(1));var Ts;function Ep(r,e=0){return(ut[r[e+0]]+ut[r[e+1]]+ut[r[e+2]]+ut[r[e+3]]+"-"+ut[r[e+4]]+ut[r[e+5]]+"-"+ut[r[e+6]]+ut[r[e+7]]+"-"+ut[r[e+8]]+ut[r[e+9]]+"-"+ut[r[e+10]]+ut[r[e+11]]+ut[r[e+12]]+ut[r[e+13]]+ut[r[e+14]]+ut[r[e+15]]).toLowerCase()}var As,Iv=new Uint8Array(16);function pc(){if(!As&&(As=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!As))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return As(Iv)}var Rv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mc={randomUUID:Rv};function Pv(r,e,t){if(mc.randomUUID&&!e&&!r)return mc.randomUUID();r=r||{};var i=r.random||(r.rng||pc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=i[n];return e}return Ep(i)}var Ge=Pv;function hc(r){let e=(r||"").split(`
|
|
2
|
-
`);for(;e.length>0&&e[0].trim()=="";)e.shift();for(;e.length>0&&e[e.length-1].trim()=="";)e.pop();let t=1/0;for(let i of e){let n=i.match(/^\s*/)?.[0].length||0;t=Math.min(t,n)}return t>0&&t<1/0&&(e=e.map(i=>i.substring(t))),e.join(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`);if(a==-1)break;let s=e.slice(0,a);e=e.slice(a+2);let o={},l=s.split(`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`,yield*t()}function kp(){if(Be().userID)return Be().userID||"";if(typeof localStorage<"u"){let r=localStorage.getItem("intelliweave.uid")||"";return r||(r=Ge(),localStorage.setItem("intelliweave.uid",r),r)}else return Ge()}function Cp(r){let e=r;if(e?.type=="object"&&e.properties)return r;let t={type:"object",properties:{},required:[]};if(r&&Array.isArray(r)){let i=r;for(let n of i)t.properties[n.name]={type:n.type||"string",description:n.description||""}}return t}var Is=class Is{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return Is.debug?!0:typeof window<"u"&&Be().debug}log(...e){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...e)}debug(...e){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...e)}info(...e){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...e)}warn(...e){console.warn(`[IntelliWeave > ${this.module}]`,...e)}error(...e){console.error(`[IntelliWeave > ${this.module}]`,...e)}timer(e,...t){let i=Date.now();return this.debug(`[${e} 0ms] Started`,...t),(...n)=>this.debug(`[${e} ${Math.floor(Date.now()-i)}ms]`,...n)}};Is.debug=!1;var ge=Is;var xp=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~",[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],"\0","","","","","","","\x07","\b"," ",`
|
|
1
|
+
import{b as P,c as rc,d as ep,e as ct}from"./chunk-AIYMQX7V.js";var tu=P(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.regexpCode=Ve.getEsmExportName=Ve.getProperty=Ve.safeStringify=Ve.stringify=Ve.strConcat=Ve.addCodeArg=Ve.str=Ve._=Ve.nil=Ve._Code=Ve.Name=Ve.IDENTIFIER=Ve._CodeOrName=void 0;var Qc=class{};Ve._CodeOrName=Qc;Ve.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var po=class extends Qc{constructor(e){if(super(),!Ve.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Ve.Name=po;var _n=class extends Qc{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof po&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Ve._Code=_n;Ve.nil=new _n("");function yI(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Yv(r,e[n]),r.push(t[++n]);return new _n(r)}Ve._=yI;var Xv=new _n("+");function bI(t,...e){let r=[eu(t[0])],n=0;for(;n<e.length;)r.push(Xv),Yv(r,e[n]),r.push(Xv,eu(t[++n]));return hj(r),new _n(r)}Ve.str=bI;function Yv(t,e){e instanceof _n?t.push(...e._items):e instanceof po?t.push(e):t.push(yj(e))}Ve.addCodeArg=Yv;function hj(t){let e=1;for(;e<t.length-1;){if(t[e]===Xv){let r=fj(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function fj(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof po||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof po))return`"${t}${e.slice(1)}`}function gj(t,e){return e.emptyStr()?t:t.emptyStr()?e:bI`${t}${e}`}Ve.strConcat=gj;function yj(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:eu(Array.isArray(t)?t.join(","):t)}function bj(t){return new _n(eu(t))}Ve.stringify=bj;function eu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ve.safeStringify=eu;function vj(t){return typeof t=="string"&&Ve.IDENTIFIER.test(t)?new _n(`.${t}`):yI`[${t}]`}Ve.getProperty=vj;function _j(t){if(typeof t=="string"&&Ve.IDENTIFIER.test(t))return new _n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Ve.getEsmExportName=_j;function Sj(t){return new _n(t.toString())}Ve.regexpCode=Sj});var t_=P(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.ValueScope=jr.ValueScopeName=jr.Scope=jr.varKinds=jr.UsedValueState=void 0;var Br=tu(),Qv=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Mm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Mm||(jr.UsedValueState=Mm={}));jr.varKinds={const:new Br.Name("const"),let:new Br.Name("let"),var:new Br.Name("var")};var $m=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Br.Name?e:this.name(e)}name(e){return new Br.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};jr.Scope=$m;var Lm=class extends Br.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Br._)`.${new Br.Name(r)}[${n}]`}};jr.ValueScopeName=Lm;var wj=(0,Br._)`\n`,e_=class extends $m{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?wj:Br.nil}}get(){return this._scope}name(e){return new Lm(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Br._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Br.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,Mm.Started);let u=r(c);if(u){let d=this.opts.es5?jr.varKinds.var:jr.varKinds.const;a=(0,Br._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Br._)`${a}${u}${this.opts._n}`;else throw new Qv(c);l.set(c,Mm.Completed)})}return a}};jr.ValueScope=e_});var Ne=P(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.or=Ie.and=Ie.not=Ie.CodeGen=Ie.operators=Ie.varKinds=Ie.ValueScopeName=Ie.ValueScope=Ie.Scope=Ie.Name=Ie.regexpCode=Ie.stringify=Ie.getProperty=Ie.nil=Ie.strConcat=Ie.str=Ie._=void 0;var ze=tu(),Bn=t_(),wa=tu();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return wa._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return wa.str}});Object.defineProperty(Ie,"strConcat",{enumerable:!0,get:function(){return wa.strConcat}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return wa.nil}});Object.defineProperty(Ie,"getProperty",{enumerable:!0,get:function(){return wa.getProperty}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return wa.stringify}});Object.defineProperty(Ie,"regexpCode",{enumerable:!0,get:function(){return wa.regexpCode}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return wa.Name}});var jm=t_();Object.defineProperty(Ie,"Scope",{enumerable:!0,get:function(){return jm.Scope}});Object.defineProperty(Ie,"ValueScope",{enumerable:!0,get:function(){return jm.ValueScope}});Object.defineProperty(Ie,"ValueScopeName",{enumerable:!0,get:function(){return jm.ValueScopeName}});Object.defineProperty(Ie,"varKinds",{enumerable:!0,get:function(){return jm.varKinds}});Ie.operators={GT:new ze._Code(">"),GTE:new ze._Code(">="),LT:new ze._Code("<"),LTE:new ze._Code("<="),EQ:new ze._Code("==="),NEQ:new ze._Code("!=="),NOT:new ze._Code("!"),OR:new ze._Code("||"),AND:new ze._Code("&&"),ADD:new ze._Code("+")};var Bi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},r_=class extends Bi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Bn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=el(this.rhs,e,r)),this}get names(){return this.rhs instanceof ze._CodeOrName?this.rhs.names:{}}},zm=class extends Bi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ze.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=el(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ze.Name?{}:{...this.lhs.names};return Bm(e,this.rhs)}},n_=class extends zm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},i_=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},a_=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},o_=class extends Bi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},s_=class extends Bi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=el(this.code,e,r),this}get names(){return this.code instanceof ze._CodeOrName?this.code.names:{}}},ru=class extends Bi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(kj(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>fo(e,r.names),{})}},ji=class extends ru{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},l_=class extends ru{},Qs=class extends ji{};Qs.kind="else";var mo=class t extends ji{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qs(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(vI(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=el(this.condition,e,r),this}get names(){let e=super.names;return Bm(e,this.condition),this.else&&fo(e,this.else.names),e}};mo.kind="if";var ho=class extends ji{};ho.kind="for";var c_=class extends ho{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=el(this.iteration,e,r),this}get names(){return fo(super.names,this.iteration.names)}},u_=class extends ho{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Bn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=Bm(super.names,this.from);return Bm(e,this.to)}},Fm=class extends ho{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=el(this.iterable,e,r),this}get names(){return fo(super.names,this.iterable.names)}},nu=class extends ji{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};nu.kind="func";var iu=class extends ru{render(e){return"return "+super.render(e)}};iu.kind="return";var d_=class extends ji{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&fo(e,this.catch.names),this.finally&&fo(e,this.finally.names),e}},au=class extends ji{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};au.kind="catch";var ou=class extends ji{render(e){return"finally"+super.render(e)}};ou.kind="finally";var p_=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=e,this._scope=new Bn.Scope({parent:e}),this._nodes=[new l_]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new r_(e,a,n)),a}const(e,r,n){return this._def(Bn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Bn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Bn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new zm(e,r,n))}add(e,r){return this._leafNode(new n_(e,Ie.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ze.nil&&this._leafNode(new s_(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ze.addCodeArg)(r,i));return r.push("}"),new ze._Code(r)}if(e,r,n){if(this._blockNode(new mo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mo(e))}else(){return this._elseNode(new Qs)}endIf(){return this._endBlockNode(mo,Qs)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new c_(e),r)}forRange(e,r,n,i,a=this.opts.es5?Bn.varKinds.var:Bn.varKinds.let){let o=this._scope.toName(e);return this._for(new u_(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Bn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ze.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ze._)`${o}.length`,s=>{this.var(a,(0,ze._)`${o}[${s}]`),n(a)})}return this._for(new Fm("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Bn.varKinds.var:Bn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ze._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new Fm("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(ho)}label(e){return this._leafNode(new i_(e))}break(e){return this._leafNode(new a_(e))}return(e){let r=new iu;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(iu)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new d_;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new au(a),r(a)}return n&&(this._currNode=i.finally=new ou,this.code(n)),this._endBlockNode(au,ou)}throw(e){return this._leafNode(new o_(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ze.nil,n,i){return this._blockNode(new nu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(nu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ie.CodeGen=p_;function fo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Bm(t,e){return e instanceof ze._CodeOrName?fo(t,e.names):t}function el(t,e,r){if(t instanceof ze.Name)return n(t);if(!i(t))return t;return new ze._Code(t._items.reduce((a,o)=>(o instanceof ze.Name&&(o=n(o)),o instanceof ze._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof ze._Code&&a._items.some(o=>o instanceof ze.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function kj(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function vI(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ze._)`!${m_(t)}`}Ie.not=vI;var xj=_I(Ie.operators.AND);function Ej(...t){return t.reduce(xj)}Ie.and=Ej;var Tj=_I(Ie.operators.OR);function Cj(...t){return t.reduce(Tj)}Ie.or=Cj;function _I(t){return(e,r)=>e===ze.nil?r:r===ze.nil?e:(0,ze._)`${m_(e)} ${t} ${m_(r)}`}function m_(t){return t instanceof ze.Name?t:(0,ze._)`(${t})`}});var He=P(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.checkStrictMode=Oe.getErrorPath=Oe.Type=Oe.useFunc=Oe.setEvaluated=Oe.evaluatedPropsToName=Oe.mergeEvaluated=Oe.eachItem=Oe.unescapeJsonPointer=Oe.escapeJsonPointer=Oe.escapeFragment=Oe.unescapeFragment=Oe.schemaRefOrVal=Oe.schemaHasRulesButRef=Oe.schemaHasRules=Oe.checkUnknownRules=Oe.alwaysValidSchema=Oe.toHash=void 0;var st=Ne(),Ij=tu();function Aj(t){let e={};for(let r of t)e[r]=!0;return e}Oe.toHash=Aj;function Pj(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(kI(t,e),!xI(e,t.self.RULES.all))}Oe.alwaysValidSchema=Pj;function kI(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||CI(t,`unknown keyword: "${a}"`)}Oe.checkUnknownRules=kI;function xI(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Oe.schemaHasRules=xI;function Rj(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Oe.schemaHasRulesButRef=Rj;function Nj({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,st._)`${r}`}return(0,st._)`${t}${e}${(0,st.getProperty)(n)}`}Oe.schemaRefOrVal=Nj;function Oj(t){return EI(decodeURIComponent(t))}Oe.unescapeFragment=Oj;function Dj(t){return encodeURIComponent(f_(t))}Oe.escapeFragment=Dj;function f_(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Oe.escapeJsonPointer=f_;function EI(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Oe.unescapeJsonPointer=EI;function Mj(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Oe.eachItem=Mj;function SI({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof st.Name?(a instanceof st.Name?t(i,a,o):e(i,a,o),o):a instanceof st.Name?(e(i,o,a),a):r(a,o);return s===st.Name&&!(l instanceof st.Name)?n(i,l):l}}Oe.mergeEvaluated={props:SI({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,st._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,st._)`${r} || {}`).code((0,st._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,st._)`${r} || {}`),g_(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:TI}),items:SI({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,st._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,st._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function TI(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,st._)`{}`);return e!==void 0&&g_(t,r,e),r}Oe.evaluatedPropsToName=TI;function g_(t,e,r){Object.keys(r).forEach(n=>t.assign((0,st._)`${e}${(0,st.getProperty)(n)}`,!0))}Oe.setEvaluated=g_;var wI={};function $j(t,e){return t.scopeValue("func",{ref:e,code:wI[e.code]||(wI[e.code]=new Ij._Code(e.code))})}Oe.useFunc=$j;var h_;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(h_||(Oe.Type=h_={}));function Lj(t,e,r){if(t instanceof st.Name){let n=e===h_.Num;return r?n?(0,st._)`"[" + ${t} + "]"`:(0,st._)`"['" + ${t} + "']"`:n?(0,st._)`"/" + ${t}`:(0,st._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,st.getProperty)(t).toString():"/"+f_(t)}Oe.getErrorPath=Lj;function CI(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Oe.checkStrictMode=CI});var Ui=P(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var gr=Ne(),zj={data:new gr.Name("data"),valCxt:new gr.Name("valCxt"),instancePath:new gr.Name("instancePath"),parentData:new gr.Name("parentData"),parentDataProperty:new gr.Name("parentDataProperty"),rootData:new gr.Name("rootData"),dynamicAnchors:new gr.Name("dynamicAnchors"),vErrors:new gr.Name("vErrors"),errors:new gr.Name("errors"),this:new gr.Name("this"),self:new gr.Name("self"),scope:new gr.Name("scope"),json:new gr.Name("json"),jsonPos:new gr.Name("jsonPos"),jsonLen:new gr.Name("jsonLen"),jsonPart:new gr.Name("jsonPart")};y_.default=zj});var su=P(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendErrors=yr.resetErrorsCount=yr.reportExtraError=yr.reportError=yr.keyword$DataError=yr.keywordError=void 0;var je=Ne(),Um=He(),Tr=Ui();yr.keywordError={message:({keyword:t})=>(0,je.str)`must pass "${t}" keyword validation`};yr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,je.str)`"${t}" keyword must be ${e} ($data)`:(0,je.str)`"${t}" keyword is invalid ($data)`};function Fj(t,e=yr.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=PI(t,e,r);n??(o||s)?II(a,l):AI(i,(0,je._)`[${l}]`)}yr.reportError=Fj;function Bj(t,e=yr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=PI(t,e,r);II(i,s),a||o||AI(n,Tr.default.vErrors)}yr.reportExtraError=Bj;function jj(t,e){t.assign(Tr.default.errors,e),t.if((0,je._)`${Tr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,je._)`${Tr.default.vErrors}.length`,e),()=>t.assign(Tr.default.vErrors,null)))}yr.resetErrorsCount=jj;function Uj({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Tr.default.errors,s=>{t.const(o,(0,je._)`${Tr.default.vErrors}[${s}]`),t.if((0,je._)`${o}.instancePath === undefined`,()=>t.assign((0,je._)`${o}.instancePath`,(0,je.strConcat)(Tr.default.instancePath,a.errorPath))),t.assign((0,je._)`${o}.schemaPath`,(0,je.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,je._)`${o}.schema`,r),t.assign((0,je._)`${o}.data`,n))})}yr.extendErrors=Uj;function II(t,e){let r=t.const("err",e);t.if((0,je._)`${Tr.default.vErrors} === null`,()=>t.assign(Tr.default.vErrors,(0,je._)`[${r}]`),(0,je._)`${Tr.default.vErrors}.push(${r})`),t.code((0,je._)`${Tr.default.errors}++`)}function AI(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,je._)`new ${t.ValidationError}(${e})`):(r.assign((0,je._)`${n}.errors`,e),r.return(!1))}var go={keyword:new je.Name("keyword"),schemaPath:new je.Name("schemaPath"),params:new je.Name("params"),propertyName:new je.Name("propertyName"),message:new je.Name("message"),schema:new je.Name("schema"),parentSchema:new je.Name("parentSchema")};function PI(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,je._)`{}`:Gj(t,e,r)}function Gj(t,e,r={}){let{gen:n,it:i}=t,a=[Vj(i,r),Hj(t,r)];return qj(t,e,a),n.object(...a)}function Vj({errorPath:t},{instancePath:e}){let r=e?(0,je.str)`${t}${(0,Um.getErrorPath)(e,Um.Type.Str)}`:t;return[Tr.default.instancePath,(0,je.strConcat)(Tr.default.instancePath,r)]}function Hj({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,je.str)`${e}/${t}`;return r&&(i=(0,je.str)`${i}${(0,Um.getErrorPath)(r,Um.Type.Str)}`),[go.schemaPath,i]}function qj(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([go.keyword,i],[go.params,typeof e=="function"?e(t):e||(0,je._)`{}`]),l.messages&&n.push([go.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([go.schema,o],[go.parentSchema,(0,je._)`${u}${d}`],[Tr.default.data,a]),c&&n.push([go.propertyName,c])}});var NI=P(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.boolOrEmptySchema=tl.topBoolOrEmptySchema=void 0;var Wj=su(),Zj=Ne(),Kj=Ui(),Jj={message:"boolean schema is false"};function Xj(t){let{gen:e,schema:r,validateName:n}=t;r===!1?RI(t,!1):typeof r=="object"&&r.$async===!0?e.return(Kj.default.data):(e.assign((0,Zj._)`${n}.errors`,null),e.return(!0))}tl.topBoolOrEmptySchema=Xj;function Yj(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),RI(t)):r.var(e,!0)}tl.boolOrEmptySchema=Yj;function RI(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Wj.reportError)(i,Jj,void 0,e)}});var b_=P(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.getRules=rl.isJSONType=void 0;var Qj=["string","number","integer","boolean","null","object","array"],eU=new Set(Qj);function tU(t){return typeof t=="string"&&eU.has(t)}rl.isJSONType=tU;function rU(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}rl.getRules=rU});var v_=P(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.shouldUseRule=ka.shouldUseGroup=ka.schemaHasRulesForType=void 0;function nU({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&OI(t,n)}ka.schemaHasRulesForType=nU;function OI(t,e){return e.rules.some(r=>DI(t,r))}ka.shouldUseGroup=OI;function DI(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ka.shouldUseRule=DI});var lu=P(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.reportTypeError=br.checkDataTypes=br.checkDataType=br.coerceAndCheckDataType=br.getJSONTypes=br.getSchemaTypes=br.DataType=void 0;var iU=b_(),aU=v_(),oU=su(),ke=Ne(),MI=He(),nl;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(nl||(br.DataType=nl={}));function sU(t){let e=$I(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}br.getSchemaTypes=sU;function $I(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(iU.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}br.getJSONTypes=$I;function lU(t,e){let{gen:r,data:n,opts:i}=t,a=cU(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,aU.schemaHasRulesForType)(t,e[0]));if(o){let s=S_(e,n,i.strictNumbers,nl.Wrong);r.if(s,()=>{a.length?uU(t,e,a):w_(t)})}return o}br.coerceAndCheckDataType=lU;var LI=new Set(["string","number","integer","boolean","null"]);function cU(t,e){return e?t.filter(r=>LI.has(r)||e==="array"&&r==="array"):[]}function uU(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,ke._)`typeof ${i}`),s=n.let("coerced",(0,ke._)`undefined`);a.coerceTypes==="array"&&n.if((0,ke._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ke._)`${i}[0]`).assign(o,(0,ke._)`typeof ${i}`).if(S_(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,ke._)`${s} !== undefined`);for(let c of r)(LI.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),w_(t),n.endIf(),n.if((0,ke._)`${s} !== undefined`,()=>{n.assign(i,s),dU(t,s)});function l(c){switch(c){case"string":n.elseIf((0,ke._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,ke._)`"" + ${i}`).elseIf((0,ke._)`${i} === null`).assign(s,(0,ke._)`""`);return;case"number":n.elseIf((0,ke._)`${o} == "boolean" || ${i} === null
|
|
3
|
+
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,ke._)`+${i}`);return;case"integer":n.elseIf((0,ke._)`${o} === "boolean" || ${i} === null
|
|
4
|
+
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,ke._)`+${i}`);return;case"boolean":n.elseIf((0,ke._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,ke._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,ke._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,ke._)`${o} === "string" || ${o} === "number"
|
|
5
|
+
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,ke._)`[${i}]`)}}}function dU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ke._)`${e} !== undefined`,()=>t.assign((0,ke._)`${e}[${r}]`,n))}function __(t,e,r,n=nl.Correct){let i=n===nl.Correct?ke.operators.EQ:ke.operators.NEQ,a;switch(t){case"null":return(0,ke._)`${e} ${i} null`;case"array":a=(0,ke._)`Array.isArray(${e})`;break;case"object":a=(0,ke._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,ke._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,ke._)`typeof ${e} ${i} ${t}`}return n===nl.Correct?a:(0,ke.not)(a);function o(s=ke.nil){return(0,ke.and)((0,ke._)`typeof ${e} == "number"`,s,r?(0,ke._)`isFinite(${e})`:ke.nil)}}br.checkDataType=__;function S_(t,e,r,n){if(t.length===1)return __(t[0],e,r,n);let i,a=(0,MI.toHash)(t);if(a.array&&a.object){let o=(0,ke._)`typeof ${e} != "object"`;i=a.null?o:(0,ke._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=ke.nil;a.number&&delete a.integer;for(let o in a)i=(0,ke.and)(i,__(o,e,r,n));return i}br.checkDataTypes=S_;var pU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ke._)`{type: ${t}}`:(0,ke._)`{type: ${e}}`};function w_(t){let e=mU(t);(0,oU.reportError)(e,pU)}br.reportTypeError=w_;function mU(t){let{gen:e,data:r,schema:n}=t,i=(0,MI.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var FI=P(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.assignDefaults=void 0;var il=Ne(),hU=He();function fU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)zI(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>zI(t,a,i.default))}Gm.assignDefaults=fU;function zI(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,il._)`${a}${(0,il.getProperty)(e)}`;if(i){(0,hU.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,il._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,il._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,il._)`${s} = ${(0,il.stringify)(r)}`)}});var Sn=P(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.validateUnion=it.validateArray=it.usePattern=it.callValidateCode=it.schemaProperties=it.allSchemaProperties=it.noPropertyInData=it.propertyInData=it.isOwnProperty=it.hasPropFunc=it.reportMissingProp=it.checkMissingProp=it.checkReportMissingProp=void 0;var gt=Ne(),k_=He(),xa=Ui(),gU=He();function yU(t,e){let{gen:r,data:n,it:i}=t;r.if(E_(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,gt._)`${e}`},!0),t.error()})}it.checkReportMissingProp=yU;function bU({gen:t,data:e,it:{opts:r}},n,i){return(0,gt.or)(...n.map(a=>(0,gt.and)(E_(t,e,a,r.ownProperties),(0,gt._)`${i} = ${a}`)))}it.checkMissingProp=bU;function vU(t,e){t.setParams({missingProperty:e},!0),t.error()}it.reportMissingProp=vU;function BI(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,gt._)`Object.prototype.hasOwnProperty`})}it.hasPropFunc=BI;function x_(t,e,r){return(0,gt._)`${BI(t)}.call(${e}, ${r})`}it.isOwnProperty=x_;function _U(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} !== undefined`;return n?(0,gt._)`${i} && ${x_(t,e,r)}`:i}it.propertyInData=_U;function E_(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} === undefined`;return n?(0,gt.or)(i,(0,gt.not)(x_(t,e,r))):i}it.noPropertyInData=E_;function jI(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}it.allSchemaProperties=jI;function SU(t,e){return jI(e).filter(r=>!(0,k_.alwaysValidSchema)(t,e[r]))}it.schemaProperties=SU;function wU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,gt._)`${t}, ${e}, ${n}${i}`:e,d=[[xa.default.instancePath,(0,gt.strConcat)(xa.default.instancePath,a)],[xa.default.parentData,o.parentData],[xa.default.parentDataProperty,o.parentDataProperty],[xa.default.rootData,xa.default.rootData]];o.opts.dynamicRef&&d.push([xa.default.dynamicAnchors,xa.default.dynamicAnchors]);let m=(0,gt._)`${u}, ${r.object(...d)}`;return l!==gt.nil?(0,gt._)`${s}.call(${l}, ${m})`:(0,gt._)`${s}(${m})`}it.callValidateCode=wU;var kU=(0,gt._)`new RegExp`;function xU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,gt._)`${i.code==="new RegExp"?kU:(0,gU.useFunc)(t,i)}(${r}, ${n})`})}it.usePattern=xU;function EU(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,gt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:k_.Type.Num},a),e.if((0,gt.not)(a),s)})}}it.validateArray=EU;function TU(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,k_.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,gt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,gt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}it.validateUnion=TU});var VI=P(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateKeywordUsage=si.validSchemaType=si.funcKeywordCode=si.macroKeywordCode=void 0;var Cr=Ne(),yo=Ui(),CU=Sn(),IU=su();function AU(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=GI(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Cr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}si.macroKeywordCode=AU;function PU(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;NU(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=GI(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&UI(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&UI(t),y(()=>RU(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Cr._)`await `),x=>n.assign(d,!1).if((0,Cr._)`${x} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Cr._)`${x}.errors`),()=>n.throw(x))),g}function h(){let g=(0,Cr._)`${u}.errors`;return n.assign(g,null),f(Cr.nil),g}function f(g=e.async?(0,Cr._)`await `:Cr.nil){let x=l.opts.passContext?yo.default.this:yo.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Cr._)`${g}${(0,CU.callValidateCode)(t,u,x,v)}`,e.modifying)}function y(g){var x;n.if((0,Cr.not)((x=e.valid)!==null&&x!==void 0?x:d),g)}}si.funcKeywordCode=PU;function UI(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Cr._)`${n.parentData}[${n.parentDataProperty}]`))}function RU(t,e){let{gen:r}=t;r.if((0,Cr._)`Array.isArray(${e})`,()=>{r.assign(yo.default.vErrors,(0,Cr._)`${yo.default.vErrors} === null ? ${e} : ${yo.default.vErrors}.concat(${e})`).assign(yo.default.errors,(0,Cr._)`${yo.default.vErrors}.length`),(0,IU.extendErrors)(t)},()=>t.error())}function NU({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function GI(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Cr.stringify)(r)})}function OU(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}si.validSchemaType=OU;function DU({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}si.validateKeywordUsage=DU});var qI=P(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.extendSubschemaMode=Ea.extendSubschemaData=Ea.getSubschema=void 0;var li=Ne(),HI=He();function MU(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}${(0,li.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,HI.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Ea.getSubschema=MU;function $U(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,li._)`${e.data}${(0,li.getProperty)(r)}`,!0);l(m),t.errorPath=(0,li.str)`${c}${(0,HI.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,li._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof li.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Ea.extendSubschemaData=$U;function LU(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Ea.extendSubschemaMode=LU});var cu=P((kce,WI)=>{"use strict";WI.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var T_=P((xce,ZI)=>{"use strict";var Ta=ZI.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Vm(e,n,i,t,"",t)};Ta.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ta.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ta.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ta.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Vm(t,e,r,n,i,a,o,s,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,a,o,s,l,c);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Ta.arrayKeywords)for(var m=0;m<d.length;m++)Vm(t,e,r,d[m],i+"/"+u+"/"+m,a,i,u,n,m)}else if(u in Ta.propsKeywords){if(d&&typeof d=="object")for(var p in d)Vm(t,e,r,d[p],i+"/"+u+"/"+zU(p),a,i,u,n,p)}else(u in Ta.keywords||t.allKeys&&!(u in Ta.skipKeywords))&&Vm(t,e,r,d,i+"/"+u,a,i,u,n)}r(n,i,a,o,s,l,c)}}function zU(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var uu=P(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getSchemaRefs=Ur.resolveUrl=Ur.normalizeId=Ur._getFullPath=Ur.getFullPath=Ur.inlineRef=void 0;var FU=He(),BU=cu(),jU=T_(),UU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GU(t,e=!0){return typeof t=="boolean"?!0:e===!0?!C_(t):e?KI(t)<=e:!1}Ur.inlineRef=GU;var VU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function C_(t){for(let e in t){if(VU.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(C_)||typeof r=="object"&&C_(r))return!0}return!1}function KI(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!UU.has(r)&&(typeof t[r]=="object"&&(0,FU.eachItem)(t[r],n=>e+=KI(n)),e===1/0))return 1/0}return e}function JI(t,e="",r){r!==!1&&(e=al(e));let n=t.parse(e);return XI(t,n)}Ur.getFullPath=JI;function XI(t,e){return t.serialize(e).split("#")[0]+"#"}Ur._getFullPath=XI;var HU=/#\/?$/;function al(t){return t?t.replace(HU,""):""}Ur.normalizeId=al;function qU(t,e,r){return r=al(r),t.resolve(e,r)}Ur.resolveUrl=qU;var WU=/^[a-z_][-a-z0-9._]*$/i;function ZU(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=al(t[r]||e),a={"":i},o=JI(n,i,!1),s={},l=new Set;return jU(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),x.call(this,d.$anchor),x.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=al(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==al(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function x(v){if(typeof v=="string"){if(!WU.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!BU(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ur.getSchemaRefs=ZU});var mu=P(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.getData=Ca.KeywordCxt=Ca.validateFunctionCode=void 0;var rA=NI(),YI=lu(),A_=v_(),Hm=lu(),KU=FI(),pu=VI(),I_=qI(),re=Ne(),fe=Ui(),JU=uu(),Gi=He(),du=su();function XU(t){if(aA(t)&&(oA(t),iA(t))){e4(t);return}nA(t,()=>(0,rA.topBoolOrEmptySchema)(t))}Ca.validateFunctionCode=XU;function nA({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,re._)`${fe.default.data}, ${fe.default.valCxt}`,n.$async,()=>{t.code((0,re._)`"use strict"; ${QI(r,i)}`),QU(t,i),t.code(a)}):t.func(e,(0,re._)`${fe.default.data}, ${YU(i)}`,n.$async,()=>t.code(QI(r,i)).code(a))}function YU(t){return(0,re._)`{${fe.default.instancePath}="", ${fe.default.parentData}, ${fe.default.parentDataProperty}, ${fe.default.rootData}=${fe.default.data}${t.dynamicRef?(0,re._)`, ${fe.default.dynamicAnchors}={}`:re.nil}}={}`}function QU(t,e){t.if(fe.default.valCxt,()=>{t.var(fe.default.instancePath,(0,re._)`${fe.default.valCxt}.${fe.default.instancePath}`),t.var(fe.default.parentData,(0,re._)`${fe.default.valCxt}.${fe.default.parentData}`),t.var(fe.default.parentDataProperty,(0,re._)`${fe.default.valCxt}.${fe.default.parentDataProperty}`),t.var(fe.default.rootData,(0,re._)`${fe.default.valCxt}.${fe.default.rootData}`),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`${fe.default.valCxt}.${fe.default.dynamicAnchors}`)},()=>{t.var(fe.default.instancePath,(0,re._)`""`),t.var(fe.default.parentData,(0,re._)`undefined`),t.var(fe.default.parentDataProperty,(0,re._)`undefined`),t.var(fe.default.rootData,fe.default.data),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`{}`)})}function e4(t){let{schema:e,opts:r,gen:n}=t;nA(t,()=>{r.$comment&&e.$comment&&lA(t),a4(t),n.let(fe.default.vErrors,null),n.let(fe.default.errors,0),r.unevaluated&&t4(t),sA(t),l4(t)})}function t4(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,re._)`${r}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function QI(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${r} */`:re.nil}function r4(t,e){if(aA(t)&&(oA(t),iA(t))){n4(t,e);return}(0,rA.boolOrEmptySchema)(t,e)}function iA({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function aA(t){return typeof t.schema!="boolean"}function n4(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&lA(t),o4(t),s4(t);let a=n.const("_errs",fe.default.errors);sA(t,a),n.var(e,(0,re._)`${a} === ${fe.default.errors}`)}function oA(t){(0,Gi.checkUnknownRules)(t),i4(t)}function sA(t,e){if(t.opts.jtd)return eA(t,[],!1,e);let r=(0,YI.getSchemaTypes)(t.schema),n=(0,YI.coerceAndCheckDataType)(t,r);eA(t,r,!n,e)}function i4(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Gi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function a4(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Gi.checkStrictMode)(t,"default is ignored in the schema root")}function o4(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,JU.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function s4(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function lA({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,re._)`${fe.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,re.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${fe.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function l4(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,re._)`${fe.default.errors} === 0`,()=>e.return(fe.default.data),()=>e.throw((0,re._)`new ${i}(${fe.default.vErrors})`)):(e.assign((0,re._)`${n}.errors`,fe.default.vErrors),a.unevaluated&&c4(t),e.return((0,re._)`${fe.default.errors} === 0`))}function c4({gen:t,evaluated:e,props:r,items:n}){r instanceof re.Name&&t.assign((0,re._)`${e}.props`,r),n instanceof re.Name&&t.assign((0,re._)`${e}.items`,n)}function eA(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Gi.schemaHasRulesButRef)(a,u))){i.block(()=>uA(t,"$ref",u.all.$ref.definition));return}l.jtd||u4(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,A_.shouldUseGroup)(a,m)&&(m.type?(i.if((0,Hm.checkDataType)(m.type,o,l.strictNumbers)),tA(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,Hm.reportTypeError)(t)),i.endIf()):tA(t,m),s||i.if((0,re._)`${fe.default.errors} === ${n||0}`))}}function tA(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,KU.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,A_.shouldUseRule)(n,a)&&uA(t,a.keyword,a.definition,e.type)})}function u4(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(d4(t,e),t.opts.allowUnionTypes||p4(t,e),m4(t,t.dataTypes))}function d4(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{cA(t.dataTypes,r)||P_(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),f4(t,e)}}function p4(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&P_(t,"use allowUnionTypes to allow union type keyword")}function m4(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,A_.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>h4(e,o))&&P_(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function h4(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function cA(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function f4(t,e){let r=[];for(let n of t.dataTypes)cA(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function P_(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Gi.checkStrictMode)(t,e,t.opts.strictTypes)}var qm=class{constructor(e,r,n){if((0,pu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",dA(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,pu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",fe.default.errors))}result(e,r,n){this.failResult((0,re.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,re.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,re._)`${r} !== undefined && (${(0,re.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?du.reportExtraError:du.reportError)(this,this.def.error,r)}$dataError(){(0,du.reportError)(this,this.def.$dataError||du.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,du.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=re.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=re.nil,r=re.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,re.or)((0,re._)`${i} === undefined`,r)),e!==re.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,re.or)(o(),s());function o(){if(n.length){if(!(r instanceof re.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,re._)`${(0,Hm.checkDataTypes)(l,r,a.opts.strictNumbers,Hm.DataType.Wrong)}`}return re.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,re._)`!${l}(${r})`}return re.nil}}subschema(e,r){let n=(0,I_.getSubschema)(this.it,e);(0,I_.extendSubschemaData)(n,this.it,e),(0,I_.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return r4(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Gi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Gi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,re.Name)),!0}};Ca.KeywordCxt=qm;function uA(t,e,r,n){let i=new qm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,pu.funcKeywordCode)(i,r):"macro"in r?(0,pu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,pu.funcKeywordCode)(i,r)}var g4=/^\/(?:[^~]|~0|~1)*$/,y4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dA(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return fe.default.rootData;if(t[0]==="/"){if(!g4.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=fe.default.rootData}else{let c=y4.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,re._)`${a}${(0,re.getProperty)((0,Gi.unescapeJsonPointer)(c))}`,o=(0,re._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Ca.getData=dA});var Wm=P(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var R_=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};N_.default=R_});var hu=P(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var O_=uu(),D_=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,O_.resolveUrl)(e,r,n),this.missingSchema=(0,O_.normalizeId)((0,O_.getFullPath)(e,this.missingRef))}};M_.default=D_});var Km=P(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;var jn=Ne(),b4=Wm(),bo=Ui(),Un=uu(),pA=He(),v4=mu(),ol=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Un.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};wn.SchemaEnv=ol;function L_(t){let e=mA.call(this,t);if(e)return e;let r=(0,Un.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new jn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:b4.default,code:(0,jn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[jn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,jn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:jn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,jn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,v4.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(bo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${bo.default.self}`,`${bo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof jn.Name?void 0:h,items:f instanceof jn.Name?void 0:f,dynamicProps:h instanceof jn.Name,dynamicItems:f instanceof jn.Name},p.source&&(p.source.evaluated=(0,jn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}wn.compileSchema=L_;function _4(t,e,r){var n;r=(0,Un.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=k4.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new ol({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=S4.call(this,a)}wn.resolveRef=_4;function S4(t){return(0,Un.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:L_.call(this,t)}function mA(t){for(let e of this._compilations)if(w4(e,t))return e}wn.getCompilingSchema=mA;function w4(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function k4(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Zm.call(this,t,e)}function Zm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Un._getFullPath)(this.opts.uriResolver,r),i=(0,Un.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return $_.call(this,r,t);let a=(0,Un.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=Zm.call(this,t,o);return typeof s?.schema!="object"?void 0:$_.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||L_.call(this,o),a===(0,Un.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,Un.resolveUrl)(this.opts.uriResolver,i,c)),new ol({schema:s,schemaId:l,root:t,baseId:i})}return $_.call(this,r,o)}}wn.resolveSchema=Zm;var x4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $_(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,pA.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!x4.has(s)&&c&&(e=(0,Un.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,pA.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Un.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=Zm.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new ol({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var hA=P((Pce,E4)=>{E4.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var F_=P((Rce,bA)=>{"use strict";var T4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gA=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function z_(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var C4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function fA(t){return t.length=0,!0}function I4(t,e,r){if(t.length){let n=z_(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function A4(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],a=!1,o=!1,s=I4;for(let l=0;l<t.length;l++){let c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(a===!0&&(o=!0),!s(i,n,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(a=!0),n.push(":");continue}else if(c==="%"){if(!s(i,n,r))break;s=fA}else{i.push(c);continue}}return i.length&&(s===fA?r.zone=i.join(""):o?n.push(i.join("")):n.push(z_(i))),r.address=n.join(""),r}function yA(t){if(P4(t,":")<2)return{host:t,isIPV6:!1};let e=A4(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function P4(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function R4(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function N4(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function O4(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!gA(r)){let n=yA(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}bA.exports={nonSimpleDomain:C4,recomposeAuthority:O4,normalizeComponentEncoding:N4,removeDotSegments:R4,isIPv4:gA,isUUID:T4,normalizeIPv6:yA,stringArrayToHexStripped:z_}});var kA=P((Nce,wA)=>{"use strict";var{isUUID:D4}=F_(),M4=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,$4=["http","https","ws","wss","urn","urn:uuid"];function L4(t){return $4.indexOf(t)!==-1}function B_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function vA(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function _A(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function z4(t){return t.secure=B_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function F4(t){if((t.port===(B_(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function B4(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(M4);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,a=j_(i);t.path=void 0,a&&(t=a.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function j4(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,a=j_(i);a&&(t=a.serialize(t,e));let o=t,s=t.nss;return o.path=`${n||e.nid}:${s}`,e.skipEscape=!0,o}function U4(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!D4(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function G4(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var SA={scheme:"http",domainHost:!0,parse:vA,serialize:_A},V4={scheme:"https",domainHost:SA.domainHost,parse:vA,serialize:_A},Jm={scheme:"ws",domainHost:!0,parse:z4,serialize:F4},H4={scheme:"wss",domainHost:Jm.domainHost,parse:Jm.parse,serialize:Jm.serialize},q4={scheme:"urn",parse:B4,serialize:j4,skipNormalize:!0},W4={scheme:"urn:uuid",parse:U4,serialize:G4,skipNormalize:!0},Xm={http:SA,https:V4,ws:Jm,wss:H4,urn:q4,"urn:uuid":W4};Object.setPrototypeOf(Xm,null);function j_(t){return t&&(Xm[t]||Xm[t.toLowerCase()])||void 0}wA.exports={wsIsSecure:B_,SCHEMES:Xm,isValidSchemeName:L4,getSchemeHandler:j_}});var TA=P((Oce,Qm)=>{"use strict";var{normalizeIPv6:Z4,removeDotSegments:fu,recomposeAuthority:K4,normalizeComponentEncoding:Ym,isIPv4:J4,nonSimpleDomain:X4}=F_(),{SCHEMES:Y4,getSchemeHandler:xA}=kA();function Q4(t,e){return typeof t=="string"?t=ci(Vi(t,e),e):typeof t=="object"&&(t=Vi(ci(t,e),e)),t}function eG(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=EA(Vi(t,n),Vi(e,n),n,!0);return n.skipEscape=!0,ci(i,n)}function EA(t,e,r,n){let i={};return n||(t=Vi(ci(t,r),r),e=Vi(ci(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=fu(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=fu(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=fu(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=fu(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function tG(t,e,r){return typeof t=="string"?(t=unescape(t),t=ci(Ym(Vi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=ci(Ym(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=ci(Ym(Vi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=ci(Ym(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function ci(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],a=xA(n.scheme||r.scheme);a&&a.serialize&&a.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=K4(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!a||!a.absolutePath)&&(s=fu(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var rG=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Vi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let a=t.match(rG);if(a){if(n.scheme=a[1],n.userinfo=a[3],n.host=a[4],n.port=parseInt(a[5],10),n.path=a[6]||"",n.query=a[7],n.fragment=a[8],isNaN(n.port)&&(n.port=a[5]),n.host)if(J4(n.host)===!1){let l=Z4(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let o=xA(r.scheme||n.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&n.host&&(r.domainHost||o&&o.domainHost)&&i===!1&&X4(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!o||o&&!o.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),o&&o.parse&&o.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var U_={SCHEMES:Y4,normalize:Q4,resolve:eG,resolveComponent:EA,equal:tG,serialize:ci,parse:Vi};Qm.exports=U_;Qm.exports.default=U_;Qm.exports.fastUri=U_});var IA=P(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var CA=TA();CA.code='require("ajv/dist/runtime/uri").default';G_.default=CA});var $A=P(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.CodeGen=ir.Name=ir.nil=ir.stringify=ir.str=ir._=ir.KeywordCxt=void 0;var nG=mu();Object.defineProperty(ir,"KeywordCxt",{enumerable:!0,get:function(){return nG.KeywordCxt}});var sl=Ne();Object.defineProperty(ir,"_",{enumerable:!0,get:function(){return sl._}});Object.defineProperty(ir,"str",{enumerable:!0,get:function(){return sl.str}});Object.defineProperty(ir,"stringify",{enumerable:!0,get:function(){return sl.stringify}});Object.defineProperty(ir,"nil",{enumerable:!0,get:function(){return sl.nil}});Object.defineProperty(ir,"Name",{enumerable:!0,get:function(){return sl.Name}});Object.defineProperty(ir,"CodeGen",{enumerable:!0,get:function(){return sl.CodeGen}});var iG=Wm(),OA=hu(),aG=b_(),gu=Km(),oG=Ne(),yu=uu(),eh=lu(),H_=He(),AA=hA(),sG=IA(),DA=(t,e)=>new RegExp(t,e);DA.code="new RegExp";var lG=["removeAdditional","useDefaults","coerceTypes"],cG=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),uG={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},dG={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PA=200;function pG(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:DA,Z=(i=t.uriResolver)!==null&&i!==void 0?i:sG.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:PA,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:PA,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(x=t.messages)!==null&&x!==void 0?x:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:($=t.int32range)!==null&&$!==void 0?$:!0,uriResolver:Z}}var bu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...pG(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new oG.ValueScope({scope:{},prefixes:cG,es5:r,lines:n}),this.logger=bG(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,aG.getRules)(),RA.call(this,uG,e,"NOT SUPPORTED"),RA.call(this,dG,e,"DEPRECATED","warn"),this._metaOpts=gG.call(this),e.formats&&hG.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&fG.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),mG.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=AA;n==="id"&&(i={...AA},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof OA.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,yu.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=NA.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new gu.SchemaEnv({schema:{},schemaId:n});if(r=gu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=NA.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,yu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(_G.call(this,n,r),!r)return(0,H_.eachItem)(n,a=>V_.call(this,a)),this;wG.call(this,r);let i={...r,type:(0,eh.getJSONTypes)(r.type),schemaType:(0,eh.getJSONTypes)(r.schemaType)};return(0,H_.eachItem)(n,i.type.length===0?a=>V_.call(this,a,i):a=>i.type.forEach(o=>V_.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=MA(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,yu.normalizeId)(o||n);let c=yu.getSchemaRefs.call(this,e,n);return l=new gu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):gu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{gu.compileSchema.call(this,e)}finally{this.opts=r}}};bu.ValidationError=iG.default;bu.MissingRefError=OA.default;ir.default=bu;function RA(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function NA(t){return t=(0,yu.normalizeId)(t),this.schemas[t]||this.refs[t]}function mG(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function hG(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function fG(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function gG(){let t={...this.opts};for(let e of lG)delete t[e];return t}var yG={log(){},warn(){},error(){}};function bG(t){if(t===!1)return yG;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var vG=/^[a-z_$][a-z0-9_$:-]*$/i;function _G(t,e){let{RULES:r}=this;if((0,H_.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!vG.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function V_(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,eh.getJSONTypes)(e.type),schemaType:(0,eh.getJSONTypes)(e.schemaType)}};e.before?SG.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function SG(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function wG(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=MA(e)),t.validateSchema=this.compile(e,!0))}var kG={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function MA(t){return{anyOf:[t,kG]}}});var LA=P(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var xG={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};q_.default=xG});var jA=P(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.callRef=vo.getValidate=void 0;var EG=hu(),zA=Sn(),Gr=Ne(),ll=Ui(),FA=Km(),th=He(),TG={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=FA.resolveRef.call(l,c,i,r);if(u===void 0)throw new EG.default(n.opts.uriResolver,i,r);if(u instanceof FA.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return rh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return rh(t,(0,Gr._)`${h}.validate`,c,c.$async)}function m(h){let f=BA(t,h);rh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Gr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:Gr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function BA(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Gr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}vo.getValidate=BA;function rh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?ll.default.this:Gr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Gr._)`await ${(0,zA.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,Gr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,zA.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,Gr._)`${h}.errors`;i.assign(ll.default.vErrors,(0,Gr._)`${ll.default.vErrors} === null ? ${f} : ${ll.default.vErrors}.concat(${f})`),i.assign(ll.default.errors,(0,Gr._)`${ll.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=th.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,Gr._)`${h}.evaluated.props`);a.props=th.mergeEvaluated.props(i,g,a.props,Gr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=th.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,Gr._)`${h}.evaluated.items`);a.items=th.mergeEvaluated.items(i,g,a.items,Gr.Name)}}}vo.callRef=rh;vo.default=TG});var UA=P(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});var CG=LA(),IG=jA(),AG=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",CG.default,IG.default];W_.default=AG});var GA=P(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var nh=Ne(),Ia=nh.operators,ih={maximum:{okStr:"<=",ok:Ia.LTE,fail:Ia.GT},minimum:{okStr:">=",ok:Ia.GTE,fail:Ia.LT},exclusiveMaximum:{okStr:"<",ok:Ia.LT,fail:Ia.GTE},exclusiveMinimum:{okStr:">",ok:Ia.GT,fail:Ia.LTE}},PG={message:({keyword:t,schemaCode:e})=>(0,nh.str)`must be ${ih[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,nh._)`{comparison: ${ih[t].okStr}, limit: ${e}}`},RG={keyword:Object.keys(ih),type:"number",schemaType:"number",$data:!0,error:PG,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,nh._)`${r} ${ih[e].fail} ${n} || isNaN(${r})`)}};Z_.default=RG});var VA=P(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var vu=Ne(),NG={message:({schemaCode:t})=>(0,vu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,vu._)`{multipleOf: ${t}}`},OG={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:NG,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,vu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,vu._)`${o} !== parseInt(${o})`;t.fail$data((0,vu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};K_.default=OG});var qA=P(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});function HA(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}J_.default=HA;HA.code='require("ajv/dist/runtime/ucs2length").default'});var WA=P(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});var _o=Ne(),DG=He(),MG=qA(),$G={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_o.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_o._)`{limit: ${t}}`},LG={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$G,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?_o.operators.GT:_o.operators.LT,o=i.opts.unicode===!1?(0,_o._)`${r}.length`:(0,_o._)`${(0,DG.useFunc)(t.gen,MG.default)}(${r})`;t.fail$data((0,_o._)`${o} ${a} ${n}`)}};X_.default=LG});var ZA=P(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var zG=Sn(),ah=Ne(),FG={message:({schemaCode:t})=>(0,ah.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ah._)`{pattern: ${t}}`},BG={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:FG,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,ah._)`(new RegExp(${i}, ${o}))`:(0,zG.usePattern)(t,n);t.fail$data((0,ah._)`!${s}.test(${e})`)}};Y_.default=BG});var KA=P(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var _u=Ne(),jG={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,_u.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,_u._)`{limit: ${t}}`},UG={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:jG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?_u.operators.GT:_u.operators.LT;t.fail$data((0,_u._)`Object.keys(${r}).length ${i} ${n}`)}};Q_.default=UG});var JA=P(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});var Su=Sn(),wu=Ne(),GG=He(),VG={message:({params:{missingProperty:t}})=>(0,wu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,wu._)`{missingProperty: ${t}}`},HG={keyword:"required",type:"object",schemaType:"array",$data:!0,error:VG,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,GG.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(wu.nil,d);else for(let p of r)(0,Su.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,Su.checkMissingProp)(t,r,p)),(0,Su.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Su.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,Su.propertyInData)(e,i,p,s.ownProperties)),e.if((0,wu.not)(h),()=>{t.error(),e.break()})},wu.nil)}}};eS.default=HG});var XA=P(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var ku=Ne(),qG={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ku.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ku._)`{limit: ${t}}`},WG={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?ku.operators.GT:ku.operators.LT;t.fail$data((0,ku._)`${r}.length ${i} ${n}`)}};tS.default=WG});var oh=P(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var YA=cu();YA.code='require("ajv/dist/runtime/equal").default';rS.default=YA});var QA=P(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var nS=lu(),ar=Ne(),ZG=He(),KG=oh(),JG={message:({params:{i:t,j:e}})=>(0,ar.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ar._)`{i: ${t}, j: ${e}}`},XG={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:JG,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,nS.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,ar._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,ar._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,ar._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,nS.checkDataTypes)(c,y,s.opts.strictNumbers,nS.DataType.Wrong),x=e.const("indices",(0,ar._)`{}`);e.for((0,ar._)`;${h}--;`,()=>{e.let(y,(0,ar._)`${r}[${h}]`),e.if(g,(0,ar._)`continue`),c.length>1&&e.if((0,ar._)`typeof ${y} == "string"`,(0,ar._)`${y} += "_"`),e.if((0,ar._)`typeof ${x}[${y}] == "number"`,()=>{e.assign(f,(0,ar._)`${x}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,ar._)`${x}[${y}] = ${h}`)})}function p(h,f){let y=(0,ZG.useFunc)(e,KG.default),g=e.name("outer");e.label(g).for((0,ar._)`;${h}--;`,()=>e.for((0,ar._)`${f} = ${h}; ${f}--;`,()=>e.if((0,ar._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};iS.default=XG});var eP=P(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var aS=Ne(),YG=He(),QG=oh(),eV={message:"must be equal to constant",params:({schemaCode:t})=>(0,aS._)`{allowedValue: ${t}}`},tV={keyword:"const",$data:!0,error:eV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,aS._)`!${(0,YG.useFunc)(e,QG.default)}(${r}, ${i})`):t.fail((0,aS._)`${a} !== ${r}`)}};oS.default=tV});var tP=P(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var xu=Ne(),rV=He(),nV=oh(),iV={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,xu._)`{allowedValues: ${t}}`},aV={keyword:"enum",schemaType:"array",$data:!0,error:iV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,rV.useFunc)(e,nV.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,xu.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,xu._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,xu._)`${c()}(${r}, ${p}[${h}])`:(0,xu._)`${r} === ${f}`}}};sS.default=aV});var rP=P(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});var oV=GA(),sV=VA(),lV=WA(),cV=ZA(),uV=KA(),dV=JA(),pV=XA(),mV=QA(),hV=eP(),fV=tP(),gV=[oV.default,sV.default,lV.default,cV.default,uV.default,dV.default,pV.default,mV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hV.default,fV.default];lS.default=gV});var uS=P(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.validateAdditionalItems=void 0;var So=Ne(),cS=He(),yV={message:({params:{len:t}})=>(0,So.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,So._)`{limit: ${t}}`},bV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:yV,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,cS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}nP(t,n)}};function nP(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,So._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,So._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,cS.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,So._)`${s} <= ${e.length}`);r.if((0,So.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:cS.Type.Num},c),o.allErrors||r.if((0,So.not)(c),()=>r.break())})}}Eu.validateAdditionalItems=nP;Eu.default=bV});var dS=P(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.validateTuple=void 0;var iP=Ne(),sh=He(),vV=Sn(),_V={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return aP(t,"additionalItems",e);r.items=!0,!(0,sh.alwaysValidSchema)(r,e)&&t.ok((0,vV.validateArray)(t))}};function aP(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=sh.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,iP._)`${a}.length`);r.forEach((d,m)=>{(0,sh.alwaysValidSchema)(s,d)||(n.if((0,iP._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,sh.checkStrictMode)(s,y,m.strictTuples)}}}Tu.validateTuple=aP;Tu.default=_V});var oP=P(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var SV=dS(),wV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,SV.validateTuple)(t,"items")};pS.default=wV});var lP=P(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var sP=Ne(),kV=He(),xV=Sn(),EV=uS(),TV={message:({params:{len:t}})=>(0,sP.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sP._)`{limit: ${t}}`},CV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:TV,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,kV.alwaysValidSchema)(n,e)&&(i?(0,EV.validateAdditionalItems)(t,i):t.ok((0,xV.validateArray)(t)))}};mS.default=CV});var cP=P(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});var kn=Ne(),lh=He(),IV={message:({params:{min:t,max:e}})=>e===void 0?(0,kn.str)`must contain at least ${t} valid item(s)`:(0,kn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,kn._)`{minContains: ${t}}`:(0,kn._)`{minContains: ${t}, maxContains: ${e}}`},AV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:IV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,kn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,lh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,lh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,lh.alwaysValidSchema)(a,r)){let f=(0,kn._)`${u} >= ${o}`;s!==void 0&&(f=(0,kn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,kn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:lh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,kn._)`${f}++`),s===void 0?e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,kn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};hS.default=AV});var pP=P(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.validateSchemaDeps=ui.validatePropertyDeps=ui.error=void 0;var fS=Ne(),PV=He(),Cu=Sn();ui.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,fS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,fS._)`{property: ${t},
|
|
6
|
+
missingProperty: ${n},
|
|
7
|
+
depsCount: ${e},
|
|
8
|
+
deps: ${r}}`};var RV={keyword:"dependencies",type:"object",schemaType:"object",error:ui.error,code(t){let[e,r]=NV(t);uP(t,e),dP(t,r)}};function NV({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function uP(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,Cu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,Cu.checkReportMissingProp)(t,c)}):(r.if((0,fS._)`${l} && (${(0,Cu.checkMissingProp)(t,s,a)})`),(0,Cu.reportMissingProp)(t,a),r.else())}}ui.validatePropertyDeps=uP;function dP(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,PV.alwaysValidSchema)(a,e[s])||(r.if((0,Cu.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}ui.validateSchemaDeps=dP;ui.default=RV});var hP=P(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var mP=Ne(),OV=He(),DV={message:"property name must be valid",params:({params:t})=>(0,mP._)`{propertyName: ${t.propertyName}}`},MV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:DV,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,OV.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,mP.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};gS.default=MV});var bS=P(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var ch=Sn(),Gn=Ne(),$V=Ui(),uh=He(),LV={message:"must NOT have additional properties",params:({params:t})=>(0,Gn._)`{additionalProperty: ${t.additionalProperty}}`},zV={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:LV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,uh.alwaysValidSchema)(o,r))return;let c=(0,ch.allSchemaProperties)(n.properties),u=(0,ch.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Gn._)`${a} === ${$V.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let x=(0,uh.schemaRefOrVal)(o,n.properties,"properties");g=(0,ch.isOwnProperty)(e,x,y)}else c.length?g=(0,Gn.or)(...c.map(x=>(0,Gn._)`${y} === ${x}`)):g=Gn.nil;return u.length&&(g=(0,Gn.or)(g,...u.map(x=>(0,Gn._)`${(0,ch.usePattern)(t,x)}.test(${y})`))),(0,Gn.not)(g)}function p(y){e.code((0,Gn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,uh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Gn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Gn.not)(g),()=>e.break()))}}function f(y,g,x){let v={keyword:"additionalProperties",dataProp:y,dataPropType:uh.Type.Str};x===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};yS.default=zV});var yP=P(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var FV=mu(),fP=Sn(),vS=He(),gP=bS(),BV={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&gP.default.code(new FV.KeywordCxt(a,gP.default,"additionalProperties"));let o=(0,fP.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=vS.mergeEvaluated.props(e,(0,vS.toHash)(o),a.props));let s=o.filter(d=>!(0,vS.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,fP.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};_S.default=BV});var SP=P(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var bP=Sn(),dh=Ne(),vP=He(),_P=He(),jV={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,bP.allSchemaProperties)(r),l=s.filter(f=>(0,vP.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof dh.Name)&&(a.props=(0,_P.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,vP.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,dh._)`${(0,bP.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:_P.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,dh._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,dh.not)(u),()=>e.break())})})}}};SS.default=jV});var wP=P(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var UV=He(),GV={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,UV.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};wS.default=GV});var kP=P(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var VV=Sn(),HV={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:VV.validateUnion,error:{message:"must match a schema in anyOf"}};kS.default=HV});var xP=P(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var ph=Ne(),qV=He(),WV={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ph._)`{passingSchemas: ${t.passing}}`},ZV={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:WV,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,qV.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,ph._)`${l} && ${o}`).assign(o,!1).assign(s,(0,ph._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,ph.Name)})})}}};xS.default=ZV});var EP=P(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var KV=He(),JV={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,KV.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};ES.default=JV});var IP=P(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});var mh=Ne(),CP=He(),XV={message:({params:t})=>(0,mh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,mh._)`{failingKeyword: ${t.ifClause}}`},YV={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:XV,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,CP.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=TP(n,"then"),a=TP(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,mh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,mh._)`${u}`):t.setParams({ifClause:u})}}}};function TP(t,e){let r=t.schema[e];return r!==void 0&&!(0,CP.alwaysValidSchema)(t,r)}TS.default=YV});var AP=P(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var QV=He(),e3={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,QV.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};CS.default=e3});var PP=P(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var t3=uS(),r3=oP(),n3=dS(),i3=lP(),a3=cP(),o3=pP(),s3=hP(),l3=bS(),c3=yP(),u3=SP(),d3=wP(),p3=kP(),m3=xP(),h3=EP(),f3=IP(),g3=AP();function y3(t=!1){let e=[d3.default,p3.default,m3.default,h3.default,f3.default,g3.default,s3.default,l3.default,o3.default,c3.default,u3.default];return t?e.push(r3.default,i3.default):e.push(t3.default,n3.default),e.push(a3.default),e}IS.default=y3});var RP=P(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var Nt=Ne(),b3={message:({schemaCode:t})=>(0,Nt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Nt._)`{format: ${t}}`},v3={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:b3,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Nt._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Nt._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Nt._)`${f}.type || "string"`).assign(g,(0,Nt._)`${f}.validate`),()=>r.assign(y,(0,Nt._)`"string"`).assign(g,f)),t.fail$data((0,Nt.or)(x(),v()));function x(){return l.strictSchema===!1?Nt.nil:(0,Nt._)`${o} && !${g}`}function v(){let I=u.$async?(0,Nt._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Nt._)`${g}(${n})`,T=(0,Nt._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Nt._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){x();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function x(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Nt.regexpCode)(T):l.code.formats?(0,Nt._)`${l.code.formats}${(0,Nt.getProperty)(a)}`:void 0,M=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Nt._)`${M}.validate`]:["string",T,M]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Nt._)`await ${g}(${n})`}return typeof y=="function"?(0,Nt._)`${g}(${n})`:(0,Nt._)`${g}.test(${n})`}}}};AS.default=v3});var NP=P(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var _3=RP(),S3=[_3.default];PS.default=S3});var OP=P(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.contentVocabulary=cl.metadataVocabulary=void 0;cl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];cl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var MP=P(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var w3=UA(),k3=rP(),x3=PP(),E3=NP(),DP=OP(),T3=[w3.default,k3.default,(0,x3.default)(),E3.default,DP.metadataVocabulary,DP.contentVocabulary];RS.default=T3});var LP=P(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.DiscrError=void 0;var $P;(function(t){t.Tag="tag",t.Mapping="mapping"})($P||(hh.DiscrError=$P={}))});var FP=P(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var ul=Ne(),NS=LP(),zP=Km(),C3=hu(),I3=He(),A3={message:({params:{discrError:t,tagName:e}})=>t===NS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ul._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},P3={keyword:"discriminator",type:"object",schemaType:"object",error:A3,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,ul._)`${r}${(0,ul.getProperty)(s)}`);e.if((0,ul._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:NS.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,ul._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:NS.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,ul.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];if(T?.$ref&&!(0,I3.schemaHasRulesButRef)(T,a.self.RULES)){let M=T.$ref;if(T=zP.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,M),T instanceof zP.SchemaEnv&&(T=T.schema),T===void 0)throw new C3.default(a.opts.uriResolver,a.baseId,M)}let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),x(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function x(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};OS.default=P3});var BP=P((Sue,R3)=>{R3.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var UP=P((yt,DS)=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.MissingRefError=yt.ValidationError=yt.CodeGen=yt.Name=yt.nil=yt.stringify=yt.str=yt._=yt.KeywordCxt=yt.Ajv=void 0;var N3=$A(),O3=MP(),D3=FP(),jP=BP(),M3=["/properties"],fh="http://json-schema.org/draft-07/schema",dl=class extends N3.default{_addVocabularies(){super._addVocabularies(),O3.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(D3.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(jP,M3):jP;this.addMetaSchema(e,fh,!1),this.refs["http://json-schema.org/schema"]=fh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(fh)?fh:void 0)}};yt.Ajv=dl;DS.exports=yt=dl;DS.exports.Ajv=dl;Object.defineProperty(yt,"__esModule",{value:!0});yt.default=dl;var $3=mu();Object.defineProperty(yt,"KeywordCxt",{enumerable:!0,get:function(){return $3.KeywordCxt}});var pl=Ne();Object.defineProperty(yt,"_",{enumerable:!0,get:function(){return pl._}});Object.defineProperty(yt,"str",{enumerable:!0,get:function(){return pl.str}});Object.defineProperty(yt,"stringify",{enumerable:!0,get:function(){return pl.stringify}});Object.defineProperty(yt,"nil",{enumerable:!0,get:function(){return pl.nil}});Object.defineProperty(yt,"Name",{enumerable:!0,get:function(){return pl.Name}});Object.defineProperty(yt,"CodeGen",{enumerable:!0,get:function(){return pl.CodeGen}});var L3=Wm();Object.defineProperty(yt,"ValidationError",{enumerable:!0,get:function(){return L3.default}});var z3=hu();Object.defineProperty(yt,"MissingRefError",{enumerable:!0,get:function(){return z3.default}})});var JP=P(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.formatNames=pi.fastFormats=pi.fullFormats=void 0;function di(t,e){return{validate:t,compare:e}}pi.fullFormats={date:di(qP,zS),time:di($S(!0),FS),"date-time":di(GP(!0),ZP),"iso-time":di($S(),WP),"iso-date-time":di(GP(),KP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:V3,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:X3,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:H3,int32:{type:"number",validate:Z3},int64:{type:"number",validate:K3},float:{type:"number",validate:HP},double:{type:"number",validate:HP},password:!0,binary:!0};pi.fastFormats={...pi.fullFormats,date:di(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,zS),time:di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FS),"date-time":di(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ZP),"iso-time":di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,WP),"iso-date-time":di(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,KP),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};pi.formatNames=Object.keys(pi.fullFormats);function F3(t){return t%4===0&&(t%100!==0||t%400===0)}var B3=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,j3=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qP(t){let e=B3.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&F3(r)?29:j3[n])}function zS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var MS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $S(t){return function(r){let n=MS.exec(r);if(!n)return!1;let i=+n[1],a=+n[2],o=+n[3],s=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||t&&!s)return!1;if(i<=23&&a<=59&&o<60)return!0;let d=a-u*l,m=i-c*l-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}}function FS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function WP(t,e){if(!(t&&e))return;let r=MS.exec(t),n=MS.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var LS=/t|\s/i;function GP(t){let e=$S(t);return function(n){let i=n.split(LS);return i.length===2&&qP(i[0])&&e(i[1])}}function ZP(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function KP(t,e){if(!(t&&e))return;let[r,n]=t.split(LS),[i,a]=e.split(LS),o=zS(r,i);if(o!==void 0)return o||FS(n,a)}var U3=/\/|:/,G3=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function V3(t){return U3.test(t)&&G3.test(t)}var VP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function H3(t){return VP.lastIndex=0,VP.test(t)}var q3=-(2**31),W3=2**31-1;function Z3(t){return Number.isInteger(t)&&t<=W3&&t>=q3}function K3(t){return Number.isInteger(t)}function HP(){return!0}var J3=/[^\\]\\Z/;function X3(t){if(J3.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Pu=P(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.regexpCode=qe.getEsmExportName=qe.getProperty=qe.safeStringify=qe.stringify=qe.strConcat=qe.addCodeArg=qe.str=qe._=qe.nil=qe._Code=qe.Name=qe.IDENTIFIER=qe._CodeOrName=void 0;var Iu=class{};qe._CodeOrName=Iu;qe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var wo=class extends Iu{constructor(e){if(super(),!qe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};qe.Name=wo;var xn=class extends Iu{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof wo&&(r[n.str]=(r[n.str]||0)+1),r),{})}};qe._Code=xn;qe.nil=new xn("");function XP(t,...e){let r=[t[0]],n=0;for(;n<e.length;)jS(r,e[n]),r.push(t[++n]);return new xn(r)}qe._=XP;var BS=new xn("+");function YP(t,...e){let r=[Au(t[0])],n=0;for(;n<e.length;)r.push(BS),jS(r,e[n]),r.push(BS,Au(t[++n]));return Y3(r),new xn(r)}qe.str=YP;function jS(t,e){e instanceof xn?t.push(...e._items):e instanceof wo?t.push(e):t.push(t6(e))}qe.addCodeArg=jS;function Y3(t){let e=1;for(;e<t.length-1;){if(t[e]===BS){let r=Q3(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Q3(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof wo||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof wo))return`"${t}${e.slice(1)}`}function e6(t,e){return e.emptyStr()?t:t.emptyStr()?e:YP`${t}${e}`}qe.strConcat=e6;function t6(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Au(Array.isArray(t)?t.join(","):t)}function r6(t){return new xn(Au(t))}qe.stringify=r6;function Au(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qe.safeStringify=Au;function n6(t){return typeof t=="string"&&qe.IDENTIFIER.test(t)?new xn(`.${t}`):XP`[${t}]`}qe.getProperty=n6;function i6(t){if(typeof t=="string"&&qe.IDENTIFIER.test(t))return new xn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}qe.getEsmExportName=i6;function a6(t){return new xn(t.toString())}qe.regexpCode=a6});var HS=P(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.ValueScope=Ir.ValueScopeName=Ir.Scope=Ir.varKinds=Ir.UsedValueState=void 0;var Vr=Pu(),US=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},GS;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(GS=Ir.UsedValueState||(Ir.UsedValueState={}));Ir.varKinds={const:new Vr.Name("const"),let:new Vr.Name("let"),var:new Vr.Name("var")};var gh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Vr.Name?e:this.name(e)}name(e){return new Vr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ir.Scope=gh;var yh=class extends Vr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Vr._)`.${new Vr.Name(r)}[${n}]`}};Ir.ValueScopeName=yh;var o6=(0,Vr._)`\n`,VS=class extends gh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o6:Vr.nil}}get(){return this._scope}name(e){return new yh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Vr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Vr.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,GS.Started);let u=r(c);if(u){let d=this.opts.es5?Ir.varKinds.var:Ir.varKinds.const;a=(0,Vr._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Vr._)`${a}${u}${this.opts._n}`;else throw new US(c);l.set(c,GS.Completed)})}return a}};Ir.ValueScope=VS});var Ee=P(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.or=Ae.and=Ae.not=Ae.CodeGen=Ae.operators=Ae.varKinds=Ae.ValueScopeName=Ae.ValueScope=Ae.Scope=Ae.Name=Ae.regexpCode=Ae.stringify=Ae.getProperty=Ae.nil=Ae.strConcat=Ae.str=Ae._=void 0;var Fe=Pu(),Vn=HS(),Aa=Pu();Object.defineProperty(Ae,"_",{enumerable:!0,get:function(){return Aa._}});Object.defineProperty(Ae,"str",{enumerable:!0,get:function(){return Aa.str}});Object.defineProperty(Ae,"strConcat",{enumerable:!0,get:function(){return Aa.strConcat}});Object.defineProperty(Ae,"nil",{enumerable:!0,get:function(){return Aa.nil}});Object.defineProperty(Ae,"getProperty",{enumerable:!0,get:function(){return Aa.getProperty}});Object.defineProperty(Ae,"stringify",{enumerable:!0,get:function(){return Aa.stringify}});Object.defineProperty(Ae,"regexpCode",{enumerable:!0,get:function(){return Aa.regexpCode}});Object.defineProperty(Ae,"Name",{enumerable:!0,get:function(){return Aa.Name}});var Sh=HS();Object.defineProperty(Ae,"Scope",{enumerable:!0,get:function(){return Sh.Scope}});Object.defineProperty(Ae,"ValueScope",{enumerable:!0,get:function(){return Sh.ValueScope}});Object.defineProperty(Ae,"ValueScopeName",{enumerable:!0,get:function(){return Sh.ValueScopeName}});Object.defineProperty(Ae,"varKinds",{enumerable:!0,get:function(){return Sh.varKinds}});Ae.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},qS=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Vn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=hl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},bh=class extends Hi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Fe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=hl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Fe.Name?{}:{...this.lhs.names};return _h(e,this.rhs)}},WS=class extends bh{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},KS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},JS=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},XS=class extends Hi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=hl(this.code,e,r),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},Ru=class extends Hi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(s6(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Eo(e,r.names),{})}},qi=class extends Ru{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},YS=class extends Ru{},ml=class extends qi{};ml.kind="else";var ko=class t extends qi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ml(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(QP(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=hl(this.condition,e,r),this}get names(){let e=super.names;return _h(e,this.condition),this.else&&Eo(e,this.else.names),e}};ko.kind="if";var xo=class extends qi{};xo.kind="for";var QS=class extends xo{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=hl(this.iteration,e,r),this}get names(){return Eo(super.names,this.iteration.names)}},ew=class extends xo{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Vn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=_h(super.names,this.from);return _h(e,this.to)}},vh=class extends xo{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=hl(this.iterable,e,r),this}get names(){return Eo(super.names,this.iterable.names)}},Nu=class extends qi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nu.kind="func";var Ou=class extends Ru{render(e){return"return "+super.render(e)}};Ou.kind="return";var tw=class extends qi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Eo(e,this.catch.names),this.finally&&Eo(e,this.finally.names),e}},Du=class extends qi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Du.kind="catch";var Mu=class extends qi{render(e){return"finally"+super.render(e)}};Mu.kind="finally";var rw=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
9
|
+
`:""},this._extScope=e,this._scope=new Vn.Scope({parent:e}),this._nodes=[new YS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new qS(e,a,n)),a}const(e,r,n){return this._def(Vn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Vn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Vn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new bh(e,r,n))}add(e,r){return this._leafNode(new WS(e,Ae.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Fe.nil&&this._leafNode(new XS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Fe.addCodeArg)(r,i));return r.push("}"),new Fe._Code(r)}if(e,r,n){if(this._blockNode(new ko(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ko(e))}else(){return this._elseNode(new ml)}endIf(){return this._endBlockNode(ko,ml)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new QS(e),r)}forRange(e,r,n,i,a=this.opts.es5?Vn.varKinds.var:Vn.varKinds.let){let o=this._scope.toName(e);return this._for(new ew(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Vn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Fe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Fe._)`${o}.length`,s=>{this.var(a,(0,Fe._)`${o}[${s}]`),n(a)})}return this._for(new vh("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Vn.varKinds.var:Vn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Fe._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new vh("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(xo)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new KS(e))}return(e){let r=new Ou;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ou)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new tw;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new Du(a),r(a)}return n&&(this._currNode=i.finally=new Mu,this.code(n)),this._endBlockNode(Du,Mu)}throw(e){return this._leafNode(new JS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Fe.nil,n,i){return this._blockNode(new Nu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Nu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ko))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ae.CodeGen=rw;function Eo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function _h(t,e){return e instanceof Fe._CodeOrName?Eo(t,e.names):t}function hl(t,e,r){if(t instanceof Fe.Name)return n(t);if(!i(t))return t;return new Fe._Code(t._items.reduce((a,o)=>(o instanceof Fe.Name&&(o=n(o)),o instanceof Fe._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof Fe._Code&&a._items.some(o=>o instanceof Fe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function s6(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function QP(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Fe._)`!${nw(t)}`}Ae.not=QP;var l6=eR(Ae.operators.AND);function c6(...t){return t.reduce(l6)}Ae.and=c6;var u6=eR(Ae.operators.OR);function d6(...t){return t.reduce(u6)}Ae.or=d6;function eR(t){return(e,r)=>e===Fe.nil?r:r===Fe.nil?e:(0,Fe._)`${nw(e)} ${t} ${nw(r)}`}function nw(t){return t instanceof Fe.Name?t:(0,Fe._)`(${t})`}});var We=P(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.checkStrictMode=Pe.getErrorPath=Pe.Type=Pe.useFunc=Pe.setEvaluated=Pe.evaluatedPropsToName=Pe.mergeEvaluated=Pe.eachItem=Pe.unescapeJsonPointer=Pe.escapeJsonPointer=Pe.escapeFragment=Pe.unescapeFragment=Pe.schemaRefOrVal=Pe.schemaHasRulesButRef=Pe.schemaHasRules=Pe.checkUnknownRules=Pe.alwaysValidSchema=Pe.toHash=void 0;var lt=Ee(),p6=Pu();function m6(t){let e={};for(let r of t)e[r]=!0;return e}Pe.toHash=m6;function h6(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nR(t,e),!iR(e,t.self.RULES.all))}Pe.alwaysValidSchema=h6;function nR(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||lR(t,`unknown keyword: "${a}"`)}Pe.checkUnknownRules=nR;function iR(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Pe.schemaHasRules=iR;function f6(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Pe.schemaHasRulesButRef=f6;function g6({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,lt._)`${r}`}return(0,lt._)`${t}${e}${(0,lt.getProperty)(n)}`}Pe.schemaRefOrVal=g6;function y6(t){return aR(decodeURIComponent(t))}Pe.unescapeFragment=y6;function b6(t){return encodeURIComponent(iw(t))}Pe.escapeFragment=b6;function iw(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Pe.escapeJsonPointer=iw;function aR(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Pe.unescapeJsonPointer=aR;function v6(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Pe.eachItem=v6;function tR({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof lt.Name?(a instanceof lt.Name?t(i,a,o):e(i,a,o),o):a instanceof lt.Name?(e(i,o,a),a):r(a,o);return s===lt.Name&&!(l instanceof lt.Name)?n(i,l):l}}Pe.mergeEvaluated={props:tR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,lt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,lt._)`${r} || {}`).code((0,lt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,lt._)`${r} || {}`),aw(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:oR}),items:tR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,lt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,lt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function oR(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,lt._)`{}`);return e!==void 0&&aw(t,r,e),r}Pe.evaluatedPropsToName=oR;function aw(t,e,r){Object.keys(r).forEach(n=>t.assign((0,lt._)`${e}${(0,lt.getProperty)(n)}`,!0))}Pe.setEvaluated=aw;var rR={};function _6(t,e){return t.scopeValue("func",{ref:e,code:rR[e.code]||(rR[e.code]=new p6._Code(e.code))})}Pe.useFunc=_6;var sR;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(sR=Pe.Type||(Pe.Type={}));function S6(t,e,r){if(t instanceof lt.Name){let n=e===sR.Num;return r?n?(0,lt._)`"[" + ${t} + "]"`:(0,lt._)`"['" + ${t} + "']"`:n?(0,lt._)`"/" + ${t}`:(0,lt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,lt.getProperty)(t).toString():"/"+iw(t)}Pe.getErrorPath=S6;function lR(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Pe.checkStrictMode=lR});var Wi=P(ow=>{"use strict";Object.defineProperty(ow,"__esModule",{value:!0});var vr=Ee(),w6={data:new vr.Name("data"),valCxt:new vr.Name("valCxt"),instancePath:new vr.Name("instancePath"),parentData:new vr.Name("parentData"),parentDataProperty:new vr.Name("parentDataProperty"),rootData:new vr.Name("rootData"),dynamicAnchors:new vr.Name("dynamicAnchors"),vErrors:new vr.Name("vErrors"),errors:new vr.Name("errors"),this:new vr.Name("this"),self:new vr.Name("self"),scope:new vr.Name("scope"),json:new vr.Name("json"),jsonPos:new vr.Name("jsonPos"),jsonLen:new vr.Name("jsonLen"),jsonPart:new vr.Name("jsonPart")};ow.default=w6});var $u=P(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendErrors=_r.resetErrorsCount=_r.reportExtraError=_r.reportError=_r.keyword$DataError=_r.keywordError=void 0;var Ue=Ee(),wh=We(),Ar=Wi();_r.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};_r.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function k6(t,e=_r.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=dR(t,e,r);n??(o||s)?cR(a,l):uR(i,(0,Ue._)`[${l}]`)}_r.reportError=k6;function x6(t,e=_r.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=dR(t,e,r);cR(i,s),a||o||uR(n,Ar.default.vErrors)}_r.reportExtraError=x6;function E6(t,e){t.assign(Ar.default.errors,e),t.if((0,Ue._)`${Ar.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${Ar.default.vErrors}.length`,e),()=>t.assign(Ar.default.vErrors,null)))}_r.resetErrorsCount=E6;function T6({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Ar.default.errors,s=>{t.const(o,(0,Ue._)`${Ar.default.vErrors}[${s}]`),t.if((0,Ue._)`${o}.instancePath === undefined`,()=>t.assign((0,Ue._)`${o}.instancePath`,(0,Ue.strConcat)(Ar.default.instancePath,a.errorPath))),t.assign((0,Ue._)`${o}.schemaPath`,(0,Ue.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,Ue._)`${o}.schema`,r),t.assign((0,Ue._)`${o}.data`,n))})}_r.extendErrors=T6;function cR(t,e){let r=t.const("err",e);t.if((0,Ue._)`${Ar.default.vErrors} === null`,()=>t.assign(Ar.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${Ar.default.vErrors}.push(${r})`),t.code((0,Ue._)`${Ar.default.errors}++`)}function uR(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var To={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function dR(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:C6(t,e,r)}function C6(t,e,r={}){let{gen:n,it:i}=t,a=[I6(i,r),A6(t,r)];return P6(t,e,a),n.object(...a)}function I6({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,wh.getErrorPath)(e,wh.Type.Str)}`:t;return[Ar.default.instancePath,(0,Ue.strConcat)(Ar.default.instancePath,r)]}function A6({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ue.str)`${e}/${t}`;return r&&(i=(0,Ue.str)`${i}${(0,wh.getErrorPath)(r,wh.Type.Str)}`),[To.schemaPath,i]}function P6(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([To.keyword,i],[To.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),l.messages&&n.push([To.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([To.schema,o],[To.parentSchema,(0,Ue._)`${u}${d}`],[Ar.default.data,a]),c&&n.push([To.propertyName,c])}});var mR=P(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.boolOrEmptySchema=fl.topBoolOrEmptySchema=void 0;var R6=$u(),N6=Ee(),O6=Wi(),D6={message:"boolean schema is false"};function M6(t){let{gen:e,schema:r,validateName:n}=t;r===!1?pR(t,!1):typeof r=="object"&&r.$async===!0?e.return(O6.default.data):(e.assign((0,N6._)`${n}.errors`,null),e.return(!0))}fl.topBoolOrEmptySchema=M6;function $6(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),pR(t)):r.var(e,!0)}fl.boolOrEmptySchema=$6;function pR(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,R6.reportError)(i,D6,void 0,e)}});var sw=P(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.getRules=gl.isJSONType=void 0;var L6=["string","number","integer","boolean","null","object","array"],z6=new Set(L6);function F6(t){return typeof t=="string"&&z6.has(t)}gl.isJSONType=F6;function B6(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}gl.getRules=B6});var lw=P(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.shouldUseRule=Pa.shouldUseGroup=Pa.schemaHasRulesForType=void 0;function j6({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&hR(t,n)}Pa.schemaHasRulesForType=j6;function hR(t,e){return e.rules.some(r=>fR(t,r))}Pa.shouldUseGroup=hR;function fR(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Pa.shouldUseRule=fR});var zu=P(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.reportTypeError=or.checkDataTypes=or.checkDataType=or.coerceAndCheckDataType=or.getJSONTypes=or.getSchemaTypes=or.DataType=void 0;var U6=sw(),G6=lw(),V6=$u(),xe=Ee(),gR=We(),Lu;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Lu=or.DataType||(or.DataType={}));function H6(t){let e=yR(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}or.getSchemaTypes=H6;function yR(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(U6.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}or.getJSONTypes=yR;function q6(t,e){let{gen:r,data:n,opts:i}=t,a=W6(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,G6.schemaHasRulesForType)(t,e[0]));if(o){let s=uw(e,n,i.strictNumbers,Lu.Wrong);r.if(s,()=>{a.length?Z6(t,e,a):dw(t)})}return o}or.coerceAndCheckDataType=q6;var bR=new Set(["string","number","integer","boolean","null"]);function W6(t,e){return e?t.filter(r=>bR.has(r)||e==="array"&&r==="array"):[]}function Z6(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,xe._)`typeof ${i}`),s=n.let("coerced",(0,xe._)`undefined`);a.coerceTypes==="array"&&n.if((0,xe._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,xe._)`${i}[0]`).assign(o,(0,xe._)`typeof ${i}`).if(uw(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,xe._)`${s} !== undefined`);for(let c of r)(bR.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),dw(t),n.endIf(),n.if((0,xe._)`${s} !== undefined`,()=>{n.assign(i,s),K6(t,s)});function l(c){switch(c){case"string":n.elseIf((0,xe._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,xe._)`"" + ${i}`).elseIf((0,xe._)`${i} === null`).assign(s,(0,xe._)`""`);return;case"number":n.elseIf((0,xe._)`${o} == "boolean" || ${i} === null
|
|
10
|
+
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,xe._)`+${i}`);return;case"integer":n.elseIf((0,xe._)`${o} === "boolean" || ${i} === null
|
|
11
|
+
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,xe._)`+${i}`);return;case"boolean":n.elseIf((0,xe._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,xe._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,xe._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,xe._)`${o} === "string" || ${o} === "number"
|
|
12
|
+
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,xe._)`[${i}]`)}}}function K6({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,xe._)`${e} !== undefined`,()=>t.assign((0,xe._)`${e}[${r}]`,n))}function cw(t,e,r,n=Lu.Correct){let i=n===Lu.Correct?xe.operators.EQ:xe.operators.NEQ,a;switch(t){case"null":return(0,xe._)`${e} ${i} null`;case"array":a=(0,xe._)`Array.isArray(${e})`;break;case"object":a=(0,xe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,xe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,xe._)`typeof ${e} ${i} ${t}`}return n===Lu.Correct?a:(0,xe.not)(a);function o(s=xe.nil){return(0,xe.and)((0,xe._)`typeof ${e} == "number"`,s,r?(0,xe._)`isFinite(${e})`:xe.nil)}}or.checkDataType=cw;function uw(t,e,r,n){if(t.length===1)return cw(t[0],e,r,n);let i,a=(0,gR.toHash)(t);if(a.array&&a.object){let o=(0,xe._)`typeof ${e} != "object"`;i=a.null?o:(0,xe._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=xe.nil;a.number&&delete a.integer;for(let o in a)i=(0,xe.and)(i,cw(o,e,r,n));return i}or.checkDataTypes=uw;var J6={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,xe._)`{type: ${t}}`:(0,xe._)`{type: ${e}}`};function dw(t){let e=X6(t);(0,V6.reportError)(e,J6)}or.reportTypeError=dw;function X6(t){let{gen:e,data:r,schema:n}=t,i=(0,gR.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var _R=P(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.assignDefaults=void 0;var yl=Ee(),Y6=We();function Q6(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)vR(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>vR(t,a,i.default))}kh.assignDefaults=Q6;function vR(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,yl._)`${a}${(0,yl.getProperty)(e)}`;if(i){(0,Y6.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,yl._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,yl._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,yl._)`${s} = ${(0,yl.stringify)(r)}`)}});var En=P(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateUnion=at.validateArray=at.usePattern=at.callValidateCode=at.schemaProperties=at.allSchemaProperties=at.noPropertyInData=at.propertyInData=at.isOwnProperty=at.hasPropFunc=at.reportMissingProp=at.checkMissingProp=at.checkReportMissingProp=void 0;var bt=Ee(),pw=We(),Ra=Wi(),eH=We();function tH(t,e){let{gen:r,data:n,it:i}=t;r.if(hw(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,bt._)`${e}`},!0),t.error()})}at.checkReportMissingProp=tH;function rH({gen:t,data:e,it:{opts:r}},n,i){return(0,bt.or)(...n.map(a=>(0,bt.and)(hw(t,e,a,r.ownProperties),(0,bt._)`${i} = ${a}`)))}at.checkMissingProp=rH;function nH(t,e){t.setParams({missingProperty:e},!0),t.error()}at.reportMissingProp=nH;function SR(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,bt._)`Object.prototype.hasOwnProperty`})}at.hasPropFunc=SR;function mw(t,e,r){return(0,bt._)`${SR(t)}.call(${e}, ${r})`}at.isOwnProperty=mw;function iH(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} !== undefined`;return n?(0,bt._)`${i} && ${mw(t,e,r)}`:i}at.propertyInData=iH;function hw(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} === undefined`;return n?(0,bt.or)(i,(0,bt.not)(mw(t,e,r))):i}at.noPropertyInData=hw;function wR(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}at.allSchemaProperties=wR;function aH(t,e){return wR(e).filter(r=>!(0,pw.alwaysValidSchema)(t,e[r]))}at.schemaProperties=aH;function oH({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,bt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ra.default.instancePath,(0,bt.strConcat)(Ra.default.instancePath,a)],[Ra.default.parentData,o.parentData],[Ra.default.parentDataProperty,o.parentDataProperty],[Ra.default.rootData,Ra.default.rootData]];o.opts.dynamicRef&&d.push([Ra.default.dynamicAnchors,Ra.default.dynamicAnchors]);let m=(0,bt._)`${u}, ${r.object(...d)}`;return l!==bt.nil?(0,bt._)`${s}.call(${l}, ${m})`:(0,bt._)`${s}(${m})`}at.callValidateCode=oH;var sH=(0,bt._)`new RegExp`;function lH({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,bt._)`${i.code==="new RegExp"?sH:(0,eH.useFunc)(t,i)}(${r}, ${n})`})}at.usePattern=lH;function cH(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,bt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:pw.Type.Num},a),e.if((0,bt.not)(a),s)})}}at.validateArray=cH;function uH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,pw.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,bt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,bt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}at.validateUnion=uH});var ER=P(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateKeywordUsage=mi.validSchemaType=mi.funcKeywordCode=mi.macroKeywordCode=void 0;var Pr=Ee(),Co=Wi(),dH=En(),pH=$u();function mH(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=xR(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Pr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}mi.macroKeywordCode=mH;function hH(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;gH(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=xR(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&kR(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&kR(t),y(()=>fH(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Pr._)`await `),x=>n.assign(d,!1).if((0,Pr._)`${x} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Pr._)`${x}.errors`),()=>n.throw(x))),g}function h(){let g=(0,Pr._)`${u}.errors`;return n.assign(g,null),f(Pr.nil),g}function f(g=e.async?(0,Pr._)`await `:Pr.nil){let x=l.opts.passContext?Co.default.this:Co.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Pr._)`${g}${(0,dH.callValidateCode)(t,u,x,v)}`,e.modifying)}function y(g){var x;n.if((0,Pr.not)((x=e.valid)!==null&&x!==void 0?x:d),g)}}mi.funcKeywordCode=hH;function kR(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Pr._)`${n.parentData}[${n.parentDataProperty}]`))}function fH(t,e){let{gen:r}=t;r.if((0,Pr._)`Array.isArray(${e})`,()=>{r.assign(Co.default.vErrors,(0,Pr._)`${Co.default.vErrors} === null ? ${e} : ${Co.default.vErrors}.concat(${e})`).assign(Co.default.errors,(0,Pr._)`${Co.default.vErrors}.length`),(0,pH.extendErrors)(t)},()=>t.error())}function gH({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function xR(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Pr.stringify)(r)})}function yH(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}mi.validSchemaType=yH;function bH({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}mi.validateKeywordUsage=bH});var CR=P(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.extendSubschemaMode=Na.extendSubschemaData=Na.getSubschema=void 0;var hi=Ee(),TR=We();function vH(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}${(0,hi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,TR.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Na.getSubschema=vH;function _H(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,hi._)`${e.data}${(0,hi.getProperty)(r)}`,!0);l(m),t.errorPath=(0,hi.str)`${c}${(0,TR.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,hi._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof hi.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Na.extendSubschemaData=_H;function SH(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Na.extendSubschemaMode=SH});var Fu=P(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.getSchemaRefs=Hr.resolveUrl=Hr.normalizeId=Hr._getFullPath=Hr.getFullPath=Hr.inlineRef=void 0;var wH=We(),kH=cu(),xH=T_(),EH=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function TH(t,e=!0){return typeof t=="boolean"?!0:e===!0?!fw(t):e?IR(t)<=e:!1}Hr.inlineRef=TH;var CH=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fw(t){for(let e in t){if(CH.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(fw)||typeof r=="object"&&fw(r))return!0}return!1}function IR(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!EH.has(r)&&(typeof t[r]=="object"&&(0,wH.eachItem)(t[r],n=>e+=IR(n)),e===1/0))return 1/0}return e}function AR(t,e="",r){r!==!1&&(e=bl(e));let n=t.parse(e);return PR(t,n)}Hr.getFullPath=AR;function PR(t,e){return t.serialize(e).split("#")[0]+"#"}Hr._getFullPath=PR;var IH=/#\/?$/;function bl(t){return t?t.replace(IH,""):""}Hr.normalizeId=bl;function AH(t,e,r){return r=bl(r),t.resolve(e,r)}Hr.resolveUrl=AH;var PH=/^[a-z_][-a-z0-9._]*$/i;function RH(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=bl(t[r]||e),a={"":i},o=AR(n,i,!1),s={},l=new Set;return xH(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),x.call(this,d.$anchor),x.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=bl(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==bl(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function x(v){if(typeof v=="string"){if(!PH.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!kH(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Hr.getSchemaRefs=RH});var Uu=P(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.getData=Oa.KeywordCxt=Oa.validateFunctionCode=void 0;var MR=mR(),RR=zu(),yw=lw(),xh=zu(),NH=_R(),ju=ER(),gw=CR(),ne=Ee(),ge=Wi(),OH=Fu(),Zi=We(),Bu=$u();function DH(t){if(zR(t)&&(FR(t),LR(t))){LH(t);return}$R(t,()=>(0,MR.topBoolOrEmptySchema)(t))}Oa.validateFunctionCode=DH;function $R({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,ne._)`${ge.default.data}, ${ge.default.valCxt}`,n.$async,()=>{t.code((0,ne._)`"use strict"; ${NR(r,i)}`),$H(t,i),t.code(a)}):t.func(e,(0,ne._)`${ge.default.data}, ${MH(i)}`,n.$async,()=>t.code(NR(r,i)).code(a))}function MH(t){return(0,ne._)`{${ge.default.instancePath}="", ${ge.default.parentData}, ${ge.default.parentDataProperty}, ${ge.default.rootData}=${ge.default.data}${t.dynamicRef?(0,ne._)`, ${ge.default.dynamicAnchors}={}`:ne.nil}}={}`}function $H(t,e){t.if(ge.default.valCxt,()=>{t.var(ge.default.instancePath,(0,ne._)`${ge.default.valCxt}.${ge.default.instancePath}`),t.var(ge.default.parentData,(0,ne._)`${ge.default.valCxt}.${ge.default.parentData}`),t.var(ge.default.parentDataProperty,(0,ne._)`${ge.default.valCxt}.${ge.default.parentDataProperty}`),t.var(ge.default.rootData,(0,ne._)`${ge.default.valCxt}.${ge.default.rootData}`),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`${ge.default.valCxt}.${ge.default.dynamicAnchors}`)},()=>{t.var(ge.default.instancePath,(0,ne._)`""`),t.var(ge.default.parentData,(0,ne._)`undefined`),t.var(ge.default.parentDataProperty,(0,ne._)`undefined`),t.var(ge.default.rootData,ge.default.data),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`{}`)})}function LH(t){let{schema:e,opts:r,gen:n}=t;$R(t,()=>{r.$comment&&e.$comment&&jR(t),UH(t),n.let(ge.default.vErrors,null),n.let(ge.default.errors,0),r.unevaluated&&zH(t),BR(t),HH(t)})}function zH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ne._)`${r}.evaluated`),e.if((0,ne._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ne._)`${t.evaluated}.props`,(0,ne._)`undefined`)),e.if((0,ne._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ne._)`${t.evaluated}.items`,(0,ne._)`undefined`))}function NR(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ne._)`/*# sourceURL=${r} */`:ne.nil}function FH(t,e){if(zR(t)&&(FR(t),LR(t))){BH(t,e);return}(0,MR.boolOrEmptySchema)(t,e)}function LR({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function zR(t){return typeof t.schema!="boolean"}function BH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&jR(t),GH(t),VH(t);let a=n.const("_errs",ge.default.errors);BR(t,a),n.var(e,(0,ne._)`${a} === ${ge.default.errors}`)}function FR(t){(0,Zi.checkUnknownRules)(t),jH(t)}function BR(t,e){if(t.opts.jtd)return OR(t,[],!1,e);let r=(0,RR.getSchemaTypes)(t.schema),n=(0,RR.coerceAndCheckDataType)(t,r);OR(t,r,!n,e)}function jH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function UH(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zi.checkStrictMode)(t,"default is ignored in the schema root")}function GH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,OH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function VH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function jR({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,ne._)`${ge.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,ne.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,ne._)`${ge.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function HH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,ne._)`${ge.default.errors} === 0`,()=>e.return(ge.default.data),()=>e.throw((0,ne._)`new ${i}(${ge.default.vErrors})`)):(e.assign((0,ne._)`${n}.errors`,ge.default.vErrors),a.unevaluated&&qH(t),e.return((0,ne._)`${ge.default.errors} === 0`))}function qH({gen:t,evaluated:e,props:r,items:n}){r instanceof ne.Name&&t.assign((0,ne._)`${e}.props`,r),n instanceof ne.Name&&t.assign((0,ne._)`${e}.items`,n)}function OR(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Zi.schemaHasRulesButRef)(a,u))){i.block(()=>GR(t,"$ref",u.all.$ref.definition));return}l.jtd||WH(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,yw.shouldUseGroup)(a,m)&&(m.type?(i.if((0,xh.checkDataType)(m.type,o,l.strictNumbers)),DR(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,xh.reportTypeError)(t)),i.endIf()):DR(t,m),s||i.if((0,ne._)`${ge.default.errors} === ${n||0}`))}}function DR(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,NH.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,yw.shouldUseRule)(n,a)&&GR(t,a.keyword,a.definition,e.type)})}function WH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(ZH(t,e),t.opts.allowUnionTypes||KH(t,e),JH(t,t.dataTypes))}function ZH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{UR(t.dataTypes,r)||bw(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),YH(t,e)}}function KH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&bw(t,"use allowUnionTypes to allow union type keyword")}function JH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,yw.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>XH(e,o))&&bw(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function XH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function UR(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function YH(t,e){let r=[];for(let n of t.dataTypes)UR(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function bw(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Zi.checkStrictMode)(t,e,t.opts.strictTypes)}var Eh=class{constructor(e,r,n){if((0,ju.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",VR(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ju.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ge.default.errors))}result(e,r,n){this.failResult((0,ne.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ne.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ne._)`${r} !== undefined && (${(0,ne.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Bu.reportExtraError:Bu.reportError)(this,this.def.error,r)}$dataError(){(0,Bu.reportError)(this,this.def.$dataError||Bu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Bu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ne.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ne.nil,r=ne.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,ne.or)((0,ne._)`${i} === undefined`,r)),e!==ne.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,ne.or)(o(),s());function o(){if(n.length){if(!(r instanceof ne.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,ne._)`${(0,xh.checkDataTypes)(l,r,a.opts.strictNumbers,xh.DataType.Wrong)}`}return ne.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ne._)`!${l}(${r})`}return ne.nil}}subschema(e,r){let n=(0,gw.getSubschema)(this.it,e);(0,gw.extendSubschemaData)(n,this.it,e),(0,gw.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return FH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Zi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ne.Name)),!0}};Oa.KeywordCxt=Eh;function GR(t,e,r,n){let i=new Eh(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,ju.funcKeywordCode)(i,r):"macro"in r?(0,ju.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,ju.funcKeywordCode)(i,r)}var QH=/^\/(?:[^~]|~0|~1)*$/,eq=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function VR(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return ge.default.rootData;if(t[0]==="/"){if(!QH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=ge.default.rootData}else{let c=eq.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,ne._)`${a}${(0,ne.getProperty)((0,Zi.unescapeJsonPointer)(c))}`,o=(0,ne._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Oa.getData=VR});var Th=P(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var vw=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_w.default=vw});var Ch=P(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});var Sw=Fu(),ww=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Sw.resolveUrl)(e,r,n),this.missingSchema=(0,Sw.normalizeId)((0,Sw.getFullPath)(e,this.missingRef))}};kw.default=ww});var Ah=P(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.resolveSchema=Tn.getCompilingSchema=Tn.resolveRef=Tn.compileSchema=Tn.SchemaEnv=void 0;var Hn=Ee(),tq=Th(),Io=Wi(),qn=Fu(),HR=We(),rq=Uu(),vl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Tn.SchemaEnv=vl;function Ew(t){let e=qR.call(this,t);if(e)return e;let r=(0,qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new Hn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:tq.default,code:(0,Hn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:Io.default.data,parentData:Io.default.parentData,parentDataProperty:Io.default.parentDataProperty,dataNames:[Io.default.data],dataPathArr:[Hn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Hn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Hn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Hn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,rq.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Io.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Io.default.self}`,`${Io.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof Hn.Name?void 0:h,items:f instanceof Hn.Name?void 0:f,dynamicProps:h instanceof Hn.Name,dynamicItems:f instanceof Hn.Name},p.source&&(p.source.evaluated=(0,Hn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Tn.compileSchema=Ew;function nq(t,e,r){var n;r=(0,qn.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=oq.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new vl({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=iq.call(this,a)}Tn.resolveRef=nq;function iq(t){return(0,qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Ew.call(this,t)}function qR(t){for(let e of this._compilations)if(aq(e,t))return e}Tn.getCompilingSchema=qR;function aq(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function oq(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ih.call(this,t,e)}function Ih(t,e){let r=this.opts.uriResolver.parse(e),n=(0,qn._getFullPath)(this.opts.uriResolver,r),i=(0,qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return xw.call(this,r,t);let a=(0,qn.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=Ih.call(this,t,o);return typeof s?.schema!="object"?void 0:xw.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||Ew.call(this,o),a===(0,qn.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,qn.resolveUrl)(this.opts.uriResolver,i,c)),new vl({schema:s,schemaId:l,root:t,baseId:i})}return xw.call(this,r,o)}}Tn.resolveSchema=Ih;var sq=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xw(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,HR.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!sq.has(s)&&c&&(e=(0,qn.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,HR.schemaHasRulesButRef)(r,this.RULES)){let s=(0,qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=Ih.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new vl({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var WR=P((Uue,lq)=>{lq.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var KR=P((Ph,ZR)=>{"use strict";(function(t,e){typeof Ph=="object"&&typeof ZR<"u"?e(Ph):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Ph,function(t){"use strict";function e(){for(var _=arguments.length,b=Array(_),E=0;E<_;E++)b[E]=arguments[E];if(b.length>1){b[0]=b[0].slice(0,-1);for(var A=b.length-1,R=1;R<A;++R)b[R]=b[R].slice(1,-1);return b[A]=b[A].slice(1),b.join("")}else return b[0]}function r(_){return"(?:"+_+")"}function n(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function i(_){return _.toUpperCase()}function a(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,b){var E=_;if(b)for(var A in b)E[A]=b[A];return E}function s(_){var b="[A-Za-z]",E="[\\x0D]",A="[0-9]",R="[\\x22]",J=e(A,"[A-Fa-f]"),we="[\\x0A]",Ge="[\\x20]",Ye=r(r("%[EFef]"+J+"%"+J+J+"%"+J+J)+"|"+r("%[89A-Fa-f]"+J+"%"+J+J)+"|"+r("%"+J+J)),Ft="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",xt=e(Ft,Be),Bt=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",vt=_?"[\\uE000-\\uF8FF]":"[]",Ze=e(b,A,"[\\-\\.\\_\\~]",Bt),Et=r(b+e(b,A,"[\\+\\-\\.]")+"*"),rt=r(r(Ye+"|"+e(Ze,Be,"[\\:]"))+"*"),Ha=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("[1-9]"+A)+"|"+A),Jr=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("0?[1-9]"+A)+"|0?0?"+A),pn=r(Jr+"\\."+Jr+"\\."+Jr+"\\."+Jr),ot=r(J+"{1,4}"),Xr=r(r(ot+"\\:"+ot)+"|"+pn),mn=r(r(ot+"\\:")+"{6}"+Xr),Qn=r("\\:\\:"+r(ot+"\\:")+"{5}"+Xr),qa=r(r(ot)+"?\\:\\:"+r(ot+"\\:")+"{4}"+Xr),wi=r(r(r(ot+"\\:")+"{0,1}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{3}"+Xr),Xl=r(r(r(ot+"\\:")+"{0,2}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{2}"+Xr),Xd=r(r(r(ot+"\\:")+"{0,3}"+ot)+"?\\:\\:"+ot+"\\:"+Xr),Yd=r(r(r(ot+"\\:")+"{0,4}"+ot)+"?\\:\\:"+Xr),Ko=r(r(r(ot+"\\:")+"{0,5}"+ot)+"?\\:\\:"+ot),Jo=r(r(r(ot+"\\:")+"{0,6}"+ot)+"?\\:\\:"),ki=r([mn,Qn,qa,wi,Xl,Xd,Yd,Ko,Jo].join("|")),Xo=r(r(Ze+"|"+Ye)+"+"),mg=r(ki+"\\%25"+Xo),Wa=r(ki+r("\\%25|\\%(?!"+J+"{2})")+Xo),EM=r("[vV]"+J+"+\\."+e(Ze,Be,"[\\:]")+"+"),TM=r("\\["+r(Wa+"|"+ki+"|"+EM)+"\\]"),eE=r(r(Ye+"|"+e(Ze,Be))+"*"),Yl=r(TM+"|"+pn+"(?!"+eE+")|"+eE),Ql=r(A+"*"),tE=r(r(rt+"@")+"?"+Yl+r("\\:"+Ql)+"?"),ec=r(Ye+"|"+e(Ze,Be,"[\\:\\@]")),CM=r(ec+"*"),rE=r(ec+"+"),IM=r(r(Ye+"|"+e(Ze,Be,"[\\@]"))+"+"),xi=r(r("\\/"+CM)+"*"),Yo=r("\\/"+r(rE+xi)+"?"),hg=r(IM+xi),Qd=r(rE+xi),Qo="(?!"+ec+")",w7=r(xi+"|"+Yo+"|"+hg+"|"+Qd+"|"+Qo),es=r(r(ec+"|"+e("[\\/\\?]",vt))+"*"),tc=r(r(ec+"|[\\/\\?]")+"*"),nE=r(r("\\/\\/"+tE+xi)+"|"+Yo+"|"+Qd+"|"+Qo),AM=r(Et+"\\:"+nE+r("\\?"+es)+"?"+r("\\#"+tc)+"?"),PM=r(r("\\/\\/"+tE+xi)+"|"+Yo+"|"+hg+"|"+Qo),RM=r(PM+r("\\?"+es)+"?"+r("\\#"+tc)+"?"),k7=r(AM+"|"+RM),x7=r(Et+"\\:"+nE+r("\\?"+es)+"?"),E7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+Qd+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+tc+")")+"?$",T7="^(){0}"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+hg+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+tc+")")+"?$",C7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+Qd+"|"+Qo+")")+r("\\?("+es+")")+"?$",I7="^"+r("\\#("+tc+")")+"?$",A7="^"+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,A,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Ze,Be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Ze,Be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Ze,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Ze,Be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]",vt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Ze,Be),"g"),UNRESERVED:new RegExp(Ze,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Ze,xt),"g"),PCT_ENCODED:new RegExp(Ye,"g"),IPV4ADDRESS:new RegExp("^("+pn+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ki+")"+r(r("\\%25|\\%(?!"+J+"{2})")+"("+Xo+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function _(b,E){var A=[],R=!0,J=!1,we=void 0;try{for(var Ge=b[Symbol.iterator](),Ye;!(R=(Ye=Ge.next()).done)&&(A.push(Ye.value),!(E&&A.length===E));R=!0);}catch(Ft){J=!0,we=Ft}finally{try{!R&&Ge.return&&Ge.return()}finally{if(J)throw we}}return A}return function(b,E){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return _(b,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(_){if(Array.isArray(_)){for(var b=0,E=Array(_.length);b<_.length;b++)E[b]=_[b];return E}else return Array.from(_)},m=2147483647,p=36,h=1,f=26,y=38,g=700,x=72,v=128,I="-",T=/^xn--/,C=/[^\0-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=p-h,B=Math.floor,Y=String.fromCharCode;function H(_){throw new RangeError(W[_])}function j(_,b){for(var E=[],A=_.length;A--;)E[A]=b(_[A]);return E}function Z(_,b){var E=_.split("@"),A="";E.length>1&&(A=E[0]+"@",_=E[1]),_=_.replace(M,".");var R=_.split("."),J=j(R,b).join(".");return A+J}function ae(_){for(var b=[],E=0,A=_.length;E<A;){var R=_.charCodeAt(E++);if(R>=55296&&R<=56319&&E<A){var J=_.charCodeAt(E++);(J&64512)==56320?b.push(((R&1023)<<10)+(J&1023)+65536):(b.push(R),E--)}else b.push(R)}return b}var $e=function(b){return String.fromCodePoint.apply(String,d(b))},Xe=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:p},At=function(b,E){return b+22+75*(b<26)-((E!=0)<<5)},kt=function(b,E,A){var R=0;for(b=A?B(b/g):b>>1,b+=B(b/E);b>$*f>>1;R+=p)b=B(b/$);return B(R+($+1)*b/(b+y))},S=function(b){var E=[],A=b.length,R=0,J=v,we=x,Ge=b.lastIndexOf(I);Ge<0&&(Ge=0);for(var Ye=0;Ye<Ge;++Ye)b.charCodeAt(Ye)>=128&&H("not-basic"),E.push(b.charCodeAt(Ye));for(var Ft=Ge>0?Ge+1:0;Ft<A;){for(var Be=R,xt=1,Bt=p;;Bt+=p){Ft>=A&&H("invalid-input");var vt=Xe(b.charCodeAt(Ft++));(vt>=p||vt>B((m-R)/xt))&&H("overflow"),R+=vt*xt;var Ze=Bt<=we?h:Bt>=we+f?f:Bt-we;if(vt<Ze)break;var Et=p-Ze;xt>B(m/Et)&&H("overflow"),xt*=Et}var rt=E.length+1;we=kt(R-Be,rt,Be==0),B(R/rt)>m-J&&H("overflow"),J+=B(R/rt),R%=rt,E.splice(R++,0,J)}return String.fromCodePoint.apply(String,E)},xr=function(b){var E=[];b=ae(b);var A=b.length,R=v,J=0,we=x,Ge=!0,Ye=!1,Ft=void 0;try{for(var Be=b[Symbol.iterator](),xt;!(Ge=(xt=Be.next()).done);Ge=!0){var Bt=xt.value;Bt<128&&E.push(Y(Bt))}}catch(Wa){Ye=!0,Ft=Wa}finally{try{!Ge&&Be.return&&Be.return()}finally{if(Ye)throw Ft}}var vt=E.length,Ze=vt;for(vt&&E.push(I);Ze<A;){var Et=m,rt=!0,Ha=!1,Jr=void 0;try{for(var pn=b[Symbol.iterator](),ot;!(rt=(ot=pn.next()).done);rt=!0){var Xr=ot.value;Xr>=R&&Xr<Et&&(Et=Xr)}}catch(Wa){Ha=!0,Jr=Wa}finally{try{!rt&&pn.return&&pn.return()}finally{if(Ha)throw Jr}}var mn=Ze+1;Et-R>B((m-J)/mn)&&H("overflow"),J+=(Et-R)*mn,R=Et;var Qn=!0,qa=!1,wi=void 0;try{for(var Xl=b[Symbol.iterator](),Xd;!(Qn=(Xd=Xl.next()).done);Qn=!0){var Yd=Xd.value;if(Yd<R&&++J>m&&H("overflow"),Yd==R){for(var Ko=J,Jo=p;;Jo+=p){var ki=Jo<=we?h:Jo>=we+f?f:Jo-we;if(Ko<ki)break;var Xo=Ko-ki,mg=p-ki;E.push(Y(At(ki+Xo%mg,0))),Ko=B(Xo/mg)}E.push(Y(At(Ko,0))),we=kt(J,mn,Ze==vt),J=0,++Ze}}}catch(Wa){qa=!0,wi=Wa}finally{try{!Qn&&Xl.return&&Xl.return()}finally{if(qa)throw wi}}++J,++R}return E.join("")},Pn=function(b){return Z(b,function(E){return T.test(E)?S(E.slice(4).toLowerCase()):E})},k=function(b){return Z(b,function(E){return C.test(E)?"xn--"+xr(E):E})},Lt={version:"2.1.0",ucs2:{decode:ae,encode:$e},decode:S,encode:xr,toASCII:k,toUnicode:Pn},zt={};function Mr(_){var b=_.charCodeAt(0),E=void 0;return b<16?E="%0"+b.toString(16).toUpperCase():b<128?E="%"+b.toString(16).toUpperCase():b<2048?E="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():E="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),E}function Rn(_){for(var b="",E=0,A=_.length;E<A;){var R=parseInt(_.substr(E+1,2),16);if(R<128)b+=String.fromCharCode(R),E+=3;else if(R>=194&&R<224){if(A-E>=6){var J=parseInt(_.substr(E+4,2),16);b+=String.fromCharCode((R&31)<<6|J&63)}else b+=_.substr(E,6);E+=6}else if(R>=224){if(A-E>=9){var we=parseInt(_.substr(E+4,2),16),Ge=parseInt(_.substr(E+7,2),16);b+=String.fromCharCode((R&15)<<12|(we&63)<<6|Ge&63)}else b+=_.substr(E,9);E+=9}else b+=_.substr(E,3),E+=3}return b}function Pt(_,b){function E(A){var R=Rn(A);return R.match(b.UNRESERVED)?R:A}return _.scheme&&(_.scheme=String(_.scheme).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(b.PCT_ENCODED,E).replace(b.NOT_USERINFO,Mr).replace(b.PCT_ENCODED,i)),_.host!==void 0&&(_.host=String(_.host).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_HOST,Mr).replace(b.PCT_ENCODED,i)),_.path!==void 0&&(_.path=String(_.path).replace(b.PCT_ENCODED,E).replace(_.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Mr).replace(b.PCT_ENCODED,i)),_.query!==void 0&&(_.query=String(_.query).replace(b.PCT_ENCODED,E).replace(b.NOT_QUERY,Mr).replace(b.PCT_ENCODED,i)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(b.PCT_ENCODED,E).replace(b.NOT_FRAGMENT,Mr).replace(b.PCT_ENCODED,i)),_}function _i(_){return _.replace(/^0*(.*)/,"$1")||"0"}function $r(_,b){var E=_.match(b.IPV4ADDRESS)||[],A=u(E,2),R=A[1];return R?R.split(".").map(_i).join("."):_}function Si(_,b){var E=_.match(b.IPV6ADDRESS)||[],A=u(E,3),R=A[1],J=A[2];if(R){for(var we=R.toLowerCase().split("::").reverse(),Ge=u(we,2),Ye=Ge[0],Ft=Ge[1],Be=Ft?Ft.split(":").map(_i):[],xt=Ye.split(":").map(_i),Bt=b.IPV4ADDRESS.test(xt[xt.length-1]),vt=Bt?7:8,Ze=xt.length-vt,Et=Array(vt),rt=0;rt<vt;++rt)Et[rt]=Be[rt]||xt[Ze+rt]||"";Bt&&(Et[vt-1]=$r(Et[vt-1],b));var Ha=Et.reduce(function(mn,Qn,qa){if(!Qn||Qn==="0"){var wi=mn[mn.length-1];wi&&wi.index+wi.length===qa?wi.length++:mn.push({index:qa,length:1})}return mn},[]),Jr=Ha.sort(function(mn,Qn){return Qn.length-mn.length})[0],pn=void 0;if(Jr&&Jr.length>1){var ot=Et.slice(0,Jr.index),Xr=Et.slice(Jr.index+Jr.length);pn=ot.join(":")+"::"+Xr.join(":")}else pn=Et.join(":");return J&&(pn+="%"+J),pn}else return _}var ra=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Zl="".match(/(){0}/)[1]===void 0;function cn(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},A=b.iri!==!1?c:l;b.reference==="suffix"&&(_=(b.scheme?b.scheme+":":"")+"//"+_);var R=_.match(ra);if(R){Zl?(E.scheme=R[1],E.userinfo=R[3],E.host=R[4],E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=R[7],E.fragment=R[8],isNaN(E.port)&&(E.port=R[5])):(E.scheme=R[1]||void 0,E.userinfo=_.indexOf("@")!==-1?R[3]:void 0,E.host=_.indexOf("//")!==-1?R[4]:void 0,E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=_.indexOf("?")!==-1?R[7]:void 0,E.fragment=_.indexOf("#")!==-1?R[8]:void 0,isNaN(E.port)&&(E.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),E.host&&(E.host=Si($r(E.host,A),A)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==E.reference&&(E.error=E.error||"URI is not a "+b.reference+" reference.");var J=zt[(b.scheme||E.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!J||!J.unicodeSupport)){if(E.host&&(b.domainHost||J&&J.domainHost))try{E.host=Lt.toASCII(E.host.replace(A.PCT_ENCODED,Rn).toLowerCase())}catch(we){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+we}Pt(E,l)}else Pt(E,A);J&&J.parse&&J.parse(E,b)}else E.error=E.error||"URI can not be parsed.";return E}function Wd(_,b){var E=b.iri!==!1?c:l,A=[];return _.userinfo!==void 0&&(A.push(_.userinfo),A.push("@")),_.host!==void 0&&A.push(Si($r(String(_.host),E),E).replace(E.IPV6ADDRESS,function(R,J,we){return"["+J+(we?"%25"+we:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(A.push(":"),A.push(String(_.port))),A.length?A.join(""):void 0}var Kl=/^\.\.?\//,Zd=/^\/\.(\/|$)/,Jl=/^\/\.\.(\/|$)/,Kd=/^\/?(?:.|\n)*?(?=\/|$)/;function na(_){for(var b=[];_.length;)if(_.match(Kl))_=_.replace(Kl,"");else if(_.match(Zd))_=_.replace(Zd,"/");else if(_.match(Jl))_=_.replace(Jl,"/"),b.pop();else if(_==="."||_==="..")_="";else{var E=_.match(Kd);if(E){var A=E[0];_=_.slice(A.length),b.push(A)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function un(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=b.iri?c:l,A=[],R=zt[(b.scheme||_.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(_,b),_.host&&!E.IPV6ADDRESS.test(_.host)){if(b.domainHost||R&&R.domainHost)try{_.host=b.iri?Lt.toUnicode(_.host):Lt.toASCII(_.host.replace(E.PCT_ENCODED,Rn).toLowerCase())}catch(Ge){_.error=_.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+Ge}}Pt(_,E),b.reference!=="suffix"&&_.scheme&&(A.push(_.scheme),A.push(":"));var J=Wd(_,b);if(J!==void 0&&(b.reference!=="suffix"&&A.push("//"),A.push(J),_.path&&_.path.charAt(0)!=="/"&&A.push("/")),_.path!==void 0){var we=_.path;!b.absolutePath&&(!R||!R.absolutePath)&&(we=na(we)),J===void 0&&(we=we.replace(/^\/\//,"/%2F")),A.push(we)}return _.query!==void 0&&(A.push("?"),A.push(_.query)),_.fragment!==void 0&&(A.push("#"),A.push(_.fragment)),A.join("")}function Jd(_,b){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=arguments[3],R={};return A||(_=cn(un(_,E),E),b=cn(un(b,E),E)),E=E||{},!E.tolerant&&b.scheme?(R.scheme=b.scheme,R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.path?(b.path.charAt(0)==="/"?R.path=na(b.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?R.path="/"+b.path:_.path?R.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+b.path:R.path=b.path,R.path=na(R.path)),R.query=b.query):(R.path=_.path,b.query!==void 0?R.query=b.query:R.query=_.query),R.userinfo=_.userinfo,R.host=_.host,R.port=_.port),R.scheme=_.scheme),R.fragment=b.fragment,R}function ug(_,b,E){var A=o({scheme:"null"},E);return un(Jd(cn(_,A),cn(b,A),A,!0),A)}function dg(_,b){return typeof _=="string"?_=un(cn(_,b),b):n(_)==="object"&&(_=cn(un(_,b),b)),_}function O(_,b,E){return typeof _=="string"?_=un(cn(_,E),E):n(_)==="object"&&(_=un(_,E)),typeof b=="string"?b=un(cn(b,E),E):n(b)==="object"&&(b=un(b,E)),_===b}function G(_,b){return _&&_.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Mr)}function oe(_,b){return _&&_.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,Rn)}var Se={scheme:"http",domainHost:!0,parse:function(b,E){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,E){var A=String(b.scheme).toLowerCase()==="https";return(b.port===(A?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Je={scheme:"https",domainHost:Se.domainHost,parse:Se.parse,serialize:Se.serialize};function Lr(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Kr={scheme:"ws",domainHost:!0,parse:function(b,E){var A=b;return A.secure=Lr(A),A.resourceName=(A.path||"/")+(A.query?"?"+A.query:""),A.path=void 0,A.query=void 0,A},serialize:function(b,E){if((b.port===(Lr(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var A=b.resourceName.split("?"),R=u(A,2),J=R[0],we=R[1];b.path=J&&J!=="/"?J:void 0,b.query=we,b.resourceName=void 0}return b.fragment=void 0,b}},dn={scheme:"wss",domainHost:Kr.domainHost,parse:Kr.parse,serialize:Kr.serialize},Ga={},Va=!0,ur="[A-Za-z0-9\\-\\.\\_\\~"+(Va?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xt="[0-9A-Fa-f]",Nn=r(r("%[EFef]"+Xt+"%"+Xt+Xt+"%"+Xt+Xt)+"|"+r("%[89A-Fa-f]"+Xt+"%"+Xt+Xt)+"|"+r("%"+Xt+Xt)),gM="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yM="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bM=e(yM,'[\\"\\\\]'),vM="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_M=new RegExp(ur,"g"),Zo=new RegExp(Nn,"g"),SM=new RegExp(e("[^]",gM,"[\\.]",'[\\"]',bM),"g"),Jx=new RegExp(e("[^]",ur,vM),"g"),wM=Jx;function pg(_){var b=Rn(_);return b.match(_M)?b:_}var Xx={scheme:"mailto",parse:function(b,E){var A=b,R=A.to=A.path?A.path.split(","):[];if(A.path=void 0,A.query){for(var J=!1,we={},Ge=A.query.split("&"),Ye=0,Ft=Ge.length;Ye<Ft;++Ye){var Be=Ge[Ye].split("=");switch(Be[0]){case"to":for(var xt=Be[1].split(","),Bt=0,vt=xt.length;Bt<vt;++Bt)R.push(xt[Bt]);break;case"subject":A.subject=oe(Be[1],E);break;case"body":A.body=oe(Be[1],E);break;default:J=!0,we[oe(Be[0],E)]=oe(Be[1],E);break}}J&&(A.headers=we)}A.query=void 0;for(var Ze=0,Et=R.length;Ze<Et;++Ze){var rt=R[Ze].split("@");if(rt[0]=oe(rt[0]),E.unicodeSupport)rt[1]=oe(rt[1],E).toLowerCase();else try{rt[1]=Lt.toASCII(oe(rt[1],E).toLowerCase())}catch(Ha){A.error=A.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ha}R[Ze]=rt.join("@")}return A},serialize:function(b,E){var A=b,R=a(b.to);if(R){for(var J=0,we=R.length;J<we;++J){var Ge=String(R[J]),Ye=Ge.lastIndexOf("@"),Ft=Ge.slice(0,Ye).replace(Zo,pg).replace(Zo,i).replace(SM,Mr),Be=Ge.slice(Ye+1);try{Be=E.iri?Lt.toUnicode(Be):Lt.toASCII(oe(Be,E).toLowerCase())}catch(Ze){A.error=A.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Ze}R[J]=Ft+"@"+Be}A.path=R.join(",")}var xt=b.headers=b.headers||{};b.subject&&(xt.subject=b.subject),b.body&&(xt.body=b.body);var Bt=[];for(var vt in xt)xt[vt]!==Ga[vt]&&Bt.push(vt.replace(Zo,pg).replace(Zo,i).replace(Jx,Mr)+"="+xt[vt].replace(Zo,pg).replace(Zo,i).replace(wM,Mr));return Bt.length&&(A.query=Bt.join("&")),A}},kM=/^([^\:]+)\:(.*)/,Yx={scheme:"urn",parse:function(b,E){var A=b.path&&b.path.match(kM),R=b;if(A){var J=E.scheme||R.scheme||"urn",we=A[1].toLowerCase(),Ge=A[2],Ye=J+":"+(E.nid||we),Ft=zt[Ye];R.nid=we,R.nss=Ge,R.path=void 0,Ft&&(R=Ft.parse(R,E))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(b,E){var A=E.scheme||b.scheme||"urn",R=b.nid,J=A+":"+(E.nid||R),we=zt[J];we&&(b=we.serialize(b,E));var Ge=b,Ye=b.nss;return Ge.path=(R||E.nid)+":"+Ye,Ge}},xM=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Qx={scheme:"urn:uuid",parse:function(b,E){var A=b;return A.uuid=A.nss,A.nss=void 0,!E.tolerant&&(!A.uuid||!A.uuid.match(xM))&&(A.error=A.error||"UUID is not valid."),A},serialize:function(b,E){var A=b;return A.nss=(b.uuid||"").toLowerCase(),A}};zt[Se.scheme]=Se,zt[Je.scheme]=Je,zt[Kr.scheme]=Kr,zt[dn.scheme]=dn,zt[Xx.scheme]=Xx,zt[Yx.scheme]=Yx,zt[Qx.scheme]=Qx,t.SCHEMES=zt,t.pctEncChar=Mr,t.pctDecChars=Rn,t.parse=cn,t.removeDotSegments=na,t.serialize=un,t.resolveComponents=Jd,t.resolve=ug,t.normalize=dg,t.equal=O,t.escapeComponent=G,t.unescapeComponent=oe,Object.defineProperty(t,"__esModule",{value:!0})})});var XR=P(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});var JR=KR();JR.code='require("ajv/dist/runtime/uri").default';Tw.default=JR});var aN=P(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.CodeGen=sr.Name=sr.nil=sr.stringify=sr.str=sr._=sr.KeywordCxt=void 0;var cq=Uu();Object.defineProperty(sr,"KeywordCxt",{enumerable:!0,get:function(){return cq.KeywordCxt}});var _l=Ee();Object.defineProperty(sr,"_",{enumerable:!0,get:function(){return _l._}});Object.defineProperty(sr,"str",{enumerable:!0,get:function(){return _l.str}});Object.defineProperty(sr,"stringify",{enumerable:!0,get:function(){return _l.stringify}});Object.defineProperty(sr,"nil",{enumerable:!0,get:function(){return _l.nil}});Object.defineProperty(sr,"Name",{enumerable:!0,get:function(){return _l.Name}});Object.defineProperty(sr,"CodeGen",{enumerable:!0,get:function(){return _l.CodeGen}});var uq=Th(),rN=Ch(),dq=sw(),Gu=Ah(),pq=Ee(),Vu=Fu(),Rh=zu(),Iw=We(),YR=WR(),mq=XR(),nN=(t,e)=>new RegExp(t,e);nN.code="new RegExp";var hq=["removeAdditional","useDefaults","coerceTypes"],fq=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),gq={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},yq={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},QR=200;function bq(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:nN,Z=(i=t.uriResolver)!==null&&i!==void 0?i:mq.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:QR,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:QR,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(x=t.messages)!==null&&x!==void 0?x:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:($=t.int32range)!==null&&$!==void 0?$:!0,uriResolver:Z}}var Hu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...bq(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new pq.ValueScope({scope:{},prefixes:fq,es5:r,lines:n}),this.logger=xq(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,dq.getRules)(),eN.call(this,gq,e,"NOT SUPPORTED"),eN.call(this,yq,e,"DEPRECATED","warn"),this._metaOpts=wq.call(this),e.formats&&_q.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Sq.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),vq.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=YR;n==="id"&&(i={...YR},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof rN.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Vu.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=tN.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Gu.SchemaEnv({schema:{},schemaId:n});if(r=Gu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=tN.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Tq.call(this,n,r),!r)return(0,Iw.eachItem)(n,a=>Cw.call(this,a)),this;Iq.call(this,r);let i={...r,type:(0,Rh.getJSONTypes)(r.type),schemaType:(0,Rh.getJSONTypes)(r.schemaType)};return(0,Iw.eachItem)(n,i.type.length===0?a=>Cw.call(this,a,i):a=>i.type.forEach(o=>Cw.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=iN(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,Vu.normalizeId)(o||n);let c=Vu.getSchemaRefs.call(this,e,n);return l=new Gu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gu.compileSchema.call(this,e)}finally{this.opts=r}}};sr.default=Hu;Hu.ValidationError=uq.default;Hu.MissingRefError=rN.default;function eN(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function tN(t){return t=(0,Vu.normalizeId)(t),this.schemas[t]||this.refs[t]}function vq(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function _q(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Sq(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function wq(){let t={...this.opts};for(let e of hq)delete t[e];return t}var kq={log(){},warn(){},error(){}};function xq(t){if(t===!1)return kq;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Eq=/^[a-z_$][a-z0-9_$:-]*$/i;function Tq(t,e){let{RULES:r}=this;if((0,Iw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Eq.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Cw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Rh.getJSONTypes)(e.type),schemaType:(0,Rh.getJSONTypes)(e.schemaType)}};e.before?Cq.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function Cq(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Iq(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=iN(e)),t.validateSchema=this.compile(e,!0))}var Aq={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function iN(t){return{anyOf:[t,Aq]}}});var oN=P(Aw=>{"use strict";Object.defineProperty(Aw,"__esModule",{value:!0});var Pq={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Aw.default=Pq});var uN=P(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.callRef=Ao.getValidate=void 0;var Rq=Ch(),sN=En(),qr=Ee(),Sl=Wi(),lN=Ah(),Nh=We(),Nq={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=lN.resolveRef.call(l,c,i,r);if(u===void 0)throw new Rq.default(n.opts.uriResolver,i,r);if(u instanceof lN.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return Oh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return Oh(t,(0,qr._)`${h}.validate`,c,c.$async)}function m(h){let f=cN(t,h);Oh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,qr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:qr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function cN(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ao.getValidate=cN;function Oh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?Sl.default.this:qr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,qr._)`await ${(0,sN.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,qr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,sN.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,qr._)`${h}.errors`;i.assign(Sl.default.vErrors,(0,qr._)`${Sl.default.vErrors} === null ? ${f} : ${Sl.default.vErrors}.concat(${f})`),i.assign(Sl.default.errors,(0,qr._)`${Sl.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=Nh.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,qr._)`${h}.evaluated.props`);a.props=Nh.mergeEvaluated.props(i,g,a.props,qr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=Nh.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,qr._)`${h}.evaluated.items`);a.items=Nh.mergeEvaluated.items(i,g,a.items,qr.Name)}}}Ao.callRef=Oh;Ao.default=Nq});var dN=P(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});var Oq=oN(),Dq=uN(),Mq=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Oq.default,Dq.default];Pw.default=Mq});var pN=P(Rw=>{"use strict";Object.defineProperty(Rw,"__esModule",{value:!0});var Dh=Ee(),Da=Dh.operators,Mh={maximum:{okStr:"<=",ok:Da.LTE,fail:Da.GT},minimum:{okStr:">=",ok:Da.GTE,fail:Da.LT},exclusiveMaximum:{okStr:"<",ok:Da.LT,fail:Da.GTE},exclusiveMinimum:{okStr:">",ok:Da.GT,fail:Da.LTE}},$q={message:({keyword:t,schemaCode:e})=>(0,Dh.str)`must be ${Mh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Dh._)`{comparison: ${Mh[t].okStr}, limit: ${e}}`},Lq={keyword:Object.keys(Mh),type:"number",schemaType:"number",$data:!0,error:$q,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Dh._)`${r} ${Mh[e].fail} ${n} || isNaN(${r})`)}};Rw.default=Lq});var mN=P(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0});var qu=Ee(),zq={message:({schemaCode:t})=>(0,qu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,qu._)`{multipleOf: ${t}}`},Fq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:zq,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,qu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,qu._)`${o} !== parseInt(${o})`;t.fail$data((0,qu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};Nw.default=Fq});var fN=P(Ow=>{"use strict";Object.defineProperty(Ow,"__esModule",{value:!0});function hN(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}Ow.default=hN;hN.code='require("ajv/dist/runtime/ucs2length").default'});var gN=P(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});var Po=Ee(),Bq=We(),jq=fN(),Uq={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Po.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Po._)`{limit: ${t}}`},Gq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Uq,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?Po.operators.GT:Po.operators.LT,o=i.opts.unicode===!1?(0,Po._)`${r}.length`:(0,Po._)`${(0,Bq.useFunc)(t.gen,jq.default)}(${r})`;t.fail$data((0,Po._)`${o} ${a} ${n}`)}};Dw.default=Gq});var yN=P(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});var Vq=En(),$h=Ee(),Hq={message:({schemaCode:t})=>(0,$h.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,$h._)`{pattern: ${t}}`},qq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Hq,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,$h._)`(new RegExp(${i}, ${o}))`:(0,Vq.usePattern)(t,n);t.fail$data((0,$h._)`!${s}.test(${e})`)}};Mw.default=qq});var bN=P($w=>{"use strict";Object.defineProperty($w,"__esModule",{value:!0});var Wu=Ee(),Wq={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Wu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Wu._)`{limit: ${t}}`},Zq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Wq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Wu.operators.GT:Wu.operators.LT;t.fail$data((0,Wu._)`Object.keys(${r}).length ${i} ${n}`)}};$w.default=Zq});var vN=P(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var Zu=En(),Ku=Ee(),Kq=We(),Jq={message:({params:{missingProperty:t}})=>(0,Ku.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ku._)`{missingProperty: ${t}}`},Xq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Jq,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,Kq.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(Ku.nil,d);else for(let p of r)(0,Zu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,Zu.checkMissingProp)(t,r,p)),(0,Zu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Zu.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,Zu.propertyInData)(e,i,p,s.ownProperties)),e.if((0,Ku.not)(h),()=>{t.error(),e.break()})},Ku.nil)}}};Lw.default=Xq});var _N=P(zw=>{"use strict";Object.defineProperty(zw,"__esModule",{value:!0});var Ju=Ee(),Yq={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ju.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ju._)`{limit: ${t}}`},Qq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Yq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Ju.operators.GT:Ju.operators.LT;t.fail$data((0,Ju._)`${r}.length ${i} ${n}`)}};zw.default=Qq});var Lh=P(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var SN=cu();SN.code='require("ajv/dist/runtime/equal").default';Fw.default=SN});var wN=P(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});var Bw=zu(),lr=Ee(),eW=We(),tW=Lh(),rW={message:({params:{i:t,j:e}})=>(0,lr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,lr._)`{i: ${t}, j: ${e}}`},nW={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rW,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,Bw.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,lr._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,lr._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,lr._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,Bw.checkDataTypes)(c,y,s.opts.strictNumbers,Bw.DataType.Wrong),x=e.const("indices",(0,lr._)`{}`);e.for((0,lr._)`;${h}--;`,()=>{e.let(y,(0,lr._)`${r}[${h}]`),e.if(g,(0,lr._)`continue`),c.length>1&&e.if((0,lr._)`typeof ${y} == "string"`,(0,lr._)`${y} += "_"`),e.if((0,lr._)`typeof ${x}[${y}] == "number"`,()=>{e.assign(f,(0,lr._)`${x}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,lr._)`${x}[${y}] = ${h}`)})}function p(h,f){let y=(0,eW.useFunc)(e,tW.default),g=e.name("outer");e.label(g).for((0,lr._)`;${h}--;`,()=>e.for((0,lr._)`${f} = ${h}; ${f}--;`,()=>e.if((0,lr._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};jw.default=nW});var kN=P(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});var Uw=Ee(),iW=We(),aW=Lh(),oW={message:"must be equal to constant",params:({schemaCode:t})=>(0,Uw._)`{allowedValue: ${t}}`},sW={keyword:"const",$data:!0,error:oW,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,Uw._)`!${(0,iW.useFunc)(e,aW.default)}(${r}, ${i})`):t.fail((0,Uw._)`${a} !== ${r}`)}};Gw.default=sW});var xN=P(Vw=>{"use strict";Object.defineProperty(Vw,"__esModule",{value:!0});var Xu=Ee(),lW=We(),cW=Lh(),uW={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Xu._)`{allowedValues: ${t}}`},dW={keyword:"enum",schemaType:"array",$data:!0,error:uW,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,lW.useFunc)(e,cW.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,Xu.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,Xu._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,Xu._)`${c()}(${r}, ${p}[${h}])`:(0,Xu._)`${r} === ${f}`}}};Vw.default=dW});var EN=P(Hw=>{"use strict";Object.defineProperty(Hw,"__esModule",{value:!0});var pW=pN(),mW=mN(),hW=gN(),fW=yN(),gW=bN(),yW=vN(),bW=_N(),vW=wN(),_W=kN(),SW=xN(),wW=[pW.default,mW.default,hW.default,fW.default,gW.default,yW.default,bW.default,vW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},_W.default,SW.default];Hw.default=wW});var Ww=P(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.validateAdditionalItems=void 0;var Ro=Ee(),qw=We(),kW={message:({params:{len:t}})=>(0,Ro.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ro._)`{limit: ${t}}`},xW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:kW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,qw.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}TN(t,n)}};function TN(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,Ro._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ro._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,qw.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,Ro._)`${s} <= ${e.length}`);r.if((0,Ro.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:qw.Type.Num},c),o.allErrors||r.if((0,Ro.not)(c),()=>r.break())})}}Yu.validateAdditionalItems=TN;Yu.default=xW});var Zw=P(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.validateTuple=void 0;var CN=Ee(),zh=We(),EW=En(),TW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return IN(t,"additionalItems",e);r.items=!0,!(0,zh.alwaysValidSchema)(r,e)&&t.ok((0,EW.validateArray)(t))}};function IN(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=zh.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,CN._)`${a}.length`);r.forEach((d,m)=>{(0,zh.alwaysValidSchema)(s,d)||(n.if((0,CN._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,zh.checkStrictMode)(s,y,m.strictTuples)}}}Qu.validateTuple=IN;Qu.default=TW});var AN=P(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});var CW=Zw(),IW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,CW.validateTuple)(t,"items")};Kw.default=IW});var RN=P(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});var PN=Ee(),AW=We(),PW=En(),RW=Ww(),NW={message:({params:{len:t}})=>(0,PN.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,PN._)`{limit: ${t}}`},OW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:NW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,AW.alwaysValidSchema)(n,e)&&(i?(0,RW.validateAdditionalItems)(t,i):t.ok((0,PW.validateArray)(t)))}};Jw.default=OW});var NN=P(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});var Cn=Ee(),Fh=We(),DW={message:({params:{min:t,max:e}})=>e===void 0?(0,Cn.str)`must contain at least ${t} valid item(s)`:(0,Cn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Cn._)`{minContains: ${t}}`:(0,Cn._)`{minContains: ${t}, maxContains: ${e}}`},MW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:DW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,Cn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,Fh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,Fh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Fh.alwaysValidSchema)(a,r)){let f=(0,Cn._)`${u} >= ${o}`;s!==void 0&&(f=(0,Cn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,Cn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Fh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,Cn._)`${f}++`),s===void 0?e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Cn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};Xw.default=MW});var MN=P(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.validateSchemaDeps=fi.validatePropertyDeps=fi.error=void 0;var Yw=Ee(),$W=We(),ed=En();fi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Yw.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Yw._)`{property: ${t},
|
|
13
|
+
missingProperty: ${n},
|
|
14
|
+
depsCount: ${e},
|
|
15
|
+
deps: ${r}}`};var LW={keyword:"dependencies",type:"object",schemaType:"object",error:fi.error,code(t){let[e,r]=zW(t);ON(t,e),DN(t,r)}};function zW({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function ON(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,ed.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,ed.checkReportMissingProp)(t,c)}):(r.if((0,Yw._)`${l} && (${(0,ed.checkMissingProp)(t,s,a)})`),(0,ed.reportMissingProp)(t,a),r.else())}}fi.validatePropertyDeps=ON;function DN(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,$W.alwaysValidSchema)(a,e[s])||(r.if((0,ed.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}fi.validateSchemaDeps=DN;fi.default=LW});var LN=P(Qw=>{"use strict";Object.defineProperty(Qw,"__esModule",{value:!0});var $N=Ee(),FW=We(),BW={message:"property name must be valid",params:({params:t})=>(0,$N._)`{propertyName: ${t.propertyName}}`},jW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:BW,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,FW.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,$N.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};Qw.default=jW});var tk=P(ek=>{"use strict";Object.defineProperty(ek,"__esModule",{value:!0});var Bh=En(),Wn=Ee(),UW=Wi(),jh=We(),GW={message:"must NOT have additional properties",params:({params:t})=>(0,Wn._)`{additionalProperty: ${t.additionalProperty}}`},VW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:GW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,jh.alwaysValidSchema)(o,r))return;let c=(0,Bh.allSchemaProperties)(n.properties),u=(0,Bh.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Wn._)`${a} === ${UW.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let x=(0,jh.schemaRefOrVal)(o,n.properties,"properties");g=(0,Bh.isOwnProperty)(e,x,y)}else c.length?g=(0,Wn.or)(...c.map(x=>(0,Wn._)`${y} === ${x}`)):g=Wn.nil;return u.length&&(g=(0,Wn.or)(g,...u.map(x=>(0,Wn._)`${(0,Bh.usePattern)(t,x)}.test(${y})`))),(0,Wn.not)(g)}function p(y){e.code((0,Wn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,jh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Wn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Wn.not)(g),()=>e.break()))}}function f(y,g,x){let v={keyword:"additionalProperties",dataProp:y,dataPropType:jh.Type.Str};x===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};ek.default=VW});var BN=P(nk=>{"use strict";Object.defineProperty(nk,"__esModule",{value:!0});var HW=Uu(),zN=En(),rk=We(),FN=tk(),qW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&FN.default.code(new HW.KeywordCxt(a,FN.default,"additionalProperties"));let o=(0,zN.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=rk.mergeEvaluated.props(e,(0,rk.toHash)(o),a.props));let s=o.filter(d=>!(0,rk.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,zN.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};nk.default=qW});var VN=P(ik=>{"use strict";Object.defineProperty(ik,"__esModule",{value:!0});var jN=En(),Uh=Ee(),UN=We(),GN=We(),WW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,jN.allSchemaProperties)(r),l=s.filter(f=>(0,UN.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof Uh.Name)&&(a.props=(0,GN.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,UN.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,Uh._)`${(0,jN.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:GN.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,Uh._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,Uh.not)(u),()=>e.break())})})}}};ik.default=WW});var HN=P(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});var ZW=We(),KW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,ZW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ak.default=KW});var qN=P(ok=>{"use strict";Object.defineProperty(ok,"__esModule",{value:!0});var JW=En(),XW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:JW.validateUnion,error:{message:"must match a schema in anyOf"}};ok.default=XW});var WN=P(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});var Gh=Ee(),YW=We(),QW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Gh._)`{passingSchemas: ${t.passing}}`},e5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:QW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,YW.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Gh._)`${l} && ${o}`).assign(o,!1).assign(s,(0,Gh._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,Gh.Name)})})}}};sk.default=e5});var ZN=P(lk=>{"use strict";Object.defineProperty(lk,"__esModule",{value:!0});var t5=We(),r5={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,t5.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};lk.default=r5});var XN=P(ck=>{"use strict";Object.defineProperty(ck,"__esModule",{value:!0});var Vh=Ee(),JN=We(),n5={message:({params:t})=>(0,Vh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Vh._)`{failingKeyword: ${t.ifClause}}`},i5={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:n5,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,JN.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=KN(n,"then"),a=KN(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,Vh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,Vh._)`${u}`):t.setParams({ifClause:u})}}}};function KN(t,e){let r=t.schema[e];return r!==void 0&&!(0,JN.alwaysValidSchema)(t,r)}ck.default=i5});var YN=P(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});var a5=We(),o5={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,a5.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};uk.default=o5});var QN=P(dk=>{"use strict";Object.defineProperty(dk,"__esModule",{value:!0});var s5=Ww(),l5=AN(),c5=Zw(),u5=RN(),d5=NN(),p5=MN(),m5=LN(),h5=tk(),f5=BN(),g5=VN(),y5=HN(),b5=qN(),v5=WN(),_5=ZN(),S5=XN(),w5=YN();function k5(t=!1){let e=[y5.default,b5.default,v5.default,_5.default,S5.default,w5.default,m5.default,h5.default,p5.default,f5.default,g5.default];return t?e.push(l5.default,u5.default):e.push(s5.default,c5.default),e.push(d5.default),e}dk.default=k5});var eO=P(pk=>{"use strict";Object.defineProperty(pk,"__esModule",{value:!0});var Ot=Ee(),x5={message:({schemaCode:t})=>(0,Ot.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ot._)`{format: ${t}}`},E5={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:x5,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Ot._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Ot._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Ot._)`${f}.type || "string"`).assign(g,(0,Ot._)`${f}.validate`),()=>r.assign(y,(0,Ot._)`"string"`).assign(g,f)),t.fail$data((0,Ot.or)(x(),v()));function x(){return l.strictSchema===!1?Ot.nil:(0,Ot._)`${o} && !${g}`}function v(){let I=u.$async?(0,Ot._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Ot._)`${g}(${n})`,T=(0,Ot._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Ot._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){x();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function x(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Ot.regexpCode)(T):l.code.formats?(0,Ot._)`${l.code.formats}${(0,Ot.getProperty)(a)}`:void 0,M=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Ot._)`${M}.validate`]:["string",T,M]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ot._)`await ${g}(${n})`}return typeof y=="function"?(0,Ot._)`${g}(${n})`:(0,Ot._)`${g}.test(${n})`}}}};pk.default=E5});var tO=P(mk=>{"use strict";Object.defineProperty(mk,"__esModule",{value:!0});var T5=eO(),C5=[T5.default];mk.default=C5});var rO=P(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.contentVocabulary=wl.metadataVocabulary=void 0;wl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var iO=P(hk=>{"use strict";Object.defineProperty(hk,"__esModule",{value:!0});var I5=dN(),A5=EN(),P5=QN(),R5=tO(),nO=rO(),N5=[I5.default,A5.default,(0,P5.default)(),R5.default,nO.metadataVocabulary,nO.contentVocabulary];hk.default=N5});var aO=P(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.DiscrError=void 0;var O5;(function(t){t.Tag="tag",t.Mapping="mapping"})(O5=td.DiscrError||(td.DiscrError={}))});var sO=P(gk=>{"use strict";Object.defineProperty(gk,"__esModule",{value:!0});var kl=Ee(),fk=aO(),oO=Ah(),D5=We(),M5={message:({params:{discrError:t,tagName:e}})=>t===fk.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,kl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},$5={keyword:"discriminator",type:"object",schemaType:"object",error:M5,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,kl._)`${r}${(0,kl.getProperty)(s)}`);e.if((0,kl._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:fk.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,kl._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:fk.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,kl.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];T?.$ref&&!(0,D5.schemaHasRulesButRef)(T,a.self.RULES)&&(T=oO.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,T?.$ref),T instanceof oO.SchemaEnv&&(T=T.schema));let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),x(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function x(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};gk.default=$5});var lO=P((Pde,L5)=>{L5.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var dO=P((Ct,uO)=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.MissingRefError=Ct.ValidationError=Ct.CodeGen=Ct.Name=Ct.nil=Ct.stringify=Ct.str=Ct._=Ct.KeywordCxt=void 0;var z5=aN(),F5=iO(),B5=sO(),cO=lO(),j5=["/properties"],Hh="http://json-schema.org/draft-07/schema",qh=class extends z5.default{_addVocabularies(){super._addVocabularies(),F5.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(B5.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(cO,j5):cO;this.addMetaSchema(e,Hh,!1),this.refs["http://json-schema.org/schema"]=Hh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Hh)?Hh:void 0)}};uO.exports=Ct=qh;Object.defineProperty(Ct,"__esModule",{value:!0});Ct.default=qh;var U5=Uu();Object.defineProperty(Ct,"KeywordCxt",{enumerable:!0,get:function(){return U5.KeywordCxt}});var xl=Ee();Object.defineProperty(Ct,"_",{enumerable:!0,get:function(){return xl._}});Object.defineProperty(Ct,"str",{enumerable:!0,get:function(){return xl.str}});Object.defineProperty(Ct,"stringify",{enumerable:!0,get:function(){return xl.stringify}});Object.defineProperty(Ct,"nil",{enumerable:!0,get:function(){return xl.nil}});Object.defineProperty(Ct,"Name",{enumerable:!0,get:function(){return xl.Name}});Object.defineProperty(Ct,"CodeGen",{enumerable:!0,get:function(){return xl.CodeGen}});var G5=Th();Object.defineProperty(Ct,"ValidationError",{enumerable:!0,get:function(){return G5.default}});var V5=Ch();Object.defineProperty(Ct,"MissingRefError",{enumerable:!0,get:function(){return V5.default}})});var pO=P(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.formatLimitDefinition=void 0;var H5=dO(),Zn=Ee(),Ma=Zn.operators,Wh={formatMaximum:{okStr:"<=",ok:Ma.LTE,fail:Ma.GT},formatMinimum:{okStr:">=",ok:Ma.GTE,fail:Ma.LT},formatExclusiveMaximum:{okStr:"<",ok:Ma.LT,fail:Ma.GTE},formatExclusiveMinimum:{okStr:">",ok:Ma.GT,fail:Ma.LTE}},q5={message:({keyword:t,schemaCode:e})=>(0,Zn.str)`should be ${Wh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Zn._)`{comparison: ${Wh[t].okStr}, limit: ${e}}`};El.formatLimitDefinition={keyword:Object.keys(Wh),type:"string",schemaType:"string",$data:!0,error:q5,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:a}=t,{opts:o,self:s}=a;if(!o.validateFormats)return;let l=new H5.KeywordCxt(a,s.RULES.all.format.definition,"format");l.$data?c():u();function c(){let m=e.scopeValue("formats",{ref:s.formats,code:o.code.formats}),p=e.const("fmt",(0,Zn._)`${m}[${l.schemaCode}]`);t.fail$data((0,Zn.or)((0,Zn._)`typeof ${p} != "object"`,(0,Zn._)`${p} instanceof RegExp`,(0,Zn._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=l.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${m}" does not define "compare" function`);let h=e.scopeValue("formats",{key:m,ref:p,code:o.code.formats?(0,Zn._)`${o.code.formats}${(0,Zn.getProperty)(m)}`:void 0});t.fail$data(d(h))}function d(m){return(0,Zn._)`${m}.compare(${r}, ${n}) ${Wh[i].fail} 0`}},dependencies:["format"]};var W5=t=>(t.addKeyword(El.formatLimitDefinition),t);El.default=W5});var gO=P((rd,fO)=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var Tl=JP(),Z5=pO(),yk=Ee(),mO=new yk.Name("fullFormats"),K5=new yk.Name("fastFormats"),bk=(t,e={keywords:!0})=>{if(Array.isArray(e))return hO(t,e,Tl.fullFormats,mO),t;let[r,n]=e.mode==="fast"?[Tl.fastFormats,K5]:[Tl.fullFormats,mO],i=e.formats||Tl.formatNames;return hO(t,i,r,n),e.keywords&&(0,Z5.default)(t),t};bk.get=(t,e="full")=>{let n=(e==="fast"?Tl.fastFormats:Tl.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function hO(t,e,r,n){var i,a;(i=(a=t.opts.code).formats)!==null&&i!==void 0||(a.formats=(0,yk._)`require("ajv-formats/dist/formats").${n}`);for(let o of e)t.addFormat(o,r[o])}fO.exports=rd=bk;Object.defineProperty(rd,"__esModule",{value:!0});rd.default=bk});var VD=P((RSe,GD)=>{"use strict";var Wf=Object.prototype.hasOwnProperty,UD=Object.prototype.toString,$D=Object.defineProperty,LD=Object.getOwnPropertyDescriptor,zD=function(e){return typeof Array.isArray=="function"?Array.isArray(e):UD.call(e)==="[object Array]"},FD=function(e){if(!e||UD.call(e)!=="[object Object]")return!1;var r=Wf.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Wf.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||Wf.call(e,i)},BD=function(e,r){$D&&r.name==="__proto__"?$D(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},jD=function(e,r){if(r==="__proto__")if(Wf.call(e,r)){if(LD)return LD(e,r).value}else return;return e[r]};GD.exports=function t(){var e,r,n,i,a,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(r in e)n=jD(s,r),i=jD(e,r),s!==i&&(u&&i&&(FD(i)||(a=zD(i)))?(a?(a=!1,o=n&&zD(n)?n:[]):o=n&&FD(n)?n:{},BD(s,{name:r,newValue:t(u,o,i)})):typeof i<"u"&&BD(s,{name:r,newValue:i}));return s}});var mM=P(Me=>{"use strict";var qd=Symbol.for("react.element"),s7=Symbol.for("react.portal"),l7=Symbol.for("react.fragment"),c7=Symbol.for("react.strict_mode"),u7=Symbol.for("react.profiler"),d7=Symbol.for("react.provider"),p7=Symbol.for("react.context"),m7=Symbol.for("react.forward_ref"),h7=Symbol.for("react.suspense"),f7=Symbol.for("react.memo"),g7=Symbol.for("react.lazy"),rM=Symbol.iterator;function y7(t){return t===null||typeof t!="object"?null:(t=rM&&t[rM]||t["@@iterator"],typeof t=="function"?t:null)}var aM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oM=Object.assign,sM={};function Wl(t,e,r){this.props=t,this.context=e,this.refs=sM,this.updater=r||aM}Wl.prototype.isReactComponent={};Wl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Wl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lM(){}lM.prototype=Wl.prototype;function qx(t,e,r){this.props=t,this.context=e,this.refs=sM,this.updater=r||aM}var Wx=qx.prototype=new lM;Wx.constructor=qx;oM(Wx,Wl.prototype);Wx.isPureReactComponent=!0;var nM=Array.isArray,cM=Object.prototype.hasOwnProperty,Zx={current:null},uM={key:!0,ref:!0,__self:!0,__source:!0};function dM(t,e,r){var n,i={},a=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(a=""+e.key),e)cM.call(e,n)&&!uM.hasOwnProperty(n)&&(i[n]=e[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)i[n]===void 0&&(i[n]=s[n]);return{$$typeof:qd,type:t,key:a,ref:o,props:i,_owner:Zx.current}}function b7(t,e){return{$$typeof:qd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Kx(t){return typeof t=="object"&&t!==null&&t.$$typeof===qd}function v7(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var iM=/\/+/g;function Hx(t,e){return typeof t=="object"&&t!==null&&t.key!=null?v7(""+t.key):e.toString(36)}function lg(t,e,r,n,i){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case qd:case s7:o=!0}}if(o)return o=t,i=i(o),t=n===""?"."+Hx(o,0):n,nM(i)?(r="",t!=null&&(r=t.replace(iM,"$&/")+"/"),lg(i,e,r,"",function(c){return c})):i!=null&&(Kx(i)&&(i=b7(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(iM,"$&/")+"/")+t)),e.push(i)),1;if(o=0,n=n===""?".":n+":",nM(t))for(var s=0;s<t.length;s++){a=t[s];var l=n+Hx(a,s);o+=lg(a,e,r,l,i)}else if(l=y7(t),typeof l=="function")for(t=l.call(t),s=0;!(a=t.next()).done;)a=a.value,l=n+Hx(a,s++),o+=lg(a,e,r,l,i);else if(a==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function sg(t,e,r){if(t==null)return t;var n=[],i=0;return lg(t,n,"","",function(a){return e.call(r,a,i++)}),n}function _7(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Dr={current:null},cg={transition:null},S7={ReactCurrentDispatcher:Dr,ReactCurrentBatchConfig:cg,ReactCurrentOwner:Zx};function pM(){throw Error("act(...) is not supported in production builds of React.")}Me.Children={map:sg,forEach:function(t,e,r){sg(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return sg(t,function(){e++}),e},toArray:function(t){return sg(t,function(e){return e})||[]},only:function(t){if(!Kx(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Me.Component=Wl;Me.Fragment=l7;Me.Profiler=u7;Me.PureComponent=qx;Me.StrictMode=c7;Me.Suspense=h7;Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=S7;Me.act=pM;Me.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=oM({},t.props),i=t.key,a=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,o=Zx.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(l in e)cM.call(e,l)&&!uM.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];n.children=s}return{$$typeof:qd,type:t.type,key:i,ref:a,props:n,_owner:o}};Me.createContext=function(t){return t={$$typeof:p7,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:d7,_context:t},t.Consumer=t};Me.createElement=dM;Me.createFactory=function(t){var e=dM.bind(null,t);return e.type=t,e};Me.createRef=function(){return{current:null}};Me.forwardRef=function(t){return{$$typeof:m7,render:t}};Me.isValidElement=Kx;Me.lazy=function(t){return{$$typeof:g7,_payload:{_status:-1,_result:t},_init:_7}};Me.memo=function(t,e){return{$$typeof:f7,type:t,compare:e===void 0?null:e}};Me.startTransition=function(t){var e=cg.transition;cg.transition={};try{t()}finally{cg.transition=e}};Me.unstable_act=pM;Me.useCallback=function(t,e){return Dr.current.useCallback(t,e)};Me.useContext=function(t){return Dr.current.useContext(t)};Me.useDebugValue=function(){};Me.useDeferredValue=function(t){return Dr.current.useDeferredValue(t)};Me.useEffect=function(t,e){return Dr.current.useEffect(t,e)};Me.useId=function(){return Dr.current.useId()};Me.useImperativeHandle=function(t,e,r){return Dr.current.useImperativeHandle(t,e,r)};Me.useInsertionEffect=function(t,e){return Dr.current.useInsertionEffect(t,e)};Me.useLayoutEffect=function(t,e){return Dr.current.useLayoutEffect(t,e)};Me.useMemo=function(t,e){return Dr.current.useMemo(t,e)};Me.useReducer=function(t,e,r){return Dr.current.useReducer(t,e,r)};Me.useRef=function(t){return Dr.current.useRef(t)};Me.useState=function(t){return Dr.current.useState(t)};Me.useSyncExternalStore=function(t,e,r){return Dr.current.useSyncExternalStore(t,e,r)};Me.useTransition=function(){return Dr.current.useTransition()};Me.version="18.3.1"});var fM=P((cke,hM)=>{"use strict";hM.exports=mM()});var Yt=[];for(tp=0;tp<256;++tp)Yt.push((tp+256).toString(16).slice(1));var tp;function iE(t,e=0){return(Yt[t[e+0]]+Yt[t[e+1]]+Yt[t[e+2]]+Yt[t[e+3]]+"-"+Yt[t[e+4]]+Yt[t[e+5]]+"-"+Yt[t[e+6]]+Yt[t[e+7]]+"-"+Yt[t[e+8]]+Yt[t[e+9]]+"-"+Yt[t[e+10]]+Yt[t[e+11]]+Yt[t[e+12]]+Yt[t[e+13]]+Yt[t[e+14]]+Yt[t[e+15]]).toLowerCase()}var rp,NM=new Uint8Array(16);function fg(){if(!rp&&(rp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rp))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rp(NM)}var OM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gg={randomUUID:OM};function DM(t,e,r){if(gg.randomUUID&&!e&&!t)return gg.randomUUID();t=t||{};var n=t.random||(t.rng||fg)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return iE(n)}var _t=DM;function yg(t){let e=(t||"").split(`
|
|
16
|
+
`);for(;e.length>0&&e[0].trim()=="";)e.shift();for(;e.length>0&&e[e.length-1].trim()=="";)e.pop();let r=1/0;for(let n of e){let i=n.match(/^\s*/)?.[0].length||0;r=Math.min(r,i)}return r>0&&r<1/0&&(e=e.map(n=>n.substring(r))),e.join(`
|
|
17
|
+
`)}var MM={};function ia(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:MM}function ht(){return ia().intelliweave=ia().intelliweave||ia().webWeaver||{},ia().intelliweave}async function*aE(t){let e="",r=function*(){for(;;){let a=e.indexOf(`
|
|
18
|
+
|
|
19
|
+
`);if(a==-1)break;let o=e.slice(0,a);e=e.slice(a+2);let s={},l=o.split(`
|
|
20
|
+
`);for(let c of l){a=c.indexOf(": ");let u=c.slice(0,a),d=c.slice(a+2);a==-1&&(u=c,d=""),u&&(s[u]!==void 0?s[u]+=`
|
|
21
|
+
`+d:s[u]=d)}yield s}},n=new TextDecoder,i=t.getReader();for(;;){let{done:a,value:o}=await i.read();if(a)break;e+=n.decode(o,{stream:!0}),yield*r()}e+=n.decode()+`
|
|
22
|
+
|
|
23
|
+
`,yield*r()}function oE(){if(ht().userID)return ht().userID||"";if(typeof localStorage<"u"){let t=localStorage.getItem("intelliweave.uid")||"";return t||(t=_t(),localStorage.setItem("intelliweave.uid",t),t)}else return _t()}function sE(t){let e=t;if(e?.type=="object"&&e.properties)return t;let r={type:"object",properties:{},required:[]};if(t&&Array.isArray(t)){let n=t;for(let i of n)r.properties[i.name]={type:i.type||"string",description:i.description||""}}return r}var np=class np{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return np.debug?!0:typeof window<"u"&&ht().debug}log(...e){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...e)}debug(...e){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...e)}info(...e){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...e)}warn(...e){console.warn(`[IntelliWeave > ${this.module}]`,...e)}error(...e){console.error(`[IntelliWeave > ${this.module}]`,...e)}timer(e,...r){let n=Date.now();return this.debug(`[${e} 0ms] Started`,...r),(...i)=>this.debug(`[${e} ${Math.floor(Date.now()-n)}ms]`,...i)}};np.debug=!1;var Re=np;var lE=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~",[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],"\0","","","","","","","\x07","\b"," ",`
|
|
10
24
|
`,"\v","\f","\r","","","","","","","","","","","","","","\x1B","","","",""," ","\x7F",[128],[129],[130],[131],[132],[133],[134],[135],[136],[137],[138],[139],[140],[141],[142],[143],[144],[145],[146],[147],[148],[149],[150],[151],[152],[153],[154],[155],[156],[157],[158],[159],[160],[173]," "," ","in"," t"," ","er"," ","on"," a","re","at","st","en","or"," th",`
|
|
11
25
|
|
|
12
26
|
`," c","le"," s","it","an","ar","al"," the",`;
|
|
@@ -3236,7 +3250,7 @@ import{b as ie,c as uc,d as dc,e as Ne}from"./chunk-AIYMQX7V.js";var Ch=ie((Po,k
|
|
|
3236
3250
|
|
|
3237
3251
|
|
|
3238
3252
|
|
|
3239
|
-
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],
|
|
3253
|
+
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],cE=["IClient","ISODE","Issuer",`)}\r
|
|
3240
3254
|
`,",but"," Uph","(Sub"," t\xE9l\xE9phone"," onDataChange"," marshaller","-analytics",",content"," debacle","_ValueChanged"," fauna"," #=>"," foyer","'utilisation"," M\xFCller"," Fetish"," defaultManager"," backtrack","Bah","Explicit","_ASCII"," mActivity","(Msg"," \uAC8C"," TERMS"," Angie","HSV"," Mosque",".Names","\uD2BC","reste","_parms"," gaping"," cropping","DataFrame"," responsiveness","_undo","_tran",".terminate"," italiane"," walkthrough"," attractiveness","\u0434\u0435","_STS","_learn"," chocolates","ierarchical","-thinking"," )))","ishments",".Logf"," TMZ"," Canary","foil"," Vaccine",".vx"," Surround","Intermediate"," iov","vais",`';";
|
|
3241
3255
|
`,`\uFF5E
|
|
3242
3256
|
|
|
@@ -3246,60 +3260,79 @@ import{b as ie,c as uc,d as dc,e as Ne}from"./chunk-AIYMQX7V.js";var Ch=ie((Po,k
|
|
|
3246
3260
|
`," spac"," rookies","(describing","ngen",[224,174,191,224,174],".rdf",".Mutex"," kneeling"," QE","setMax","ReadStream"," ventas","sut","cmpeq",".WriteAllText"," Experienced","$__"," kaum"," LIS"," documentos","_HEALTH","icontains"," artisans","OWNER"," blinked","getDisplay"," toen"," rowNum"," avril"," invis"," Kear","toBeInTheDocument","apur"," racked"," McMaster","_ATTRIB","Haz"," factura","/ts"," \u0440\u0430\u0437\u043C\u0435\u0440"," zf"," shortfall",".fasta"," CONSTANT",".managed","gems","SharedPointer"," blurry","brightness","(components",` ..."
|
|
3247
3261
|
|
|
3248
3262
|
`,"SELL"," Illustrator",".getChannel"," trouv\xE9","ysters"," vois"," Linden"," emojis"," brawl"," MSR"," Elo"," Croatian","PopupMenu","Lewis",".JWT"," astonished","Bush","(itemId"," detachment"," Encore","\u5C14"," rekl"," cram",")$/",".getHost","_recommend","-HT","_calibration","Authenticate",".firebaseapp","UNIX"," Camera"," HEAP","Ideal",".office"," goofy","(Symbol"," jouer","_partitions"," rapidement"," GNUNET","idUser"," supervise","(Contact","AWN","\u3058"," naam"," aust","\u5728\u7EBF","_softmax","AllowAnonymous","ammable","ROUTE","*D"," aden"," Cristina"," Cristiano"," bloodstream","subclass","_persona","CHILD","-know"," navigationOptions"," Zukunft"," Pixar","Tyler"," underworld"," sincerity"," dispenser"," kter","idders",".addNode","-checked"," keyst"," WTO",".signals"," adventurer"," Pang","\\R","=pos"," dispensaries"," Closet",'("{\\"',"ideon"," n\xE9cessaire",`()"
|
|
3249
|
-
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],Mv=xp.concat(Tp);xp.length=0;Tp.length=0;var Ap=Mv;var hi="all";var Ip=r=>r<=127;function gc(r){if(r.length===0)return!1;let e=r.charCodeAt(r.length-1);return e>=55296&&e<=56319}function Ov(r){let e=0;for(;e<r.length;){let t=r[e],i=0,n=0;if(t<=127)i=1,n=t;else if((t&224)===192){if(i=2,n=t&31,t<=193)return!1}else if((t&240)===224)i=3,n=t&15;else if((t&248)===240){if(i=4,n=t&7,t>244)return!1}else return!1;if(e+i>r.length)return!1;for(let a=1;a<i;a++){let s=r[e+a];if(s===void 0||(s&192)!==128)return!1;n=n<<6|s&63}if(i===2&&n<128||i===3&&n<2048||i===4&&n<65536||n>=55296&&n<=57343||n>1114111)return!1;e+=i}return!0}var Nv=new TextDecoder("utf8",{fatal:!1});function Rp(r){if(Ov(r))return Nv.decode(r)}function Pp(r,e){let t=Math.min(r.length,e.length);for(let i=0;i<t;i++)if(r[i]!==e[i])return r[i]-e[i];return r.length-e.length}function Dp(r){let e=0;return r.forEach(t=>{e=Math.max(e,t)}),e}function fc(r){return r.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function yc(r){let t=[...r].map(fc).join("|");return new RegExp(`(${t})`)}var Rs=new Uint8Array(0),gi=new TextDecoder("utf8"),Ps=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:i,mergeCacheSize:n=1e5}){Ne(this,"mergeableBytePairRankCount");Ne(this,"bytePairRankDecoder");Ne(this,"bytePairNonUtfRankDecoder",new Map);Ne(this,"bytePairNonUtfSortedEncoder");Ne(this,"bytePairStringRankEncoder");Ne(this,"tokenSplitRegex");Ne(this,"specialTokensEncoder");Ne(this,"specialTokensDecoder");Ne(this,"specialTokenPatternRegex");Ne(this,"textEncoder",new TextEncoder);Ne(this,"mergeCache");Ne(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=n,n>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let a=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>Pp(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=i;let o=[...this.specialTokensEncoder.keys()].map(fc).join("|");try{this.specialTokenPatternRegex=new RegExp(o,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let i=0,n=0;for(;;){let a=this.findNextSpecialToken(e,t,i),s=a?.[0],o=s??e.length,l=i===0&&o===e.length?e:e.slice(i,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n=1,yield[u];continue}let p=this.bytePairEncode(c);n=p.length,yield p}if(s!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],i=s+c.length,n=1}else break}return n}encodeNative(e,t){let i=0,n=[];for(;;){let a=this.findNextSpecialToken(e,t,i),s=a?.[0],o=s??e.length,l=i===0&&o===e.length?e:e.slice(i,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n.push(u);continue}let p=this.bytePairEncode(c);n.push(...p)}if(s!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n.push(u),i=s+c.length}else break}return n}countNative(e,t){let i=0,n=0;for(;;){let a=this.findNextSpecialToken(e,t,i),s=a?.[0],o=s??e.length,l=i===0&&o===e.length?e:e.slice(i,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){n++;continue}let p=this.bytePairEncode(c);n+=p.length}if(s!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n++,i=s+c.length}else break}return n}*decodeNativeGenerator(e){for(let t of e){let i=this.tryDecodeToken(t);i&&(yield i)}}decodeNative(e){let t="",i=Rs;for(let n of e){let a=this.tryDecodeToken(n);if(a===void 0)throw new Error(`Token ${n} is not in the byte pair encoder.`);if(typeof a=="string")i!==Rs&&(t+=gi.decode(i,{stream:!0}),i=Rs),t+=a;else{let s=new Uint8Array(i.length+a.length);s.set(i),s.set(a,i.length),i=s}}return i!==Rs&&(t+=gi.decode(i,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let i=this.tryDecodeToken(t);i&&(yield i)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=Rp(e);if(t!==void 0)return this.getBpeRankFromString(t);let i=this.binarySearch(e);if(i!==-1)return this.bytePairNonUtfSortedEncoder[i][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,i=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=i;){let n=t+i>>>1,a=this.bytePairNonUtfSortedEncoder[n][0],s=0,o=Math.min(a.length,e.length);for(let l=0;l<o&&(s=a[l]-e[l],s===0);l++);if(s===0&&(s=a.length-e.length),s===0)return n;s<0?t=n+1:i=n-1}return-1}findNextSpecialToken(e,t,i){let n=i;for(;;){this.specialTokenPatternRegex.lastIndex=n;let a=this.specialTokenPatternRegex.exec(e);if(!a)return;let s=a[0];if(t?.has(s))return[a.index+n,s];n=a.index+n+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t=="string")return t;if(typeof t=="object"){let i=this.bytePairNonUtfRankDecoder.get(e);if(i)return i}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let i=this.mergeCache.keys().next().value;this.mergeCache.delete(i)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&Ip(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let n=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,n),n}let t=this.textEncoder.encode(e),i=this.bytePairMerge(t);return this.addToMergeCache(e,i),i}bytePairMerge(e){let t=[],i=[],n=(s,o=t[s],l=t[s+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(o,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let s=0;s<=e.length;s++)t.push(s),s<e.length-1?i.push(n(s,s,s+2)):i.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let s=Number.POSITIVE_INFINITY,o=-1;for(let l=0;l<i.length-1;l++){let c=i[l];c<s&&(s=c,o=l)}if(s===Number.POSITIVE_INFINITY||o===-1)break;t.splice(o+1,1),i.splice(o,1),i[o]=n(o),o>0&&(i[o-1]=n(o-1))}let a=[];for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(o,l));a.push(c)}return a}};var Mp={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Bv={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Fv={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},Op={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Np={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Lp={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Bp={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Gv={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},zv={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},Uv={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},Hv={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},Vv={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Wv={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},jv={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Fp={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},qv={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},$v={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Kv={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Gp={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},Xv={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},Yv={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},Jv={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},zp={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},Zv={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Up={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},Qv={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},Hp={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},bc={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},e_={...bc,humanName:"GPT-4 1106 Preview"},Vp={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Wp={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},t_={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},r_={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},n_={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},i_={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},a_={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},vc={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},$p={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},s_=$p,o_={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},l_={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},c_={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},u_={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},d_={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},p_={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},m_={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},h_={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},g_={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},f_={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},y_={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},b_={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},v_={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},jp={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},__={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},S_={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},qp={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},E_={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},w_={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},k_={...vc,humanName:"GPT-4 32k 0314"},C_={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},x_={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},T_={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},A_={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},I_={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},R_={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},P_={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},D_={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},M_={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},O_={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},N_={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},L_={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},B_={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},F_={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},G_={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},z_={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},U_={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},_c={o1:Np,"o1-2024-12-17":Np,"o1-preview":Lp,"o1-preview-2024-09-12":Lp,"o1-mini":Bp,"o1-mini-2024-09-12":Bp,"o3-mini":Gv,"chatgpt-4o-latest":Qv,"gpt-4o":Mp,"gpt-4o-2024-11-20":Bv,"gpt-4o-2024-08-06":Mp,"gpt-4o-2024-05-13":Fv,"gpt-4o-mini":Op,"gpt-4o-mini-2024-07-18":Op,"gpt-4o-realtime-preview":Vv,"gpt-4o-realtime-preview-2024-10-01":Wv,"gpt-4o-realtime-preview-2024-12-17":jv,"gpt-4o-mini-realtime-preview":Fp,"gpt-4o-mini-realtime-preview-2024-12-17":Fp,"gpt-4o-audio-preview":qv,"gpt-4o-audio-preview-2024-10-01":$v,"gpt-4o-audio-preview-2024-12-17":Kv,"gpt-4o-mini-audio-preview":Gp,"gpt-4o-mini-audio-preview-2024-12-17":Gp,"gpt-4o-2024-08-06-finetune":Xv,"gpt-4o-mini-2024-07-18-finetune":Yv,"gpt-4o-mini-training":zp,"gpt-4o-mini-training-2024-07-18":zp,"davinci-002-finetune":n_,"babbage-002-finetune":a_,"gpt-4-turbo":Up,"gpt-4-turbo-2024-04-09":Up,"gpt-4-turbo-preview":bc,"gpt-4-0125-preview":bc,"gpt-4-1106-preview":e_,"gpt-4":Hp,"gpt-4-0613":Hp,"gpt-3.5-turbo":Vp,"gpt-3.5-turbo-0125":Vp,"gpt-3.5-turbo-1106":t_,"gpt-3.5-turbo-finetune":Jv,"gpt-3.5-turbo-16k":Zv,"gpt-4-32k":vc,"gpt-4-32k-0613":vc,"gpt-4-vision-preview":$p,"gpt-4-1106-vision-preview":s_,"gpt-4-0314":E_,"gpt-4-32k-0314":k_,"gpt-3.5-turbo-0613":o_,"gpt-3.5-turbo-16k-0613":l_,"gpt-3.5-turbo-0301":w_},Ds={..._c,"text-embedding-3-small":zv,"text-embedding-3-large":Uv,"text-embedding-ada-002":Hv,"gpt-3.5-turbo-instruct":Wp,"gpt-3.5-turbo-instruct-0914":Wp,"davinci-002":r_,"babbage-002":i_,"text-ada-001":c_,"text-babbage-001":u_,"text-curie-001":d_,"text-davinci-001":p_,"text-davinci-002":m_,"text-davinci-003":h_,ada:g_,babbage:f_,curie:y_,davinci:b_,"code-davinci-002":v_,"code-davinci-001":jp,"davinci-codex":jp,"code-davinci-edit-001":__,"code-cushman-002":S_,"code-cushman-001":qp,"cushman-codex":qp,"code-search-ada-code-001":A_,"code-search-ada-text-001":I_,"text-davinci-edit-001":R_,"text-similarity-ada-001":C_,"text-search-ada-doc-001":x_,"text-search-ada-query-001":T_,"text-similarity-babbage-001":P_,"text-search-babbage-doc-001":D_,"text-search-babbage-query-001":M_,"code-search-babbage-code-001":O_,"code-search-babbage-text-001":N_,"text-similarity-curie-001":L_,"text-search-curie-doc-001":B_,"text-search-curie-query-001":F_,"text-similarity-davinci-001":G_,"text-search-davinci-doc-001":z_,"text-search-davinci-query-001":U_};var Xt="<|endoftext|>",Xr="<|fim_prefix|>",Yr="<|fim_middle|>",Jr="<|fim_suffix|>",fi="<|im_start|>",yi="<|im_end|>",Zr="<|im_sep|>",bi="<|endofprompt|>";var Kp=Object.fromEntries(Object.entries(_c).map(([r,e])=>[r,e.encoding])),Xp=Object.fromEntries(Object.entries(Ds).map(([r,e])=>[r,e.encoding])),H_={messageSeparator:`
|
|
3263
|
+
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],$M=lE.concat(cE);lE.length=0;cE.length=0;var uE=$M;var ts="all";var dE=t=>t<=127;function bg(t){if(t.length===0)return!1;let e=t.charCodeAt(t.length-1);return e>=55296&&e<=56319}function LM(t){let e=0;for(;e<t.length;){let r=t[e],n=0,i=0;if(r<=127)n=1,i=r;else if((r&224)===192){if(n=2,i=r&31,r<=193)return!1}else if((r&240)===224)n=3,i=r&15;else if((r&248)===240){if(n=4,i=r&7,r>244)return!1}else return!1;if(e+n>t.length)return!1;for(let a=1;a<n;a++){let o=t[e+a];if(o===void 0||(o&192)!==128)return!1;i=i<<6|o&63}if(n===2&&i<128||n===3&&i<2048||n===4&&i<65536||i>=55296&&i<=57343||i>1114111)return!1;e+=n}return!0}var zM=new TextDecoder("utf8",{fatal:!1});function pE(t){if(LM(t))return zM.decode(t)}function mE(t,e){let r=Math.min(t.length,e.length);for(let n=0;n<r;n++)if(t[n]!==e[n])return t[n]-e[n];return t.length-e.length}function hE(t){let e=0;return t.forEach(r=>{e=Math.max(e,r)}),e}function vg(t){return t.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function _g(t){let r=[...t].map(vg).join("|");return new RegExp(`(${r})`)}var ip=new Uint8Array(0),rs=new TextDecoder("utf8"),ap=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:r,tokenSplitRegex:n,mergeCacheSize:i=1e5}){ct(this,"mergeableBytePairRankCount");ct(this,"bytePairRankDecoder");ct(this,"bytePairNonUtfRankDecoder",new Map);ct(this,"bytePairNonUtfSortedEncoder");ct(this,"bytePairStringRankEncoder");ct(this,"tokenSplitRegex");ct(this,"specialTokensEncoder");ct(this,"specialTokensDecoder");ct(this,"specialTokenPatternRegex");ct(this,"textEncoder",new TextEncoder);ct(this,"mergeCache");ct(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=i,i>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let a=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>mE(l[0],c[0])),this.specialTokensEncoder=r??new Map,this.specialTokensDecoder=r?new Map([...r].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=n;let s=[...this.specialTokensEncoder.keys()].map(vg).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i=1,yield[u];continue}let d=this.bytePairEncode(c);i=d.length,yield d}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],n=o+c.length,i=1}else break}return i}encodeNative(e,r){let n=0,i=[];for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i.push(u);continue}let d=this.bytePairEncode(c);i.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i.push(u),n=o+c.length}else break}return i}countNative(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){i++;continue}let d=this.bytePairEncode(c);i+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i++,n=o+c.length}else break}return i}*decodeNativeGenerator(e){for(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}decodeNative(e){let r="",n=ip;for(let i of e){let a=this.tryDecodeToken(i);if(a===void 0)throw new Error(`Token ${i} is not in the byte pair encoder.`);if(typeof a=="string")n!==ip&&(r+=rs.decode(n,{stream:!0}),n=ip),r+=a;else{let o=new Uint8Array(n.length+a.length);o.set(n),o.set(a,n.length),n=o}}return n!==ip&&(r+=rs.decode(n,{stream:!0})),r}async*decodeNativeAsyncIterable(e){for await(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let r=this.getBpeRankFromString(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return r}getBpeRankFromBytes(e){let r=pE(e);if(r!==void 0)return this.getBpeRankFromString(r);let n=this.binarySearch(e);if(n!==-1)return this.bytePairNonUtfSortedEncoder[n][1]}getBpeRankFromBytesOrThrow(e){let r=this.getBpeRankFromBytes(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return r}binarySearch(e){let r=0,n=this.bytePairNonUtfSortedEncoder.length-1;for(;r<=n;){let i=r+n>>>1,a=this.bytePairNonUtfSortedEncoder[i][0],o=0,s=Math.min(a.length,e.length);for(let l=0;l<s&&(o=a[l]-e[l],o===0);l++);if(o===0&&(o=a.length-e.length),o===0)return i;o<0?r=i+1:n=i-1}return-1}findNextSpecialToken(e,r,n){let i=n;for(;;){this.specialTokenPatternRegex.lastIndex=i;let a=this.specialTokenPatternRegex.exec(e);if(!a)return;let o=a[0];if(r?.has(o))return[a.index+i,o];i=a.index+i+1}}tryDecodeToken(e){let r=this.bytePairRankDecoder[e];if(typeof r=="string")return r;if(typeof r=="object"){let n=this.bytePairNonUtfRankDecoder.get(e);if(n)return n}return this.specialTokensDecoder.get(e)}addToMergeCache(e,r){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let n=this.mergeCache.keys().next().value;this.mergeCache.delete(n)}this.mergeCache.set(e,r)}}bytePairEncode(e){if(e.length===1&&dE(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let i=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,i),i}let r=this.textEncoder.encode(e),n=this.bytePairMerge(r);return this.addToMergeCache(e,n),n}bytePairMerge(e){let r=[],n=[],i=(o,s=r[o],l=r[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)r.push(o),o<e.length-1?n.push(i(o,o,o+2)):n.push(Number.POSITIVE_INFINITY);for(;r.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<n.length-1;l++){let c=n[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;r.splice(s+1,1),n.splice(s,1),n[s]=i(s),s>0&&(n[s-1]=i(s-1))}let a=[];for(let o=0;o<r.length-1;o++){let s=r[o],l=r[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));a.push(c)}return a}};var fE={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},BM={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},jM={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},gE={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},yE={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},bE={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},vE={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},UM={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},GM={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},VM={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},HM={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},qM={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},WM={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},ZM={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},_E={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},KM={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},JM={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},XM={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},SE={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},YM={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},QM={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},e$={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},wE={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},t$={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},kE={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},r$={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},xE={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Sg={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},n$={...Sg,humanName:"GPT-4 1106 Preview"},EE={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},TE={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},i$={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},a$={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},o$={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},s$={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},l$={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},wg={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},AE={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},c$=AE,u$={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},d$={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},p$={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},m$={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},h$={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},f$={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},g$={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},y$={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},b$={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},v$={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},_$={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},S$={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},w$={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},CE={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},k$={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},x$={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},IE={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},E$={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},T$={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},C$={...wg,humanName:"GPT-4 32k 0314"},I$={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},A$={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},P$={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},R$={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},N$={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},O$={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},D$={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},M$={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},$$={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},L$={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},z$={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},F$={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},B$={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},j$={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},U$={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},G$={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},V$={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},kg={o1:yE,"o1-2024-12-17":yE,"o1-preview":bE,"o1-preview-2024-09-12":bE,"o1-mini":vE,"o1-mini-2024-09-12":vE,"o3-mini":UM,"chatgpt-4o-latest":r$,"gpt-4o":fE,"gpt-4o-2024-11-20":BM,"gpt-4o-2024-08-06":fE,"gpt-4o-2024-05-13":jM,"gpt-4o-mini":gE,"gpt-4o-mini-2024-07-18":gE,"gpt-4o-realtime-preview":qM,"gpt-4o-realtime-preview-2024-10-01":WM,"gpt-4o-realtime-preview-2024-12-17":ZM,"gpt-4o-mini-realtime-preview":_E,"gpt-4o-mini-realtime-preview-2024-12-17":_E,"gpt-4o-audio-preview":KM,"gpt-4o-audio-preview-2024-10-01":JM,"gpt-4o-audio-preview-2024-12-17":XM,"gpt-4o-mini-audio-preview":SE,"gpt-4o-mini-audio-preview-2024-12-17":SE,"gpt-4o-2024-08-06-finetune":YM,"gpt-4o-mini-2024-07-18-finetune":QM,"gpt-4o-mini-training":wE,"gpt-4o-mini-training-2024-07-18":wE,"davinci-002-finetune":o$,"babbage-002-finetune":l$,"gpt-4-turbo":kE,"gpt-4-turbo-2024-04-09":kE,"gpt-4-turbo-preview":Sg,"gpt-4-0125-preview":Sg,"gpt-4-1106-preview":n$,"gpt-4":xE,"gpt-4-0613":xE,"gpt-3.5-turbo":EE,"gpt-3.5-turbo-0125":EE,"gpt-3.5-turbo-1106":i$,"gpt-3.5-turbo-finetune":e$,"gpt-3.5-turbo-16k":t$,"gpt-4-32k":wg,"gpt-4-32k-0613":wg,"gpt-4-vision-preview":AE,"gpt-4-1106-vision-preview":c$,"gpt-4-0314":E$,"gpt-4-32k-0314":C$,"gpt-3.5-turbo-0613":u$,"gpt-3.5-turbo-16k-0613":d$,"gpt-3.5-turbo-0301":T$},op={...kg,"text-embedding-3-small":GM,"text-embedding-3-large":VM,"text-embedding-ada-002":HM,"gpt-3.5-turbo-instruct":TE,"gpt-3.5-turbo-instruct-0914":TE,"davinci-002":a$,"babbage-002":s$,"text-ada-001":p$,"text-babbage-001":m$,"text-curie-001":h$,"text-davinci-001":f$,"text-davinci-002":g$,"text-davinci-003":y$,ada:b$,babbage:v$,curie:_$,davinci:S$,"code-davinci-002":w$,"code-davinci-001":CE,"davinci-codex":CE,"code-davinci-edit-001":k$,"code-cushman-002":x$,"code-cushman-001":IE,"cushman-codex":IE,"code-search-ada-code-001":R$,"code-search-ada-text-001":N$,"text-davinci-edit-001":O$,"text-similarity-ada-001":I$,"text-search-ada-doc-001":A$,"text-search-ada-query-001":P$,"text-similarity-babbage-001":D$,"text-search-babbage-doc-001":M$,"text-search-babbage-query-001":$$,"code-search-babbage-code-001":L$,"code-search-babbage-text-001":z$,"text-similarity-curie-001":F$,"text-search-curie-doc-001":B$,"text-search-curie-query-001":j$,"text-similarity-davinci-001":U$,"text-search-davinci-doc-001":G$,"text-search-davinci-query-001":V$};var hn="<|endoftext|>",aa="<|fim_prefix|>",oa="<|fim_middle|>",sa="<|fim_suffix|>",ns="<|im_start|>",is="<|im_end|>",la="<|im_sep|>",as="<|endofprompt|>";var PE=Object.fromEntries(Object.entries(kg).map(([t,e])=>[t,e.encoding])),RE=Object.fromEntries(Object.entries(op).map(([t,e])=>[t,e.encoding])),H$={messageSeparator:`
|
|
3250
3264
|
`,roleSeparator:`
|
|
3251
|
-
`},
|
|
3252
|
-
`;this.itemPadding=0;this.sortFunction=(e,
|
|
3253
|
-
|
|
3254
|
-
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config=e,this.tokenWindow.size=this.config.maxTokens||16e3}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){throw new Error("Not implemented")}addUserMessage(e){throw new Error("Not implemented")}addAssistantMessage(e){throw new Error("Not implemented")}onBeforeIncomingMessage(e){}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}async trimMessages(){this.tokenWindow.removeOverflow()}registerTool(e){return this.toolGroup.add({id:e.name,customData:e,cannotRemove:e.isContext,sortOrder:101,disabled:e.disabled,content:JSON.stringify(e)})}};var Mr=new ge("ChatGPT"),Ls=class extends _i{async sendMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(t),customData:t}),await this.processMessages();let n=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return n?.role=="assistant"&&n.content||""}addAssistantMessage(e){let t={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(t),customData:t})}addUserMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Mr.debugEnabled&&Mr.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(i=>i.customData),messages:this.messageGroup.items.map(i=>i.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let i of t.tool_calls)await this.processToolCall(i);await this.processMessages()}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendRequest(e){let t={};return t["Content-Type"]="application/json",this.config.apiKey&&(t.Authorization=`Bearer ${this.config.apiKey}`),await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:t,body:JSON.stringify(e)})}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let o=this.messageGroup.items.length-1;o>=0;o--){let l=this.messageGroup.items[o].customData;if(l.role=="assistant"&&l.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(l.role=="user")break}Mr.debugEnabled&&Mr.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(o=>o.customData),messages:this.messageGroup.items.map(o=>o.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let i={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(o=>o.customData)]};for(let o of this.toolGroup.getAll()){let l=o.customData;l.description&&l.description.length>1024&&Mr.warn(`Tool description for "${l.name}" is too long, it will be truncated.`);let c={type:"function",function:{name:l.name,description:(l.description||"").substring(0,1024),parameters:l.params}};i.tools.push(c)}if(i.user||delete i.user,i.tools.length||delete i.tools,e)return i;let n=await this.sendRequest(i);if(!n.ok){let o=`${n.status} ${n.statusText}`;try{let c=await n.json();o=c.errorText||c.error?.message||c.error||o}catch{}let l=new Error(o);throw l.code=n.status,l}let a=null,s=null;if(this.config.stream){for await(let l of wp(n.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(s){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&s[u]==c.choices[0].delta[u])continue;s[u]=(s[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[u.index]){s.tool_calls[u.index]=u;continue}let p=s.tool_calls[u.index];p.function=p.function||{},p.function.name=(p.function.name||"")+(u.function?.name||""),p.function.arguments=(p.function.arguments||"")+(u.function?.arguments||"")}}else s={chunkID:c.id,...c.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}let o=kn(JSON.stringify(i)+JSON.stringify(s)||"");this.stats.tokensUsed+=o,Mr.debug(`Estimated ${o} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else a=await n.json(),this.stats.tokensUsed+=a?.usage?.total_tokens||0,Mr.debug(`Used ${a?.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=a?.choices?.[0]?.message;if(s||(Mr.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.onBeforeIncomingMessage(s),this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}async processToolCall(e){try{let i=this.toolGroup.items.find(o=>o.id==e.function.name)?.customData;if(!i)throw new Error(`Tool "${e.function.name}" not found.`);let n=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,n);let a=await i.callback(n);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let s={role:"tool",content:a,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(s),customData:s})}catch(t){Mr.warn(`Unable to process tool call for "${e?.function?.name}"`,t);let i={role:"tool",content:`Error: ${t.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(i),customData:i})}}};function re(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}function z(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)}var wc=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return wc=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^t()&15>>+i/4).toString(16))};function Or(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var va=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};var te=class extends Error{},it=class r extends te{constructor(e,t,i,n){super(`${r.makeMessage(e,t,i)}`),this.status=e,this.headers=n,this.requestID=n?.get("request-id"),this.error=t}static makeMessage(e,t,i){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,i,n){if(!e||!n)return new Qr({message:i,cause:va(t)});let a=t;return e===400?new Ei(e,a,i,n):e===401?new wi(e,a,i,n):e===403?new ki(e,a,i,n):e===404?new Ci(e,a,i,n):e===409?new xi(e,a,i,n):e===422?new Ti(e,a,i,n):e===429?new Ai(e,a,i,n):e>=500?new Ii(e,a,i,n):new r(e,a,i,n)}},dt=class extends it{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Qr=class extends it{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},Si=class extends Qr{constructor({message:e}={}){super({message:e??"Request timed out."})}},Ei=class extends it{},wi=class extends it{},ki=class extends it{},Ci=class extends it{},xi=class extends it{},Ti=class extends it{},Ai=class extends it{},Ii=class extends it{};var q_=/^[a-z][a-z0-9+.-]*:/i,rm=r=>q_.test(r),kc=r=>(kc=Array.isArray,kc(r)),Cc=kc;function xc(r){return typeof r!="object"?{}:r??{}}function nm(r){if(!r)return!0;for(let e in r)return!1;return!0}function im(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var am=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new te(`${r} must be an integer`);if(e<0)throw new te(`${r} must be a positive integer`);return e};var Bs=r=>{try{return JSON.parse(r)}catch{return}};var sm=r=>new Promise(e=>setTimeout(e,r));var en="0.60.0";var um=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function $_(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var K_=()=>{let r=$_();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":en,"X-Stainless-OS":lm(Deno.build.os),"X-Stainless-Arch":om(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":en,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":en,"X-Stainless-OS":lm(globalThis.process.platform??"unknown"),"X-Stainless-Arch":om(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=X_();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":en,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":en,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function X_(){if(typeof navigator>"u"||!navigator)return null;let r=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of r){let i=t.exec(navigator.userAgent);if(i){let n=i[1]||0,a=i[2]||0,s=i[3]||0;return{browser:e,version:`${n}.${a}.${s}`}}}return null}var om=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",lm=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),cm,dm=()=>cm??(cm=K_());function pm(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Tc(...r){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...r)}function Fs(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return Tc({start(){},async pull(t){let{done:i,value:n}=await e.next();i?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function _a(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function mm(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var hm=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function ym(r){let e=0;for(let n of r)e+=n.length;let t=new Uint8Array(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var gm;function Sa(r){let e;return(gm??(e=new globalThis.TextEncoder,gm=e.encode.bind(e)))(r)}var fm;function Ac(r){let e;return(fm??(e=new globalThis.TextDecoder,fm=e.decode.bind(e)))(r)}var Bt,Ft,Nr=class{constructor(){Bt.set(this,void 0),Ft.set(this,void 0),re(this,Bt,new Uint8Array,"f"),re(this,Ft,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Sa(e):e;re(this,Bt,ym([z(this,Bt,"f"),t]),"f");let i=[],n;for(;(n=Z_(z(this,Bt,"f"),z(this,Ft,"f")))!=null;){if(n.carriage&&z(this,Ft,"f")==null){re(this,Ft,n.index,"f");continue}if(z(this,Ft,"f")!=null&&(n.index!==z(this,Ft,"f")+1||n.carriage)){i.push(Ac(z(this,Bt,"f").subarray(0,z(this,Ft,"f")-1))),re(this,Bt,z(this,Bt,"f").subarray(z(this,Ft,"f")),"f"),re(this,Ft,null,"f");continue}let a=z(this,Ft,"f")!==null?n.preceding-1:n.preceding,s=Ac(z(this,Bt,"f").subarray(0,a));i.push(s),re(this,Bt,z(this,Bt,"f").subarray(n.index),"f"),re(this,Ft,null,"f")}return i}flush(){return z(this,Bt,"f").length?this.decode(`
|
|
3255
|
-
`):[]}};
|
|
3256
|
-
`,"\r"]);
|
|
3257
|
-
`);
|
|
3258
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(e),e.startsWith(":"))return null;let[
|
|
3265
|
+
`},q$={messageSeparator:"",roleSeparator:la},NE=Object.fromEntries(Object.keys(PE).flatMap(t=>t.startsWith("gpt-4")?[[t,q$]]:t.startsWith("gpt-3.5-turbo")?[[t,H$]]:[])),rJ=Object.keys(PE);var os=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,sp=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function OE(t){return{tokenSplitRegex:sp,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,100257],[aa,100258],[oa,100259],[sa,100260],[ns,100264],[is,100265],[la,100266],[as,100276]])}}function DE(t){return{tokenSplitRegex:sp,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,199999],[aa,2e5],[oa,200001],[sa,200002],[ns,200003],[is,200004],[la,200005],[as,200006]])}}function ME(t){return{expectedVocabularySize:50281,tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256]])}}function $E(t){return{tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256],[aa,50281],[oa,50282],[sa,50283]])}}function LE(t){return{expectedVocabularySize:50257,tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256]])}}function xg(t,e){let r=e(t);switch(t.toLowerCase()){case"r50k_base":return LE(r);case"p50k_base":return ME(r);case"p50k_edit":return $E(r);case"cl100k_base":return OE(r);case"o200k_base":return DE(r);default:throw new Error(`Unknown encoding name: ${t}`)}}var Ei=class Ei{constructor({bytePairRankDecoder:e,specialTokensEncoder:r,expectedVocabularySize:n,modelName:i,...a}){ct(this,"modelName");ct(this,"bytePairEncodingCoreProcessor");ct(this,"specialTokensEncoder");ct(this,"specialTokensSet");ct(this,"allSpecialTokenRegex");ct(this,"defaultSpecialTokenConfig");ct(this,"vocabularySize");this.specialTokensEncoder=r,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=_g(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new ap({bytePairRankDecoder:e,specialTokensEncoder:r,...a}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(e.length-1,hE(r));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+r.size,n!==void 0){if(this.vocabularySize!==n)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==n-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${n-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=i}static getEncodingApi(e,r){let n=xg(e,r);return new Ei(n)}static getEncodingApiForModel(e,r){let n=RE[e],i=xg(n,r);return new Ei({...i,modelName:e})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:r}={}){let n;if(e===ts||e?.has(ts)){e=new Set(this.specialTokensSet);let i=e;if(r===ts)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof r=="object"?r.forEach(a=>i.delete(a)):r=new Set}if(!r||r===ts||r.has(ts)){r=new Set(this.specialTokensSet);let i=r;e?.size?(e.forEach(a=>i.delete(a)),r.forEach(a=>e.delete(a)),r.size>0&&(n=_g(r))):n=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:n}}encodeGenerator(e,r){let n=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(n.regexPattern){let i=e.match(n.regexPattern);if(i!==null)throw new Error(`Disallowed special token found: ${i[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,n.allowedSpecial)}encode(e,r){let n=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(n.regexPattern){let i=e.match(n.regexPattern);if(i!==null)throw new Error(`Disallowed special token found: ${i[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,n.allowedSpecial)}*encodeChatGenerator(e,r=this.modelName){if(!r)throw new Error("Model name must be provided either during initialization or passed in to the method.");let n=NE[r],i=this.specialTokensEncoder.get(ns),a=this.specialTokensEncoder.get(is);if(!n||i===void 0||a===void 0)throw new Error(`Model '${r}' does not support chat.`);let o=new Set([la]),{messageSeparator:s,roleSeparator:l}=n,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],d=new Map;for(let{role:m="system",name:p=m,content:h}of e){if(h===void 0)throw new Error("Content must be defined for all messages.");yield[i];let f=d.get(p)??this.encode(p);d.set(p,f),yield f,u.length>0&&(yield u),yield*this.encodeGenerator(h),yield[a],yield c}yield[i],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(e,r=this.modelName){return[...this.encodeChatGenerator(e,r)].flat()}isWithinTokenLimit(e,r){let n=typeof e=="string"?this.encodeGenerator(e):this.encodeChatGenerator(e),i=0;for(let a of n)if(i+=a.length,i>r)return!1;return i}countTokens(e,r){if(typeof e=="string"){let a=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(a.regexPattern){let o=e.match(a.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,a.allowedSpecial)}let n=this.encodeChatGenerator(e),i=0;for(let a of n)i+=a.length;return i}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),n="";for(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0}),!(n.length===0||bg(n))&&(yield n,n="");n.length>0&&(yield n)}async*decodeAsyncGenerator(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n="";for await(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0}),!(n.length===0||bg(n))&&(yield n,n="");n.length>0&&(yield n)}async decodeAsync(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n="";for await(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0});return n}estimateCost(e,r=this.modelName){if(!r)throw new Error("Model name must be provided either during initialization or passed in to the method.");let n=op[r];if(!n)throw new Error(`Unknown model: ${r}`);if(!n.cost)throw new Error(`No cost information available for model: ${r}`);let i=n.cost,a={},o=e/1e6;return i.input!==void 0&&(a.input=i.input*o),i.output!==void 0&&(a.output=i.output*o),i.batchInput!==void 0&&(a.batchInput=i.batchInput*o),i.batchOutput!==void 0&&(a.batchOutput=i.batchOutput*o),a}};ct(Ei,"EndOfPrompt",as),ct(Ei,"EndOfText",hn),ct(Ei,"FimMiddle",oa),ct(Ei,"FimPrefix",aa),ct(Ei,"FimSuffix",sa);var lp=Ei;var W$=lp.getEncodingApi("cl100k_base",()=>uE),{decode:jJ,decodeAsyncGenerator:UJ,decodeGenerator:GJ,encode:VJ,encodeGenerator:HJ,isWithinTokenLimit:qJ,countTokens:Za,encodeChat:WJ,encodeChatGenerator:ZJ,vocabularySize:KJ,setMergeCacheSize:JJ,clearMergeCache:XJ,estimateCost:YJ}=W$;var cp=class{constructor(){this.size=4096;this.groups=[]}createGroup(e){let r=new Eg;return r.id=e,this.groups.push(r),r}group(e){return this.groups.find(r=>r.id===e)}countTokens(){return this.groups.reduce((e,r)=>e+r.tokenCount,0)}removeOverflow(){let e=this.countTokens(),r=this.groups.reduce((n,i)=>n+i.weight,0);for(;e>this.size;){let n=this.groups.slice().sort((a,o)=>{let s=Math.floor(a.weight/r*this.size),l=Math.floor(o.weight/r*this.size),c=a.tokenCount-s;return o.tokenCount-l-c}),i=this.removeOneItem(n);if(!i)throw new Error("Too many items in the token window that cannot be removed.");e-=i.tokenCount}}removeOneItem(e){for(let r of e){let n=r.items.findIndex(a=>!a.cannotRemove);if(n===-1)continue;let i=r.items[n];return r.items.splice(n,1),r.tokenCount-=i.tokenCount,i}return null}},Eg=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
|
|
3266
|
+
`;this.itemPadding=0;this.sortFunction=(e,r)=>e.sortOrder!==r.sortOrder?e.sortOrder-r.sortOrder:e.dateAdded!==r.dateAdded?e.dateAdded-r.dateAdded:e.content.localeCompare(r.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,r)=>(r.tokenCount=Za(r.content)+Za(this.separator)+this.itemPadding,e+r.tokenCount),0)}add(e){typeof e=="string"&&(e={content:e});let r=e;r.id===void 0&&(r.id=_t());let n=this.items.find(i=>i.id===r.id);return n?(this.tokenCount-=n.tokenCount,Object.assign(n,r),r=n):this.items.push(r),r.dateAdded===void 0&&(r.dateAdded=Date.now()),r.sortOrder===void 0&&(r.sortOrder=0),r.disabled===void 0&&(r.disabled=!1),r.tokenCount=r.disabled?0:Za(e.content)+Za(this.separator)+this.itemPadding,this.tokenCount+=r.tokenCount,this.items.sort(this.sortFunction),r}getAllAsString(){return this.getAll().map(e=>e.content).join(this.separator)}getAll(){return this.items.filter(e=>!e.disabled)}empty(){this.items=[],this.tokenCount=0}};var ss=class{constructor(e){this.id="";this.metadata={};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let e=new cp;return e.createGroup("context").setSeparator(`
|
|
3267
|
+
|
|
3268
|
+
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config=e,this.tokenWindow.size=this.config.maxTokens||16e3}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){throw new Error("Not implemented")}addUserMessage(e){throw new Error("Not implemented")}addAssistantMessage(e){throw new Error("Not implemented")}onBeforeIncomingMessage(e){}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}async trimMessages(){this.tokenWindow.removeOverflow()}registerTool(e){return this.toolGroup.add({id:e.name,customData:e,cannotRemove:e.isContext,sortOrder:101,disabled:e.disabled,content:JSON.stringify(e)})}};var Ti=new Re("ChatGPT"),up=class extends ss{async sendMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r}),await this.processMessages();let i=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return i?.role=="assistant"&&i.content||""}addAssistantMessage(e){let r={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}addUserMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ti.debugEnabled&&Ti.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(n=>n.customData),messages:this.messageGroup.items.map(n=>n.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(r?.role=="user"||r?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(r?.role=="assistant"&&r?.tool_calls?.length){for(let n of r.tool_calls)await this.processToolCall(n);await this.processMessages()}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendRequest(e){let r={};return r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(e)})}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let r=0;for(let s=this.messageGroup.items.length-1;s>=0;s--){let l=this.messageGroup.items[s].customData;if(l.role=="assistant"&&l.tool_calls){if(r+=1,r>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(l.role=="user")break}Ti.debugEnabled&&Ti.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(s=>s.customData),messages:this.messageGroup.items.map(s=>s.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let n={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(s=>s.customData)]};for(let s of this.toolGroup.getAll()){let l=s.customData;l.description&&l.description.length>1024&&Ti.warn(`Tool description for "${l.name}" is too long, it will be truncated.`);let c={type:"function",function:{name:l.name,description:(l.description||"").substring(0,1024),parameters:l.params}};n.tools.push(c)}if(n.user||delete n.user,n.tools.length||delete n.tools,e)return n;let i=await this.sendRequest(n);if(!i.ok){let s=`${i.status} ${i.statusText}`;try{let c=await i.json();s=c.errorText||c.error?.message||c.error||s}catch{}let l=new Error(s);throw l.code=i.status,l}let a=null,o=null;if(this.config.stream){for await(let l of aE(i.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(o){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&o[u]==c.choices[0].delta[u])continue;o[u]=(o[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(o.tool_calls||(o.tool_calls=[]),!o.tool_calls[u.index]){o.tool_calls[u.index]=u;continue}let d=o.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.function.arguments||"")+(u.function?.arguments||"")}}else o={chunkID:c.id,...c.choices[0].delta};o?.content&&!o.content.startsWith("{")&&this.config.onAIMessage?.(o.content,!0)}let s=Za(JSON.stringify(n)+JSON.stringify(o)||"");this.stats.tokensUsed+=s,Ti.debug(`Estimated ${s} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else a=await i.json(),this.stats.tokensUsed+=a?.usage?.total_tokens||0,Ti.debug(`Used ${a?.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),o=a?.choices?.[0]?.message;if(o||(Ti.warn("No response block in API response."),o={role:"assistant",content:""}),o.role=="user")throw new Error("API returned a user message, which is not allowed.");this.onBeforeIncomingMessage(o),this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o}),o.content&&this.config.onAIMessage?.(o.content,!1)}async processToolCall(e){try{let n=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!n)throw new Error(`Tool "${e.function.name}" not found.`);let i=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,i);let a=await n.callback(i);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o})}catch(r){Ti.warn(`Unable to process tool call for "${e?.function?.name}"`,r);let n={role:"tool",content:`Error: ${r.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(n),customData:n})}}};function ce(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function D(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var Tg=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Tg=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Ci(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var nc=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var se=class extends Error{},qt=class t extends se{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("request-id"),this.error=r}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new ca({message:n,cause:nc(r)});let a=r;return e===400?new cs(e,a,n,i):e===401?new us(e,a,n,i):e===403?new ds(e,a,n,i):e===404?new ps(e,a,n,i):e===409?new ms(e,a,n,i):e===422?new hs(e,a,n,i):e===429?new fs(e,a,n,i):e>=500?new gs(e,a,n,i):new t(e,a,n,i)}},Qt=class extends qt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ca=class extends qt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ls=class extends ca{constructor({message:e}={}){super({message:e??"Request timed out."})}},cs=class extends qt{},us=class extends qt{},ds=class extends qt{},ps=class extends qt{},ms=class extends qt{},hs=class extends qt{},fs=class extends qt{},gs=class extends qt{};var K$=/^[a-z][a-z0-9+.-]*:/i,zE=t=>K$.test(t),Cg=t=>(Cg=Array.isArray,Cg(t)),Ig=Cg;function Ag(t){return typeof t!="object"?{}:t??{}}function FE(t){if(!t)return!0;for(let e in t)return!1;return!0}function BE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var jE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new se(`${t} must be an integer`);if(e<0)throw new se(`${t} must be a positive integer`);return e};var dp=t=>{try{return JSON.parse(t)}catch{return}};var UE=t=>new Promise(e=>setTimeout(e,t));var ua="0.60.0";var qE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function J$(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var X$=()=>{let t=J$();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":VE(Deno.build.os),"X-Stainless-Arch":GE(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":VE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":GE(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Y$();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Y$(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,a=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${a}.${o}`}}}return null}var GE=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",VE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),HE,WE=()=>HE??(HE=X$());function ZE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Pg(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function pp(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Pg({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function ic(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function KE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var JE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function QE(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var XE;function ac(t){let e;return(XE??(e=new globalThis.TextEncoder,XE=e.encode.bind(e)))(t)}var YE;function Rg(t){let e;return(YE??(e=new globalThis.TextDecoder,YE=e.decode.bind(e)))(t)}var Yr,Qr,Ii=class{constructor(){Yr.set(this,void 0),Qr.set(this,void 0),ce(this,Yr,new Uint8Array,"f"),ce(this,Qr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?ac(e):e;ce(this,Yr,QE([D(this,Yr,"f"),r]),"f");let n=[],i;for(;(i=tL(D(this,Yr,"f"),D(this,Qr,"f")))!=null;){if(i.carriage&&D(this,Qr,"f")==null){ce(this,Qr,i.index,"f");continue}if(D(this,Qr,"f")!=null&&(i.index!==D(this,Qr,"f")+1||i.carriage)){n.push(Rg(D(this,Yr,"f").subarray(0,D(this,Qr,"f")-1))),ce(this,Yr,D(this,Yr,"f").subarray(D(this,Qr,"f")),"f"),ce(this,Qr,null,"f");continue}let a=D(this,Qr,"f")!==null?i.preceding-1:i.preceding,o=Rg(D(this,Yr,"f").subarray(0,a));n.push(o),ce(this,Yr,D(this,Yr,"f").subarray(i.index),"f"),ce(this,Qr,null,"f")}return n}flush(){return D(this,Yr,"f").length?this.decode(`
|
|
3269
|
+
`):[]}};Yr=new WeakMap,Qr=new WeakMap;Ii.NEWLINE_CHARS=new Set([`
|
|
3270
|
+
`,"\r"]);Ii.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function tL(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function eT(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var hp={off:0,error:200,warn:300,info:400,debug:500},Ng=(t,e,r)=>{if(t){if(BE(hp,t))return t;Wt(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(hp))}`)}};function oc(){}function mp(t,e,r){return!e||hp[t]>hp[r]?oc:e[t].bind(e)}var rL={error:oc,warn:oc,info:oc,debug:oc},tT=new WeakMap;function Wt(t){let e=t.logger,r=t.logLevel??"off";if(!e)return rL;let n=tT.get(e);if(n&&n[0]===r)return n[1];let i={error:mp("error",e,r),warn:mp("warn",e,r),info:mp("info",e,r),debug:mp("debug",e,r)};return tT.set(e,[r,i]),i}var Ai=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var sc,ei=class t{constructor(e,r,n){this.iterator=e,sc.set(this,void 0),this.controller=r,ce(this,sc,n,"f")}static fromSSEResponse(e,r,n){let i=!1,a=n?Wt(n):console;async function*o(){if(i)throw new se("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let l of nL(e,r)){if(l.event==="completion")try{yield JSON.parse(l.data)}catch(c){throw a.error("Could not parse message into JSON:",l.data),a.error("From chunk:",l.raw),c}if(l.event==="message_start"||l.event==="message_delta"||l.event==="message_stop"||l.event==="content_block_start"||l.event==="content_block_delta"||l.event==="content_block_stop")try{yield JSON.parse(l.data)}catch(c){throw a.error("Could not parse message into JSON:",l.data),a.error("From chunk:",l.raw),c}if(l.event!=="ping"&&l.event==="error")throw new qt(void 0,dp(l.data)??l.data,void 0,e.headers)}s=!0}catch(l){if(Ci(l))return;throw l}finally{s||r.abort()}}return new t(o,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*a(){let s=new Ii,l=ic(e);for await(let c of l)for(let u of s.decode(c))yield u;for(let c of s.flush())yield c}async function*o(){if(i)throw new se("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let l of a())s||l&&(yield JSON.parse(l));s=!0}catch(l){if(Ci(l))return;throw l}finally{s||r.abort()}}return new t(o,r,n)}[(sc=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=a=>({next:()=>{if(a.length===0){let o=n.next();e.push(o),r.push(o)}return a.shift()}});return[new t(()=>i(e),this.controller,D(this,sc,"f")),new t(()=>i(r),this.controller,D(this,sc,"f"))]}toReadableStream(){let e=this,r;return Pg({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:a}=await r.next();if(a)return n.close();let o=ac(JSON.stringify(i)+`
|
|
3271
|
+
`);n.enqueue(o)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*nL(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new se("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new se("Attempted to iterate over a response with no body");let r=new Og,n=new Ii,i=ic(t.body);for await(let a of iL(i))for(let o of n.decode(a)){let s=r.decode(o);s&&(yield s)}for(let a of n.flush()){let o=r.decode(a);o&&(yield o)}}async function*iL(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?ac(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let a;for(;(a=eT(e))!==-1;)yield e.slice(0,a),e=e.slice(a)}e.length>0&&(yield e)}var Og=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let a={event:this.event,data:this.data.join(`
|
|
3272
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=aL(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};function aL(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function fp(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:i,startTime:a}=e,o=await(async()=>{if(e.options.stream)return Wt(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):ei.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let l=r.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){let d=await r.json();return Dg(d,r)}return await r.text()})();return Wt(t).debug(`[${n}] response parsed`,Ai({retryOfRequestLogID:i,url:r.url,status:r.status,body:o,durationMs:Date.now()-a})),o}function Dg(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var lc,Ka=class t extends Promise{constructor(e,r,n=fp){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,lc.set(this,void 0),ce(this,lc,e,"f")}_thenUnwrap(e){return new t(D(this,lc,"f"),this.responsePromise,async(r,n)=>Dg(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(D(this,lc,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};lc=new WeakMap;var gp,Mg=class{constructor(e,r,n,i){gp.set(this,void 0),ce(this,gp,e,"f"),this.options=i,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new se("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,gp,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(gp=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cc=class extends Ka{constructor(e,r,n){super(e,r,async(i,a)=>new n(i,a.response,await fp(i,a),a.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},fn=class extends Mg{constructor(e,r,n,i){super(e,r,n,i),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...Ag(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...Ag(this.options.query),after_id:e}}:null}};var Lg=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ja(t,e,r){return Lg(),new File(t,e??"unknown_file",r)}function uc(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var zg=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function";var nT=async(t,e)=>({...t,body:await lL(t.body,e)}),rT=new WeakMap;function sL(t){let e=typeof t=="function"?t:t.fetch,r=rT.get(e);if(r)return r;let n=(async()=>{try{let i="Response"in e?e.Response:(await e("data:,")).constructor,a=new FormData;return a.toString()!==await new i(a).text()}catch{return!0}})();return rT.set(e,n),n}var lL=async(t,e)=>{if(!await sL(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,i])=>$g(r,n,i))),r},cL=t=>t instanceof Blob&&"name"in t;var $g=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let n={},i=r.headers.get("Content-Type");i&&(n={type:i}),t.append(e,Ja([await r.blob()],uc(r),n))}else if(zg(r))t.append(e,Ja([await new Response(pp(r)).blob()],uc(r)));else if(cL(r))t.append(e,Ja([r],uc(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>$g(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,i])=>$g(t,`${e}[${n}]`,i)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var iT=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",uL=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&iT(t),dL=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function yp(t,e,r){if(Lg(),t=await t,e||(e=uc(t)),uL(t))return t instanceof File&&e==null&&r==null?t:Ja([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(dL(t)){let i=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ja(await Fg(i),e,r)}let n=await Fg(t);if(!r?.type){let i=n.find(a=>typeof a=="object"&&"type"in a&&a.type);typeof i=="string"&&(r={...r,type:i})}return Ja(n,e,r)}async function Fg(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(iT(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(zg(t))for await(let r of t)e.push(...await Fg(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${pL(t)}`)}return e}function pL(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var jt=class{constructor(e){this._client=e}};var aT=Symbol.for("brand.privateNullableHeaders");function*hL(t){if(!t)return;if(aT in t){let{values:n,nulls:i}=t;yield*n.entries();for(let a of i)yield[a,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Ig(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let i=n[0];if(typeof i!="string")throw new TypeError("expected header name to be a string");let a=Ig(n[1])?n[1]:[n[1]],o=!1;for(let s of a)s!==void 0&&(e&&!o&&(o=!0,yield[i,null]),yield[i,s])}}var Ke=t=>{let e=new Headers,r=new Set;for(let n of t){let i=new Set;for(let[a,o]of hL(n)){let s=a.toLowerCase();i.has(s)||(e.delete(a),i.add(s)),o===null?(e.delete(a),r.add(s)):(e.append(a,o),r.delete(s))}}return{[aT]:!0,values:e,nulls:r}};function sT(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var oT=Object.freeze(Object.create(null)),fL=(t=sT)=>function(r,...n){if(r.length===1)return r[0];let i=!1,a=[],o=r.reduce((u,d,m)=>{/[?#]/.test(d)&&(i=!0);let p=n[m],h=(i?encodeURIComponent:t)(""+p);return m!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??oT)??oT)?.toString)&&(h=p+"",a.push({start:u.length+d.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),u+d+(m===n.length?"":h)},""),s=o.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(s))!==null;)a.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(a.sort((u,d)=>u.start-d.start),a.length>0){let u=0,d=a.reduce((m,p)=>{let h=" ".repeat(p.start-u),f="^".repeat(p.length);return u=p.start+p.length,m+h+f},"");throw new se(`Path parameters result in path with invalid segments:
|
|
3259
3273
|
${a.map(m=>m.error).join(`
|
|
3260
3274
|
`)}
|
|
3261
|
-
${
|
|
3262
|
-
${p}`)}return s},ft=pS(Cm);var Ri=class extends tt{list(e={},t){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/files",Yt,{query:n,...t,headers:ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},i){let{betas:n}=t??{};return this._client.delete(ft`/v1/files/${e}`,{...i,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},i?.headers])})}download(e,t={},i){let{betas:n}=t??{};return this._client.get(ft`/v1/files/${e}/content`,{...i,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},i?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},i){let{betas:n}=t??{};return this._client.get(ft`/v1/files/${e}`,{...i,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},i?.headers])})}upload(e,t){let{betas:i,...n}=e;return this._client.post("/v1/files",Sm({body:n,...t,headers:ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},t?.headers])},this._client))}};var Pi=class extends tt{retrieve(e,t={},i){let{betas:n}=t??{};return this._client.get(ft`/v1/models/${e}?beta=true`,{...i,headers:ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},i?.headers])})}list(e={},t){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/models?beta=true",Yt,{query:n,...t,headers:ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}};var Di=class r{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new Nr;for await(let t of this.iterator)for(let i of e.decode(t))yield JSON.parse(i);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");return new r(_a(e.body),t)}};var Mi=class extends tt{create(e,t){let{betas:i,...n}=e;return this._client.post("/v1/messages/batches?beta=true",{body:n,...t,headers:ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},i){let{betas:n}=t??{};return this._client.get(ft`/v1/messages/batches/${e}?beta=true`,{...i,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}list(e={},t){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Yt,{query:n,...t,headers:ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},i){let{betas:n}=t??{};return this._client.delete(ft`/v1/messages/batches/${e}?beta=true`,{...i,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}cancel(e,t={},i){let{betas:n}=t??{};return this._client.post(ft`/v1/messages/batches/${e}/cancel?beta=true`,{...i,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}async results(e,t={},i){let n=await this.retrieve(e);if(!n.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);let{betas:a}=t??{};return this._client.get(n.results_url,{...i,headers:ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},i?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,o)=>Di.fromResponse(o.response,o.controller))}};var fS=r=>{let e=0,t=[];for(;e<r.length;){let i=r[e];if(i==="\\"){e++;continue}if(i==="{"){t.push({type:"brace",value:"{"}),e++;continue}if(i==="}"){t.push({type:"brace",value:"}"}),e++;continue}if(i==="["){t.push({type:"paren",value:"["}),e++;continue}if(i==="]"){t.push({type:"paren",value:"]"}),e++;continue}if(i===":"){t.push({type:"separator",value:":"}),e++;continue}if(i===","){t.push({type:"delimiter",value:","}),e++;continue}if(i==='"'){let o="",l=!1;for(i=r[++e];i!=='"';){if(e===r.length){l=!0;break}if(i==="\\"){if(e++,e===r.length){l=!0;break}o+=i+r[e],i=r[++e]}else o+=i,i=r[++e]}i=r[++e],l||t.push({type:"string",value:o});continue}if(i&&/\s/.test(i)){e++;continue}let a=/[0-9]/;if(i&&a.test(i)||i==="-"||i==="."){let o="";for(i==="-"&&(o+=i,i=r[++e]);i&&a.test(i)||i===".";)o+=i,i=r[++e];t.push({type:"number",value:o});continue}let s=/[a-z]/i;if(i&&s.test(i)){let o="";for(;i&&s.test(i)&&e!==r.length;)o+=i,i=r[++e];if(o=="true"||o=="false"||o==="null")t.push({type:"name",value:o});else{e++;continue}continue}e++}return t},Oi=r=>{if(r.length===0)return r;let e=r[r.length-1];switch(e.type){case"separator":return r=r.slice(0,r.length-1),Oi(r);break;case"number":let t=e.value[e.value.length-1];if(t==="."||t==="-")return r=r.slice(0,r.length-1),Oi(r);case"string":let i=r[r.length-2];if(i?.type==="delimiter")return r=r.slice(0,r.length-1),Oi(r);if(i?.type==="brace"&&i.value==="{")return r=r.slice(0,r.length-1),Oi(r);break;case"delimiter":return r=r.slice(0,r.length-1),Oi(r);break}return r},yS=r=>{let e=[];return r.map(t=>{t.type==="brace"&&(t.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),t.type==="paren"&&(t.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(t=>{t==="}"?r.push({type:"brace",value:"}"}):t==="]"&&r.push({type:"paren",value:"]"})}),r},bS=r=>{let e="";return r.map(t=>{switch(t.type){case"string":e+='"'+t.value+'"';break;default:e+=t.value;break}}),e},Ws=r=>JSON.parse(bS(yS(Oi(fS(r)))));var Jt,tn,Ta,js,Aa,Ia,qs,Ra,Br,Pa,$s,Ks,Ni,Xs,Ys,Bc,xm,Js,Fc,Gc,zc,Tm,Am="__json_buf";function Im(r){return r.type==="tool_use"||r.type==="server_tool_use"||r.type==="mcp_tool_use"}var Zs=class r{constructor(){Jt.add(this),this.messages=[],this.receivedMessages=[],tn.set(this,void 0),this.controller=new AbortController,Ta.set(this,void 0),js.set(this,()=>{}),Aa.set(this,()=>{}),Ia.set(this,void 0),qs.set(this,()=>{}),Ra.set(this,()=>{}),Br.set(this,{}),Pa.set(this,!1),$s.set(this,!1),Ks.set(this,!1),Ni.set(this,!1),Xs.set(this,void 0),Ys.set(this,void 0),Js.set(this,e=>{if(re(this,$s,!0,"f"),Or(e)&&(e=new dt),e instanceof dt)return re(this,Ks,!0,"f"),this._emit("abort",e);if(e instanceof te)return this._emit("error",e);if(e instanceof Error){let t=new te(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new te(String(e)))}),re(this,Ta,new Promise((e,t)=>{re(this,js,e,"f"),re(this,Aa,t,"f")}),"f"),re(this,Ia,new Promise((e,t)=>{re(this,qs,e,"f"),re(this,Ra,t,"f")}),"f"),z(this,Ta,"f").catch(()=>{}),z(this,Ia,"f").catch(()=>{})}get response(){return z(this,Xs,"f")}get request_id(){return z(this,Ys,"f")}async withResponse(){let e=await z(this,Ta,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,i){let n=new r;for(let a of t.messages)n._addMessageParam(a);return n._run(()=>n._createMessage(e,{...t,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},z(this,Js,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,i){let n=i?.signal,a;n&&(n.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),n.addEventListener("abort",a));try{z(this,Jt,"m",Fc).call(this);let{response:s,data:o}=await e.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of o)z(this,Jt,"m",Gc).call(this,l);if(o.controller.signal?.aborted)throw new dt;z(this,Jt,"m",zc).call(this)}finally{n&&a&&n.removeEventListener("abort",a)}}_connected(e){this.ended||(re(this,Xs,e,"f"),re(this,Ys,e?.headers.get("request-id"),"f"),z(this,js,"f").call(this,e),this._emit("connect"))}get ended(){return z(this,Pa,"f")}get errored(){return z(this,$s,"f")}get aborted(){return z(this,Ks,"f")}abort(){this.controller.abort()}on(e,t){return(z(this,Br,"f")[e]||(z(this,Br,"f")[e]=[])).push({listener:t}),this}off(e,t){let i=z(this,Br,"f")[e];if(!i)return this;let n=i.findIndex(a=>a.listener===t);return n>=0&&i.splice(n,1),this}once(e,t){return(z(this,Br,"f")[e]||(z(this,Br,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{re(this,Ni,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){re(this,Ni,!0,"f"),await z(this,Ia,"f")}get currentMessage(){return z(this,tn,"f")}async finalMessage(){return await this.done(),z(this,Jt,"m",Bc).call(this)}async finalText(){return await this.done(),z(this,Jt,"m",xm).call(this)}_emit(e,...t){if(z(this,Pa,"f"))return;e==="end"&&(re(this,Pa,!0,"f"),z(this,qs,"f").call(this));let i=z(this,Br,"f")[e];if(i&&(z(this,Br,"f")[e]=i.filter(n=>!n.once),i.forEach(({listener:n})=>n(...t))),e==="abort"){let n=t[0];!z(this,Ni,"f")&&!i?.length&&Promise.reject(n),z(this,Aa,"f").call(this,n),z(this,Ra,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=t[0];!z(this,Ni,"f")&&!i?.length&&Promise.reject(n),z(this,Aa,"f").call(this,n),z(this,Ra,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",z(this,Jt,"m",Bc).call(this))}async _fromReadableStream(e,t){let i=t?.signal,n;i&&(i.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),i.addEventListener("abort",n));try{z(this,Jt,"m",Fc).call(this),this._connected(null);let a=br.fromReadableStream(e,this.controller);for await(let s of a)z(this,Jt,"m",Gc).call(this,s);if(a.controller.signal?.aborted)throw new dt;z(this,Jt,"m",zc).call(this)}finally{i&&n&&i.removeEventListener("abort",n)}}[(tn=new WeakMap,Ta=new WeakMap,js=new WeakMap,Aa=new WeakMap,Ia=new WeakMap,qs=new WeakMap,Ra=new WeakMap,Br=new WeakMap,Pa=new WeakMap,$s=new WeakMap,Ks=new WeakMap,Ni=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,Js=new WeakMap,Jt=new WeakSet,Bc=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},xm=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(i=>i.type==="text").map(i=>i.text);if(t.length===0)throw new te("stream ended without producing a content block with type=text");return t.join(" ")},Fc=function(){this.ended||re(this,tn,void 0,"f")},Gc=function(t){if(this.ended)return;let i=z(this,Jt,"m",Tm).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let n=i.content.at(-1);switch(t.delta.type){case"text_delta":{n.type==="text"&&this._emit("text",t.delta.text,n.text||"");break}case"citations_delta":{n.type==="text"&&this._emit("citation",t.delta.citation,n.citations??[]);break}case"input_json_delta":{Im(n)&&n.input&&this._emit("inputJson",t.delta.partial_json,n.input);break}case"thinking_delta":{n.type==="thinking"&&this._emit("thinking",t.delta.thinking,n.thinking);break}case"signature_delta":{n.type==="thinking"&&this._emit("signature",n.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(i),this._addMessage(i,!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{re(this,tn,i,"f");break}case"content_block_start":case"message_delta":break}},zc=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let t=z(this,tn,"f");if(!t)throw new te("request ended without sending any chunks");return re(this,tn,void 0,"f"),t},Tm=function(t){let i=z(this,tn,"f");if(t.type==="message_start"){if(i)throw new te(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new te(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":return i.container=t.delta.container,i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(i.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(i.usage.server_tool_use=t.usage.server_tool_use),i;case"content_block_start":return i.content.push(t.content_block),i;case"content_block_delta":{let n=i.content.at(t.index);switch(t.delta.type){case"text_delta":{n?.type==="text"&&(i.content[t.index]={...n,text:(n.text||"")+t.delta.text});break}case"citations_delta":{n?.type==="text"&&(i.content[t.index]={...n,citations:[...n.citations??[],t.delta.citation]});break}case"input_json_delta":{if(n&&Im(n)){let a=n[Am]||"";a+=t.delta.partial_json;let s={...n};if(Object.defineProperty(s,Am,{value:a,enumerable:!1,writable:!0}),a)try{s.input=Ws(a)}catch(o){let l=new te(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${o}. JSON: ${a}`);z(this,Js,"f").call(this,l)}i.content[t.index]=s}break}case"thinking_delta":{n?.type==="thinking"&&(i.content[t.index]={...n,thinking:n.thinking+t.delta.thinking});break}case"signature_delta":{n?.type==="thinking"&&(i.content[t.index]={...n,signature:t.delta.signature});break}default:t.delta}return i}case"content_block_stop":return i}},Symbol.asyncIterator)](){let e=[],t=[],i=!1;return this.on("streamEvent",n=>{let a=t.shift();a?a.resolve(n):e.push(n)}),this.on("end",()=>{i=!0;for(let n of t)n.resolve(void 0);t.length=0}),this.on("abort",n=>{i=!0;for(let a of t)a.reject(n);t.length=0}),this.on("error",n=>{i=!0;for(let a of t)a.reject(n);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((a,s)=>t.push({resolve:a,reject:s})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new br(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Qs={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var Rm={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},Tn=class extends tt{constructor(){super(...arguments),this.batches=new Mi(this._client)}create(e,t){let{betas:i,...n}=e;n.model in Rm&&console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${Rm[n.model]}
|
|
3263
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!n.stream&&a==null){let s=Qs[n.model]??void 0;a=this._client.calculateNonstreamingTimeout(n.max_tokens,s)}return this._client.post("/v1/messages?beta=true",{body:n,timeout:a??6e5,...t,headers:ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}stream(e,t){return Zs.createMessage(this,e,t)}countTokens(e,t){let{betas:i,...n}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:ke([{"anthropic-beta":[...i??[],"token-counting-2024-11-01"].toString()},t?.headers])})}};Tn.Batches=Mi;var vr=class extends tt{constructor(){super(...arguments),this.models=new Pi(this._client),this.messages=new Tn(this._client),this.files=new Ri(this._client)}};vr.Models=Pi;vr.Messages=Tn;vr.Files=Ri;var An=class extends tt{create(e,t){let{betas:i,...n}=e;return this._client.post("/v1/complete",{body:n,timeout:this._client._options.timeout??6e5,...t,headers:ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}};var Zt,rn,Da,eo,Ma,Oa,to,Na,Fr,La,ro,no,Li,io,ao,Uc,Pm,Hc,Vc,Wc,jc,Dm,Mm="__json_buf";function Om(r){return r.type==="tool_use"||r.type==="server_tool_use"}var so=class r{constructor(){Zt.add(this),this.messages=[],this.receivedMessages=[],rn.set(this,void 0),this.controller=new AbortController,Da.set(this,void 0),eo.set(this,()=>{}),Ma.set(this,()=>{}),Oa.set(this,void 0),to.set(this,()=>{}),Na.set(this,()=>{}),Fr.set(this,{}),La.set(this,!1),ro.set(this,!1),no.set(this,!1),Li.set(this,!1),io.set(this,void 0),ao.set(this,void 0),Hc.set(this,e=>{if(re(this,ro,!0,"f"),Or(e)&&(e=new dt),e instanceof dt)return re(this,no,!0,"f"),this._emit("abort",e);if(e instanceof te)return this._emit("error",e);if(e instanceof Error){let t=new te(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new te(String(e)))}),re(this,Da,new Promise((e,t)=>{re(this,eo,e,"f"),re(this,Ma,t,"f")}),"f"),re(this,Oa,new Promise((e,t)=>{re(this,to,e,"f"),re(this,Na,t,"f")}),"f"),z(this,Da,"f").catch(()=>{}),z(this,Oa,"f").catch(()=>{})}get response(){return z(this,io,"f")}get request_id(){return z(this,ao,"f")}async withResponse(){let e=await z(this,Da,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,i){let n=new r;for(let a of t.messages)n._addMessageParam(a);return n._run(()=>n._createMessage(e,{...t,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},z(this,Hc,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,i){let n=i?.signal,a;n&&(n.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),n.addEventListener("abort",a));try{z(this,Zt,"m",Vc).call(this);let{response:s,data:o}=await e.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of o)z(this,Zt,"m",Wc).call(this,l);if(o.controller.signal?.aborted)throw new dt;z(this,Zt,"m",jc).call(this)}finally{n&&a&&n.removeEventListener("abort",a)}}_connected(e){this.ended||(re(this,io,e,"f"),re(this,ao,e?.headers.get("request-id"),"f"),z(this,eo,"f").call(this,e),this._emit("connect"))}get ended(){return z(this,La,"f")}get errored(){return z(this,ro,"f")}get aborted(){return z(this,no,"f")}abort(){this.controller.abort()}on(e,t){return(z(this,Fr,"f")[e]||(z(this,Fr,"f")[e]=[])).push({listener:t}),this}off(e,t){let i=z(this,Fr,"f")[e];if(!i)return this;let n=i.findIndex(a=>a.listener===t);return n>=0&&i.splice(n,1),this}once(e,t){return(z(this,Fr,"f")[e]||(z(this,Fr,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{re(this,Li,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){re(this,Li,!0,"f"),await z(this,Oa,"f")}get currentMessage(){return z(this,rn,"f")}async finalMessage(){return await this.done(),z(this,Zt,"m",Uc).call(this)}async finalText(){return await this.done(),z(this,Zt,"m",Pm).call(this)}_emit(e,...t){if(z(this,La,"f"))return;e==="end"&&(re(this,La,!0,"f"),z(this,to,"f").call(this));let i=z(this,Fr,"f")[e];if(i&&(z(this,Fr,"f")[e]=i.filter(n=>!n.once),i.forEach(({listener:n})=>n(...t))),e==="abort"){let n=t[0];!z(this,Li,"f")&&!i?.length&&Promise.reject(n),z(this,Ma,"f").call(this,n),z(this,Na,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=t[0];!z(this,Li,"f")&&!i?.length&&Promise.reject(n),z(this,Ma,"f").call(this,n),z(this,Na,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",z(this,Zt,"m",Uc).call(this))}async _fromReadableStream(e,t){let i=t?.signal,n;i&&(i.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),i.addEventListener("abort",n));try{z(this,Zt,"m",Vc).call(this),this._connected(null);let a=br.fromReadableStream(e,this.controller);for await(let s of a)z(this,Zt,"m",Wc).call(this,s);if(a.controller.signal?.aborted)throw new dt;z(this,Zt,"m",jc).call(this)}finally{i&&n&&i.removeEventListener("abort",n)}}[(rn=new WeakMap,Da=new WeakMap,eo=new WeakMap,Ma=new WeakMap,Oa=new WeakMap,to=new WeakMap,Na=new WeakMap,Fr=new WeakMap,La=new WeakMap,ro=new WeakMap,no=new WeakMap,Li=new WeakMap,io=new WeakMap,ao=new WeakMap,Hc=new WeakMap,Zt=new WeakSet,Uc=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Pm=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(i=>i.type==="text").map(i=>i.text);if(t.length===0)throw new te("stream ended without producing a content block with type=text");return t.join(" ")},Vc=function(){this.ended||re(this,rn,void 0,"f")},Wc=function(t){if(this.ended)return;let i=z(this,Zt,"m",Dm).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let n=i.content.at(-1);switch(t.delta.type){case"text_delta":{n.type==="text"&&this._emit("text",t.delta.text,n.text||"");break}case"citations_delta":{n.type==="text"&&this._emit("citation",t.delta.citation,n.citations??[]);break}case"input_json_delta":{Om(n)&&n.input&&this._emit("inputJson",t.delta.partial_json,n.input);break}case"thinking_delta":{n.type==="thinking"&&this._emit("thinking",t.delta.thinking,n.thinking);break}case"signature_delta":{n.type==="thinking"&&this._emit("signature",n.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(i),this._addMessage(i,!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{re(this,rn,i,"f");break}case"content_block_start":case"message_delta":break}},jc=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let t=z(this,rn,"f");if(!t)throw new te("request ended without sending any chunks");return re(this,rn,void 0,"f"),t},Dm=function(t){let i=z(this,rn,"f");if(t.type==="message_start"){if(i)throw new te(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new te(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":return i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(i.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(i.usage.server_tool_use=t.usage.server_tool_use),i;case"content_block_start":return i.content.push({...t.content_block}),i;case"content_block_delta":{let n=i.content.at(t.index);switch(t.delta.type){case"text_delta":{n?.type==="text"&&(i.content[t.index]={...n,text:(n.text||"")+t.delta.text});break}case"citations_delta":{n?.type==="text"&&(i.content[t.index]={...n,citations:[...n.citations??[],t.delta.citation]});break}case"input_json_delta":{if(n&&Om(n)){let a=n[Mm]||"";a+=t.delta.partial_json;let s={...n};Object.defineProperty(s,Mm,{value:a,enumerable:!1,writable:!0}),a&&(s.input=Ws(a)),i.content[t.index]=s}break}case"thinking_delta":{n?.type==="thinking"&&(i.content[t.index]={...n,thinking:n.thinking+t.delta.thinking});break}case"signature_delta":{n?.type==="thinking"&&(i.content[t.index]={...n,signature:t.delta.signature});break}default:t.delta}return i}case"content_block_stop":return i}},Symbol.asyncIterator)](){let e=[],t=[],i=!1;return this.on("streamEvent",n=>{let a=t.shift();a?a.resolve(n):e.push(n)}),this.on("end",()=>{i=!0;for(let n of t)n.resolve(void 0);t.length=0}),this.on("abort",n=>{i=!0;for(let a of t)a.reject(n);t.length=0}),this.on("error",n=>{i=!0;for(let a of t)a.reject(n);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((a,s)=>t.push({resolve:a,reject:s})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new br(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Bi=class extends tt{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(ft`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",Yt,{query:e,...t})}delete(e,t){return this._client.delete(ft`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(ft`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let i=await this.retrieve(e);if(!i.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);return this._client.get(i.results_url,{...t,headers:ke([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((n,a)=>Di.fromResponse(a.response,a.controller))}};var nn=class extends tt{constructor(){super(...arguments),this.batches=new Bi(this._client)}create(e,t){e.model in Nm&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Nm[e.model]}
|
|
3264
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let
|
|
3275
|
+
${o}
|
|
3276
|
+
${d}`)}return o},dr=fL(sT);var ys=class extends jt{list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/files",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(dr`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/files/${e}/content`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...i}=e;return this._client.post("/v1/files",nT({body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}};var bs=class extends jt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/models/${e}?beta=true`,{...n,headers:Ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models?beta=true",fn,{query:i,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var vs=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new Ii;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new se("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new se("Attempted to iterate over a response with no body");return new t(ic(e.body),r)}};var _s=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/batches?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(dr`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:i}=r??{};return this._client.post(dr`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let i=await this.retrieve(e);if(!i.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:a}=r??{};return this._client.get(i.results_url,{...n,headers:Ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,s)=>vs.fromResponse(s.response,s.controller))}};var vL=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",l=!1;for(n=t[++e];n!=='"';){if(e===t.length){l=!0;break}if(n==="\\"){if(e++,e===t.length){l=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],l||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let a=/[0-9]/;if(n&&a.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&a.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let o=/[a-z]/i;if(n&&o.test(n)){let s="";for(;n&&o.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},Ss=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Ss(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),Ss(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),Ss(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),Ss(t);break;case"delimiter":return t=t.slice(0,t.length-1),Ss(t);break}return t},_L=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},SL=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},bp=t=>JSON.parse(SL(_L(Ss(vL(t)))));var gn,da,dc,vp,pc,mc,_p,hc,Pi,fc,Sp,wp,ws,kp,xp,Bg,lT,Ep,jg,Ug,Gg,cT,uT="__json_buf";function dT(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var Tp=class t{constructor(){gn.add(this),this.messages=[],this.receivedMessages=[],da.set(this,void 0),this.controller=new AbortController,dc.set(this,void 0),vp.set(this,()=>{}),pc.set(this,()=>{}),mc.set(this,void 0),_p.set(this,()=>{}),hc.set(this,()=>{}),Pi.set(this,{}),fc.set(this,!1),Sp.set(this,!1),wp.set(this,!1),ws.set(this,!1),kp.set(this,void 0),xp.set(this,void 0),Ep.set(this,e=>{if(ce(this,Sp,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,wp,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,dc,new Promise((e,r)=>{ce(this,vp,e,"f"),ce(this,pc,r,"f")}),"f"),ce(this,mc,new Promise((e,r)=>{ce(this,_p,e,"f"),ce(this,hc,r,"f")}),"f"),D(this,dc,"f").catch(()=>{}),D(this,mc,"f").catch(()=>{})}get response(){return D(this,kp,"f")}get request_id(){return D(this,xp,"f")}async withResponse(){let e=await D(this,dc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,Ep,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,gn,"m",jg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,gn,"m",Ug).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,gn,"m",Gg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,kp,e,"f"),ce(this,xp,e?.headers.get("request-id"),"f"),D(this,vp,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,fc,"f")}get errored(){return D(this,Sp,"f")}get aborted(){return D(this,wp,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Pi,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ws,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ws,!0,"f"),await D(this,mc,"f")}get currentMessage(){return D(this,da,"f")}async finalMessage(){return await this.done(),D(this,gn,"m",Bg).call(this)}async finalText(){return await this.done(),D(this,gn,"m",lT).call(this)}_emit(e,...r){if(D(this,fc,"f"))return;e==="end"&&(ce(this,fc,!0,"f"),D(this,_p,"f").call(this));let n=D(this,Pi,"f")[e];if(n&&(D(this,Pi,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,pc,"f").call(this,i),D(this,hc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,pc,"f").call(this,i),D(this,hc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,gn,"m",Bg).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,gn,"m",jg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,gn,"m",Ug).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,gn,"m",Gg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(da=new WeakMap,dc=new WeakMap,vp=new WeakMap,pc=new WeakMap,mc=new WeakMap,_p=new WeakMap,hc=new WeakMap,Pi=new WeakMap,fc=new WeakMap,Sp=new WeakMap,wp=new WeakMap,ws=new WeakMap,kp=new WeakMap,xp=new WeakMap,Ep=new WeakMap,gn=new WeakSet,Bg=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},lT=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},jg=function(){this.ended||ce(this,da,void 0,"f")},Ug=function(r){if(this.ended)return;let n=D(this,gn,"m",cT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{dT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,da,n,"f");break}case"content_block_start":case"message_delta":break}},Gg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,da,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,da,void 0,"f"),r},cT=function(r){let n=D(this,da,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&dT(i)){let a=i[uT]||"";a+=r.delta.partial_json;let o={...i};if(Object.defineProperty(o,uT,{value:a,enumerable:!1,writable:!0}),a)try{o.input=bp(a)}catch(s){let l=new se(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${a}`);D(this,Ep,"f").call(this,l)}n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Cp={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var pT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},Xa=class extends jt{constructor(){super(...arguments),this.batches=new _s(this._client)}create(e,r){let{betas:n,...i}=e;i.model in pT&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${pT[i.model]}
|
|
3277
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!i.stream&&a==null){let o=Cp[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,o)}return this._client.post("/v1/messages?beta=true",{body:i,timeout:a??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return Tp.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}};Xa.Batches=_s;var ti=class extends jt{constructor(){super(...arguments),this.models=new bs(this._client),this.messages=new Xa(this._client),this.files=new ys(this._client)}};ti.Models=bs;ti.Messages=Xa;ti.Files=ys;var Ya=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/complete",{body:i,timeout:this._client._options.timeout??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};var yn,pa,gc,Ip,yc,bc,Ap,vc,Ri,_c,Pp,Rp,ks,Np,Op,Vg,mT,Hg,qg,Wg,Zg,hT,fT="__json_buf";function gT(t){return t.type==="tool_use"||t.type==="server_tool_use"}var Dp=class t{constructor(){yn.add(this),this.messages=[],this.receivedMessages=[],pa.set(this,void 0),this.controller=new AbortController,gc.set(this,void 0),Ip.set(this,()=>{}),yc.set(this,()=>{}),bc.set(this,void 0),Ap.set(this,()=>{}),vc.set(this,()=>{}),Ri.set(this,{}),_c.set(this,!1),Pp.set(this,!1),Rp.set(this,!1),ks.set(this,!1),Np.set(this,void 0),Op.set(this,void 0),Hg.set(this,e=>{if(ce(this,Pp,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,Rp,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,gc,new Promise((e,r)=>{ce(this,Ip,e,"f"),ce(this,yc,r,"f")}),"f"),ce(this,bc,new Promise((e,r)=>{ce(this,Ap,e,"f"),ce(this,vc,r,"f")}),"f"),D(this,gc,"f").catch(()=>{}),D(this,bc,"f").catch(()=>{})}get response(){return D(this,Np,"f")}get request_id(){return D(this,Op,"f")}async withResponse(){let e=await D(this,gc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,Hg,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,yn,"m",qg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,yn,"m",Wg).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,yn,"m",Zg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,Np,e,"f"),ce(this,Op,e?.headers.get("request-id"),"f"),D(this,Ip,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,_c,"f")}get errored(){return D(this,Pp,"f")}get aborted(){return D(this,Rp,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Ri,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ks,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ks,!0,"f"),await D(this,bc,"f")}get currentMessage(){return D(this,pa,"f")}async finalMessage(){return await this.done(),D(this,yn,"m",Vg).call(this)}async finalText(){return await this.done(),D(this,yn,"m",mT).call(this)}_emit(e,...r){if(D(this,_c,"f"))return;e==="end"&&(ce(this,_c,!0,"f"),D(this,Ap,"f").call(this));let n=D(this,Ri,"f")[e];if(n&&(D(this,Ri,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,yc,"f").call(this,i),D(this,vc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,yc,"f").call(this,i),D(this,vc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,yn,"m",Vg).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,yn,"m",qg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,yn,"m",Wg).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,yn,"m",Zg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(pa=new WeakMap,gc=new WeakMap,Ip=new WeakMap,yc=new WeakMap,bc=new WeakMap,Ap=new WeakMap,vc=new WeakMap,Ri=new WeakMap,_c=new WeakMap,Pp=new WeakMap,Rp=new WeakMap,ks=new WeakMap,Np=new WeakMap,Op=new WeakMap,Hg=new WeakMap,yn=new WeakSet,Vg=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},mT=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},qg=function(){this.ended||ce(this,pa,void 0,"f")},Wg=function(r){if(this.ended)return;let n=D(this,yn,"m",hT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{gT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,pa,n,"f");break}case"content_block_start":case"message_delta":break}},Zg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,pa,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,pa,void 0,"f"),r},hT=function(r){let n=D(this,pa,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push({...r.content_block}),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&gT(i)){let a=i[fT]||"";a+=r.delta.partial_json;let o={...i};Object.defineProperty(o,fT,{value:a,enumerable:!1,writable:!0}),a&&(o.input=bp(a)),n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var xs=class extends jt{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(dr`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",fn,{query:e,...r})}delete(e,r){return this._client.delete(dr`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(dr`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:Ke([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,a)=>vs.fromResponse(a.response,a.controller))}};var ma=class extends jt{constructor(){super(...arguments),this.batches=new xs(this._client)}create(e,r){e.model in yT&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${yT[e.model]}
|
|
3278
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let n=this._client._options.timeout;if(!e.stream&&n==null){let i=Cp[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,i)}return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,stream:e.stream??!1})}stream(e,r){return Dp.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},yT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"};ma.Batches=xs;var Qa=class extends jt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/models/${e}`,{...n,headers:Ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models",fn,{query:i,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var Sc=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Kg,Jg,Mp,bT,Tt=class{constructor({baseURL:e=Sc("ANTHROPIC_BASE_URL"),apiKey:r=Sc("ANTHROPIC_API_KEY")??null,authToken:n=Sc("ANTHROPIC_AUTH_TOKEN")??null,...i}={}){Kg.add(this),Mp.set(this,void 0);let a={apiKey:r,authToken:n,...i,baseURL:e||"https://api.anthropic.com"};if(!a.dangerouslyAllowBrowser&&qE())throw new se(`It looks like you're running in a browser-like environment.
|
|
3265
3279
|
|
|
3266
3280
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
3267
3281
|
If you understand the risks and have appropriate mitigations in place,
|
|
3268
3282
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
3269
3283
|
|
|
3270
3284
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
3271
|
-
`);this.baseURL=a.baseURL,this.timeout=a.timeout
|
|
3285
|
+
`);this.baseURL=a.baseURL,this.timeout=a.timeout??Jg.DEFAULT_TIMEOUT,this.logger=a.logger??console;let o="warn";this.logLevel=o,this.logLevel=Ng(a.logLevel,"ClientOptions.logLevel",this)??Ng(Sc("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??o,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??ZE(),ce(this,Mp,JE,"f"),this._options=a,this.apiKey=r,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(this.apiKey&&e.get("x-api-key"))&&!r.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!r.has("authorization"))throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(e){return Ke([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return Ke([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return Ke([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new se(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${ua}`}defaultIdempotencyKey(){return`stainless-node-retry-${Tg()}`}makeStatusError(e,r,n,i){return qt.generate(e,r,n,i)}buildURL(e,r,n){let i=!D(this,Kg,"m",bT).call(this)&&n||this.baseURL,a=zE(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return FE(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(a.search=this.stringifyQuery(r)),a.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new se("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>({method:e,path:r,...i})))}request(e,r=null){return new Ka(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let i=await e,a=i.maxRetries??this.maxRetries;r==null&&(r=a),await this.prepareOptions(i);let{req:o,url:s,timeout:l}=await this.buildRequest(i,{retryCount:a-r});await this.prepareRequest(o,{url:s,options:i});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Wt(this).debug(`[${c}] sending request`,Ai({retryOfRequestLogID:n,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Qt;let m=new AbortController,p=await this.fetchWithTimeout(s,o,l,m).catch(nc),h=Date.now();if(p instanceof Error){let g=`retrying, ${r} attempts remaining`;if(i.signal?.aborted)throw new Qt;let x=Ci(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Wt(this).info(`[${c}] connection ${x?"timed out":"failed"} - ${g}`),Wt(this).debug(`[${c}] connection ${x?"timed out":"failed"} (${g})`,Ai({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),this.retryRequest(i,r,n??c);throw Wt(this).info(`[${c}] connection ${x?"timed out":"failed"} - error; no more retries left`),Wt(this).debug(`[${c}] connection ${x?"timed out":"failed"} (error; no more retries left)`,Ai({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),x?new ls:new ca({cause:p})}let f=[...p.headers.entries()].filter(([g])=>g==="request-id").map(([g,x])=>", "+g+": "+JSON.stringify(x)).join(""),y=`[${c}${u}${f}] ${o.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let M=`retrying, ${r} attempts remaining`;return await KE(p.body),Wt(this).info(`${y} - ${M}`),Wt(this).debug(`[${c}] response error (${M})`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(i,r,n??c,p.headers)}let x=g?"error; no more retries left":"error; not retryable";Wt(this).info(`${y} - ${x}`);let v=await p.text().catch(M=>nc(M).message),I=dp(v),T=I?void 0:v;throw Wt(this).debug(`[${c}] response error (${x})`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,I,T,p.headers)}return Wt(this).info(y),Wt(this).debug(`[${c}] response start`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:i,controller:m,requestLogID:c,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cc(this,n,e)}async fetchWithTimeout(e,r,n,i){let{signal:a,method:o,...s}=r||{};a&&a.addEventListener("abort",()=>i.abort());let l=setTimeout(()=>i.abort(),n),c=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,u={signal:i.signal,...c?{duplex:"half"}:{},method:"GET",...s};o&&(u.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){let a,o=i?.get("retry-after-ms");if(o){let l=parseFloat(o);Number.isNaN(l)||(a=l)}let s=i?.get("retry-after");if(s&&!a){let l=parseFloat(s);Number.isNaN(l)?a=Date.parse(s)-Date.now():a=l*1e3}if(!(a&&0<=a&&a<60*1e3)){let l=e.maxRetries??this.maxRetries;a=this.calculateDefaultRetryTimeoutMillis(r,l)}return await UE(a),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let a=r-e,o=Math.min(.5*Math.pow(2,a),8),s=1-Math.random()*.25;return o*s*1e3}calculateNonstreamingTimeout(e,r){if(36e5*e/128e3>6e5||r!=null&&e>r)throw new se("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:i,path:a,query:o,defaultBaseURL:s}=n,l=this.buildURL(a,o,s);"timeout"in n&&jE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:i,bodyHeaders:c,retryCount:r});return{req:{method:i,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:l,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let a={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let o=Ke([a,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...WE(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=Ke([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:pp(e)}:D(this,Mp,"f").call(this,{body:e,headers:n})}};Jg=Tt,Mp=new WeakMap,Kg=new WeakSet,bT=function(){return this.baseURL!=="https://api.anthropic.com"};Tt.Anthropic=Jg;Tt.HUMAN_PROMPT=`
|
|
3272
3286
|
|
|
3273
|
-
Human:`;
|
|
3287
|
+
Human:`;Tt.AI_PROMPT=`
|
|
3274
3288
|
|
|
3275
|
-
Assistant:`;
|
|
3289
|
+
Assistant:`;Tt.DEFAULT_TIMEOUT=6e5;Tt.AnthropicError=se;Tt.APIError=qt;Tt.APIConnectionError=ca;Tt.APIConnectionTimeoutError=ls;Tt.APIUserAbortError=Qt;Tt.NotFoundError=ps;Tt.ConflictError=ms;Tt.RateLimitError=fs;Tt.BadRequestError=cs;Tt.AuthenticationError=us;Tt.InternalServerError=gs;Tt.PermissionDeniedError=ds;Tt.UnprocessableEntityError=hs;Tt.toFile=yp;var On=class extends Tt{constructor(){super(...arguments),this.completions=new Ya(this),this.messages=new ma(this),this.models=new Qa(this),this.beta=new ti(this)}};On.Completions=Ya;On.Messages=ma;On.Models=Qa;On.Beta=ti;var{HUMAN_PROMPT:EL,AI_PROMPT:TL}=On;var $p=new Re("AnthropicChat"),Lp=class extends ss{addUserMessage(e){let r={role:"user",content:e||""};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}addAssistantMessage(e){let r={role:"assistant",content:e||""};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}async sendMessage(e){this.addUserMessage(e);let r=new On({apiKey:this.config.apiKey,baseURL:this.config.endpoint,dangerouslyAllowBrowser:!0}),n=!0,i="",a="";for(;n;){n=!1,await this.config.onBeforeMessageProcessing?.(),await this.trimMessages(),$p.debug("Before processing state",{messages:this.messageGroup.getAll().map(m=>m.customData),tools:this.toolGroup.getAll().map(m=>m.customData),context:this.contextGroup.getAll().map(m=>m.content)});let o=this.toolGroup.getAll().map(m=>({name:m.customData?.name||"",description:m.customData?.description||"",input_schema:{type:"object",required:m.customData?.params.required||[],properties:m.customData?.params.properties||{}}})),s;if(this.config.stream){let m=r.messages.stream({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.getAll().map(p=>p.customData),tools:o,stream:!0});m.on("text",p=>{a+=p,this.config.onAIMessage?.(a,!0)}),s=await m.finalMessage()}else s=await r.messages.create({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.items.map(m=>m.customData),tools:o});$p.debug("Message received",s);let l=!0;Array.isArray(s.content)&&s.content.length==0&&(l=!1);let c={role:s.role,content:s.content};l&&this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(c),customData:c});let u=[];for(let m of s.content)m.type=="thinking"?$p.debug(`AI is thinking: ${m.thinking}`):m.type=="text"?i+=m.text||`
|
|
3276
3290
|
|
|
3277
|
-
`:m.type=="tool_use"&&u.push(this.performToolCall(m));let p=await Promise.all(u);if(p.length>0){let m={role:"user",content:p};this.messageGroup.add({id:"msg-"+Ge(),content:JSON.stringify(m),customData:m}),i=!0}this.config.onAIMessage?.(n,!0),this.stats.tokensUsed+=o.usage.input_tokens+o.usage.output_tokens}return n=n.trim(),this.config.onAIMessage?.(n,!1),n}async performToolCall(e){try{let t=this.toolGroup.getAll().find(n=>n.customData?.name==e.name);if(!t)throw new Error(`Tool ${e.name} not found`);this.config.onAIToolStart?.(e.name,e.input);let i=await t.customData.callback(e.input);return typeof i!="string"&&(i=JSON.stringify(i)||""),(i===""||i==="undefined")&&(i="success"),{type:"tool_result",tool_use_id:e.id,content:String(i||"")}}catch(t){return lo.error(`Error performing tool call ${e.name}: ${t.message||t.toString()}`),{type:"tool_result",tool_use_id:e.id,content:`Error performing tool call ${e.name}: ${t.message||t.toString()}`}}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items[0]?.customData?.content?.type=="tool_result";)this.messageGroup.items.shift()}};var Le=function(){return Le=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Le.apply(this,arguments)};function kS(r,e,t,i){function n(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(i.next(u))}catch(p){s(p)}}function l(u){try{c(i.throw(u))}catch(p){s(p)}}function c(u){u.done?a(u.value):n(u.value).then(o,l)}c((i=i.apply(r,e||[])).next())})}function CS(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(i=1,n&&(a=c[0]&2?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){t.label=c[1];break}if(c[0]===6&&t.label<a[1]){t.label=a[1],a=c;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(c);break}a[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],n=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function he(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $e(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,a=[],s;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(o){s={error:o}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(s)throw s.error}}return a}var xS="ENTRIES",Um="KEYS",Hm="VALUES",pt="",Kc=function(){function r(e,t){var i=e._tree,n=Array.from(i.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:i,keys:n}]:[]}return r.prototype.next=function(){var e=this.dive();return this.backtrack(),e},r.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Fi(this._path),t=e.node,i=e.keys;if(Fi(i)===pt)return{done:!1,value:this.result()};var n=t.get(Fi(i));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},r.prototype.backtrack=function(){if(this._path.length!==0){var e=Fi(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},r.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return Fi(t)}).filter(function(e){return e!==pt}).join("")},r.prototype.value=function(){return Fi(this._path).node.get(pt)},r.prototype.result=function(){switch(this._type){case Hm:return this.value();case Um:return this.key();default:return[this.key(),this.value()]}},r.prototype[Symbol.iterator]=function(){return this},r}(),Fi=function(r){return r[r.length-1]},TS=function(r,e,t){var i=new Map;if(e===void 0)return i;for(var n=e.length+1,a=n+t,s=new Uint8Array(a*n).fill(t+1),o=0;o<n;++o)s[o]=o;for(var l=1;l<a;++l)s[l*n]=l;return Vm(r,e,t,i,s,1,n,""),i},Vm=function(r,e,t,i,n,a,s,o){var l,c,u=a*s;try{e:for(var p=he(r.keys()),m=p.next();!m.done;m=p.next()){var d=m.value;if(d===pt){var g=n[u-1];g<=t&&i.set(o,[r.get(d),g])}else{for(var f=a,y=0;y<d.length;++y,++f){for(var b=d[y],x=s*f,S=x-s,A=n[x],R=Math.max(0,f-t-1),k=Math.min(s-1,f+t),O=R;O<k;++O){var B=b!==e[O],P=n[S+O]+ +B,G=n[S+O+1]+1,U=n[x+O]+1,N=n[x+O+1]=Math.min(P,G,U);N<A&&(A=N)}if(A>t)continue e}Vm(r.get(d),e,t,i,n,f,s,o+d)}}}catch(T){l={error:T}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}},Xc=function(){function r(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return r.prototype.atPrefix=function(e){var t,i;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=$e(po(this._tree,e.slice(this._prefix.length)),2),a=n[0],s=n[1];if(a===void 0){var o=$e(nu(s),2),l=o[0],c=o[1];try{for(var u=he(l.keys()),p=u.next();!p.done;p=u.next()){var m=p.value;if(m!==pt&&m.startsWith(c)){var d=new Map;return d.set(m.slice(c.length),l.get(m)),new r(d,e)}}}catch(g){t={error:g}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}}return new r(a,e)},r.prototype.clear=function(){this._size=void 0,this._tree.clear()},r.prototype.delete=function(e){return this._size=void 0,AS(this._tree,e)},r.prototype.entries=function(){return new Kc(this,xS)},r.prototype.forEach=function(e){var t,i;try{for(var n=he(this),a=n.next();!a.done;a=n.next()){var s=$e(a.value,2),o=s[0],l=s[1];e(o,l,this)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},r.prototype.fuzzyGet=function(e,t){return TS(this._tree,e,t)},r.prototype.get=function(e){var t=eu(this._tree,e);return t!==void 0?t.get(pt):void 0},r.prototype.has=function(e){var t=eu(this._tree,e);return t!==void 0&&t.has(pt)},r.prototype.keys=function(){return new Kc(this,Um)},r.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var i=Yc(this._tree,e);return i.set(pt,t),this},Object.defineProperty(r.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),r.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var i=Yc(this._tree,e);return i.set(pt,t(i.get(pt))),this},r.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var i=Yc(this._tree,e),n=i.get(pt);return n===void 0&&i.set(pt,n=t()),n},r.prototype.values=function(){return new Kc(this,Hm)},r.prototype[Symbol.iterator]=function(){return this.entries()},r.from=function(e){var t,i,n=new r;try{for(var a=he(e),s=a.next();!s.done;s=a.next()){var o=$e(s.value,2),l=o[0],c=o[1];n.set(l,c)}}catch(u){t={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return n},r.fromObject=function(e){return r.from(Object.entries(e))},r}(),po=function(r,e,t){var i,n;if(t===void 0&&(t=[]),e.length===0||r==null)return[r,t];try{for(var a=he(r.keys()),s=a.next();!s.done;s=a.next()){var o=s.value;if(o!==pt&&e.startsWith(o))return t.push([r,o]),po(r.get(o),e.slice(o.length),t)}}catch(l){i={error:l}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return t.push([r,e]),po(void 0,"",t)},eu=function(r,e){var t,i;if(e.length===0||r==null)return r;try{for(var n=he(r.keys()),a=n.next();!a.done;a=n.next()){var s=a.value;if(s!==pt&&e.startsWith(s))return eu(r.get(s),e.slice(s.length))}}catch(o){t={error:o}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},Yc=function(r,e){var t,i,n=e.length;e:for(var a=0;r&&a<n;){try{for(var s=(t=void 0,he(r.keys())),o=s.next();!o.done;o=s.next()){var l=o.value;if(l!==pt&&e[a]===l[0]){for(var c=Math.min(n-a,l.length),u=1;u<c&&e[a+u]===l[u];)++u;var p=r.get(l);if(u===l.length)r=p;else{var m=new Map;m.set(l.slice(u),p),r.set(e.slice(a,a+u),m),r.delete(l),r=m}a+=u;continue e}}}catch(g){t={error:g}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}var d=new Map;return r.set(e.slice(a),d),d}return r},AS=function(r,e){var t=$e(po(r,e),2),i=t[0],n=t[1];if(i!==void 0){if(i.delete(pt),i.size===0)Wm(n);else if(i.size===1){var a=$e(i.entries().next().value,2),s=a[0],o=a[1];jm(n,s,o)}}},Wm=function(r){if(r.length!==0){var e=$e(nu(r),2),t=e[0],i=e[1];if(t.delete(i),t.size===0)Wm(r.slice(0,-1));else if(t.size===1){var n=$e(t.entries().next().value,2),a=n[0],s=n[1];a!==pt&&jm(r.slice(0,-1),a,s)}}},jm=function(r,e,t){if(r.length!==0){var i=$e(nu(r),2),n=i[0],a=i[1];n.set(a+e,t),n.delete(a)}},nu=function(r){return r[r.length-1]},Fa,iu="or",qm="and",IS="and_not",$m=function(){function r(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?Qc:e.autoVacuum;this._options=Le(Le(Le({},Zc),e),{autoVacuum:t,searchOptions:Le(Le({},Bm),e.searchOptions||{}),autoSuggestOptions:Le(Le({},OS),e.autoSuggestOptions||{})}),this._index=new Xc,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ru,this.addFields(this._options.fields)}return r.prototype.add=function(e){var t,i,n,a,s,o,l=this._options,c=l.extractField,u=l.tokenize,p=l.processTerm,m=l.fields,d=l.idField,g=c(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var f=this.addDocumentId(g);this.saveStoredFields(f,e);try{for(var y=he(m),b=y.next();!b.done;b=y.next()){var x=b.value,S=c(e,x);if(S!=null){var A=u(S.toString(),x),R=this._fieldIds[x],k=new Set(A).size;this.addFieldLength(f,R,this._documentCount-1,k);try{for(var O=(n=void 0,he(A)),B=O.next();!B.done;B=O.next()){var P=B.value,G=p(P,x);if(Array.isArray(G))try{for(var U=(s=void 0,he(G)),N=U.next();!N.done;N=U.next()){var T=N.value;this.addTerm(R,f,T)}}catch(I){s={error:I}}finally{try{N&&!N.done&&(o=U.return)&&o.call(U)}finally{if(s)throw s.error}}else G&&this.addTerm(R,f,G)}}catch(I){n={error:I}}finally{try{B&&!B.done&&(a=O.return)&&a.call(O)}finally{if(n)throw n.error}}}}}catch(I){t={error:I}}finally{try{b&&!b.done&&(i=y.return)&&i.call(y)}finally{if(t)throw t.error}}},r.prototype.addAll=function(e){var t,i;try{for(var n=he(e),a=n.next();!a.done;a=n.next()){var s=a.value;this.add(s)}}catch(o){t={error:o}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},r.prototype.addAllAsync=function(e,t){var i=this;t===void 0&&(t={});var n=t.chunkSize,a=n===void 0?10:n,s={chunk:[],promise:Promise.resolve()},o=e.reduce(function(u,p,m){var d=u.chunk,g=u.promise;return d.push(p),(m+1)%a===0?{chunk:[],promise:g.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return i.addAll(d)})}:{chunk:d,promise:g}},s),l=o.chunk,c=o.promise;return c.then(function(){return i.addAll(l)})},r.prototype.remove=function(e){var t,i,n,a,s,o,l=this._options,c=l.tokenize,u=l.processTerm,p=l.extractField,m=l.fields,d=l.idField,g=p(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var f=this._idToShortId.get(g);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var y=he(m),b=y.next();!b.done;b=y.next()){var x=b.value,S=p(e,x);if(S!=null){var A=c(S.toString(),x),R=this._fieldIds[x],k=new Set(A).size;this.removeFieldLength(f,R,this._documentCount,k);try{for(var O=(n=void 0,he(A)),B=O.next();!B.done;B=O.next()){var P=B.value,G=u(P,x);if(Array.isArray(G))try{for(var U=(s=void 0,he(G)),N=U.next();!N.done;N=U.next()){var T=N.value;this.removeTerm(R,f,T)}}catch(I){s={error:I}}finally{try{N&&!N.done&&(o=U.return)&&o.call(U)}finally{if(s)throw s.error}}else G&&this.removeTerm(R,f,G)}}catch(I){n={error:I}}finally{try{B&&!B.done&&(a=O.return)&&a.call(O)}finally{if(n)throw n.error}}}}}catch(I){t={error:I}}finally{try{b&&!b.done&&(i=y.return)&&i.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(g),this._fieldLength.delete(f),this._documentCount-=1},r.prototype.removeAll=function(e){var t,i;if(e)try{for(var n=he(e),a=n.next();!a.done;a=n.next()){var s=a.value;this.remove(s)}}catch(o){t={error:o}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Xc,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.discard=function(e){var t=this,i=this._idToShortId.get(e);if(i==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(i),this._storedFields.delete(i),(this._fieldLength.get(i)||[]).forEach(function(n,a){t.removeFieldLength(i,a,t._documentCount,n)}),this._fieldLength.delete(i),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},r.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,i=e.minDirtCount,n=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:a},{minDirtCount:i,minDirtFactor:t})}},r.prototype.discardAll=function(e){var t,i,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=he(e),s=a.next();!s.done;s=a.next()){var o=s.value;this.discard(o)}}catch(l){t={error:l}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},r.prototype.replace=function(e){var t=this._options,i=t.idField,n=t.extractField,a=n(e,i);this.discard(a),this.add(e)},r.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},r.prototype.conditionalVacuum=function(e,t){var i=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=i._enqueuedVacuumConditions;return i._enqueuedVacuumConditions=ru,i.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},r.prototype.performVacuuming=function(e,t){return kS(this,void 0,void 0,function(){var i,n,a,s,o,l,c,u,p,m,d,g,f,y,b,x,S,A,R,k,O,B,P,G,U;return CS(this,function(N){switch(N.label){case 0:if(i=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||tu.batchSize,a=e.batchWait||tu.batchWait,s=1,N.label=1;case 1:N.trys.push([1,7,8,9]),o=he(this._index),l=o.next(),N.label=2;case 2:if(l.done)return[3,6];c=$e(l.value,2),u=c[0],p=c[1];try{for(m=(B=void 0,he(p)),d=m.next();!d.done;d=m.next()){g=$e(d.value,2),f=g[0],y=g[1];try{for(b=(G=void 0,he(y)),x=b.next();!x.done;x=b.next())S=$e(x.value,1),A=S[0],!this._documentIds.has(A)&&(y.size<=1?p.delete(f):y.delete(A))}catch(T){G={error:T}}finally{try{x&&!x.done&&(U=b.return)&&U.call(b)}finally{if(G)throw G.error}}}}catch(T){B={error:T}}finally{try{d&&!d.done&&(P=m.return)&&P.call(m)}finally{if(B)throw B.error}}return this._index.get(u).size===0&&this._index.delete(u),s%n!==0?[3,4]:[4,new Promise(function(T){return setTimeout(T,a)})];case 3:N.sent(),N.label=4;case 4:s+=1,N.label=5;case 5:return l=o.next(),[3,2];case 6:return[3,9];case 7:return R=N.sent(),k={error:R},[3,9];case 8:try{l&&!l.done&&(O=o.return)&&O.call(o)}finally{if(k)throw k.error}return[7];case 9:this._dirtCount-=i,N.label=10;case 10:return[4,null];case 11:return N.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},r.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,i=e.minDirtFactor;return t=t||Qc.minDirtCount,i=i||Qc.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=i},Object.defineProperty(r.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this._idToShortId.has(e)},r.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},r.prototype.search=function(e,t){var i,n;t===void 0&&(t={});var a=this.executeQuery(e,t),s=[];try{for(var o=he(a),l=o.next();!l.done;l=o.next()){var c=$e(l.value,2),u=c[0],p=c[1],m=p.score,d=p.terms,g=p.match,f=d.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(g),queryTerms:d,match:g};Object.assign(y,this._storedFields.get(u)),(t.filter==null||t.filter(y))&&s.push(y)}}catch(b){i={error:b}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return e===r.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||s.sort(Gm),s},r.prototype.autoSuggest=function(e,t){var i,n,a,s;t===void 0&&(t={}),t=Le(Le({},this._options.autoSuggestOptions),t);var o=new Map;try{for(var l=he(this.search(e,t)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.score,m=u.terms,d=m.join(" "),g=o.get(d);g!=null?(g.score+=p,g.count+=1):o.set(d,{score:p,terms:m,count:1})}}catch(R){i={error:R}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}var f=[];try{for(var y=he(o),b=y.next();!b.done;b=y.next()){var x=$e(b.value,2),g=x[0],S=x[1],p=S.score,m=S.terms,A=S.count;f.push({suggestion:g,terms:m,score:p/A})}}catch(R){a={error:R}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}return f.sort(Gm),f},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),r.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},r.getDefault=function(e){if(Zc.hasOwnProperty(e))return Jc(Zc,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},r.loadJS=function(e,t){var i,n,a,s,o,l,c=e.index,u=e.documentCount,p=e.nextId,m=e.documentIds,d=e.fieldIds,g=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,b=e.dirtCount,x=e.serializationVersion;if(x!==1&&x!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var S=new r(t);S._documentCount=u,S._nextId=p,S._documentIds=uo(m),S._idToShortId=new Map,S._fieldIds=d,S._fieldLength=uo(g),S._avgFieldLength=f,S._storedFields=uo(y),S._dirtCount=b||0,S._index=new Xc;try{for(var A=he(S._documentIds),R=A.next();!R.done;R=A.next()){var k=$e(R.value,2),O=k[0],B=k[1];S._idToShortId.set(B,O)}}catch(Z){i={error:Z}}finally{try{R&&!R.done&&(n=A.return)&&n.call(A)}finally{if(i)throw i.error}}try{for(var P=he(c),G=P.next();!G.done;G=P.next()){var U=$e(G.value,2),N=U[0],T=U[1],I=new Map;try{for(var F=(o=void 0,he(Object.keys(T))),Y=F.next();!Y.done;Y=F.next()){var K=Y.value,ee=T[K];x===1&&(ee=ee.ds),I.set(parseInt(K,10),uo(ee))}}catch(Z){o={error:Z}}finally{try{Y&&!Y.done&&(l=F.return)&&l.call(F)}finally{if(o)throw o.error}}S._index.set(N,I)}}catch(Z){a={error:Z}}finally{try{G&&!G.done&&(s=P.return)&&s.call(P)}finally{if(a)throw a.error}}return S},r.prototype.executeQuery=function(e,t){var i=this;if(t===void 0&&(t={}),e===r.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=Le(Le(Le({},t),e),{queries:void 0}),a=e.queries.map(function(y){return i.executeQuery(y,n)});return this.combineResults(a,n.combineWith)}var s=this._options,o=s.tokenize,l=s.processTerm,c=s.searchOptions,u=Le(Le({tokenize:o,processTerm:l},c),t),p=u.tokenize,m=u.processTerm,d=p(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),g=d.map(MS(u)),f=g.map(function(y){return i.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},r.prototype.executeQuerySpec=function(e,t){var i,n,a,s,o=Le(Le({},this._options.searchOptions),t),l=(o.fields||this._options.fields).reduce(function(K,ee){var Z;return Le(Le({},K),(Z={},Z[ee]=Jc(o.boost,ee)||1,Z))},{}),c=o.boostDocument,u=o.weights,p=o.maxFuzzy,m=o.bm25,d=Le(Le({},Bm.weights),u),g=d.fuzzy,f=d.prefix,y=this._index.get(e.term),b=this.termResults(e.term,e.term,1,y,l,c,m),x,S;if(e.prefix&&(x=this._index.atPrefix(e.term)),e.fuzzy){var A=e.fuzzy===!0?.2:e.fuzzy,R=A<1?Math.min(p,Math.round(e.term.length*A)):A;R&&(S=this._index.fuzzyGet(e.term,R))}if(x)try{for(var k=he(x),O=k.next();!O.done;O=k.next()){var B=$e(O.value,2),P=B[0],G=B[1],U=P.length-e.term.length;if(U){S?.delete(P);var N=f*P.length/(P.length+.3*U);this.termResults(e.term,P,N,G,l,c,m,b)}}}catch(K){i={error:K}}finally{try{O&&!O.done&&(n=k.return)&&n.call(k)}finally{if(i)throw i.error}}if(S)try{for(var T=he(S.keys()),I=T.next();!I.done;I=T.next()){var P=I.value,F=$e(S.get(P),2),Y=F[0],U=F[1];if(U){var N=g*P.length/(P.length+U);this.termResults(e.term,P,N,Y,l,c,m,b)}}}catch(K){a={error:K}}finally{try{I&&!I.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}return b},r.prototype.executeWildcardQuery=function(e){var t,i,n=new Map,a=Le(Le({},this._options.searchOptions),e);try{for(var s=he(this._documentIds),o=s.next();!o.done;o=s.next()){var l=$e(o.value,2),c=l[0],u=l[1],p=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;n.set(c,{score:p,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}return n},r.prototype.combineResults=function(e,t){if(t===void 0&&(t=iu),e.length===0)return new Map;var i=t.toLowerCase();return e.reduce(RS[i])||new Map},r.prototype.toJSON=function(){var e,t,i,n,a=[];try{for(var s=he(this._index),o=s.next();!o.done;o=s.next()){var l=$e(o.value,2),c=l[0],u=l[1],p={};try{for(var m=(i=void 0,he(u)),d=m.next();!d.done;d=m.next()){var g=$e(d.value,2),f=g[0],y=g[1];p[f]=Object.fromEntries(y)}}catch(b){i={error:b}}finally{try{d&&!d.done&&(n=m.return)&&n.call(m)}finally{if(i)throw i.error}}a.push([c,p])}}catch(b){e={error:b}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},r.prototype.termResults=function(e,t,i,n,a,s,o,l){var c,u,p,m,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var g=he(Object.keys(a)),f=g.next();!f.done;f=g.next()){var y=f.value,b=a[y],x=this._fieldIds[y],S=n.get(x);if(S!=null){var A=S.size,R=this._avgFieldLength[x];try{for(var k=(p=void 0,he(S.keys())),O=k.next();!O.done;O=k.next()){var B=O.value;if(!this._documentIds.has(B)){this.removeTerm(x,B,t),A-=1;continue}var P=s?s(this._documentIds.get(B),t,this._storedFields.get(B)):1;if(P){var G=S.get(B),U=this._fieldLength.get(B)[x],N=DS(G,A,this._documentCount,U,R,o),T=i*b*P*N,I=l.get(B);if(I){I.score+=T,NS(I.terms,e);var F=Jc(I.match,t);F?F.push(y):I.match[t]=[y]}else l.set(B,{score:T,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(Y){p={error:Y}}finally{try{O&&!O.done&&(m=k.return)&&m.call(k)}finally{if(p)throw p.error}}}}}catch(Y){c={error:Y}}finally{try{f&&!f.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}return l},r.prototype.addTerm=function(e,t,i){var n=this._index.fetch(i,zm),a=n.get(e);if(a==null)a=new Map,a.set(t,1),n.set(e,a);else{var s=a.get(t);a.set(t,(s||0)+1)}},r.prototype.removeTerm=function(e,t,i){if(!this._index.has(i)){this.warnDocumentChanged(t,e,i);return}var n=this._index.fetch(i,zm),a=n.get(e);a==null||a.get(t)==null?this.warnDocumentChanged(t,e,i):a.get(t)<=1?a.size<=1?n.delete(e):a.delete(t):a.set(t,a.get(t)-1),this._index.get(i).size===0&&this._index.delete(i)},r.prototype.warnDocumentChanged=function(e,t,i){var n,a;try{for(var s=he(Object.keys(this._fieldIds)),o=s.next();!o.done;o=s.next()){var l=o.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(i,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){n={error:c}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}},r.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},r.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},r.prototype.addFieldLength=function(e,t,i,n){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[t]=n;var s=this._avgFieldLength[t]||0,o=s*i+n;this._avgFieldLength[t]=o/(i+1)},r.prototype.removeFieldLength=function(e,t,i,n){if(i===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*i-n;this._avgFieldLength[t]=a/(i-1)},r.prototype.saveStoredFields=function(e,t){var i,n,a=this._options,s=a.storeFields,o=a.extractField;if(!(s==null||s.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=he(s),u=c.next();!u.done;u=c.next()){var p=u.value,m=o(t,p);m!==void 0&&(l[p]=m)}}catch(d){i={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}}},r.wildcard=Symbol("*"),r}(),Jc=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},RS=(Fa={},Fa[iu]=function(r,e){var t,i;try{for(var n=he(e.keys()),a=n.next();!a.done;a=n.next()){var s=a.value,o=r.get(s);if(o==null)r.set(s,e.get(s));else{var l=e.get(s),c=l.score,u=l.terms,p=l.match;o.score=o.score+c,o.match=Object.assign(o.match,p),Fm(o.terms,u)}}}catch(m){t={error:m}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}return r},Fa[qm]=function(r,e){var t,i,n=new Map;try{for(var a=he(e.keys()),s=a.next();!s.done;s=a.next()){var o=s.value,l=r.get(o);if(l!=null){var c=e.get(o),u=c.score,p=c.terms,m=c.match;Fm(l.terms,p),n.set(o,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(d){t={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return n},Fa[IS]=function(r,e){var t,i;try{for(var n=he(e.keys()),a=n.next();!a.done;a=n.next()){var s=a.value;r.delete(s)}}catch(o){t={error:o}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}return r},Fa),PS={k:1.2,b:.7,d:.5},DS=function(r,e,t,i,n,a){var s=a.k,o=a.b,l=a.d,c=Math.log(1+(t-e+.5)/(e+.5));return c*(l+r*(s+1)/(r+s*(1-o+o*i/n)))},MS=function(r){return function(e,t,i){var n=typeof r.fuzzy=="function"?r.fuzzy(e,t,i):r.fuzzy||!1,a=typeof r.prefix=="function"?r.prefix(e,t,i):r.prefix===!0;return{term:e,fuzzy:n,prefix:a}}},Zc={idField:"id",extractField:function(r,e){return r[e]},tokenize:function(r){return r.split(LS)},processTerm:function(r){return r.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(r,e){typeof console?.[r]=="function"&&console[r](e)},autoVacuum:!0},Bm={combineWith:iu,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:PS},OS={combineWith:qm,prefix:function(r,e,t){return e===t.length-1}},tu={batchSize:1e3,batchWait:10},ru={minDirtFactor:.1,minDirtCount:20},Qc=Le(Le({},tu),ru),NS=function(r,e){r.includes(e)||r.push(e)},Fm=function(r,e){var t,i;try{for(var n=he(e),a=n.next();!a.done;a=n.next()){var s=a.value;r.includes(s)||r.push(s)}}catch(o){t={error:o}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},Gm=function(r,e){var t=r.score,i=e.score;return i-t},zm=function(){return new Map},uo=function(r){var e,t,i=new Map;try{for(var n=he(Object.keys(r)),a=n.next();!a.done;a=n.next()){var s=a.value;i.set(parseInt(s,10),r[s])}}catch(o){e={error:o}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return i},LS=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var Km=r=>[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,t)=>{let i=await t.knowledgeBase.search(e.query),n=t;n._lastKBsearch=e.query,n._nextRequestUseKBitems=i,t.submitAnalyticsEvent({type:"kb-search",query:e.query,results:i});let a=i.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",s=i.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${a}. New tools available: ${s}.`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!r?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,t)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!t.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return t.submitAnalyticsEvent({type:"open-url",url:e.url}),`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!r?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,t)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!t.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let i=new URL(e.path,window.location.origin).pathname;return window.location.href=i,t.submitAnalyticsEvent({type:"change-route",path:i}),`Changed route to: ${i}`}},{id:"ui.sendEmail",type:"action",name:"Send an email using the default mail client.",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!r?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,t)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!t.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let i=encodeURIComponent(e.email_address),n=encodeURIComponent(e.subject),a=encodeURIComponent(e.body),s=`mailto:${i}?subject=${n}&body=${a}`;try{window.location.href=s}catch(o){throw new Error(`Failed to open email client: ${o instanceof Error?o.message:String(o)}`)}return t.submitAnalyticsEvent({type:"send-email",email_address:e.email_address,subject:e.subject,body_length:e.body.length}),`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var h={};uc(h,{BRAND:()=>lE,DIRTY:()=>Rn,EMPTY_PATH:()=>zS,INVALID:()=>ne,NEVER:()=>qE,OK:()=>yt,ParseStatus:()=>mt,Schema:()=>me,ZodAny:()=>on,ZodArray:()=>Hr,ZodBigInt:()=>Dn,ZodBoolean:()=>Mn,ZodBranded:()=>za,ZodCatch:()=>Wn,ZodDate:()=>On,ZodDefault:()=>Vn,ZodDiscriminatedUnion:()=>go,ZodEffects:()=>tr,ZodEnum:()=>Un,ZodError:()=>It,ZodFirstPartyTypeKind:()=>ae,ZodFunction:()=>yo,ZodIntersection:()=>Fn,ZodIssueCode:()=>H,ZodLazy:()=>Gn,ZodLiteral:()=>zn,ZodMap:()=>Wi,ZodNaN:()=>qi,ZodNativeEnum:()=>Hn,ZodNever:()=>cr,ZodNull:()=>Ln,ZodNullable:()=>Er,ZodNumber:()=>Pn,ZodObject:()=>Rt,ZodOptional:()=>Qt,ZodParsedType:()=>q,ZodPipeline:()=>Ua,ZodPromise:()=>ln,ZodReadonly:()=>jn,ZodRecord:()=>fo,ZodSchema:()=>me,ZodSet:()=>ji,ZodString:()=>sn,ZodSymbol:()=>Hi,ZodTransformer:()=>tr,ZodTuple:()=>Sr,ZodType:()=>me,ZodUndefined:()=>Nn,ZodUnion:()=>Bn,ZodUnknown:()=>Ur,ZodVoid:()=>Vi,addIssueToContext:()=>j,any:()=>yE,array:()=>SE,bigint:()=>pE,boolean:()=>ah,coerce:()=>jE,custom:()=>rh,date:()=>mE,datetimeRegex:()=>eh,defaultErrorMap:()=>Gr,discriminatedUnion:()=>CE,effect:()=>BE,enum:()=>OE,function:()=>PE,getErrorMap:()=>Gi,getParsedType:()=>_r,instanceof:()=>uE,intersection:()=>xE,isAborted:()=>mo,isAsync:()=>zi,isDirty:()=>ho,isValid:()=>an,late:()=>cE,lazy:()=>DE,literal:()=>ME,makeIssue:()=>Ga,map:()=>IE,nan:()=>dE,nativeEnum:()=>NE,never:()=>vE,null:()=>fE,nullable:()=>GE,number:()=>ih,object:()=>EE,objectUtil:()=>au,oboolean:()=>WE,onumber:()=>VE,optional:()=>FE,ostring:()=>HE,pipeline:()=>UE,preprocess:()=>zE,promise:()=>LE,quotelessJson:()=>BS,record:()=>AE,set:()=>RE,setErrorMap:()=>GS,strictObject:()=>wE,string:()=>nh,symbol:()=>hE,transformer:()=>BE,tuple:()=>TE,undefined:()=>gE,union:()=>kE,unknown:()=>bE,util:()=>fe,void:()=>_E});var fe;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let s of n)a[s]=s;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),s={};for(let o of a)s[o]=n[o];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&a.push(s);return a},r.find=(n,a)=>{for(let s of n)if(a(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,a=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}r.joinValues=i,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(fe||(fe={}));var au;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(au||(au={}));var q=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_r=r=>{switch(typeof r){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(r)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(r)?q.array:r===null?q.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?q.promise:typeof Map<"u"&&r instanceof Map?q.map:typeof Set<"u"&&r instanceof Set?q.set:typeof Date<"u"&&r instanceof Date?q.date:q.object;default:return q.unknown}};var H=fe.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"]),BS=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),It=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},i={_errors:[]},n=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(t(s));else{let o=i,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return n(this),i}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},i=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}};It.create=r=>new It(r);var FS=(r,e)=>{let t;switch(r.code){case H.invalid_type:r.received===q.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case H.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,fe.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:t=`Unrecognized key(s) in object: ${fe.joinValues(r.keys,", ")}`;break;case H.invalid_union:t="Invalid input";break;case H.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${fe.joinValues(r.options)}`;break;case H.invalid_enum_value:t=`Invalid enum value. Expected ${fe.joinValues(r.options)}, received '${r.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 r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:fe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case H.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case H.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.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 ${r.multipleOf}`;break;case H.not_finite:t="Number must be finite";break;default:t=e.defaultError,fe.assertNever(r)}return{message:t}},Gr=FS;var Xm=Gr;function GS(r){Xm=r}function Gi(){return Xm}var Ga=r=>{let{data:e,path:t,errorMaps:i,issueData:n}=r,a=[...t,...n.path||[]],s={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",l=i.filter(c=>!!c).slice().reverse();for(let c of l)o=c(s,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},zS=[];function j(r,e){let t=Gi(),i=Ga({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Gr?void 0:Gr].filter(n=>!!n)});r.common.issues.push(i)}var mt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let i=[];for(let n of t){if(n.status==="aborted")return ne;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){let i=[];for(let n of t){let a=await n.key,s=await n.value;i.push({key:a,value:s})}return r.mergeObjectSync(e,i)}static mergeObjectSync(e,t){let i={};for(let n of t){let{key:a,value:s}=n;if(a.status==="aborted"||s.status==="aborted")return ne;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[a.value]=s.value)}return{status:e.value,value:i}}},ne=Object.freeze({status:"aborted"}),Rn=r=>({status:"dirty",value:r}),yt=r=>({status:"valid",value:r}),mo=r=>r.status==="aborted",ho=r=>r.status==="dirty",an=r=>r.status==="valid",zi=r=>typeof Promise<"u"&&r instanceof Promise;var J;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(J||(J={}));var er=class{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ym=(r,e)=>{if(an(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new It(r.common.issues);return this._error=t,this._error}}};function ue(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:i,description:n}=r;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,o)=>{let{message:l}=r;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:n}}var me=class{get description(){return this._def.description}_getType(e){return _r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:_r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new mt,ctx:{common:e.parent.common,data:e.data,parsedType:_r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(zi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){let i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_r(e)},n=this._parseSync({data:e,path:i.path,parent:i});return Ym(i,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_r(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:t});return an(i)?{value:i.value}:{issues:t.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>an(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){let i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){let i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_r(e)},n=this._parse({data:e,path:i.path,parent:i}),a=await(zi(n)?n:Promise.resolve(n));return Ym(i,a)}refine(e,t){let i=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let s=e(n),o=()=>a.addIssue({code:H.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,t){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof t=="function"?t(i,n):t),!1))}_refinement(e){return new tr({schema:this,typeName:ae.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 Qt.create(this,this._def)}nullable(){return Er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Hr.create(this)}promise(){return ln.create(this,this._def)}or(e){return Bn.create([this,e],this._def)}and(e){return Fn.create(this,e,this._def)}transform(e){return new tr({...ue(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Vn({...ue(this._def),innerType:this,defaultValue:t,typeName:ae.ZodDefault})}brand(){return new za({typeName:ae.ZodBranded,type:this,...ue(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Wn({...ue(this._def),innerType:this,catchValue:t,typeName:ae.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ua.create(this,e)}readonly(){return jn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},US=/^c[^\s-]{8,}$/i,HS=/^[0-9a-z]+$/,VS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,WS=/^[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,jS=/^[a-z0-9_-]{21}$/i,qS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$S=/^[-+]?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)?)??$/,KS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",su,YS=/^(?:(?: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])$/,JS=/^(?:(?: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])$/,ZS=/^(([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]))$/,QS=/^(([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])$/,eE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zm="((\\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])))",rE=new RegExp(`^${Zm}$`);function Qm(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function nE(r){return new RegExp(`^${Qm(r)}$`)}function eh(r){let e=`${Zm}T${Qm(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function iE(r,e){return!!((e==="v4"||!e)&&YS.test(r)||(e==="v6"||!e)&&ZS.test(r))}function aE(r,e){if(!qS.test(r))return!1;try{let[t]=r.split("."),i=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function sE(r,e){return!!((e==="v4"||!e)&&JS.test(r)||(e==="v6"||!e)&&QS.test(r))}var sn=class r extends me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let a=this._getOrReturnCtx(e);return j(a,{code:H.invalid_type,expected:q.string,received:a.parsedType}),ne}let i=new mt,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),j(n,{code:H.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),j(n,{code:H.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(n=this._getOrReturnCtx(e,n),s?j(n,{code:H.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&j(n,{code:H.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")KS.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"email",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")su||(su=new RegExp(XS,"u")),su.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"emoji",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")WS.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"uuid",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")jS.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"nanoid",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")US.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"cuid",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")HS.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"cuid2",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")VS.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"ulid",code:H.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),j(n,{validation:"url",code:H.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"regex",code:H.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.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)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?eh(a).test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?rE.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?nE(a).test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{code:H.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?$S.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"duration",code:H.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?iE(e.data,a.version)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"ip",code:H.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?aE(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"jwt",code:H.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?sE(e.data,a.version)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"cidr",code:H.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?eE.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"base64",code:H.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?tE.test(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{validation:"base64url",code:H.invalid_string,message:a.message}),i.dirty()):fe.assertNever(a);return{status:i.value,value:e.data}}_regex(e,t,i){return this.refinement(n=>e.test(n),{validation:t,code:H.invalid_string,...J.errToObj(i)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...J.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...J.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...J.errToObj(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?.precision>"u"?null:e?.precision,...J.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...J.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};sn.create=r=>new sn({checks:[],typeName:ae.ZodString,coerce:r?.coerce??!1,...ue(r)});function oE(r,e){let t=(r.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=t>i?t:i,a=Number.parseInt(r.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return a%s/10**n}var Pn=class r extends me{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)!==q.number){let a=this._getOrReturnCtx(e);return j(a,{code:H.invalid_type,expected:q.number,received:a.parsedType}),ne}let i,n=new mt;for(let a of this._def.checks)a.kind==="int"?fe.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),j(i,{code:H.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?oE(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),j(i,{code:H.not_finite,message:a.message}),n.dirty()):fe.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,i,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:J.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let 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"&&fe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Pn.create=r=>new Pn({checks:[],typeName:ae.ZodNumber,coerce:r?.coerce||!1,...ue(r)});var Dn=class r extends me{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)!==q.bigint)return this._getInvalidInput(e);let i,n=new mt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),j(i,{code:H.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):fe.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:H.invalid_type,expected:q.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,i,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:J.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Dn.create=r=>new Dn({checks:[],typeName:ae.ZodBigInt,coerce:r?.coerce??!1,...ue(r)});var Mn=class extends me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.boolean,received:i.parsedType}),ne}return yt(e.data)}};Mn.create=r=>new Mn({typeName:ae.ZodBoolean,coerce:r?.coerce||!1,...ue(r)});var On=class r extends me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let a=this._getOrReturnCtx(e);return j(a,{code:H.invalid_type,expected:q.date,received:a.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return j(a,{code:H.invalid_date}),ne}let i=new mt,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),j(n,{code:H.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),j(n,{code:H.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):fe.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(t)})}get minDate(){let e=null;for(let 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(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};On.create=r=>new On({checks:[],coerce:r?.coerce||!1,typeName:ae.ZodDate,...ue(r)});var Hi=class extends me{_parse(e){if(this._getType(e)!==q.symbol){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.symbol,received:i.parsedType}),ne}return yt(e.data)}};Hi.create=r=>new Hi({typeName:ae.ZodSymbol,...ue(r)});var Nn=class extends me{_parse(e){if(this._getType(e)!==q.undefined){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.undefined,received:i.parsedType}),ne}return yt(e.data)}};Nn.create=r=>new Nn({typeName:ae.ZodUndefined,...ue(r)});var Ln=class extends me{_parse(e){if(this._getType(e)!==q.null){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.null,received:i.parsedType}),ne}return yt(e.data)}};Ln.create=r=>new Ln({typeName:ae.ZodNull,...ue(r)});var on=class extends me{constructor(){super(...arguments),this._any=!0}_parse(e){return yt(e.data)}};on.create=r=>new on({typeName:ae.ZodAny,...ue(r)});var Ur=class extends me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yt(e.data)}};Ur.create=r=>new Ur({typeName:ae.ZodUnknown,...ue(r)});var cr=class extends me{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:H.invalid_type,expected:q.never,received:t.parsedType}),ne}};cr.create=r=>new cr({typeName:ae.ZodNever,...ue(r)});var Vi=class extends me{_parse(e){if(this._getType(e)!==q.undefined){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.void,received:i.parsedType}),ne}return yt(e.data)}};Vi.create=r=>new Vi({typeName:ae.ZodVoid,...ue(r)});var Hr=class r extends me{_parse(e){let{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==q.array)return j(t,{code:H.invalid_type,expected:q.array,received:t.parsedType}),ne;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(s||o)&&(j(t,{code:s?H.too_big:H.too_small,minimum:o?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(j(t,{code:H.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(j(t,{code:H.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((s,o)=>n.type._parseAsync(new er(t,s,t.path,o)))).then(s=>mt.mergeArray(i,s));let a=[...t.data].map((s,o)=>n.type._parseSync(new er(t,s,t.path,o)));return mt.mergeArray(i,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}};Hr.create=(r,e)=>new Hr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...ue(e)});function Ui(r){if(r instanceof Rt){let e={};for(let t in r.shape){let i=r.shape[t];e[t]=Qt.create(Ui(i))}return new Rt({...r._def,shape:()=>e})}else return r instanceof Hr?new Hr({...r._def,type:Ui(r.element)}):r instanceof Qt?Qt.create(Ui(r.unwrap())):r instanceof Er?Er.create(Ui(r.unwrap())):r instanceof Sr?Sr.create(r.items.map(e=>Ui(e))):r}var Rt=class r extends me{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=fe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let c=this._getOrReturnCtx(e);return j(c,{code:H.invalid_type,expected:q.object,received:c.parsedType}),ne}let{status:i,ctx:n}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof cr&&this._def.unknownKeys==="strip"))for(let c in n.data)s.includes(c)||o.push(c);let l=[];for(let c of s){let u=a[c],p=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new er(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof cr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")o.length>0&&(j(n,{code:H.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of o){let p=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new er(n,p,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,m=await u.value;c.push({key:p,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>mt.mergeObjectSync(i,c)):mt.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{let n=this._def.errorMap?.(t,i).message??i.defaultError;return t.code==="unrecognized_keys"?{message:J.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ae.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let i of fe.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let i of fe.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new r({...this._def,shape:()=>t})}deepPartial(){return Ui(this)}partial(e){let t={};for(let i of fe.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?t[i]=n:t[i]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let i of fe.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof Qt;)a=a._def.innerType;t[i]=a}return new r({...this._def,shape:()=>t})}keyof(){return th(fe.objectKeys(this.shape))}};Rt.create=(r,e)=>new Rt({shape:()=>r,unknownKeys:"strip",catchall:cr.create(),typeName:ae.ZodObject,...ue(e)});Rt.strictCreate=(r,e)=>new Rt({shape:()=>r,unknownKeys:"strict",catchall:cr.create(),typeName:ae.ZodObject,...ue(e)});Rt.lazycreate=(r,e)=>new Rt({shape:r,unknownKeys:"strip",catchall:cr.create(),typeName:ae.ZodObject,...ue(e)});var Bn=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),i=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(o=>new It(o.ctx.common.issues));return j(t,{code:H.invalid_union,unionErrors:s}),ne}if(t.common.async)return Promise.all(i.map(async a=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let a,s=[];for(let l of i){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(l=>new It(l));return j(t,{code:H.invalid_union,unionErrors:o}),ne}}get options(){return this._def.options}};Bn.create=(r,e)=>new Bn({options:r,typeName:ae.ZodUnion,...ue(e)});var zr=r=>r instanceof Gn?zr(r.schema):r instanceof tr?zr(r.innerType()):r instanceof zn?[r.value]:r instanceof Un?r.options:r instanceof Hn?fe.objectValues(r.enum):r instanceof Vn?zr(r._def.innerType):r instanceof Nn?[void 0]:r instanceof Ln?[null]:r instanceof Qt?[void 0,...zr(r.unwrap())]:r instanceof Er?[null,...zr(r.unwrap())]:r instanceof za||r instanceof jn?zr(r.unwrap()):r instanceof Wn?zr(r._def.innerType):[],go=class r extends me{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return j(t,{code:H.invalid_type,expected:q.object,received:t.parsedType}),ne;let i=this.discriminator,n=t.data[i],a=this.optionsMap.get(n);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}):(j(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){let n=new Map;for(let a of t){let s=zr(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:ae.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...ue(i)})}};function ou(r,e){let t=_r(r),i=_r(e);if(r===e)return{valid:!0,data:r};if(t===q.object&&i===q.object){let n=fe.objectKeys(e),a=fe.objectKeys(r).filter(o=>n.indexOf(o)!==-1),s={...r,...e};for(let o of a){let l=ou(r[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(t===q.array&&i===q.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let s=r[a],o=e[a],l=ou(s,o);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===q.date&&i===q.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Fn=class extends me{_parse(e){let{status:t,ctx:i}=this._processInputParams(e),n=(a,s)=>{if(mo(a)||mo(s))return ne;let o=ou(a.value,s.value);return o.valid?((ho(a)||ho(s))&&t.dirty(),{status:t.value,value:o.data}):(j(i,{code:H.invalid_intersection_types}),ne)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([a,s])=>n(a,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Fn.create=(r,e,t)=>new Fn({left:r,right:e,typeName:ae.ZodIntersection,...ue(t)});var Sr=class r extends me{_parse(e){let{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==q.array)return j(i,{code:H.invalid_type,expected:q.array,received:i.parsedType}),ne;if(i.data.length<this._def.items.length)return j(i,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&i.data.length>this._def.items.length&&(j(i,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...i.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new er(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>mt.mergeArray(t,s)):mt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Sr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Sr({items:r,typeName:ae.ZodTuple,rest:null,...ue(e)})};var fo=class r extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==q.object)return j(i,{code:H.invalid_type,expected:q.object,received:i.parsedType}),ne;let n=[],a=this._def.keyType,s=this._def.valueType;for(let o in i.data)n.push({key:a._parse(new er(i,o,i.path,o)),value:s._parse(new er(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?mt.mergeObjectAsync(t,n):mt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof me?new r({keyType:e,valueType:t,typeName:ae.ZodRecord,...ue(i)}):new r({keyType:sn.create(),valueType:e,typeName:ae.ZodRecord,...ue(t)})}},Wi=class extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==q.map)return j(i,{code:H.invalid_type,expected:q.map,received:i.parsedType}),ne;let n=this._def.keyType,a=this._def.valueType,s=[...i.data.entries()].map(([o,l],c)=>({key:n._parse(new er(i,o,i.path,[c,"key"])),value:a._parse(new er(i,l,i.path,[c,"value"]))}));if(i.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(c.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(c.value,u.value)}return{status:t.value,value:o}}}};Wi.create=(r,e,t)=>new Wi({valueType:e,keyType:r,typeName:ae.ZodMap,...ue(t)});var ji=class r extends me{_parse(e){let{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==q.set)return j(i,{code:H.invalid_type,expected:q.set,received:i.parsedType}),ne;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(j(i,{code:H.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(j(i,{code:H.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ne;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let o=[...i.data.values()].map((l,c)=>a._parse(new er(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ji.create=(r,e)=>new ji({valueType:r,minSize:null,maxSize:null,typeName:ae.ZodSet,...ue(e)});var yo=class r extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return j(t,{code:H.invalid_type,expected:q.function,received:t.parsedType}),ne;function i(o,l){return Ga({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Gi(),Gr].filter(c=>!!c),issueData:{code:H.invalid_arguments,argumentsError:l}})}function n(o,l){return Ga({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Gi(),Gr].filter(c=>!!c),issueData:{code:H.invalid_return_type,returnTypeError:l}})}let a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof ln){let o=this;return yt(async function(...l){let c=new It([]),u=await o._def.args.parseAsync(l,a).catch(d=>{throw c.addIssue(i(l,d)),c}),p=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(p,a).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let o=this;return yt(function(...l){let c=o._def.args.safeParse(l,a);if(!c.success)throw new It([i(l,c.error)]);let u=Reflect.apply(s,this,c.data),p=o._def.returns.safeParse(u,a);if(!p.success)throw new It([n(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Sr.create(e).rest(Ur.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new r({args:e||Sr.create([]).rest(Ur.create()),returns:t||Ur.create(),typeName:ae.ZodFunction,...ue(i)})}},Gn=class extends me{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Gn.create=(r,e)=>new Gn({getter:r,typeName:ae.ZodLazy,...ue(e)});var zn=class extends me{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};zn.create=(r,e)=>new zn({value:r,typeName:ae.ZodLiteral,...ue(e)});function th(r,e){return new Un({values:r,typeName:ae.ZodEnum,...ue(e)})}var Un=class r extends me{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),i=this._def.values;return j(t,{expected:fe.joinValues(i),received:t.parsedType,code:H.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),i=this._def.values;return j(t,{received:t.data,code:H.invalid_enum_value,options:i}),ne}return yt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}};Un.create=th;var Hn=class extends me{_parse(e){let t=fe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==q.string&&i.parsedType!==q.number){let n=fe.objectValues(t);return j(i,{expected:fe.joinValues(n),received:i.parsedType,code:H.invalid_type}),ne}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=fe.objectValues(t);return j(i,{received:i.data,code:H.invalid_enum_value,options:n}),ne}return yt(e.data)}get enum(){return this._def.values}};Hn.create=(r,e)=>new Hn({values:r,typeName:ae.ZodNativeEnum,...ue(e)});var ln=class extends me{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.promise&&t.common.async===!1)return j(t,{code:H.invalid_type,expected:q.promise,received:t.parsedType}),ne;let i=t.parsedType===q.promise?t.data:Promise.resolve(t.data);return yt(i.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ln.create=(r,e)=>new ln({type:r,typeName:ae.ZodPromise,...ue(e)});var tr=class extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:s=>{j(i,s),s.fatal?t.abort():t.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let s=n.transform(i.data,a);if(i.common.async)return Promise.resolve(s).then(async o=>{if(t.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?ne:l.status==="dirty"?Rn(l.value):t.value==="dirty"?Rn(l.value):l});{if(t.value==="aborted")return ne;let o=this._def.schema._parseSync({data:s,path:i.path,parent:i});return o.status==="aborted"?ne:o.status==="dirty"?Rn(o.value):t.value==="dirty"?Rn(o.value):o}}if(n.type==="refinement"){let s=o=>{let l=n.refinement(o,a);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?ne:(o.status==="dirty"&&t.dirty(),s(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?ne:(o.status==="dirty"&&t.dirty(),s(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!an(s))return ne;let o=n.transform(s.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:i.data,path:i.path,parent:i}).then(s=>an(s)?Promise.resolve(n.transform(s.value,a)).then(o=>({status:t.value,value:o})):ne);fe.assertNever(n)}};tr.create=(r,e,t)=>new tr({schema:r,typeName:ae.ZodEffects,effect:e,...ue(t)});tr.createWithPreprocess=(r,e,t)=>new tr({schema:e,effect:{type:"preprocess",transform:r},typeName:ae.ZodEffects,...ue(t)});var Qt=class extends me{_parse(e){return this._getType(e)===q.undefined?yt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qt.create=(r,e)=>new Qt({innerType:r,typeName:ae.ZodOptional,...ue(e)});var Er=class extends me{_parse(e){return this._getType(e)===q.null?yt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Er.create=(r,e)=>new Er({innerType:r,typeName:ae.ZodNullable,...ue(e)});var Vn=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),i=t.data;return t.parsedType===q.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Vn.create=(r,e)=>new Vn({innerType:r,typeName:ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});var Wn=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return zi(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new It(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new It(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Wn.create=(r,e)=>new Wn({innerType:r,typeName:ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});var qi=class extends me{_parse(e){if(this._getType(e)!==q.nan){let i=this._getOrReturnCtx(e);return j(i,{code:H.invalid_type,expected:q.nan,received:i.parsedType}),ne}return{status:"valid",value:e.data}}};qi.create=r=>new qi({typeName:ae.ZodNaN,...ue(r)});var lE=Symbol("zod_brand"),za=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}},Ua=class r extends me{_parse(e){let{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?ne:a.status==="dirty"?(t.dirty(),Rn(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?ne:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,t){return new r({in:e,out:t,typeName:ae.ZodPipeline})}},jn=class extends me{_parse(e){let t=this._def.innerType._parse(e),i=n=>(an(n)&&(n.value=Object.freeze(n.value)),n);return zi(t)?t.then(n=>i(n)):i(t)}unwrap(){return this._def.innerType}};jn.create=(r,e)=>new jn({innerType:r,typeName:ae.ZodReadonly,...ue(e)});function Jm(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function rh(r,e={},t){return r?on.create().superRefine((i,n)=>{let a=r(i);if(a instanceof Promise)return a.then(s=>{if(!s){let o=Jm(e,i),l=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:l})}});if(!a){let s=Jm(e,i),o=s.fatal??t??!0;n.addIssue({code:"custom",...s,fatal:o})}}):on.create()}var cE={object:Rt.lazycreate},ae;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ae||(ae={}));var uE=(r,e={message:`Input not instance of ${r.name}`})=>rh(t=>t instanceof r,e),nh=sn.create,ih=Pn.create,dE=qi.create,pE=Dn.create,ah=Mn.create,mE=On.create,hE=Hi.create,gE=Nn.create,fE=Ln.create,yE=on.create,bE=Ur.create,vE=cr.create,_E=Vi.create,SE=Hr.create,EE=Rt.create,wE=Rt.strictCreate,kE=Bn.create,CE=go.create,xE=Fn.create,TE=Sr.create,AE=fo.create,IE=Wi.create,RE=ji.create,PE=yo.create,DE=Gn.create,ME=zn.create,OE=Un.create,NE=Hn.create,LE=ln.create,BE=tr.create,FE=Qt.create,GE=Er.create,zE=tr.createWithPreprocess,UE=Ua.create,HE=()=>nh().optional(),VE=()=>ih().optional(),WE=()=>ah().optional(),jE={string:r=>sn.create({...r,coerce:!0}),number:r=>Pn.create({...r,coerce:!0}),boolean:r=>Mn.create({...r,coerce:!0}),bigint:r=>Dn.create({...r,coerce:!0}),date:r=>On.create({...r,coerce:!0})};var qE=ne;var $i="2025-03-26",sh=[$i,"2024-11-05","2024-10-07"],bo="2.0",oh=h.union([h.string(),h.number().int()]),lh=h.string(),$E=h.object({progressToken:h.optional(oh)}).passthrough(),ur=h.object({_meta:h.optional($E)}).passthrough(),Gt=h.object({method:h.string(),params:h.optional(ur)}),Ha=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),wr=h.object({method:h.string(),params:h.optional(Ha)}),dr=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),vo=h.union([h.string(),h.number().int()]),ch=h.object({jsonrpc:h.literal(bo),id:vo}).merge(Gt).strict(),_o=r=>ch.safeParse(r).success,uh=h.object({jsonrpc:h.literal(bo)}).merge(wr).strict(),dh=r=>uh.safeParse(r).success,ph=h.object({jsonrpc:h.literal(bo),id:vo,result:dr}).strict(),Va=r=>ph.safeParse(r).success,rr;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(rr||(rr={}));var mh=h.object({jsonrpc:h.literal(bo),id:vo,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict(),hh=r=>mh.safeParse(r).success,Ki=h.union([ch,uh,ph,mh]),qn=dr.strict(),So=wr.extend({method:h.literal("notifications/cancelled"),params:Ha.extend({requestId:vo,reason:h.string().optional()})}),gh=h.object({name:h.string(),version:h.string()}).passthrough(),KE=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),XE=Gt.extend({method:h.literal("initialize"),params:ur.extend({protocolVersion:h.string(),capabilities:KE,clientInfo:gh})});var YE=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),lu=dr.extend({protocolVersion:h.string(),capabilities:YE,serverInfo:gh,instructions:h.optional(h.string())}),fh=wr.extend({method:h.literal("notifications/initialized")}),yh=r=>fh.safeParse(r).success,Eo=Gt.extend({method:h.literal("ping")}),JE=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),wo=wr.extend({method:h.literal("notifications/progress"),params:Ha.merge(JE).extend({progressToken:oh})}),ko=Gt.extend({params:ur.extend({cursor:h.optional(lh)}).optional()}),Co=dr.extend({nextCursor:h.optional(lh)}),bh=h.object({uri:h.string(),mimeType:h.optional(h.string())}).passthrough(),vh=bh.extend({text:h.string()}),_h=bh.extend({blob:h.string().base64()}),ZE=h.object({uri:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),QE=h.object({uriTemplate:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),ew=ko.extend({method:h.literal("resources/list")}),cu=Co.extend({resources:h.array(ZE)}),tw=ko.extend({method:h.literal("resources/templates/list")}),uu=Co.extend({resourceTemplates:h.array(QE)}),rw=Gt.extend({method:h.literal("resources/read"),params:ur.extend({uri:h.string()})}),du=dr.extend({contents:h.array(h.union([vh,_h]))}),nw=wr.extend({method:h.literal("notifications/resources/list_changed")}),iw=Gt.extend({method:h.literal("resources/subscribe"),params:ur.extend({uri:h.string()})}),aw=Gt.extend({method:h.literal("resources/unsubscribe"),params:ur.extend({uri:h.string()})}),sw=wr.extend({method:h.literal("notifications/resources/updated"),params:Ha.extend({uri:h.string()})}),ow=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),lw=h.object({name:h.string(),description:h.optional(h.string()),arguments:h.optional(h.array(ow))}).passthrough(),cw=ko.extend({method:h.literal("prompts/list")}),pu=Co.extend({prompts:h.array(lw)}),uw=Gt.extend({method:h.literal("prompts/get"),params:ur.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),xo=h.object({type:h.literal("text"),text:h.string()}).passthrough(),To=h.object({type:h.literal("image"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Ao=h.object({type:h.literal("audio"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Sh=h.object({type:h.literal("resource"),resource:h.union([vh,_h])}).passthrough(),dw=h.object({role:h.enum(["user","assistant"]),content:h.union([xo,To,Ao,Sh])}).passthrough(),mu=dr.extend({description:h.optional(h.string()),messages:h.array(dw)}),pw=wr.extend({method:h.literal("notifications/prompts/list_changed")}),mw=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),hw=h.object({name:h.string(),description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(mw)}).passthrough(),gw=ko.extend({method:h.literal("tools/list")}),hu=Co.extend({tools:h.array(hw)}),Io=dr.extend({content:h.array(h.union([xo,To,Ao,Sh])).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),L1=Io.or(dr.extend({toolResult:h.unknown()})),fw=Gt.extend({method:h.literal("tools/call"),params:ur.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),gu=wr.extend({method:h.literal("notifications/tools/list_changed")}),Eh=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),yw=Gt.extend({method:h.literal("logging/setLevel"),params:ur.extend({level:Eh})}),fu=wr.extend({method:h.literal("notifications/message"),params:Ha.extend({level:Eh,logger:h.optional(h.string()),data:h.unknown()})}),bw=h.object({name:h.string().optional()}).passthrough(),vw=h.object({hints:h.optional(h.array(bw)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),_w=h.object({role:h.enum(["user","assistant"]),content:h.union([xo,To,Ao])}).passthrough(),Sw=Gt.extend({method:h.literal("sampling/createMessage"),params:ur.extend({messages:h.array(_w),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(vw)})}),Ew=dr.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[xo,To,Ao])}),ww=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),kw=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),Cw=Gt.extend({method:h.literal("completion/complete"),params:ur.extend({ref:h.union([kw,ww]),argument:h.object({name:h.string(),value:h.string()}).passthrough()})}),yu=dr.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),xw=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string())}).passthrough(),Tw=Gt.extend({method:h.literal("roots/list")}),Aw=dr.extend({roots:h.array(xw)}),Iw=wr.extend({method:h.literal("notifications/roots/list_changed")}),B1=h.union([Eo,XE,Cw,yw,uw,cw,ew,tw,rw,iw,aw,fw,gw]),F1=h.union([So,wo,fh,Iw]),G1=h.union([qn,Ew,Aw]),z1=h.union([Eo,Sw,Tw]),U1=h.union([So,wo,fu,sw,nw,gu,pw]),H1=h.union([qn,lu,yu,mu,pu,cu,uu,du,Io,hu]),nr=class extends Error{constructor(e,t,i){super(`MCP error ${e}: ${t}`),this.code=e,this.data=i,this.name="McpError"}};var Rw=6e4,Ro=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(So,t=>{let i=this._requestHandlerAbortControllers.get(t.params.requestId);i?.abort(t.params.reason)}),this.setNotificationHandler(wo,t=>{this._onprogress(t)}),this.setRequestHandler(Eo,t=>({}))}_setupTimeout(e,t,i,n,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:i,resetTimeoutOnProgress:a,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let i=Date.now()-t.startTime;if(t.maxTotalTimeout&&i>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new nr(rr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:i});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=(t,i)=>{Va(t)||hh(t)?this._onresponse(t):_o(t)?this._onrequest(t,i):dh(t)?this._onnotification(t):this._onerror(new Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let i=new nr(rr.ConnectionClosed,"Connection closed");for(let n of t.values())n(i)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let i=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;i!==void 0&&Promise.resolve().then(()=>i(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){var i,n,a,s;let o=(i=this._requestHandlers.get(e.method))!==null&&i!==void 0?i:this.fallbackRequestHandler;if(o===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:e.id,error:{code:rr.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:(a=this._transport)===null||a===void 0?void 0:a.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id};Promise.resolve().then(()=>o(e,c)).then(u=>{var p;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p,m;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:rr.InternalError,message:(m=u.message)!==null&&m!==void 0?m:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...i}=e.params,n=Number(t),a=this._progressHandlers.get(n);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),o=this._timeoutInfo.get(n);if(o&&s&&o.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){s(l);return}a(i)}_onresponse(e){let t=Number(e.id),i=this._responseHandlers.get(t);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Va(e))i(e);else{let n=new nr(e.error.code,e.error.message,e.error.data);i(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,i){let{relatedRequestId:n,resumptionToken:a,onresumptiontoken:s}=i??{};return new Promise((o,l)=>{var c,u,p,m,d,g;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=i?.signal)===null||u===void 0||u.throwIfAborted();let f=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:f};i?.onprogress&&(this._progressHandlers.set(f,i.onprogress),y.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:f}});let b=A=>{var R;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(A)}},{relatedRequestId:n,resumptionToken:a,onresumptiontoken:s}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`))),l(A)};this._responseHandlers.set(f,A=>{var R;if(!(!((R=i?.signal)===null||R===void 0)&&R.aborted)){if(A instanceof Error)return l(A);try{let k=t.parse(A.result);o(k)}catch(k){l(k)}}}),(m=i?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var A;b((A=i?.signal)===null||A===void 0?void 0:A.reason)});let x=(d=i?.timeout)!==null&&d!==void 0?d:Rw,S=()=>b(new nr(rr.RequestTimeout,"Request timed out",{timeout:x}));this._setupTimeout(f,x,i?.maxTotalTimeout,S,(g=i?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:a,onresumptiontoken:s}).catch(A=>{this._cleanupTimeout(f),l(A)})})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let i={...e,jsonrpc:"2.0"};await this._transport.send(i,t)}setRequestHandler(e,t){let i=e.shape.method.value;this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(n,a)=>Promise.resolve(t(e.parse(n),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,i=>Promise.resolve(t(e.parse(i))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function wh(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&typeof n=="object"?t[i]=t[i]?{...t[i],...n}:n:t[i]=n,t),{...r})}var xf=dc(Cf(),1),ja=class extends Ro{constructor(e,t){var i;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(i=t?.capabilities)!==null&&i!==void 0?i:{},this._ajv=new xf.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=wh(this._capabilities,e)}assertCapability(e,t){var i;if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let i=await this.request({method:"initialize",params:{protocolVersion:$i,capabilities:this._capabilities,clientInfo:this._clientInfo}},lu,t);if(i===void 0)throw new Error(`Server sent invalid initialize result: ${i}`);if(!sh.includes(i.protocolVersion))throw new Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,this._instructions=i.instructions,await this.notification({method:"notifications/initialized"})}catch(i){throw this.close(),i}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,i,n,a,s;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},qn,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},yu,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},qn,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},mu,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},pu,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},cu,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},uu,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},du,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},qn,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},qn,t)}async callTool(e,t=Io,i){let n=await this.request({method:"tools/call",params:e},t,i),a=this.getToolOutputValidator(e.name);if(a){if(!n.structuredContent&&!n.isError)throw new nr(rr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!a(n.structuredContent))throw new nr(rr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(a.errors)}`)}catch(s){throw s instanceof nr?s:new nr(rr.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let i=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,i)}catch(i){console.warn(`Failed to compile output schema for tool ${t.name}: ${i}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let i=await this.request({method:"tools/list",params:e},hu,t);return this.cacheToolOutputSchemas(i.tools),i}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Hu;Hu=globalThis.crypto;async function cC(r){return(await Hu).getRandomValues(new Uint8Array(r))}async function uC(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",i=await cC(r);for(let n=0;n<r;n++){let a=i[n]%e.length;t+=e[a]}return t}async function dC(r){return await uC(r)}async function pC(r){let e=await(await Hu).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Vu(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await dC(r),t=await pC(e);return{code_verifier:e,code_challenge:t}}var Tf=h.object({resource:h.string().url(),authorization_servers:h.array(h.string().url()).optional(),jwks_uri:h.string().url().optional(),scopes_supported:h.array(h.string()).optional(),bearer_methods_supported:h.array(h.string()).optional(),resource_signing_alg_values_supported:h.array(h.string()).optional(),resource_name:h.string().optional(),resource_documentation:h.string().optional(),resource_policy_uri:h.string().url().optional(),resource_tos_uri:h.string().url().optional(),tls_client_certificate_bound_access_tokens:h.boolean().optional(),authorization_details_types_supported:h.array(h.string()).optional(),dpop_signing_alg_values_supported:h.array(h.string()).optional(),dpop_bound_access_tokens_required:h.boolean().optional()}).passthrough(),Af=h.object({issuer:h.string(),authorization_endpoint:h.string(),token_endpoint:h.string(),registration_endpoint:h.string().optional(),scopes_supported:h.array(h.string()).optional(),response_types_supported:h.array(h.string()),response_modes_supported:h.array(h.string()).optional(),grant_types_supported:h.array(h.string()).optional(),token_endpoint_auth_methods_supported:h.array(h.string()).optional(),token_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),service_documentation:h.string().optional(),revocation_endpoint:h.string().optional(),revocation_endpoint_auth_methods_supported:h.array(h.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),introspection_endpoint:h.string().optional(),introspection_endpoint_auth_methods_supported:h.array(h.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),code_challenge_methods_supported:h.array(h.string()).optional()}).passthrough(),Wu=h.object({access_token:h.string(),token_type:h.string(),expires_in:h.number().optional(),scope:h.string().optional(),refresh_token:h.string().optional()}).strip(),HM=h.object({error:h.string(),error_description:h.string().optional(),error_uri:h.string().optional()}),mC=h.object({redirect_uris:h.array(h.string()).refine(r=>r.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:h.string().optional(),grant_types:h.array(h.string()).optional(),response_types:h.array(h.string()).optional(),client_name:h.string().optional(),client_uri:h.string().optional(),logo_uri:h.string().optional(),scope:h.string().optional(),contacts:h.array(h.string()).optional(),tos_uri:h.string().optional(),policy_uri:h.string().optional(),jwks_uri:h.string().optional(),jwks:h.any().optional(),software_id:h.string().optional(),software_version:h.string().optional()}).strip(),hC=h.object({client_id:h.string(),client_secret:h.string().optional(),client_id_issued_at:h.number().optional(),client_secret_expires_at:h.number().optional()}).strip(),If=mC.merge(hC),VM=h.object({error:h.string(),error_description:h.string().optional()}).strip(),WM=h.object({token:h.string(),token_type_hint:h.string().optional()}).strip();var Pt=class extends Error{constructor(e){super(e??"Unauthorized")}};async function pn(r,{serverUrl:e,authorizationCode:t,scope:i,resourceMetadataUrl:n}){let a=e;try{let m=await gC(n||e);m.authorization_servers&&m.authorization_servers.length>0&&(a=m.authorization_servers[0])}catch(m){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",m)}let s=await fC(a),o=await Promise.resolve(r.clientInformation());if(!o){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await _C(a,{metadata:s,clientMetadata:r.clientMetadata});await r.saveClientInformation(m),o=m}if(t!==void 0){let m=await r.codeVerifier(),d=await bC(a,{metadata:s,clientInformation:o,authorizationCode:t,codeVerifier:m,redirectUri:r.redirectUrl});return await r.saveTokens(d),"AUTHORIZED"}let l=await r.tokens();if(l?.refresh_token)try{let m=await vC(a,{metadata:s,clientInformation:o,refreshToken:l.refresh_token});return await r.saveTokens(m),"AUTHORIZED"}catch(m){console.error("Could not refresh OAuth tokens:",m)}let c=r.state?await r.state():void 0,{authorizationUrl:u,codeVerifier:p}=await yC(a,{metadata:s,clientInformation:o,state:c,redirectUrl:r.redirectUrl,scope:i||r.clientMetadata.scope});return await r.saveCodeVerifier(p),await r.redirectToAuthorization(u),"REDIRECT"}function Xo(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,i]=e.split(" ");if(t.toLowerCase()!=="bearer"||!i){console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");return}let a=/resource_metadata="([^"]*)"/.exec(e);if(a)try{return new URL(a[1])}catch{console.log("Invalid resource metadata url: ",a[1]);return}}async function gC(r,e){var t;let i;e?.resourceMetadataUrl?i=new URL(e?.resourceMetadataUrl):i=new URL("/.well-known/oauth-protected-resource",r);let n;try{n=await fetch(i,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:$i}})}catch(a){if(a instanceof TypeError)n=await fetch(i);else throw a}if(n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Tf.parse(await n.json())}async function fC(r,e){var t;let i=new URL("/.well-known/oauth-authorization-server",r),n;try{n=await fetch(i,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:$i}})}catch(a){if(a instanceof TypeError)n=await fetch(i);else throw a}if(n.status!==404){if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return Af.parse(await n.json())}}async function yC(r,{metadata:e,clientInformation:t,redirectUrl:i,scope:n,state:a}){let s="code",o="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support response type ${s}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(o))throw new Error(`Incompatible auth server: does not support code challenge method ${o}`)}else l=new URL("/authorize",r);let c=await Vu(),u=c.code_verifier,p=c.code_challenge;return l.searchParams.set("response_type",s),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",p),l.searchParams.set("code_challenge_method",o),l.searchParams.set("redirect_uri",String(i)),a&&l.searchParams.set("state",a),n&&l.searchParams.set("scope",n),{authorizationUrl:l,codeVerifier:u}}async function bC(r,{metadata:e,clientInformation:t,authorizationCode:i,codeVerifier:n,redirectUri:a}){let s="authorization_code",o;if(e){if(o=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support grant type ${s}`)}else o=new URL("/token",r);let l=new URLSearchParams({grant_type:s,client_id:t.client_id,code:i,code_verifier:n,redirect_uri:String(a)});t.client_secret&&l.set("client_secret",t.client_secret);let c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Wu.parse(await c.json())}async function vC(r,{metadata:e,clientInformation:t,refreshToken:i}){let n="refresh_token",a;if(e){if(a=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else a=new URL("/token",r);let s=new URLSearchParams({grant_type:n,client_id:t.client_id,refresh_token:i});t.client_secret&&s.set("client_secret",t.client_secret);let o=await fetch(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});if(!o.ok)throw new Error(`Token refresh failed: HTTP ${o.status}`);return Wu.parse({refresh_token:i,...await o.json()})}async function _C(r,{metadata:e,clientMetadata:t}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",r);let n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return If.parse(await n.json())}var Yo=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function ju(r){}function Jo(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=ju,onError:t=ju,onRetry:i=ju,onComment:n}=r,a="",s=!0,o,l="",c="";function u(f){let y=s?f.replace(/^\xEF\xBB\xBF/,""):f,[b,x]=SC(`${a}${y}`);for(let S of b)p(S);a=x,s=!1}function p(f){if(f===""){d();return}if(f.startsWith(":")){n&&n(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let b=f.slice(0,y),x=f[y+1]===" "?2:1,S=f.slice(y+x);m(b,S,f);return}m(f,"",f)}function m(f,y,b){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3278
|
-
|
|
3279
|
-
`)?l.slice(0,-1):
|
|
3280
|
-
|
|
3281
|
-
`&&i++}}return[e,t]}var Zo=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:i}={}){let n;super({start(a){n=Jo({onEvent:s=>{a.enqueue(s)},onError(s){e==="terminate"?a.error(s):typeof e=="function"&&e(s)},onRetry:t,onComment:i})},transform(a){n.feed(a)}})}};var EC={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},qa=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Qo=class{constructor(e,t){var i;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._sessionId=t?.sessionId,this._reconnectionOptions=(i=t?.reconnectionOptions)!==null&&i!==void 0?i:EC}async _authThenStart(){var e;if(!this._authProvider)throw new Pt("No auth provider");let t;try{t=await pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(i){throw(e=this.onerror)===null||e===void 0||e.call(this,i),i}if(t!=="AUTHORIZED")throw new Pt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(t.Authorization=`Bearer ${i.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}async _startOrAuthSse(e){var t,i;let{resumptionToken:n}=e;try{let a=await this._commonHeaders();a.set("Accept","text/event-stream"),n&&a.set("last-event-id",n);let s=await fetch(this._url,{method:"GET",headers:a,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal});if(!s.ok){if(s.status===401&&this._authProvider)return await this._authThenStart();if(s.status===405)return;throw new qa(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e)}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,i=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(i,e),n)}_scheduleReconnection(e,t=0){var i;let n=this._reconnectionOptions.maxRetries;if(n>0&&t>=n){(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let a=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,t+1)})},a)}_handleSseStream(e,t){if(!e)return;let{onresumptiontoken:i,replayMessageId:n}=t,a;(async()=>{var o,l,c,u;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Zo).getReader();for(;;){let{value:m,done:d}=await p.read();if(d)break;if(m.id&&(a=m.id,i?.(m.id)),!m.event||m.event==="message")try{let g=Ki.parse(JSON.parse(m.data));n!==void 0&&Va(g)&&(g.id=n),(o=this.onmessage)===null||o===void 0||o.call(this,g)}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g)}}}catch(p){if((c=this.onerror)===null||c===void 0||c.call(this,new Error(`SSE stream disconnected: ${p}`)),this._abortController&&!this._abortController.signal.aborted&&a!==void 0)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:i,replayMessageId:n},0)}catch(m){(u=this.onerror)===null||u===void 0||u.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Pt("No auth provider");if(await pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Pt("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var i,n,a;try{let{resumptionToken:s,onresumptiontoken:o}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:_o(e)?e.id:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let c={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(i=this._abortController)===null||i===void 0?void 0:i.signal},u=await fetch(this._url,c),p=u.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!u.ok){if(u.status===401&&this._authProvider){if(this._resourceMetadataUrl=Xo(u),await pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Pt;return this.send(e)}let f=await u.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}if(u.status===202){yh(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let d=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,g=u.headers.get("content-type");if(d)if(g?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:o});else if(g?.includes("application/json")){let f=await u.json(),y=Array.isArray(f)?f.map(b=>Ki.parse(b)):[Ki.parse(f)];for(let b of y)(n=this.onmessage)===null||n===void 0||n.call(this,b)}else throw new qa(-1,`Unexpected content type: ${g}`)}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{let i=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},a=await fetch(this._url,n);if(!a.ok&&a.status!==405)throw new qa(a.status,`Failed to terminate session: ${a.statusText}`);this._sessionId=void 0}catch(i){throw(t=this.onerror)===null||t===void 0||t.call(this,i),i}}};var tl=class extends Event{constructor(e,t){var i,n;super(e),this.code=(i=t?.code)!=null?i:void 0,this.message=(n=t?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,i){return i(Rf(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Rf(this),t)}};function wC(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function qu(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(qu).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${qu(r.cause)}`:r.message:`${r}`}function Rf(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Df=r=>{throw TypeError(r)},ed=(r,e,t)=>e.has(r)||Df("Cannot "+t),ye=(r,e,t)=>(ed(r,e,"read from private field"),t?t.call(r):e.get(r)),rt=(r,e,t)=>e.has(r)?Df("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ze=(r,e,t,i)=>(ed(r,e,"write to private field"),e.set(r,t),t),Vr=(r,e,t)=>(ed(r,e,"access private method"),t),Dt,Xn,Xi,el,rl,Xa,Zi,Ya,mn,Yi,Qi,Ji,$a,pr,$u,Ku,Xu,Pf,Yu,Ju,Ka,Zu,Qu,Yn=class extends EventTarget{constructor(e,t){var i,n;super(),rt(this,pr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,rt(this,Dt),rt(this,Xn),rt(this,Xi),rt(this,el),rt(this,rl),rt(this,Xa),rt(this,Zi),rt(this,Ya,null),rt(this,mn),rt(this,Yi),rt(this,Qi,null),rt(this,Ji,null),rt(this,$a,null),rt(this,Ku,async a=>{var s;ye(this,Yi).reset();let{body:o,redirected:l,status:c,headers:u}=a;if(c===204){Vr(this,pr,Ka).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?ze(this,Xi,new URL(a.url)):ze(this,Xi,void 0),c!==200){Vr(this,pr,Ka).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Vr(this,pr,Ka).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(ye(this,Dt)===this.CLOSED)return;ze(this,Dt,this.OPEN);let p=new Event("open");if((s=ye(this,$a))==null||s.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Vr(this,pr,Ka).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,d=o.getReader(),g=!0;do{let{done:f,value:y}=await d.read();y&&ye(this,Yi).feed(m.decode(y,{stream:!f})),f&&(g=!1,ye(this,Yi).reset(),Vr(this,pr,Zu).call(this))}while(g)}),rt(this,Xu,a=>{ze(this,mn,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Vr(this,pr,Zu).call(this,qu(a))}),rt(this,Yu,a=>{typeof a.id=="string"&&ze(this,Ya,a.id);let s=new MessageEvent(a.event||"message",{data:a.data,origin:ye(this,Xi)?ye(this,Xi).origin:ye(this,Xn).origin,lastEventId:a.id||""});ye(this,Ji)&&(!a.event||a.event==="message")&&ye(this,Ji).call(this,s),this.dispatchEvent(s)}),rt(this,Ju,a=>{ze(this,Xa,a)}),rt(this,Qu,()=>{ze(this,Zi,void 0),ye(this,Dt)===this.CONNECTING&&Vr(this,pr,$u).call(this)});try{if(e instanceof URL)ze(this,Xn,e);else if(typeof e=="string")ze(this,Xn,new URL(e,kC()));else throw new Error("Invalid URL")}catch{throw wC("An invalid or illegal string was specified")}ze(this,Yi,Jo({onEvent:ye(this,Yu),onRetry:ye(this,Ju)})),ze(this,Dt,this.CONNECTING),ze(this,Xa,3e3),ze(this,rl,(i=t?.fetch)!=null?i:globalThis.fetch),ze(this,el,(n=t?.withCredentials)!=null?n:!1),Vr(this,pr,$u).call(this)}get readyState(){return ye(this,Dt)}get url(){return ye(this,Xn).href}get withCredentials(){return ye(this,el)}get onerror(){return ye(this,Qi)}set onerror(e){ze(this,Qi,e)}get onmessage(){return ye(this,Ji)}set onmessage(e){ze(this,Ji,e)}get onopen(){return ye(this,$a)}set onopen(e){ze(this,$a,e)}addEventListener(e,t,i){let n=t;super.addEventListener(e,n,i)}removeEventListener(e,t,i){let n=t;super.removeEventListener(e,n,i)}close(){ye(this,Zi)&&clearTimeout(ye(this,Zi)),ye(this,Dt)!==this.CLOSED&&(ye(this,mn)&&ye(this,mn).abort(),ze(this,Dt,this.CLOSED),ze(this,mn,void 0))}};Dt=new WeakMap,Xn=new WeakMap,Xi=new WeakMap,el=new WeakMap,rl=new WeakMap,Xa=new WeakMap,Zi=new WeakMap,Ya=new WeakMap,mn=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,$a=new WeakMap,pr=new WeakSet,$u=function(){ze(this,Dt,this.CONNECTING),ze(this,mn,new AbortController),ye(this,rl)(ye(this,Xn),Vr(this,pr,Pf).call(this)).then(ye(this,Ku)).catch(ye(this,Xu))},Ku=new WeakMap,Xu=new WeakMap,Pf=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ye(this,Ya)?{"Last-Event-ID":ye(this,Ya)}:void 0},cache:"no-store",signal:(r=ye(this,mn))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Yu=new WeakMap,Ju=new WeakMap,Ka=function(r,e){var t;ye(this,Dt)!==this.CLOSED&&ze(this,Dt,this.CLOSED);let i=new tl("error",{code:e,message:r});(t=ye(this,Qi))==null||t.call(this,i),this.dispatchEvent(i)},Zu=function(r,e){var t;if(ye(this,Dt)===this.CLOSED)return;ze(this,Dt,this.CONNECTING);let i=new tl("error",{code:e,message:r});(t=ye(this,Qi))==null||t.call(this,i),this.dispatchEvent(i),ze(this,Zi,setTimeout(ye(this,Qu),ye(this,Xa)))},Qu=new WeakMap,Yn.CONNECTING=0,Yn.OPEN=1,Yn.CLOSED=2;function kC(){let r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}var td=class extends Error{constructor(e,t,i){super(`SSE error: ${t}`),this.code=e,this.event=i}},nl=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider}async _authThenStart(){var e;if(!this._authProvider)throw new Pt("No auth provider");let t;try{t=await pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(i){throw(e=this.onerror)===null||e===void 0||e.call(this,i),i}if(t!=="AUTHORIZED")throw new Pt;return await this._startOrAuth()}async _commonHeaders(){var e;let t={...(e=this._requestInit)===null||e===void 0?void 0:e.headers};if(this._authProvider){let i=await this._authProvider.tokens();i&&(t.Authorization=`Bearer ${i.access_token}`)}return t}_startOrAuth(){return new Promise((e,t)=>{var i;this._eventSource=new Yn(this._url.href,(i=this._eventSourceInit)!==null&&i!==void 0?i:{fetch:(n,a)=>this._commonHeaders().then(s=>fetch(n,{...a,headers:{...s,Accept:"text/event-stream"}}))}),this._abortController=new AbortController,this._eventSource.onerror=n=>{var a;if(n.code===401&&this._authProvider){this._authThenStart().then(e,t);return}let s=new td(n.code,n.message,n);t(s),(a=this.onerror)===null||a===void 0||a.call(this,s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{var a;let s=n;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){t(o),(a=this.onerror)===null||a===void 0||a.call(this,o),this.close();return}e()}),this._eventSource.onmessage=n=>{var a,s;let o=n,l;try{l=Ki.parse(JSON.parse(o.data))}catch(c){(a=this.onerror)===null||a===void 0||a.call(this,c);return}(s=this.onmessage)===null||s===void 0||s.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Pt("No auth provider");if(await pn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Pt("Failed to authorize")}async close(){var e,t,i;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(i=this.onclose)===null||i===void 0||i.call(this)}async send(e){var t,i,n;if(!this._endpoint)throw new Error("Not connected");try{let a=await this._commonHeaders(),s=new Headers({...a,...(t=this._requestInit)===null||t===void 0?void 0:t.headers});s.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:(i=this._abortController)===null||i===void 0?void 0:i.signal},l=await fetch(this._endpoint,o);if(!l.ok){if(l.status===401&&this._authProvider){if(this._resourceMetadataUrl=Xo(l),await pn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Pt;return this.send(e)}let c=await l.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}}catch(a){throw(n=this.onerror)===null||n===void 0||n.call(this,a),a}}};var Wr={name:"@intelliweave/embedded",version:"1.9.69-beta.4",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.60.0","@modelcontextprotocol/sdk":"^1.12.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var nt=new ge("MCPKnowledgeClient"),il=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){nt.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let t=new ja({name:Wr.name,version:Wr.version}),i=new Qo(new URL(this.config.baseURL));return await t.connect(i),nt.debug("Connected with HTTP streaming mode"),t}).catch(async t=>{let i=new ja({name:Wr.name,version:Wr.version}),n=new nl(new URL(this.config.baseURL));return await i.connect(n),nt.debug("Connected with SSE mode"),i});return await this.disconnect(),this.client=e,e.onerror=t=>{nt.error(`MCP client error: ${t.message}`)},e.onclose=()=>{nt.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(fu,t=>{t.params.level=="critical"?nt.error(`[Server] ${t.params.data}`):t.params.level=="emergency"?nt.error(`[Server] ${t.params.data}`):t.params.level=="error"?nt.error(`[Server] ${t.params.data}`):t.params.level=="warning"?nt.warn(`[Server] ${t.params.data}`):t.params.level=="info"?nt.info(`[Server] ${t.params.data}`):t.params.level=="debug"?nt.debug(`[Server] ${t.params.data}`):nt.log(`[Server] ${t.params.data}`)}),e.setNotificationHandler(gu,t=>{nt.debug("Tool list changed",t),this.fetchTools()}),nt.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],t;for(;;){let n=await this.client.listTools({cursor:t});t=n.nextCursor;for(let a of n.tools||[])e.push(a);if(!n?.tools?.length||!t)break}let i=[];for(let n of e){let a=!!(this.config.searchToolName&&n.name==this.config.searchToolName&&!this.config.searchToolVisible);i.push({id:n.name,name:n.name,content:n.description||"",type:"action",isContext:!0,parameters:n.inputSchema,action:s=>this.performToolCall(n.name,s),disabled:a})}nt.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=i}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let t=this.iwActions.slice(),i=await this.performSearchCall(e);return t=t.concat(i),this.lastSearchQuery=e,this.lastSearchResults=t,nt.debug(`Search completed, found ${t.length} items.`),t}async performSearchCall(e){let t=[];if(!this.config.searchToolName)return t;let i=this.tools.find(a=>a.name==this.config.searchToolName);if(!i)return nt.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),t;let n;if(i.inputSchema.required?.length==1){let a=i.inputSchema.required[0];n=await this.performToolCall(this.config.searchToolName,{[a]:e})}else if(i.inputSchema.properties&&Object.keys(i.inputSchema.properties).length==1){let a=Object.keys(i.inputSchema.properties)[0];n=await this.performToolCall(this.config.searchToolName,{[a]:e})}else n=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(n))for(let a=0;a<n.length;a++){let s=n[a];t.push({id:this.config.id+":"+this.config.searchToolName+":"+a,name:`Search result ${a+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else t.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof n=="string"?n:JSON.stringify(n)});return t}async performToolCall(e,t){await this.connect(),nt.debug(`Performing tool call for ${e} with params:`,t),this.stats.toolsCalled+=1;let i=await this.client.callTool({name:e,arguments:t});if(i.isError){let n=i.content?.[0]?.text||"Unknown error";throw nt.error(`Error calling tool ${e}: ${n}`),new Error(`Error calling tool ${e}: ${n}`)}if(Array.isArray(i.content)&&i.content.length==1&&i.content[0].type=="text")try{return JSON.parse(i.content[0].text)}catch{}return i.content||[]}};var xC=new ge("Statistics"),Ja=[];async function wt(r,e){let t={...e,event_id:Ge(),event_date:new Date().toISOString(),sdk_version:Wr.version,conversation_id:r?.conversationID||"",api_key:r?.apiKey||"",user_id:r?.userID||""};if(Ja.push(t),!r||(await new Promise(n=>setTimeout(n,5e3)),Ja.length===0))return;let i=Ja.slice();Ja.length=0;try{let n=await fetch(r.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:i})});if(!n.ok)throw new Error(`Analytics submission failed: ${n.status} ${n.statusText}`)}catch(n){xC.warn("Failed to submit analytics event:",n),Ja.push(...i);return}}var Jn=new ge("KnowledgeBase"),rd=1,al=class r{constructor(e){this._sources=[{id:"core.internal",query:async()=>Km(this.ai)}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,t){let i=e;return typeof e=="function"&&(t=e,i=`source.${rd++}`),this._sources.push({id:i,query:t}),i}removeSource(e){this._sources=this.sources.filter(t=>t.id!==e&&t.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(t=>t.id!==e)}get sources(){let e=this._sources;return Be().knowledgeBaseSources&&(e=e.concat(Be().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(t=>!t.disabled),e}async search(e){let t=Date.now();Jn.debug(`Searching knowledge base for: ${e}`);let i=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});i.query=e,i.entries=[],i.sources=[],typeof document<"u"&&document.dispatchEvent(i),this._windowSources=i.sources;let a=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),p=await c.query(e);return Jn.debug(`Source '${c.id}' took ${Date.now()-u}ms`),p||[]}catch(u){return Jn.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();a=a.concat(i.entries),a=a.concat(this.manualEntries),Be().knowledgeBase&&(a=a.concat(Be().knowledgeBase)),a=a.filter(c=>c&&!c.disabled);for(let c=0;c<a.length;c++){let u=a[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=p=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=p=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let s=new $m({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});s.addAll(a);let l=s.search(e).map(c=>a.find(u=>u.id==c.id));for(let c of a)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,wt(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-t,sources_searched:this.sources.length}}),Jn.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(t=>t.id==e||t._functionID==e)}registerSourceFromURL(e,t){t||(t=`external.${rd++}`),Jn.debug(`Registering remote knowledge base source: ${e}`);let i=[],n=[],a=!0,s=async(l,c)=>{Jn.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},p=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!p.ok)throw new Error(`HTTP Error ${p.status} ${p.statusText}`);let m=await p.json();return o(m.updateItems||[]),m.response},o=l=>{for(let c of l){if(!c.id){Jn.warn("KB item skipped since it has no ID.",c);continue}let u=i.find(p=>p.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}i.push({...c,action:p=>s(c,p)})}};this.registerSource(t,async l=>{if(a&&n.includes(l))return i;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let p=await u.json();return a=!p.noCache,n.includes(l)||n.push(l),o(p.items),i})}clone(){let e=new r(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${rd++}`);let t=new il(e);return this.registerSource(e.id,i=>t.search(i)),t}};var sl=class{constructor(e){this.ai=e}async boolean(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3291
|
+
`:m.type=="tool_use"&&u.push(this.performToolCall(m));let d=await Promise.all(u);if(d.length>0){let m={role:"user",content:d};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(m),customData:m}),n=!0}this.config.onAIMessage?.(i,!0),this.stats.tokensUsed+=s.usage.input_tokens+s.usage.output_tokens}return i=i.trim(),this.config.onAIMessage?.(i,!1),i}async performToolCall(e){try{let r=this.toolGroup.getAll().find(i=>i.customData?.name==e.name);if(!r)throw new Error(`Tool ${e.name} not found`);this.config.onAIToolStart?.(e.name,e.input);let n=await r.customData.callback(e.input);return typeof n!="string"&&(n=JSON.stringify(n)||""),(n===""||n==="undefined")&&(n="success"),{type:"tool_result",tool_use_id:e.id,content:String(n||"")}}catch(r){return $p.error(`Error performing tool call ${e.name}: ${r.message||r.toString()}`),{type:"tool_result",tool_use_id:e.id,content:`Error performing tool call ${e.name}: ${r.message||r.toString()}`}}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items[0]?.customData?.content?.type=="tool_result";)this.messageGroup.items.shift()}};var ut=function(){return ut=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ut.apply(this,arguments)};function CL(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(u){try{c(n.next(u))}catch(d){o(d)}}function l(u){try{c(n.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):i(u.value).then(s,l)}c((n=n.apply(t,e||[])).next())})}function IL(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}var AL="ENTRIES",kT="KEYS",xT="VALUES",er="",Xg=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Es(this._path),r=e.node,n=e.keys;if(Es(n)===er)return{done:!1,value:this.result()};var i=r.get(Es(n));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=Es(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var r=e.keys;return Es(r)}).filter(function(e){return e!==er}).join("")},t.prototype.value=function(){return Es(this._path).node.get(er)},t.prototype.result=function(){switch(this._type){case xT:return this.value();case kT:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),Es=function(t){return t[t.length-1]},PL=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,a=i+r,o=new Uint8Array(a*i).fill(r+1),s=0;s<i;++s)o[s]=s;for(var l=1;l<a;++l)o[l*i]=l;return ET(t,e,r,n,o,1,i,""),n},ET=function(t,e,r,n,i,a,o,s){var l,c,u=a*o;try{e:for(var d=Te(t.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===er){var h=i[u-1];h<=r&&n.set(s,[t.get(p),h])}else{for(var f=a,y=0;y<p.length;++y,++f){for(var g=p[y],x=o*f,v=x-o,I=i[x],T=Math.max(0,f-r-1),C=Math.min(o-1,f+r),M=T;M<C;++M){var W=g!==e[M],$=i[v+M]+ +W,B=i[v+M+1]+1,Y=i[x+M]+1,H=i[x+M+1]=Math.min($,B,Y);H<I&&(I=H)}if(I>r)continue e}ET(t.get(p),e,r,n,i,f,o,s+p)}}}catch(j){l={error:j}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},Yg=function(){function t(e,r){e===void 0&&(e=new Map),r===void 0&&(r=""),this._size=void 0,this._tree=e,this._prefix=r}return t.prototype.atPrefix=function(e){var r,n;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=Rt(Fp(this._tree,e.slice(this._prefix.length)),2),a=i[0],o=i[1];if(a===void 0){var s=Rt(oy(o),2),l=s[0],c=s[1];try{for(var u=Te(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==er&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new t(p,e)}}}catch(h){r={error:h}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}return new t(a,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,RL(this._tree,e)},t.prototype.entries=function(){return new Xg(this,AL)},t.prototype.forEach=function(e){var r,n;try{for(var i=Te(this),a=i.next();!a.done;a=i.next()){var o=Rt(a.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return PL(this._tree,e,r)},t.prototype.get=function(e){var r=ny(this._tree,e);return r!==void 0?r.get(er):void 0},t.prototype.has=function(e){var r=ny(this._tree,e);return r!==void 0&&r.has(er)},t.prototype.keys=function(){return new Xg(this,kT)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e);return n.set(er,r),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e);return n.set(er,r(n.get(er))),this},t.prototype.fetch=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e),i=n.get(er);return i===void 0&&n.set(er,i=r()),i},t.prototype.values=function(){return new Xg(this,xT)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=Rt(o.value,2),l=s[0],c=s[1];i.set(l,c)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),Fp=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var a=Te(t.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==er&&e.startsWith(s))return r.push([t,s]),Fp(t.get(s),e.slice(s.length),r)}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.push([t,e]),Fp(void 0,"",r)},ny=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=Te(t.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;if(o!==er&&e.startsWith(o))return ny(t.get(o),e.slice(o.length))}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Qg=function(t,e){var r,n,i=e.length;e:for(var a=0;t&&a<i;){try{for(var o=(r=void 0,Te(t.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==er&&e[a]===l[0]){for(var c=Math.min(i-a,l.length),u=1;u<c&&e[a+u]===l[u];)++u;var d=t.get(l);if(u===l.length)t=d;else{var m=new Map;m.set(l.slice(u),d),t.set(e.slice(a,a+u),m),t.delete(l),t=m}a+=u;continue e}}}catch(h){r={error:h}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var p=new Map;return t.set(e.slice(a),p),p}return t},RL=function(t,e){var r=Rt(Fp(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(er),n.size===0)TT(i);else if(n.size===1){var a=Rt(n.entries().next().value,2),o=a[0],s=a[1];CT(i,o,s)}}},TT=function(t){if(t.length!==0){var e=Rt(oy(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)TT(t.slice(0,-1));else if(r.size===1){var i=Rt(r.entries().next().value,2),a=i[0],o=i[1];a!==er&&CT(t.slice(0,-1),a,o)}}},CT=function(t,e,r){if(t.length!==0){var n=Rt(oy(t),2),i=n[0],a=n[1];i.set(a+e,r),i.delete(a)}},oy=function(t){return t[t.length-1]},wc,sy="or",IT="and",NL="and_not",AT=function(){function t(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?ry:e.autoVacuum;this._options=ut(ut(ut({},ty),e),{autoVacuum:r,searchOptions:ut(ut({},vT),e.searchOptions||{}),autoSuggestOptions:ut(ut({},LL),e.autoSuggestOptions||{})}),this._index=new Yg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ay,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,h=c(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(h))throw new Error("MiniSearch: duplicate ID ".concat(h));var f=this.addDocumentId(h);this.saveStoredFields(f,e);try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var x=g.value,v=c(e,x);if(v!=null){var I=u(v.toString(),x),T=this._fieldIds[x],C=new Set(I).size;this.addFieldLength(f,T,this._documentCount-1,C);try{for(var M=(i=void 0,Te(I)),W=M.next();!W.done;W=M.next()){var $=W.value,B=d($,x);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.addTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.addTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.add(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,a=i===void 0?10:i,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,d,m){var p=u.chunk,h=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:h.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return n.addAll(p)})}:{chunk:p,promise:h}},o),l=s.chunk,c=s.promise;return c.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,h=d(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var f=this._idToShortId.get(h);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(h,": it is not in the index"));try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var x=g.value,v=d(e,x);if(v!=null){var I=c(v.toString(),x),T=this._fieldIds[x],C=new Set(I).size;this.removeFieldLength(f,T,this._documentCount,C);try{for(var M=(i=void 0,Te(I)),W=M.next();!W.done;W=M.next()){var $=W.value,B=u($,x);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.removeTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.removeTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(h),this._fieldLength.delete(f),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.remove(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Yg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,a){r.removeFieldLength(n,a,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:a},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,a=i(e,n);this.discard(a),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=ay,n.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,r){return CL(this,void 0,void 0,function(){var n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$,B,Y;return IL(this,function(H){switch(H.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||iy.batchSize,a=e.batchWait||iy.batchWait,o=1,H.label=1;case 1:H.trys.push([1,7,8,9]),s=Te(this._index),l=s.next(),H.label=2;case 2:if(l.done)return[3,6];c=Rt(l.value,2),u=c[0],d=c[1];try{for(m=(W=void 0,Te(d)),p=m.next();!p.done;p=m.next()){h=Rt(p.value,2),f=h[0],y=h[1];try{for(g=(B=void 0,Te(y)),x=g.next();!x.done;x=g.next())v=Rt(x.value,1),I=v[0],!this._documentIds.has(I)&&(y.size<=1?d.delete(f):y.delete(I))}catch(j){B={error:j}}finally{try{x&&!x.done&&(Y=g.return)&&Y.call(g)}finally{if(B)throw B.error}}}}catch(j){W={error:j}}finally{try{p&&!p.done&&($=m.return)&&$.call(m)}finally{if(W)throw W.error}}return this._index.get(u).size===0&&this._index.delete(u),o%i!==0?[3,4]:[4,new Promise(function(j){return setTimeout(j,a)})];case 3:H.sent(),H.label=4;case 4:o+=1,H.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return T=H.sent(),C={error:T},[3,9];case 8:try{l&&!l.done&&(M=s.return)&&M.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=n,H.label=10;case 10:return[4,null];case 11:return H.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||ry.minDirtCount,n=n||ry.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.getStoredFields=function(e){var r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var a=this.executeQuery(e,r),o=[];try{for(var s=Te(a),l=s.next();!l.done;l=s.next()){var c=Rt(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,h=d.match,f=p.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(h),queryTerms:p,match:h};Object.assign(y,this._storedFields.get(u)),(r.filter==null||r.filter(y))&&o.push(y)}}catch(g){n={error:g}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e===t.wildcard&&r.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(ST),o},t.prototype.autoSuggest=function(e,r){var n,i,a,o;r===void 0&&(r={}),r=ut(ut({},this._options.autoSuggestOptions),r);var s=new Map;try{for(var l=Te(this.search(e,r)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),h=s.get(p);h!=null?(h.score+=d,h.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(T){n={error:T}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var f=[];try{for(var y=Te(s),g=y.next();!g.done;g=y.next()){var x=Rt(g.value,2),h=x[0],v=x[1],d=v.score,m=v.terms,I=v.count;f.push({suggestion:h,terms:m,score:d/I})}}catch(T){a={error:T}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(a)throw a.error}}return f.sort(ST),f},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)},t.getDefault=function(e){if(ty.hasOwnProperty(e))return ey(ty,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,a,o,s,l,c=e.index,u=e.documentCount,d=e.nextId,m=e.documentIds,p=e.fieldIds,h=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,g=e.dirtCount,x=e.serializationVersion;if(x!==1&&x!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var v=new t(r);v._documentCount=u,v._nextId=d,v._documentIds=zp(m),v._idToShortId=new Map,v._fieldIds=p,v._fieldLength=zp(h),v._avgFieldLength=f,v._storedFields=zp(y),v._dirtCount=g||0,v._index=new Yg;try{for(var I=Te(v._documentIds),T=I.next();!T.done;T=I.next()){var C=Rt(T.value,2),M=C[0],W=C[1];v._idToShortId.set(W,M)}}catch(kt){n={error:kt}}finally{try{T&&!T.done&&(i=I.return)&&i.call(I)}finally{if(n)throw n.error}}try{for(var $=Te(c),B=$.next();!B.done;B=$.next()){var Y=Rt(B.value,2),H=Y[0],j=Y[1],Z=new Map;try{for(var ae=(s=void 0,Te(Object.keys(j))),$e=ae.next();!$e.done;$e=ae.next()){var Xe=$e.value,At=j[Xe];x===1&&(At=At.ds),Z.set(parseInt(Xe,10),zp(At))}}catch(kt){s={error:kt}}finally{try{$e&&!$e.done&&(l=ae.return)&&l.call(ae)}finally{if(s)throw s.error}}v._index.set(H,Z)}}catch(kt){a={error:kt}}finally{try{B&&!B.done&&(o=$.return)&&o.call($)}finally{if(a)throw a.error}}return v},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){var i=ut(ut(ut({},r),e),{queries:void 0}),a=e.queries.map(function(y){return n.executeQuery(y,i)});return this.combineResults(a,i.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=ut(ut({tokenize:s,processTerm:l},c),r),d=u.tokenize,m=u.processTerm,p=d(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),h=p.map($L(u)),f=h.map(function(y){return n.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,a,o,s=ut(ut({},this._options.searchOptions),r),l=(s.fields||this._options.fields).reduce(function(Xe,At){var kt;return ut(ut({},Xe),(kt={},kt[At]=ey(s.boost,At)||1,kt))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=ut(ut({},vT.weights),u),h=p.fuzzy,f=p.prefix,y=this._index.get(e.term),g=this.termResults(e.term,e.term,1,y,l,c,m),x,v;if(e.prefix&&(x=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,T=I<1?Math.min(d,Math.round(e.term.length*I)):I;T&&(v=this._index.fuzzyGet(e.term,T))}if(x)try{for(var C=Te(x),M=C.next();!M.done;M=C.next()){var W=Rt(M.value,2),$=W[0],B=W[1],Y=$.length-e.term.length;if(Y){v?.delete($);var H=f*$.length/($.length+.3*Y);this.termResults(e.term,$,H,B,l,c,m,g)}}}catch(Xe){n={error:Xe}}finally{try{M&&!M.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}if(v)try{for(var j=Te(v.keys()),Z=j.next();!Z.done;Z=j.next()){var $=Z.value,ae=Rt(v.get($),2),$e=ae[0],Y=ae[1];if(Y){var H=h*$.length/($.length+Y);this.termResults(e.term,$,H,$e,l,c,m,g)}}}catch(Xe){a={error:Xe}}finally{try{Z&&!Z.done&&(o=j.return)&&o.call(j)}finally{if(a)throw a.error}}return g},t.prototype.executeWildcardQuery=function(e){var r,n,i=new Map,a=ut(ut({},this._options.searchOptions),e);try{for(var o=Te(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;i.set(c,{score:d,terms:[],match:{}})}}catch(m){r={error:m}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=sy),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(OL[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,a=[];try{for(var o=Te(this._index),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(n=void 0,Te(u)),p=m.next();!p.done;p=m.next()){var h=Rt(p.value,2),f=h[0],y=h[1];d[f]=Object.fromEntries(y)}}catch(g){n={error:g}}finally{try{p&&!p.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}a.push([c,d])}}catch(g){e={error:g}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),i==null)return l;try{for(var h=Te(Object.keys(a)),f=h.next();!f.done;f=h.next()){var y=f.value,g=a[y],x=this._fieldIds[y],v=i.get(x);if(v!=null){var I=v.size,T=this._avgFieldLength[x];try{for(var C=(d=void 0,Te(v.keys())),M=C.next();!M.done;M=C.next()){var W=M.value;if(!this._documentIds.has(W)){this.removeTerm(x,W,r),I-=1;continue}var $=o?o(this._documentIds.get(W),r,this._storedFields.get(W)):1;if($){var B=v.get(W),Y=this._fieldLength.get(W)[x],H=ML(B,I,this._documentCount,Y,T,s),j=n*g*$*H,Z=l.get(W);if(Z){Z.score+=j,zL(Z.terms,e);var ae=ey(Z.match,r);ae?ae.push(y):Z.match[r]=[y]}else l.set(W,{score:j,terms:[e],match:(p={},p[r]=[y],p)})}}}catch($e){d={error:$e}}finally{try{M&&!M.done&&(m=C.return)&&m.call(C)}finally{if(d)throw d.error}}}}}catch($e){c={error:$e}}finally{try{f&&!f.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,wT),a=i.get(e);if(a==null)a=new Map,a.set(r,1),i.set(e,a);else{var o=a.get(r);a.set(r,(o||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,wT),a=i.get(e);a==null||a.get(r)==null?this.warnDocumentChanged(r,e,n):a.get(r)<=1?a.size<=1?i.delete(e):a.delete(r):a.set(r,a.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,a;try{for(var o=Te(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){i={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[r]=i;var o=this._avgFieldLength[r]||0,s=o*n+i;this._avgFieldLength[r]=s/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var a=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=a/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=Te(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(r,d);m!==void 0&&(l[d]=m)}}catch(p){n={error:p}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}},t.wildcard=Symbol("*"),t}(),ey=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},OL=(wc={},wc[sy]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value,s=t.get(o);if(s==null)t.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),_T(s.terms,u)}}}catch(m){r={error:m}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},wc[IT]=function(t,e){var r,n,i=new Map;try{for(var a=Te(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=t.get(s);if(l!=null){var c=e.get(s),u=c.score,d=c.terms,m=c.match;_T(l.terms,d),i.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){r={error:p}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},wc[NL]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;t.delete(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},wc),DL={k:1.2,b:.7,d:.5},ML=function(t,e,r,n,i,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(r-e+.5)/(e+.5));return c*(l+t*(o+1)/(t+o*(1-s+s*n/i)))},$L=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,a=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:a}}},ty={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t){return t.split(FL)},processTerm:function(t){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e){typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},vT={combineWith:sy,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:DL},LL={combineWith:IT,prefix:function(t,e,r){return e===r.length-1}},iy={batchSize:1e3,batchWait:10},ay={minDirtFactor:.1,minDirtCount:20},ry=ut(ut({},iy),ay),zL=function(t,e){t.includes(e)||t.push(e)},_T=function(t,e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;t.includes(o)||t.push(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},ST=function(t,e){var r=t.score,n=e.score;return n-r},wT=function(){return new Map},zp=function(t){var e,r,n=new Map;try{for(var i=Te(Object.keys(t)),a=i.next();!a.done;a=i.next()){var o=a.value;n.set(parseInt(o,10),t[o])}}catch(s){e={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},FL=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var PT=t=>[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,r)=>{let n=await r.knowledgeBase.search(e.query),i=r;i._lastKBsearch=e.query,i._nextRequestUseKBitems=n,r.submitAnalyticsEvent({type:"kb-search",query:e.query,results:n});let a=n.filter(s=>s.type!="action").map(s=>"id="+s.id).join(", ")||"(none)",o=n.filter(s=>s.type=="action").map(s=>"name="+s._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${a}. New tools available: ${o}.`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return r.submitAnalyticsEvent({type:"open-url",url:e.url}),`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,r.submitAnalyticsEvent({type:"change-route",path:n}),`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email using the default mail client.",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),a=encodeURIComponent(e.body),o=`mailto:${n}?subject=${i}&body=${a}`;try{window.location.href=o}catch(s){throw new Error(`Failed to open email client: ${s instanceof Error?s.message:String(s)}`)}return r.submitAnalyticsEvent({type:"send-email",email_address:e.email_address,subject:e.subject,body_length:e.body.length}),`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Le;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Le||(Le={}));var RT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(RT||(RT={}));var K=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ni=t=>{switch(typeof t){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN(t)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(t)?K.array:t===null?K.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?K.promise:typeof Map<"u"&&t instanceof Map?K.map:typeof Set<"u"&&t instanceof Set?K.set:typeof Date<"u"&&t instanceof Date?K.date:K.object;default:return K.unknown}};var L=Le.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"]);var en=class t 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]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};en.create=t=>new en(t);var BL=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===K.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Le.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Le.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Le.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Le.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Le.assertNever(t)}return{message:r}},ha=BL;var jL=ha;function kc(){return jL}var Bp=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function q(t,e){let r=kc(),n=Bp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ha?void 0:ha].filter(i=>!!i)});t.common.issues.push(n)}var pr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return de;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return de;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},de=Object.freeze({status:"aborted"}),Ts=t=>({status:"dirty",value:t}),Er=t=>({status:"valid",value:t}),ly=t=>t.status==="aborted",cy=t=>t.status==="dirty",eo=t=>t.status==="valid",xc=t=>typeof Promise<"u"&&t instanceof Promise;var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var bn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},NT=(t,e)=>{if(eo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new en(t.common.issues);return this._error=r,this._error}}};function _e(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:i}}var Ce=class{get description(){return this._def.description}_getType(e){return Ni(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pr,ctx:{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(xc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parseSync({data:e,path:n.path,parent:n});return NT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return eo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>eo(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(xc(i)?i:Promise.resolve(i));return NT(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Mn({schema:this,typeName:ue.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:r=>this["~validate"](r)}}optional(){return Dn.create(this,this._def)}nullable(){return Mi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ga.create(this)}promise(){return to.create(this,this._def)}or(e){return Rs.create([this,e],this._def)}and(e){return Ns.create(this,e,this._def)}transform(e){return new Mn({..._e(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ls({..._e(this._def),innerType:this,defaultValue:r,typeName:ue.ZodDefault})}brand(){return new jp({typeName:ue.ZodBranded,type:this,..._e(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zs({..._e(this._def),innerType:this,catchValue:r,typeName:ue.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Up.create(this,e)}readonly(){return Fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},UL=/^c[^\s-]{8,}$/i,GL=/^[0-9a-z]+$/,VL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HL=/^[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,qL=/^[a-z0-9_-]{21}$/i,WL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ZL=/^[-+]?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)?)??$/,KL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uy,XL=/^(?:(?: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])$/,YL=/^(?:(?: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])$/,QL=/^(([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]))$/,ez=/^(([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])$/,tz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OT="((\\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])))",nz=new RegExp(`^${OT}$`);function DT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function iz(t){return new RegExp(`^${DT(t)}$`)}function az(t){let e=`${OT}T${DT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function oz(t,e){return!!((e==="v4"||!e)&&XL.test(t)||(e==="v6"||!e)&&QL.test(t))}function sz(t,e){if(!WL.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function lz(t,e){return!!((e==="v4"||!e)&&YL.test(t)||(e==="v6"||!e)&&ez.test(t))}var Is=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.string,received:a.parsedType}),de}let n=new pr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.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&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")KL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")uy||(uy=new RegExp(JL,"u")),uy.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")HL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")qL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")UL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")GL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")VL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:L.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)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.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)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?az(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?nz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?iz(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?ZL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?oz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?sz(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?lz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?tz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):Le.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Q.errToObj(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?.precision>"u"?null:e?.precision,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Is.create=t=>new Is({checks:[],typeName:ue.ZodString,coerce:t?.coerce??!1,..._e(t)});function cz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Ec=class t extends Ce{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)!==K.number){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.number,received:a.parsedType}),de}let n,i=new pr;for(let a of this._def.checks)a.kind==="int"?Le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?cz(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_finite,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Ec.create=t=>new Ec({checks:[],typeName:ue.ZodNumber,coerce:t?.coerce||!1,..._e(t)});var Tc=class t extends Ce{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)!==K.bigint)return this._getInvalidInput(e);let n,i=new pr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.bigint,received:r.parsedType}),de}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Tc.create=t=>new Tc({checks:[],typeName:ue.ZodBigInt,coerce:t?.coerce??!1,..._e(t)});var Cc=class extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.boolean,received:n.parsedType}),de}return Er(e.data)}};Cc.create=t=>new Cc({typeName:ue.ZodBoolean,coerce:t?.coerce||!1,..._e(t)});var Ic=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.date,received:a.parsedType}),de}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_date}),de}let n=new pr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Le.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Ic.create=t=>new Ic({checks:[],coerce:t?.coerce||!1,typeName:ue.ZodDate,..._e(t)});var Ac=class extends Ce{_parse(e){if(this._getType(e)!==K.symbol){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.symbol,received:n.parsedType}),de}return Er(e.data)}};Ac.create=t=>new Ac({typeName:ue.ZodSymbol,..._e(t)});var As=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.undefined,received:n.parsedType}),de}return Er(e.data)}};As.create=t=>new As({typeName:ue.ZodUndefined,..._e(t)});var Ps=class extends Ce{_parse(e){if(this._getType(e)!==K.null){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.null,received:n.parsedType}),de}return Er(e.data)}};Ps.create=t=>new Ps({typeName:ue.ZodNull,..._e(t)});var Pc=class extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Er(e.data)}};Pc.create=t=>new Pc({typeName:ue.ZodAny,..._e(t)});var fa=class extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Er(e.data)}};fa.create=t=>new fa({typeName:ue.ZodUnknown,..._e(t)});var ri=class extends Ce{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.never,received:r.parsedType}),de}};ri.create=t=>new ri({typeName:ue.ZodNever,..._e(t)});var Rc=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.void,received:n.parsedType}),de}return Er(e.data)}};Rc.create=t=>new Rc({typeName:ue.ZodVoid,..._e(t)});var ga=class t extends Ce{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==K.array)return q(r,{code:L.invalid_type,expected:K.array,received:r.parsedType}),de;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(q(r,{code:o?L.too_big:L.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new bn(r,o,r.path,s)))).then(o=>pr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new bn(r,o,r.path,s)));return pr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};ga.create=(t,e)=>new ga({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,..._e(e)});function Cs(t){if(t instanceof tn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Dn.create(Cs(n))}return new tn({...t._def,shape:()=>e})}else return t instanceof ga?new ga({...t._def,type:Cs(t.element)}):t instanceof Dn?Dn.create(Cs(t.unwrap())):t instanceof Mi?Mi.create(Cs(t.unwrap())):t instanceof Di?Di.create(t.items.map(e=>Cs(e))):t}var tn=class t extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==K.object){let c=this._getOrReturnCtx(e);return q(c,{code:L.invalid_type,expected:K.object,received:c.parsedType}),de}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ri&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=a[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new bn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ri){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")s.length>0&&(q(i,{code:L.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new bn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,m=await u.value;c.push({key:d,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>pr.mergeObjectSync(n,c)):pr.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Cs(this)}partial(e){let r={};for(let n of Le.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Dn;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return MT(Le.objectKeys(this.shape))}};tn.create=(t,e)=>new tn({shape:()=>t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.strictCreate=(t,e)=>new tn({shape:()=>t,unknownKeys:"strict",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.lazycreate=(t,e)=>new tn({shape:t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});var Rs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new en(s.ctx.common.issues));return q(r,{code:L.invalid_union,unionErrors:o}),de}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new en(l));return q(r,{code:L.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rs.create=(t,e)=>new Rs({options:t,typeName:ue.ZodUnion,..._e(e)});var Oi=t=>t instanceof Os?Oi(t.schema):t instanceof Mn?Oi(t.innerType()):t instanceof Ds?[t.value]:t instanceof Ms?t.options:t instanceof $s?Le.objectValues(t.enum):t instanceof Ls?Oi(t._def.innerType):t instanceof As?[void 0]:t instanceof Ps?[null]:t instanceof Dn?[void 0,...Oi(t.unwrap())]:t instanceof Mi?[null,...Oi(t.unwrap())]:t instanceof jp||t instanceof Fs?Oi(t.unwrap()):t instanceof zs?Oi(t._def.innerType):[],dy=class t extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.object)return q(r,{code:L.invalid_type,expected:K.object,received:r.parsedType}),de;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Oi(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,..._e(n)})}};function py(t,e){let r=Ni(t),n=Ni(e);if(t===e)return{valid:!0,data:t};if(r===K.object&&n===K.object){let i=Le.objectKeys(e),a=Le.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=py(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===K.array&&n===K.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=py(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===K.date&&n===K.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ns=class extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(ly(a)||ly(o))return de;let s=py(a.value,o.value);return s.valid?((cy(a)||cy(o))&&r.dirty(),{status:r.value,value:s.data}):(q(n,{code:L.invalid_intersection_types}),de)};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,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ns.create=(t,e,r)=>new Ns({left:t,right:e,typeName:ue.ZodIntersection,..._e(r)});var Di=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.array)return q(n,{code:L.invalid_type,expected:K.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return q(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(q(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new bn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>pr.mergeArray(r,o)):pr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Di.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Di({items:t,typeName:ue.ZodTuple,rest:null,..._e(e)})};var my=class t extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.object)return q(n,{code:L.invalid_type,expected:K.object,received:n.parsedType}),de;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new bn(n,s,n.path,s)),value:o._parse(new bn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?pr.mergeObjectAsync(r,i):pr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ce?new t({keyType:e,valueType:r,typeName:ue.ZodRecord,..._e(n)}):new t({keyType:Is.create(),valueType:e,typeName:ue.ZodRecord,..._e(r)})}},Nc=class extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.map)return q(n,{code:L.invalid_type,expected:K.map,received:n.parsedType}),de;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:i._parse(new bn(n,s,n.path,[c,"key"])),value:a._parse(new bn(n,l,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};Nc.create=(t,e,r)=>new Nc({valueType:e,keyType:t,typeName:ue.ZodMap,..._e(r)});var Oc=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.set)return q(n,{code:L.invalid_type,expected:K.set,received:n.parsedType}),de;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(q(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(q(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return de;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((l,c)=>a._parse(new bn(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Oc.create=(t,e)=>new Oc({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,..._e(e)});var hy=class t extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.function)return q(r,{code:L.invalid_type,expected:K.function,received:r.parsedType}),de;function n(s,l){return Bp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kc(),ha].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(s,l){return Bp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kc(),ha].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof to){let s=this;return Er(async function(...l){let c=new en([]),u=await s._def.args.parseAsync(l,a).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{let s=this;return Er(function(...l){let c=s._def.args.safeParse(l,a);if(!c.success)throw new en([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new en([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Di.create(e).rest(fa.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Di.create([]).rest(fa.create()),returns:r||fa.create(),typeName:ue.ZodFunction,..._e(n)})}},Os=class extends Ce{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Os.create=(t,e)=>new Os({getter:t,typeName:ue.ZodLazy,..._e(e)});var Ds=class extends Ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ds.create=(t,e)=>new Ds({value:t,typeName:ue.ZodLiteral,..._e(e)});function MT(t,e){return new Ms({values:t,typeName:ue.ZodEnum,..._e(e)})}var Ms=class t extends Ce{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{expected:Le.joinValues(n),received:r.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{received:r.data,code:L.invalid_enum_value,options:n}),de}return Er(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ms.create=MT;var $s=class extends Ce{_parse(e){let r=Le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==K.string&&n.parsedType!==K.number){let i=Le.objectValues(r);return q(n,{expected:Le.joinValues(i),received:n.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(Le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Le.objectValues(r);return q(n,{received:n.data,code:L.invalid_enum_value,options:i}),de}return Er(e.data)}get enum(){return this._def.values}};$s.create=(t,e)=>new $s({values:t,typeName:ue.ZodNativeEnum,..._e(e)});var to=class extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.promise&&r.common.async===!1)return q(r,{code:L.invalid_type,expected:K.promise,received:r.parsedType}),de;let n=r.parsedType===K.promise?r.data:Promise.resolve(r.data);return Er(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};to.create=(t,e)=>new to({type:t,typeName:ue.ZodPromise,..._e(e)});var Mn=class extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return de;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?de:l.status==="dirty"?Ts(l.value):r.value==="dirty"?Ts(l.value):l});{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Ts(s.value):r.value==="dirty"?Ts(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!eo(o))return de;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>eo(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):de);Le.assertNever(i)}};Mn.create=(t,e,r)=>new Mn({schema:t,typeName:ue.ZodEffects,effect:e,..._e(r)});Mn.createWithPreprocess=(t,e,r)=>new Mn({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,..._e(r)});var Dn=class extends Ce{_parse(e){return this._getType(e)===K.undefined?Er(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Dn.create=(t,e)=>new Dn({innerType:t,typeName:ue.ZodOptional,..._e(e)});var Mi=class extends Ce{_parse(e){return this._getType(e)===K.null?Er(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mi.create=(t,e)=>new Mi({innerType:t,typeName:ue.ZodNullable,..._e(e)});var Ls=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===K.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ls.create=(t,e)=>new Ls({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});var zs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zs.create=(t,e)=>new zs({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});var Dc=class extends Ce{_parse(e){if(this._getType(e)!==K.nan){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.nan,received:n.parsedType}),de}return{status:"valid",value:e.data}}};Dc.create=t=>new Dc({typeName:ue.ZodNaN,..._e(t)});var Eee=Symbol("zod_brand"),jp=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Up=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?de:a.status==="dirty"?(r.dirty(),Ts(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ue.ZodPipeline})}},Fs=class extends Ce{_parse(e){let r=this._def.innerType._parse(e),n=i=>(eo(i)&&(i.value=Object.freeze(i.value)),i);return xc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fs.create=(t,e)=>new Fs({innerType:t,typeName:ue.ZodReadonly,..._e(e)});var Tee={object:tn.lazycreate},ue;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={}));var Cee=Is.create,Iee=Ec.create,Aee=Dc.create,Pee=Tc.create,Ree=Cc.create,Nee=Ic.create,Oee=Ac.create,Dee=As.create,Mee=Ps.create,$ee=Pc.create,Lee=fa.create,zee=ri.create,Fee=Rc.create,Bee=ga.create,uz=tn.create,jee=tn.strictCreate,Uee=Rs.create,Gee=dy.create,Vee=Ns.create,Hee=Di.create,qee=my.create,Wee=Nc.create,Zee=Oc.create,Kee=hy.create,Jee=Os.create,Xee=Ds.create,Yee=Ms.create,Qee=$s.create,ete=to.create,tte=Mn.create,rte=Dn.create,nte=Mi.create,ite=Mn.createWithPreprocess,ate=Up.create;var Vp=Object.freeze({status:"aborted"});function N(t,e,r){function n(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,l);let c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let m=u[d];m in s||(s[m]=c[m].bind(s))}}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var l;let c=r?.Parent?new a:this;n(c,s),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var fy=Symbol("zod_brand"),ni=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Gp={};function mr(t){return t&&Object.assign(Gp,t),Gp}var U={};rc(U,{BIGINT_FORMAT_RANGES:()=>FT,Class:()=>yy,NUMBER_FORMAT_RANGES:()=>ky,aborted:()=>_a,allowsEval:()=>_y,assert:()=>yz,assertEqual:()=>mz,assertIs:()=>fz,assertNever:()=>gz,assertNotEqual:()=>hz,assignProp:()=>ya,base64ToUint8Array:()=>jT,base64urlToUint8Array:()=>Dz,cached:()=>Us,captureStackTrace:()=>Wp,cleanEnum:()=>Oz,cleanRegex:()=>Lc,clone:()=>zr,cloneDef:()=>vz,createTransparentProxy:()=>Ez,defineLazy:()=>nt,esc:()=>qp,escapeRegex:()=>ii,extend:()=>Iz,finalizeIssue:()=>$n,floatSafeRemainder:()=>by,getElementAtPath:()=>_z,getEnumValues:()=>Hp,getLengthableOrigin:()=>zc,getParsedType:()=>xz,getSizableOrigin:()=>BT,hexToUint8Array:()=>$z,isObject:()=>ro,isPlainObject:()=>va,issue:()=>Gs,joinValues:()=>pe,jsonStringifyReplacer:()=>js,merge:()=>Pz,mergeDefs:()=>ba,normalizeParams:()=>ie,nullish:()=>$c,numKeys:()=>kz,objectClone:()=>bz,omit:()=>Cz,optionalKeys:()=>wy,partial:()=>Rz,pick:()=>Tz,prefixIssues:()=>$i,primitiveTypes:()=>zT,promiseAllObject:()=>Sz,propertyKeyTypes:()=>Sy,randomString:()=>wz,required:()=>Nz,safeExtend:()=>Az,shallowClone:()=>LT,slugify:()=>vy,stringifyPrimitive:()=>me,uint8ArrayToBase64:()=>UT,uint8ArrayToBase64url:()=>Mz,uint8ArrayToHex:()=>Lz,unwrapMessage:()=>Mc});function mz(t){return t}function hz(t){return t}function fz(t){}function gz(t){throw new Error}function yz(t){}function Hp(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function pe(t,e="|"){return t.map(r=>me(r)).join(e)}function js(t,e){return typeof e=="bigint"?e.toString():e}function Us(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $c(t){return t==null}function Lc(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function by(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let a=r>i?r:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}var $T=Symbol("evaluating");function nt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==$T)return n===void 0&&(n=$T,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function bz(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ya(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ba(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function vz(t){return ba(t._zod.def)}function _z(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Sz(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<e.length;a++)i[e[a]]=n[a];return i})}function wz(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function qp(t){return JSON.stringify(t)}function vy(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Wp="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ro(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var _y=Us(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function va(t){if(ro(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(ro(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(t){return va(t)?{...t}:Array.isArray(t)?[...t]:t}function kz(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xz=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Sy=new Set(["string","number","symbol"]),zT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ii(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ie(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ez(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,a){return e??(e=t()),Reflect.set(e,n,i,a)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function me(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function wy(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var ky={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},FT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Tz(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Cz(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Iz(t,e){if(!va(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ba(t._zod.def,{get shape(){let a={...t._zod.def.shape,...e};return ya(this,"shape",a),a},checks:[]});return zr(t,i)}function Az(t,e){if(!va(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ya(this,"shape",n),n},checks:t._zod.def.checks};return zr(t,r)}function Pz(t,e){let r=ba(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ya(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return zr(t,r)}function Rz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function Nz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function _a(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function $i(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Mc(t){return typeof t=="string"?t:t?.message}function $n(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Mc(t.inst?._zod.def?.error?.(t))??Mc(e?.error?.(t))??Mc(r.customError?.(t))??Mc(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function BT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function zc(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Gs(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Oz(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function jT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function UT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Dz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return jT(e+r)}function Mz(t){return UT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $z(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Lz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var yy=class{constructor(...e){}};var GT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,js,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Zp=N("$ZodError",GT),xy=N("$ZodError",GT,{Parent:Error});function Kp(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function Jp(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)r._errors.push(e(a));else{let o=r,s=0;for(;s<a.path.length;){let l=a.path[s];s===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(a))):o[l]=o[l]||{_errors:[]},o=o[l],s++}}};return n(t),r}var Xp=t=>(e,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ni;if(o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,mr())));throw Wp(s,i?.callee),s}return o.value};var Yp=t=>async(e,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,mr())));throw Wp(s,i?.callee),s}return o.value};var Fc=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ni;return a.issues.length?{success:!1,error:new(t??Zp)(a.issues.map(o=>$n(o,i,mr())))}:{success:!0,data:a.value}},Vs=Fc(xy),Bc=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(o=>$n(o,i,mr())))}:{success:!0,data:a.value}},jc=Bc(xy),VT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xp(t)(e,r,i)};var HT=t=>(e,r,n)=>Xp(t)(e,r,n);var qT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yp(t)(e,r,i)};var WT=t=>async(e,r,n)=>Yp(t)(e,r,n);var ZT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fc(t)(e,r,i)};var KT=t=>(e,r,n)=>Fc(t)(e,r,n);var JT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bc(t)(e,r,i)};var XT=t=>async(e,r,n)=>Bc(t)(e,r,n);var YT=/^[cC][^\s-]{8,}$/,QT=/^[0-9a-z]+$/,e0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,t0=/^[0-9a-vA-V]{20}$/,r0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,i0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var a0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ey=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var o0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Fz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function s0(){return new RegExp(Fz,"u")}var l0=/^(?:(?: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])$/,c0=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var u0=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,d0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ty=/^[A-Za-z0-9_-]*$/;var m0=/^\+(?:[0-9]){6,14}[0-9]$/,h0="(?:(?:\\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])))",f0=new RegExp(`^${h0}$`);function g0(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function y0(t){return new RegExp(`^${g0(t)}$`)}function b0(t){let e=g0({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${h0}T(?:${n})$`)}var v0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_0=/^-?\d+n?$/,S0=/^-?\d+$/,w0=/^-?\d+(?:\.\d+)?/,k0=/^(?:true|false)$/i,x0=/^null$/i;var E0=/^[^A-Z]*$/,T0=/^[^a-z]*$/;var Zt=N("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),C0={number:"number",bigint:"bigint",object:"date"},Cy=N("$ZodCheckLessThan",(t,e)=>{Zt.init(t,e);let r=C0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Iy=N("$ZodCheckGreaterThan",(t,e)=>{Zt.init(t,e);let r=C0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),I0=N("$ZodCheckMultipleOf",(t,e)=>{Zt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):by(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),A0=N("$ZodCheckNumberFormat",(t,e)=>{Zt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=ky[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=i,s.maximum=a,r&&(s.pattern=S0)}),t._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:t})}});var P0=N("$ZodCheckMaxLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let o=zc(i);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),R0=N("$ZodCheckMinLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let o=zc(i);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),N0=N("$ZodCheckLengthEquals",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,a=i.length;if(a===e.length)return;let o=zc(i),s=a>e.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Uc=N("$ZodCheckStringFormat",(t,e)=>{var r,n;Zt.init(t,e),t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),O0=N("$ZodCheckRegex",(t,e)=>{Uc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),D0=N("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=E0),Uc.init(t,e)}),M0=N("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=T0),Uc.init(t,e)}),$0=N("$ZodCheckIncludes",(t,e)=>{Zt.init(t,e);let r=ii(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),L0=N("$ZodCheckStartsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`^${ii(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),z0=N("$ZodCheckEndsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`.*${ii(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var F0=N("$ZodCheckOverwrite",(t,e)=>{Zt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Qp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
3292
|
+
`).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),a=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...r,i.join(`
|
|
3293
|
+
`))}};var j0={major:4,minor:1,patch:13};var Qe=N("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=j0;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let a of i._zod.onattach)a(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(o,s,l)=>{let c=_a(o),u;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(o))continue}else if(c)continue;let m=o.issues.length,p=d._zod.check(o);if(p instanceof Promise&&l?.async===!1)throw new ni;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,o.issues.length!==m&&(c||(c=_a(o,m)))});else{if(o.issues.length===m)continue;c||(c=_a(o,m))}}return u?u.then(()=>o):o},a=(o,s,l)=>{if(_a(o))return o.aborted=!0,o;let c=i(s,n,l);if(c instanceof Promise){if(l.async===!1)throw new ni;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(o,s)=>{if(s.skipChecks)return t._zod.parse(o,s);if(s.direction==="backward"){let c=t._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return c instanceof Promise?c.then(u=>a(u,o,s)):a(c,o,s)}let l=t._zod.parse(o,s);if(l instanceof Promise){if(s.async===!1)throw new ni;return l.then(c=>i(c,n,s))}return i(l,n,s)}}t["~standard"]={validate:i=>{try{let a=Vs(t,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return jc(t,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),Hs=N("$ZodString",(t,e)=>{Qe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??v0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),dt=N("$ZodStringFormat",(t,e)=>{Uc.init(t,e),Hs.init(t,e)}),Py=N("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=a0),dt.init(t,e)}),Ry=N("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ey(n))}else e.pattern??(e.pattern=Ey());dt.init(t,e)}),Ny=N("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=o0),dt.init(t,e)}),Oy=N("$ZodURL",(t,e)=>{dt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Dy=N("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=s0()),dt.init(t,e)}),My=N("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=n0),dt.init(t,e)}),$y=N("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=YT),dt.init(t,e)}),Ly=N("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=QT),dt.init(t,e)}),zy=N("$ZodULID",(t,e)=>{e.pattern??(e.pattern=e0),dt.init(t,e)}),Fy=N("$ZodXID",(t,e)=>{e.pattern??(e.pattern=t0),dt.init(t,e)}),By=N("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=r0),dt.init(t,e)}),jy=N("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=b0(e)),dt.init(t,e)}),Uy=N("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=f0),dt.init(t,e)}),Gy=N("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=y0(e)),dt.init(t,e)}),Vy=N("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=i0),dt.init(t,e)}),Hy=N("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=l0),dt.init(t,e),t._zod.bag.format="ipv4"}),qy=N("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=c0),dt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Wy=N("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=u0),dt.init(t,e)}),Zy=N("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=d0),dt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,a]=n;if(!a)throw new Error;let o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Y0(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Ky=N("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=p0),dt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Y0(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Bz(t){if(!Ty.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Y0(r)}var Jy=N("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ty),dt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Bz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Xy=N("$ZodE164",(t,e)=>{e.pattern??(e.pattern=m0),dt.init(t,e)});function jz(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var Yy=N("$ZodJWT",(t,e)=>{dt.init(t,e),t._zod.check=r=>{jz(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var rm=N("$ZodNumber",(t,e)=>{Qe.init(t,e),t._zod.pattern=t._zod.bag.pattern??w0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...a?{received:a}:{}}),r}}),Qy=N("$ZodNumberFormat",(t,e)=>{A0.init(t,e),rm.init(t,e)}),nm=N("$ZodBoolean",(t,e)=>{Qe.init(t,e),t._zod.pattern=k0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),eb=N("$ZodBigInt",(t,e)=>{Qe.init(t,e),t._zod.pattern=_0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var tb=N("$ZodNull",(t,e)=>{Qe.init(t,e),t._zod.pattern=x0,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rb=N("$ZodAny",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),nb=N("$ZodUnknown",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),ib=N("$ZodNever",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var ab=N("$ZodDate",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:t}),r}});function U0(t,e,r){t.issues.length&&e.issues.push(...$i(r,t.issues)),e.value[r]=t.value}var ob=N("$ZodArray",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let a=[];for(let o=0;o<i.length;o++){let s=i[o],l=e.element._zod.run({value:s,issues:[]},n);l instanceof Promise?a.push(l.then(c=>U0(c,r,o))):U0(l,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function tm(t,e,r,n){t.issues.length&&e.issues.push(...$i(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function Q0(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=wy(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function eC(t,e,r,n,i,a){let o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type;for(let u in e){if(s.has(u))continue;if(c==="never"){o.push(u);continue}let d=l.run({value:e[u],issues:[]},n);d instanceof Promise?t.push(d.then(m=>tm(m,r,u,e))):tm(d,r,u,e)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:a}),t.length?Promise.all(t).then(()=>r):r}var tC=N("$ZodObject",(t,e)=>{if(Qe.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let l={...s};return Object.defineProperty(e,"shape",{value:l}),l}})}let n=Us(()=>Q0(e));nt(t._zod,"propValues",()=>{let s=e.shape,l={};for(let c in s){let u=s[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(let d of u.values)l[c].add(d)}}return l});let i=ro,a=e.catchall,o;t._zod.parse=(s,l)=>{o??(o=n.value);let c=s.value;if(!i(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),s;s.value={};let u=[],d=o.shape;for(let m of o.keys){let h=d[m]._zod.run({value:c[m],issues:[]},l);h instanceof Promise?u.push(h.then(f=>tm(f,s,m,c))):tm(h,s,m,c)}return a?eC(u,c,s,l,n.value,t):u.length?Promise.all(u).then(()=>s):s}}),rC=N("$ZodObjectJIT",(t,e)=>{tC.init(t,e);let r=t._zod.parse,n=Us(()=>Q0(e)),i=m=>{let p=new Qp(["shape","payload","ctx"]),h=n.value,f=v=>{let I=qp(v);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),g=0;for(let v of h.keys)y[v]=`key_${g++}`;p.write("const newResult = {};");for(let v of h.keys){let I=y[v],T=qp(v);p.write(`const ${I} = ${f(v)};`),p.write(`
|
|
3294
|
+
if (${I}.issues.length) {
|
|
3295
|
+
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
3296
|
+
...iss,
|
|
3297
|
+
path: iss.path ? [${T}, ...iss.path] : [${T}]
|
|
3298
|
+
})));
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
if (${I}.value === undefined) {
|
|
3303
|
+
if (${T} in input) {
|
|
3304
|
+
newResult[${T}] = undefined;
|
|
3305
|
+
}
|
|
3306
|
+
} else {
|
|
3307
|
+
newResult[${T}] = ${I}.value;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");let x=p.compile();return(v,I)=>x(m,v,I)},a,o=ro,s=!Gp.jitless,c=s&&_y.value,u=e.catchall,d;t._zod.parse=(m,p)=>{d??(d=n.value);let h=m.value;return o(h)?s&&c&&p?.async===!1&&p.jitless!==!0?(a||(a=i(e.shape)),m=a(m,p),u?eC([],h,m,p,d,t):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),m)}});function G0(t,e,r,n){for(let a of t)if(a.issues.length===0)return e.value=a.value,e;let i=t.filter(a=>!_a(a));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(a=>a.issues.map(o=>$n(o,n,mr())))}),e)}var im=N("$ZodUnion",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),nt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),nt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),nt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>Lc(a.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,a)=>{if(r)return n(i,a);let o=!1,s=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},a);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(l=>G0(l,i,t,a)):G0(s,i,t,a)}}),sb=N("$ZodDiscriminatedUnion",(t,e)=>{im.init(t,e);let r=t._zod.parse;nt(t._zod,"propValues",()=>{let i={};for(let a of e.options){let o=a._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let[s,l]of Object.entries(o)){i[s]||(i[s]=new Set);for(let c of l)i[s].add(c)}}return i});let n=Us(()=>{let i=e.options,a=new Map;for(let o of i){let s=o._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let l of s){if(a.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);a.set(l,o)}}return a});t._zod.parse=(i,a)=>{let o=i.value;if(!ro(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;let s=n.value.get(o?.[e.discriminator]);return s?s._zod.run(i,a):e.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),i)}}),lb=N("$ZodIntersection",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,a=e.left._zod.run({value:i,issues:[]},n),o=e.right._zod.run({value:i,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([l,c])=>V0(r,l,c)):V0(r,a,o)}});function Ay(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(va(t)&&va(e)){let r=Object.keys(e),n=Object.keys(t).filter(a=>r.indexOf(a)!==-1),i={...t,...e};for(let a of n){let o=Ay(t[a],e[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};i[a]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],a=e[n],o=Ay(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function V0(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),_a(t))return t;let n=Ay(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var cb=N("$ZodRecord",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!va(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let a=[],o=e.keyType._zod.values;if(o){r.value={};let s=new Set;for(let c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){s.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?a.push(u.then(d=>{d.issues.length&&r.issues.push(...$i(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...$i(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)s.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let l=e.keyType._zod.run({value:s,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>$n(u,n,mr())),input:s,path:[s],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[s],issues:[]},n);c instanceof Promise?a.push(c.then(u=>{u.issues.length&&r.issues.push(...$i(s,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...$i(s,c.issues)),r.value[l.value]=c.value)}}return a.length?Promise.all(a).then(()=>r):r}});var ub=N("$ZodEnum",(t,e)=>{Qe.init(t,e);let r=Hp(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>Sy.has(typeof i)).map(i=>typeof i=="string"?ii(i):i.toString()).join("|")})$`),t._zod.parse=(i,a)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),db=N("$ZodLiteral",(t,e)=>{if(Qe.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ii(n):n?ii(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:e.values,input:a,inst:t}),n}});var pb=N("$ZodTransform",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r));if(i instanceof Promise)throw new ni;return r.value=i,r}});function H0(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var mb=N("$ZodOptional",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Lc(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>H0(a,r.value)):H0(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),hb=N("$ZodNullable",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Lc(r.source)}|null)$`):void 0}),nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),fb=N("$ZodDefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>q0(a,e)):q0(i,e)}});function q0(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var gb=N("$ZodPrefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),yb=N("$ZodNonOptional",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>W0(a,t)):W0(i,t)}});function W0(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var bb=N("$ZodCatch",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>(r.value=a.value,a.issues.length&&(r.value=e.catchValue({...r,error:{issues:a.issues.map(o=>$n(o,n,mr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>$n(a,n,mr()))},input:r.value}),r.issues=[]),r)}});var vb=N("$ZodPipe",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>e.in._zod.values),nt(t._zod,"optin",()=>e.in._zod.optin),nt(t._zod,"optout",()=>e.out._zod.optout),nt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=e.out._zod.run(r,n);return a instanceof Promise?a.then(o=>em(o,e.in,n)):em(a,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>em(a,e.out,n)):em(i,e.out,n)}});function em(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var _b=N("$ZodReadonly",(t,e)=>{Qe.init(t,e),nt(t._zod,"propValues",()=>e.innerType._zod.propValues),nt(t._zod,"values",()=>e.innerType._zod.values),nt(t._zod,"optin",()=>e.innerType?._zod?.optin),nt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(Z0):Z0(i)}});function Z0(t){return t.value=Object.freeze(t.value),t}var Sb=N("$ZodCustom",(t,e)=>{Zt.init(t,e),Qe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(a=>K0(a,r,n,t));K0(i,r,n,t)}});function K0(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Gs(i))}}var Gz=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Vz=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Gz(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${me(n.values[0])}`:`Invalid option: expected one of ${pe(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=e(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=e(n.origin);return a?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${pe(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function wb(){return{localeError:Vz()}}var nC,iC=Symbol("ZodOutput"),aC=Symbol("ZodInput"),am=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function xb(){return new am}(nC=globalThis).__zod_globalRegistry??(nC.__zod_globalRegistry=xb());var Li=globalThis.__zod_globalRegistry;function Eb(t,e){return new t({type:"string",...ie(e)})}function Tb(t,e){return new t({type:"string",coerce:!0,...ie(e)})}function Cb(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ie(e)})}function om(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ie(e)})}function Ib(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(e)})}function Ab(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(e)})}function Pb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(e)})}function Rb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(e)})}function sm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ie(e)})}function Nb(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(e)})}function Ob(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(e)})}function Db(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(e)})}function Mb(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(e)})}function $b(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(e)})}function Lb(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ie(e)})}function zb(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(e)})}function Fb(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(e)})}function Bb(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(e)})}function jb(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(e)})}function Ub(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(e)})}function Gb(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ie(e)})}function Vb(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(e)})}function Hb(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ie(e)})}function qb(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(e)})}function Wb(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(e)})}function Zb(t,e){return new t({type:"string",format:"date",check:"string_format",...ie(e)})}function Kb(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ie(e)})}function Jb(t,e){return new t({type:"string",format:"duration",check:"string_format",...ie(e)})}function Xb(t,e){return new t({type:"number",checks:[],...ie(e)})}function Yb(t,e){return new t({type:"number",coerce:!0,checks:[],...ie(e)})}function Qb(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(e)})}function ev(t,e){return new t({type:"boolean",...ie(e)})}function tv(t,e){return new t({type:"boolean",coerce:!0,...ie(e)})}function rv(t,e){return new t({type:"bigint",coerce:!0,...ie(e)})}function nv(t,e){return new t({type:"null",...ie(e)})}function iv(t){return new t({type:"any"})}function av(t){return new t({type:"unknown"})}function ov(t,e){return new t({type:"never",...ie(e)})}function sv(t,e){return new t({type:"date",coerce:!0,...ie(e)})}function io(t,e){return new Cy({check:"less_than",...ie(e),value:t,inclusive:!1})}function Ln(t,e){return new Cy({check:"less_than",...ie(e),value:t,inclusive:!0})}function ao(t,e){return new Iy({check:"greater_than",...ie(e),value:t,inclusive:!1})}function rn(t,e){return new Iy({check:"greater_than",...ie(e),value:t,inclusive:!0})}function qs(t,e){return new I0({check:"multiple_of",...ie(e),value:t})}function Gc(t,e){return new P0({check:"max_length",...ie(e),maximum:t})}function oo(t,e){return new R0({check:"min_length",...ie(e),minimum:t})}function Vc(t,e){return new N0({check:"length_equals",...ie(e),length:t})}function lm(t,e){return new O0({check:"string_format",format:"regex",...ie(e),pattern:t})}function cm(t){return new D0({check:"string_format",format:"lowercase",...ie(t)})}function um(t){return new M0({check:"string_format",format:"uppercase",...ie(t)})}function dm(t,e){return new $0({check:"string_format",format:"includes",...ie(e),includes:t})}function pm(t,e){return new L0({check:"string_format",format:"starts_with",...ie(e),prefix:t})}function mm(t,e){return new z0({check:"string_format",format:"ends_with",...ie(e),suffix:t})}function zi(t){return new F0({check:"overwrite",tx:t})}function hm(t){return zi(e=>e.normalize(t))}function fm(){return zi(t=>t.trim())}function gm(){return zi(t=>t.toLowerCase())}function ym(){return zi(t=>t.toUpperCase())}function lv(){return zi(t=>vy(t))}function sC(t,e,r){return new t({type:"array",element:e,...ie(r)})}function cv(t,e,r){let n=ie(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function uv(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ie(r)})}function dv(t){let e=Zz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gs(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(Gs(i))}},t(r.value,r)));return e}function Zz(t,e){let r=new Zt({check:"custom",...ie(e)});return r._zod.check=t,r}function Ws(t){return!!t._zod}function Fn(t,e){return Ws(t)?Vs(t,e):t.safeParse(e)}function bm(t){var e,r;if(!t)return;let n;if(Ws(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function fC(t){var e;if(Ws(t)){let o=(e=t._zod)===null||e===void 0?void 0:e.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let i=t.value;if(i!==void 0)return i}var Hc={};rc(Hc,{ZodISODate:()=>hv,ZodISODateTime:()=>pv,ZodISODuration:()=>bv,ZodISOTime:()=>gv,date:()=>fv,datetime:()=>mv,duration:()=>vv,time:()=>yv});var pv=N("ZodISODateTime",(t,e)=>{jy.init(t,e),St.init(t,e)});function mv(t){return Wb(pv,t)}var hv=N("ZodISODate",(t,e)=>{Uy.init(t,e),St.init(t,e)});function fv(t){return Zb(hv,t)}var gv=N("ZodISOTime",(t,e)=>{Gy.init(t,e),St.init(t,e)});function yv(t){return Kb(gv,t)}var bv=N("ZodISODuration",(t,e)=>{Vy.init(t,e),St.init(t,e)});function vv(t){return Jb(bv,t)}var yC=(t,e)=>{Zp.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Jp(t,r)},flatten:{value:r=>Kp(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,js,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,js,2)}},isEmpty:{get(){return t.issues.length===0}}})},nae=N("ZodError",yC),nn=N("ZodError",yC,{Parent:Error});var bC=Xp(nn),vC=Yp(nn),_C=Fc(nn),SC=Bc(nn),wC=VT(nn),kC=HT(nn),xC=qT(nn),EC=WT(nn),TC=ZT(nn),CC=KT(nn),IC=JT(nn),AC=XT(nn);var pt=N("ZodType",(t,e)=>(Qe.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(U.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>zr(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>bC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>_C(t,r,n),t.parseAsync=async(r,n)=>vC(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>SC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>wC(t,r,n),t.decode=(r,n)=>kC(t,r,n),t.encodeAsync=async(r,n)=>xC(t,r,n),t.decodeAsync=async(r,n)=>EC(t,r,n),t.safeEncode=(r,n)=>TC(t,r,n),t.safeDecode=(r,n)=>CC(t,r,n),t.safeEncodeAsync=async(r,n)=>IC(t,r,n),t.safeDecodeAsync=async(r,n)=>AC(t,r,n),t.refine=(r,n)=>t.check(IF(r,n)),t.superRefine=r=>t.check(AF(r)),t.overwrite=r=>t.check(zi(r)),t.optional=()=>te(t),t.nullable=()=>NC(t),t.nullish=()=>te(NC(t)),t.nonoptional=r=>wF(t,r),t.array=()=>V(t),t.or=r=>ft([t,r]),t.and=r=>Sm(t,r),t.transform=r=>Sv(t,jC(r)),t.default=r=>vF(t,r),t.prefault=r=>SF(t,r),t.catch=r=>xF(t,r),t.pipe=r=>Sv(t,r),t.readonly=()=>CF(t),t.describe=r=>{let n=t.clone();return Li.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Li.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Li.get(t);let n=t.clone();return Li.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),OC=N("_ZodString",(t,e)=>{Hs.init(t,e),pt.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(lm(...n)),t.includes=(...n)=>t.check(dm(...n)),t.startsWith=(...n)=>t.check(pm(...n)),t.endsWith=(...n)=>t.check(mm(...n)),t.min=(...n)=>t.check(oo(...n)),t.max=(...n)=>t.check(Gc(...n)),t.length=(...n)=>t.check(Vc(...n)),t.nonempty=(...n)=>t.check(oo(1,...n)),t.lowercase=n=>t.check(cm(n)),t.uppercase=n=>t.check(um(n)),t.trim=()=>t.check(fm()),t.normalize=(...n)=>t.check(hm(...n)),t.toLowerCase=()=>t.check(gm()),t.toUpperCase=()=>t.check(ym()),t.slugify=()=>t.check(lv())}),wv=N("ZodString",(t,e)=>{Hs.init(t,e),OC.init(t,e),t.email=r=>t.check(Cb(G2,r)),t.url=r=>t.check(sm(DC,r)),t.jwt=r=>t.check(qb(iF,r)),t.emoji=r=>t.check(Nb(V2,r)),t.guid=r=>t.check(om(PC,r)),t.uuid=r=>t.check(Ib(vm,r)),t.uuidv4=r=>t.check(Ab(vm,r)),t.uuidv6=r=>t.check(Pb(vm,r)),t.uuidv7=r=>t.check(Rb(vm,r)),t.nanoid=r=>t.check(Ob(H2,r)),t.guid=r=>t.check(om(PC,r)),t.cuid=r=>t.check(Db(q2,r)),t.cuid2=r=>t.check(Mb(W2,r)),t.ulid=r=>t.check($b(Z2,r)),t.base64=r=>t.check(Gb(tF,r)),t.base64url=r=>t.check(Vb(rF,r)),t.xid=r=>t.check(Lb(K2,r)),t.ksuid=r=>t.check(zb(J2,r)),t.ipv4=r=>t.check(Fb(X2,r)),t.ipv6=r=>t.check(Bb(Y2,r)),t.cidrv4=r=>t.check(jb(Q2,r)),t.cidrv6=r=>t.check(Ub(eF,r)),t.e164=r=>t.check(Hb(nF,r)),t.datetime=r=>t.check(mv(r)),t.date=r=>t.check(fv(r)),t.time=r=>t.check(yv(r)),t.duration=r=>t.check(vv(r))});function w(t){return Eb(wv,t)}var St=N("ZodStringFormat",(t,e)=>{dt.init(t,e),OC.init(t,e)}),G2=N("ZodEmail",(t,e)=>{Ny.init(t,e),St.init(t,e)});var PC=N("ZodGUID",(t,e)=>{Py.init(t,e),St.init(t,e)});var vm=N("ZodUUID",(t,e)=>{Ry.init(t,e),St.init(t,e)});var DC=N("ZodURL",(t,e)=>{Oy.init(t,e),St.init(t,e)});function MC(t){return sm(DC,t)}var V2=N("ZodEmoji",(t,e)=>{Dy.init(t,e),St.init(t,e)});var H2=N("ZodNanoID",(t,e)=>{My.init(t,e),St.init(t,e)});var q2=N("ZodCUID",(t,e)=>{$y.init(t,e),St.init(t,e)});var W2=N("ZodCUID2",(t,e)=>{Ly.init(t,e),St.init(t,e)});var Z2=N("ZodULID",(t,e)=>{zy.init(t,e),St.init(t,e)});var K2=N("ZodXID",(t,e)=>{Fy.init(t,e),St.init(t,e)});var J2=N("ZodKSUID",(t,e)=>{By.init(t,e),St.init(t,e)});var X2=N("ZodIPv4",(t,e)=>{Hy.init(t,e),St.init(t,e)});var Y2=N("ZodIPv6",(t,e)=>{qy.init(t,e),St.init(t,e)});var Q2=N("ZodCIDRv4",(t,e)=>{Wy.init(t,e),St.init(t,e)});var eF=N("ZodCIDRv6",(t,e)=>{Zy.init(t,e),St.init(t,e)});var tF=N("ZodBase64",(t,e)=>{Ky.init(t,e),St.init(t,e)});var rF=N("ZodBase64URL",(t,e)=>{Jy.init(t,e),St.init(t,e)});var nF=N("ZodE164",(t,e)=>{Xy.init(t,e),St.init(t,e)});var iF=N("ZodJWT",(t,e)=>{Yy.init(t,e),St.init(t,e)});var _m=N("ZodNumber",(t,e)=>{rm.init(t,e),pt.init(t,e),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.int=n=>t.check(RC(n)),t.safe=n=>t.check(RC(n)),t.positive=n=>t.check(ao(0,n)),t.nonnegative=n=>t.check(rn(0,n)),t.negative=n=>t.check(io(0,n)),t.nonpositive=n=>t.check(Ln(0,n)),t.multipleOf=(n,i)=>t.check(qs(n,i)),t.step=(n,i)=>t.check(qs(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function et(t){return Xb(_m,t)}var aF=N("ZodNumberFormat",(t,e)=>{Qy.init(t,e),_m.init(t,e)});function RC(t){return Qb(aF,t)}var kv=N("ZodBoolean",(t,e)=>{nm.init(t,e),pt.init(t,e)});function mt(t){return ev(kv,t)}var $C=N("ZodBigInt",(t,e)=>{eb.init(t,e),pt.init(t,e),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.positive=n=>t.check(ao(BigInt(0),n)),t.negative=n=>t.check(io(BigInt(0),n)),t.nonpositive=n=>t.check(Ln(BigInt(0),n)),t.nonnegative=n=>t.check(rn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(qs(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var oF=N("ZodNull",(t,e)=>{tb.init(t,e),pt.init(t,e)});function xv(t){return nv(oF,t)}var sF=N("ZodAny",(t,e)=>{rb.init(t,e),pt.init(t,e)});function LC(){return iv(sF)}var lF=N("ZodUnknown",(t,e)=>{nb.init(t,e),pt.init(t,e)});function Ut(){return av(lF)}var cF=N("ZodNever",(t,e)=>{ib.init(t,e),pt.init(t,e)});function uF(t){return ov(cF,t)}var zC=N("ZodDate",(t,e)=>{ab.init(t,e),pt.init(t,e),t.min=(n,i)=>t.check(rn(n,i)),t.max=(n,i)=>t.check(Ln(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var dF=N("ZodArray",(t,e)=>{ob.init(t,e),pt.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(oo(r,n)),t.nonempty=r=>t.check(oo(1,r)),t.max=(r,n)=>t.check(Gc(r,n)),t.length=(r,n)=>t.check(Vc(r,n)),t.unwrap=()=>t.element});function V(t,e){return sC(dF,t,e)}var FC=N("ZodObject",(t,e)=>{rC.init(t,e),pt.init(t,e),U.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>tr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ut()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ut()}),t.strict=()=>t.clone({...t._zod.def,catchall:uF()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>U.extend(t,r),t.safeExtend=r=>U.safeExtend(t,r),t.merge=r=>U.merge(t,r),t.pick=r=>U.pick(t,r),t.omit=r=>U.omit(t,r),t.partial=(...r)=>U.partial(UC,t,r[0]),t.required=(...r)=>U.required(GC,t,r[0])});function F(t,e){let r={type:"object",shape:t??{},...U.normalizeParams(e)};return new FC(r)}function hr(t,e){return new FC({type:"object",shape:t,catchall:Ut(),...U.normalizeParams(e)})}var BC=N("ZodUnion",(t,e)=>{im.init(t,e),pt.init(t,e),t.options=e.options});function ft(t,e){return new BC({type:"union",options:t,...U.normalizeParams(e)})}var pF=N("ZodDiscriminatedUnion",(t,e)=>{BC.init(t,e),sb.init(t,e)});function Ev(t,e,r){return new pF({type:"union",options:e,discriminator:t,...U.normalizeParams(r)})}var mF=N("ZodIntersection",(t,e)=>{lb.init(t,e),pt.init(t,e)});function Sm(t,e){return new mF({type:"intersection",left:t,right:e})}var hF=N("ZodRecord",(t,e)=>{cb.init(t,e),pt.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Gt(t,e,r){return new hF({type:"record",keyType:t,valueType:e,...U.normalizeParams(r)})}var _v=N("ZodEnum",(t,e)=>{ub.init(t,e),pt.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new _v({...e,checks:[],...U.normalizeParams(i),entries:a})},t.exclude=(n,i)=>{let a={...e.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new _v({...e,checks:[],...U.normalizeParams(i),entries:a})}});function tr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new _v({type:"enum",entries:r,...U.normalizeParams(e)})}var fF=N("ZodLiteral",(t,e)=>{db.init(t,e),pt.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ee(t,e){return new fF({type:"literal",values:Array.isArray(t)?t:[t],...U.normalizeParams(e)})}var gF=N("ZodTransform",(t,e)=>{pb.init(t,e),pt.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(U.issue(a,r.value,e));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),r.issues.push(U.issue(o))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function jC(t){return new gF({type:"transform",transform:t})}var UC=N("ZodOptional",(t,e)=>{mb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function te(t){return new UC({type:"optional",innerType:t})}var yF=N("ZodNullable",(t,e)=>{hb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function NC(t){return new yF({type:"nullable",innerType:t})}var bF=N("ZodDefault",(t,e)=>{fb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function vF(t,e){return new bF({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var _F=N("ZodPrefault",(t,e)=>{gb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function SF(t,e){return new _F({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var GC=N("ZodNonOptional",(t,e)=>{yb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function wF(t,e){return new GC({type:"nonoptional",innerType:t,...U.normalizeParams(e)})}var kF=N("ZodCatch",(t,e)=>{bb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function xF(t,e){return new kF({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var EF=N("ZodPipe",(t,e)=>{vb.init(t,e),pt.init(t,e),t.in=e.in,t.out=e.out});function Sv(t,e){return new EF({type:"pipe",in:t,out:e})}var TF=N("ZodReadonly",(t,e)=>{_b.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function CF(t){return new TF({type:"readonly",innerType:t})}var VC=N("ZodCustom",(t,e)=>{Sb.init(t,e),pt.init(t,e)});function HC(t,e){return cv(VC,t??(()=>!0),e)}function IF(t,e={}){return uv(VC,t,e)}function AF(t){return dv(t)}function Tv(t,e){return Sv(jC(t),e)}var WC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var qC;qC||(qC={});var wm={};rc(wm,{bigint:()=>OF,boolean:()=>NF,date:()=>DF,number:()=>RF,string:()=>PF});function PF(t){return Tb(wv,t)}function RF(t){return Yb(_m,t)}function NF(t){return tv(kv,t)}function OF(t){return rv($C,t)}function DF(t){return sv(zC,t)}mr(wb());var Ks="2025-11-25";var KC=[Ks,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oi="io.modelcontextprotocol/related-task",xm="2.0",ai=HC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),JC=ft([w(),et().int()]),XC=w(),$F=hr({ttl:ft([et(),xv()]).optional(),pollInterval:et().optional()}),Iv=hr({taskId:w()}),LF=hr({progressToken:JC.optional(),[oi]:Iv.optional()}),Fr=hr({task:$F.optional(),_meta:LF.optional()}),rr=F({method:w(),params:Fr.optional()}),so=hr({_meta:F({[oi]:te(Iv)}).passthrough().optional()}),vn=F({method:w(),params:so.optional()}),fr=hr({_meta:hr({[oi]:Iv.optional()}).optional()}),Em=ft([w(),et().int()]),YC=F({jsonrpc:ee(xm),id:Em,...rr.shape}).strict(),qc=t=>YC.safeParse(t).success,QC=F({jsonrpc:ee(xm),...vn.shape}).strict(),eI=t=>QC.safeParse(t).success,tI=F({jsonrpc:ee(xm),id:Em,result:fr}).strict(),lo=t=>tI.safeParse(t).success,he;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(he||(he={}));var rI=F({jsonrpc:ee(xm),id:Em,error:F({code:et().int(),message:w(),data:te(Ut())})}).strict(),nI=t=>rI.safeParse(t).success,Js=ft([YC,QC,tI,rI]),co=fr.strict(),zF=so.extend({requestId:Em,reason:w().optional()}),Tm=vn.extend({method:ee("notifications/cancelled"),params:zF}),FF=F({src:w(),mimeType:w().optional(),sizes:V(w()).optional()}),Wc=F({icons:V(FF).optional()}),Zs=F({name:w(),title:w().optional()}),iI=Zs.extend({...Zs.shape,...Wc.shape,version:w(),websiteUrl:w().optional()}),BF=Sm(F({applyDefaults:mt().optional()}),Gt(w(),Ut())),jF=Tv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Sm(F({form:BF.optional(),url:ai.optional()}),Gt(w(),Ut()).optional())),UF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({sampling:te(F({createMessage:te(F({}).passthrough())}).passthrough()),elicitation:te(F({create:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),GF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({tools:te(F({call:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),VF=F({experimental:Gt(w(),ai).optional(),sampling:F({context:ai.optional(),tools:ai.optional()}).optional(),elicitation:jF.optional(),roots:F({listChanged:mt().optional()}).optional(),tasks:te(UF)}),HF=Fr.extend({protocolVersion:w(),capabilities:VF,clientInfo:iI}),qF=rr.extend({method:ee("initialize"),params:HF});var WF=F({experimental:Gt(w(),ai).optional(),logging:ai.optional(),completions:ai.optional(),prompts:te(F({listChanged:te(mt())})),resources:F({subscribe:mt().optional(),listChanged:mt().optional()}).optional(),tools:F({listChanged:mt().optional()}).optional(),tasks:te(GF)}).passthrough(),Av=fr.extend({protocolVersion:w(),capabilities:WF,serverInfo:iI,instructions:w().optional()}),aI=vn.extend({method:ee("notifications/initialized")}),oI=t=>aI.safeParse(t).success,Cm=rr.extend({method:ee("ping")}),ZF=F({progress:et(),total:te(et()),message:te(w())}),KF=F({...so.shape,...ZF.shape,progressToken:JC}),Im=vn.extend({method:ee("notifications/progress"),params:KF}),JF=Fr.extend({cursor:XC.optional()}),Zc=rr.extend({params:JF.optional()}),Kc=fr.extend({nextCursor:te(XC)}),Jc=F({taskId:w(),status:tr(["working","input_required","completed","failed","cancelled"]),ttl:ft([et(),xv()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:te(et()),statusMessage:te(w())}),uo=fr.extend({task:Jc}),XF=so.merge(Jc),Xc=vn.extend({method:ee("notifications/tasks/status"),params:XF}),Am=rr.extend({method:ee("tasks/get"),params:Fr.extend({taskId:w()})}),Pm=fr.merge(Jc),Rm=rr.extend({method:ee("tasks/result"),params:Fr.extend({taskId:w()})}),Nm=Zc.extend({method:ee("tasks/list")}),Om=Kc.extend({tasks:V(Jc)}),sI=rr.extend({method:ee("tasks/cancel"),params:Fr.extend({taskId:w()})}),lI=fr.merge(Jc),cI=F({uri:w(),mimeType:te(w()),_meta:Gt(w(),Ut()).optional()}),uI=cI.extend({text:w()}),Pv=w().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),dI=cI.extend({blob:Pv}),Xs=F({audience:V(tr(["user","assistant"])).optional(),priority:et().min(0).max(1).optional(),lastModified:Hc.datetime({offset:!0}).optional()}),pI=F({...Zs.shape,...Wc.shape,uri:w(),description:te(w()),mimeType:te(w()),annotations:Xs.optional(),_meta:te(hr({}))}),YF=F({...Zs.shape,...Wc.shape,uriTemplate:w(),description:te(w()),mimeType:te(w()),annotations:Xs.optional(),_meta:te(hr({}))}),QF=Zc.extend({method:ee("resources/list")}),Rv=Kc.extend({resources:V(pI)}),eB=Zc.extend({method:ee("resources/templates/list")}),Nv=Kc.extend({resourceTemplates:V(YF)}),Ov=Fr.extend({uri:w()}),tB=Ov,rB=rr.extend({method:ee("resources/read"),params:tB}),Dv=fr.extend({contents:V(ft([uI,dI]))}),nB=vn.extend({method:ee("notifications/resources/list_changed")}),iB=Ov,aB=rr.extend({method:ee("resources/subscribe"),params:iB}),oB=Ov,sB=rr.extend({method:ee("resources/unsubscribe"),params:oB}),lB=so.extend({uri:w()}),cB=vn.extend({method:ee("notifications/resources/updated"),params:lB}),uB=F({name:w(),description:te(w()),required:te(mt())}),dB=F({...Zs.shape,...Wc.shape,description:te(w()),arguments:te(V(uB)),_meta:te(hr({}))}),pB=Zc.extend({method:ee("prompts/list")}),Mv=Kc.extend({prompts:V(dB)}),mB=Fr.extend({name:w(),arguments:Gt(w(),w()).optional()}),hB=rr.extend({method:ee("prompts/get"),params:mB}),$v=F({type:ee("text"),text:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),Lv=F({type:ee("image"),data:Pv,mimeType:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),zv=F({type:ee("audio"),data:Pv,mimeType:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),fB=F({type:ee("tool_use"),name:w(),id:w(),input:F({}).passthrough(),_meta:te(F({}).passthrough())}).passthrough(),gB=F({type:ee("resource"),resource:ft([uI,dI]),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),yB=pI.extend({type:ee("resource_link")}),Fv=ft([$v,Lv,zv,yB,gB]),bB=F({role:tr(["user","assistant"]),content:Fv}),Bv=fr.extend({description:te(w()),messages:V(bB)}),vB=vn.extend({method:ee("notifications/prompts/list_changed")}),_B=F({title:w().optional(),readOnlyHint:mt().optional(),destructiveHint:mt().optional(),idempotentHint:mt().optional(),openWorldHint:mt().optional()}),SB=F({taskSupport:tr(["required","optional","forbidden"]).optional()}),mI=F({...Zs.shape,...Wc.shape,description:w().optional(),inputSchema:F({type:ee("object"),properties:Gt(w(),ai).optional(),required:V(w()).optional()}).catchall(Ut()),outputSchema:F({type:ee("object"),properties:Gt(w(),ai).optional(),required:V(w()).optional()}).catchall(Ut()).optional(),annotations:te(_B),execution:te(SB),_meta:Gt(w(),Ut()).optional()}),wB=Zc.extend({method:ee("tools/list")}),jv=Kc.extend({tools:V(mI)}),Ys=fr.extend({content:V(Fv).default([]),structuredContent:Gt(w(),Ut()).optional(),isError:te(mt())}),kae=Ys.or(fr.extend({toolResult:Ut()})),kB=Fr.extend({name:w(),arguments:te(Gt(w(),Ut()))}),xB=rr.extend({method:ee("tools/call"),params:kB}),Uv=vn.extend({method:ee("notifications/tools/list_changed")}),hI=tr(["debug","info","notice","warning","error","critical","alert","emergency"]),EB=Fr.extend({level:hI}),TB=rr.extend({method:ee("logging/setLevel"),params:EB}),CB=so.extend({level:hI,logger:w().optional(),data:Ut()}),Gv=vn.extend({method:ee("notifications/message"),params:CB}),IB=F({name:w().optional()}),AB=F({hints:te(V(IB)),costPriority:te(et().min(0).max(1)),speedPriority:te(et().min(0).max(1)),intelligencePriority:te(et().min(0).max(1))}),PB=F({mode:te(tr(["auto","required","none"]))}),RB=F({type:ee("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:V(Fv).default([]),structuredContent:F({}).passthrough().optional(),isError:te(mt()),_meta:te(F({}).passthrough())}).passthrough(),NB=Ev("type",[$v,Lv,zv]),km=Ev("type",[$v,Lv,zv,fB,RB]),OB=F({role:tr(["user","assistant"]),content:ft([km,V(km)]),_meta:te(F({}).passthrough())}).passthrough(),DB=Fr.extend({messages:V(OB),modelPreferences:AB.optional(),systemPrompt:w().optional(),includeContext:tr(["none","thisServer","allServers"]).optional(),temperature:et().optional(),maxTokens:et().int(),stopSequences:V(w()).optional(),metadata:ai.optional(),tools:te(V(mI)),toolChoice:te(PB)}),Vv=rr.extend({method:ee("sampling/createMessage"),params:DB}),Hv=fr.extend({model:w(),stopReason:te(tr(["endTurn","stopSequence","maxTokens"]).or(w())),role:tr(["user","assistant"]),content:NB}),MB=fr.extend({model:w(),stopReason:te(tr(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:tr(["user","assistant"]),content:ft([km,V(km)])}),$B=F({type:ee("boolean"),title:w().optional(),description:w().optional(),default:mt().optional()}),LB=F({type:ee("string"),title:w().optional(),description:w().optional(),minLength:et().optional(),maxLength:et().optional(),format:tr(["email","uri","date","date-time"]).optional(),default:w().optional()}),zB=F({type:tr(["number","integer"]),title:w().optional(),description:w().optional(),minimum:et().optional(),maximum:et().optional(),default:et().optional()}),FB=F({type:ee("string"),title:w().optional(),description:w().optional(),enum:V(w()),default:w().optional()}),BB=F({type:ee("string"),title:w().optional(),description:w().optional(),oneOf:V(F({const:w(),title:w()})),default:w().optional()}),jB=F({type:ee("string"),title:w().optional(),description:w().optional(),enum:V(w()),enumNames:V(w()).optional(),default:w().optional()}),UB=ft([FB,BB]),GB=F({type:ee("array"),title:w().optional(),description:w().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({type:ee("string"),enum:V(w())}),default:V(w()).optional()}),VB=F({type:ee("array"),title:w().optional(),description:w().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({anyOf:V(F({const:w(),title:w()}))}),default:V(w()).optional()}),HB=ft([GB,VB]),qB=ft([jB,UB,HB]),WB=ft([qB,$B,LB,zB]),ZB=Fr.extend({mode:ee("form").optional(),message:w(),requestedSchema:F({type:ee("object"),properties:Gt(w(),WB),required:V(w()).optional()})}),KB=Fr.extend({mode:ee("url"),message:w(),elicitationId:w(),url:w().url()}),JB=ft([ZB,KB]),qv=rr.extend({method:ee("elicitation/create"),params:JB}),XB=so.extend({elicitationId:w()}),YB=vn.extend({method:ee("notifications/elicitation/complete"),params:XB}),Wv=fr.extend({action:tr(["accept","decline","cancel"]),content:Tv(t=>t===null?void 0:t,Gt(w(),ft([w(),et(),mt(),V(w())])).optional())}),QB=F({type:ee("ref/resource"),uri:w()});var ej=F({type:ee("ref/prompt"),name:w()}),tj=Fr.extend({ref:ft([ej,QB]),argument:F({name:w(),value:w()}),context:F({arguments:Gt(w(),w()).optional()}).optional()}),rj=rr.extend({method:ee("completion/complete"),params:tj});var Zv=fr.extend({completion:hr({values:V(w()).max(100),total:te(et().int()),hasMore:te(mt())})}),nj=F({uri:w().startsWith("file://"),name:w().optional(),_meta:Gt(w(),Ut()).optional()}),ij=rr.extend({method:ee("roots/list")}),aj=fr.extend({roots:V(nj)}),oj=vn.extend({method:ee("notifications/roots/list_changed")}),xae=ft([Cm,qF,rj,TB,hB,pB,QF,eB,rB,aB,sB,xB,wB,Am,Rm,Nm]),Eae=ft([Tm,Im,aI,oj,Xc]),Tae=ft([co,Hv,MB,Wv,aj,Pm,Om,uo]),Cae=ft([Cm,Vv,qv,ij,Am,Rm,Nm]),Iae=ft([Tm,Im,Gv,cB,nB,Uv,vB,Xc,YB]),Aae=ft([co,Av,Zv,Bv,Mv,Rv,Nv,Dv,Ys,jv,Pm,Om,uo]),le=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===he.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Cv(i.elicitations,r)}return new t(e,r,n)}},Cv=class extends le{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(he.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function Sa(t){return t==="completed"||t==="failed"||t==="cancelled"}var sj=Symbol("Let zodToJsonSchema decide on which parser to use");var coe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Kv(t){let e=bm(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=fC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Jv(t,e){let r=Fn(t,e);if(!r.success)throw r.error;return r.data}var mj=6e4,Dm=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Tm,r=>{this._oncancel(r)}),this.setNotificationHandler(Im,r=>{this._onprogress(r)}),this.setRequestHandler(Cm,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Am,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Rm,async(r,n)=>{let i=async()=>{var a;let o=r.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(l.type==="response"||l.type==="error"){let c=l.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),l.type==="response")d(c);else{let m=c,p=new le(m.error.code,m.error.message,m.error.data);d(p)}else{let m=l.type==="response"?"Response":"Error";this._onerror(new Error(`${m} handler missing for request ${u}`))}continue}await((a=this._transport)===null||a===void 0?void 0:a.send(l.message,{relatedRequestId:n.requestId}))}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new le(he.InvalidParams,`Task not found: ${o}`);if(!Sa(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(Sa(s.status)){let l=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...l,_meta:{...l._meta,[oi]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Nm,async(r,n)=>{var i;try{let{tasks:a,nextCursor:o}=await this._taskStore.listTasks((i=r.params)===null||i===void 0?void 0:i.cursor,n.sessionId);return{tasks:a,nextCursor:o,_meta:{}}}catch(a){throw new le(he.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(sI,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,`Task not found: ${r.params.taskId}`);if(Sa(i.status))throw new le(he.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new le(he.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof le?i:new le(he.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),le.fromError(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=l=>{o?.(l),this._onerror(l)};let s=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(l,c)=>{s?.(l,c),lo(l)||nI(l)?this._onresponse(l):qc(l)?this._onrequest(l,c):eI(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=le.fromError(he.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i,a,o,s,l;let c=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,u=this._transport,d=(o=(a=(i=e.params)===null||i===void 0?void 0:i._meta)===null||a===void 0?void 0:a[oi])===null||o===void 0?void 0:o.taskId;if(c===void 0){let y={jsonrpc:"2.0",id:e.id,error:{code:he.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:y,timestamp:Date.now()},u?.sessionId).catch(g=>this._onerror(new Error(`Failed to enqueue error response: ${g}`))):u?.send(y).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)));return}let m=new AbortController;this._requestHandlerAbortControllers.set(e.id,m);let p=(s=e.params)===null||s===void 0?void 0:s.task,h=this._taskStore?this.requestTaskStore(e,u?.sessionId):void 0,f={signal:m.signal,sessionId:u?.sessionId,_meta:(l=e.params)===null||l===void 0?void 0:l._meta,sendNotification:async y=>{let g={relatedRequestId:e.id};d&&(g.relatedTask={taskId:d}),await this.notification(y,g)},sendRequest:async(y,g,x)=>{var v,I;let T={...x,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let C=(I=(v=T.relatedTask)===null||v===void 0?void 0:v.taskId)!==null&&I!==void 0?I:d;return C&&h&&await h.updateTaskStatus(C,"input_required"),await this.request(y,g,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:h,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>c(e,f)).then(async y=>{if(m.signal.aborted)return;let g={result:y,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:g,timestamp:Date.now()},u?.sessionId):await u?.send(g)},async y=>{var g;if(m.signal.aborted)return;let x={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(y.code)?y.code:he.InternalError,message:(g=y.message)!==null&&g!==void 0?g:"Internal error",...y.data!==void 0&&{data:y.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:x,timestamp:Date.now()},u?.sessionId):await u?.send(x)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(l);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),lo(e))n(e);else{let o=new le(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(lo(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),lo(e))i(e);else{let o=le.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var i,a,o,s;let{task:l}=n??{};if(!l){try{yield{type:"result",result:await this.request(e,r,n)}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}return}let c;try{let u=await this.request(e,uo,n);if(u.task)c=u.task.taskId,yield{type:"taskCreated",task:u.task};else throw new le(he.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:c},n);if(yield{type:"taskStatus",task:d},Sa(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)}:d.status==="failed"?yield{type:"error",error:new le(he.InternalError,`Task ${c} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new le(he.InternalError,`Task ${c} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)};return}let m=(o=(i=d.pollInterval)!==null&&i!==void 0?i:(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;await new Promise(p=>setTimeout(p,m)),(s=n?.signal)===null||s===void 0||s.throwIfAborted()}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:l}=n??{};return new Promise((c,u)=>{var d,m,p,h,f,y,g;let x=$=>{u($)};if(!this._transport){x(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch($){x($);return}(m=n?.signal)===null||m===void 0||m.throwIfAborted();let v=this._requestMessageId++,I={...e,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),I.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:v}}),s&&(I.params={...I.params,task:s}),l&&(I.params={...I.params,_meta:{...((h=I.params)===null||h===void 0?void 0:h._meta)||{},[oi]:l}});let T=$=>{var B;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String($)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(H=>this._onerror(new Error(`Failed to send cancellation: ${H}`)));let Y=$ instanceof le?$:new le(he.RequestTimeout,String($));u(Y)};this._responseHandlers.set(v,$=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if($ instanceof Error)return u($);try{let Y=Fn(r,$.result);Y.success?c(Y.data):u(Y.error)}catch(Y){u(Y)}}}),(f=n?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var $;T(($=n?.signal)===null||$===void 0?void 0:$.reason)});let C=(y=n?.timeout)!==null&&y!==void 0?y:mj,M=()=>T(le.fromError(he.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(v,C,n?.maxTotalTimeout,M,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1);let W=l?.taskId;if(W){let $=B=>{let Y=this._responseHandlers.get(v);Y?Y(B):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,$),this._enqueueTaskMessage(W,{type:"request",message:I,timestamp:Date.now()}).catch(B=>{this._cleanupTimeout(v),u(B)})}else this._transport.send(I,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch($=>{this._cleanupTimeout(v),u($)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Pm,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Om,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},lI,r)}async notification(e,r){var n,i,a,o,s;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let l=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(l){let m={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((i=e.params)===null||i===void 0?void 0:i._meta)||{},[oi]:r.relatedTask}}};await this._enqueueTaskMessage(l,{type:"notification",message:m,timestamp:Date.now()});return}if(((o=(a=this._options)===null||a===void 0?void 0:a.debouncedNotificationMethods)!==null&&o!==void 0?o:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var m,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let h={...e,jsonrpc:"2.0"};r?.relatedTask&&(h={...h,params:{...h.params,_meta:{...((m=h.params)===null||m===void 0?void 0:m._meta)||{},[oi]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(h,r).catch(f=>this._onerror(f))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((s=d.params)===null||s===void 0?void 0:s._meta)||{},[oi]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=Kv(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=Jv(e,i);return Promise.resolve(r(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Kv(e);this._notificationHandlers.set(n,i=>{let a=Jv(e,i);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var i;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let a=(i=this._options)===null||i===void 0?void 0:i.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,a)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&qc(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new le(he.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,i,a;let o=(i=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;try{let s=await((a=this._taskStore)===null||a===void 0?void 0:a.getTask(e));s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,l)=>{if(r.aborted){l(new le(he.InvalidRequest,"Request cancelled"));return}let c=setTimeout(s,o);r.addEventListener("abort",()=>{clearTimeout(c),l(new le(he.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let l=Xc.parse({method:"notifications/tasks/status",params:s});await this.notification(l),Sa(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new le(he.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Sa(s.status))throw new le(he.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let l=await n.getTask(i,r);if(l){let c=Xc.parse({method:"notifications/tasks/status",params:l});await this.notification(c),Sa(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function fI(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gI(t,e){let r={...t};for(let n in e){let i=n,a=e[i];if(a===void 0)continue;let o=r[i];fI(o)&&fI(a)?r[i]={...o,...a}:r[i]=a}return r}var yO=ep(UP(),1),bO=ep(gO(),1);function J5(){let t=new yO.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bO.default)(t),t}var Zh=class{constructor(e){this._ajv=e??J5()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Kh=class{constructor(e){this._client=e}async*callToolStream(e,r=Ys,n){var i;let a=this._client,o={...n,task:(i=n?.task)!==null&&i!==void 0?i:a.isToolTask(e.name)?{}:void 0},s=a.requestStream({method:"tools/call",params:e},r,o),l=a.getToolOutputValidator(e.name);for await(let c of s){if(c.type==="result"&&l){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let d=l(u.structuredContent);if(!d.valid){yield{type:"error",error:new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof le){yield{type:"error",error:d};return}yield{type:"error",error:new le(he.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function vO(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function _O(t,e,r){var n,i;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((i=t.elicitation)===null||i===void 0)&&i.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Jh(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let a=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[i]=a.default),r[i]!==void 0&&Jh(a,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Jh(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Jh(r,e)}}function X5(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var nd=class extends Dm{constructor(e,r){var n,i;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(i=r?.jsonSchemaValidator)!==null&&i!==void 0?i:new Zh}get experimental(){return this._experimental||(this._experimental={tasks:new Kh(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=gI(this._capabilities,e)}setRequestHandler(e,r){var n,i,a;let o=bm(e),s=o?.method;if(!s)throw new Error("Schema is missing a method literal");let l;if(Ws(s)){let u=s,d=(n=u._zod)===null||n===void 0?void 0:n.def;l=(i=d?.value)!==null&&i!==void 0?i:u.value}else{let u=s,d=u._def;l=(a=d?.value)!==null&&a!==void 0?a:u.value}if(typeof l!="string")throw new Error("Schema method literal must be a string");let c=l;if(c==="elicitation/create"){let u=async(d,m)=>{var p,h,f;let y=Fn(qv,d);if(!y.success){let $=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid elicitation request: ${$}`)}let{params:g}=y.data,x=(p=g.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:v,supportsUrlMode:I}=X5(this._capabilities.elicitation);if(x==="form"&&!v)throw new le(he.InvalidParams,"Client does not support form-mode elicitation requests");if(x==="url"&&!I)throw new le(he.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,m));if(g.task){let $=Fn(uo,T);if(!$.success){let B=$.error instanceof Error?$.error.message:String($.error);throw new le(he.InvalidParams,`Invalid task creation result: ${B}`)}return $.data}let C=Fn(Wv,T);if(!C.success){let $=C.error instanceof Error?C.error.message:String(C.error);throw new le(he.InvalidParams,`Invalid elicitation result: ${$}`)}let M=C.data,W=x==="form"?g.requestedSchema:void 0;if(x==="form"&&M.action==="accept"&&M.content&&W&&!((f=(h=this._capabilities.elicitation)===null||h===void 0?void 0:h.form)===null||f===void 0)&&f.applyDefaults)try{Jh(W,M.content)}catch{}return M};return super.setRequestHandler(e,u)}if(c==="sampling/createMessage"){let u=async(d,m)=>{let p=Fn(Vv,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new le(he.InvalidParams,`Invalid sampling request: ${g}`)}let{params:h}=p.data,f=await Promise.resolve(r(d,m));if(h.task){let g=Fn(uo,f);if(!g.success){let x=g.error instanceof Error?g.error.message:String(g.error);throw new le(he.InvalidParams,`Invalid task creation result: ${x}`)}return g.data}let y=Fn(Hv,f);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid sampling result: ${g}`)}return y.data};return super.setRequestHandler(e,u)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Ks,capabilities:this._capabilities,clientInfo:this._clientInfo}},Av,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!KC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,a,o;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;vO((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&_O((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},co,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Zv,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},co,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Bv,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Mv,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Rv,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Nv,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Dv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},co,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},co,r)}async callTool(e,r=Ys,n){if(this.isToolTaskRequired(e.name))throw new le(he.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),a=this.getToolOutputValidator(e.name);if(a){if(!i.structuredContent&&!i.isError)throw new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let o=a(i.structuredContent);if(!o.valid)throw new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${o.errorMessage}`)}catch(o){throw o instanceof le?o:new le(he.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return i}isToolTask(e){var r,n,i,a;return!((a=(i=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||i===void 0?void 0:i.tools)===null||a===void 0)&&a.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let a=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,a)}let i=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(i==="required"||i==="optional")&&this._cachedKnownTaskTools.add(n.name),i==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},jv,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function Cl(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Xh(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...Cl(e.headers),...Cl(n.headers)}:e.headers};return t(r,i)}:t}var vk;vk=globalThis.crypto;async function Y5(t){return(await vk).getRandomValues(new Uint8Array(t))}async function Q5(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await Y5(t);for(let i=0;i<t;i++){let a=n[i]%e.length;r+=e[a]}return r}async function e9(t){return await Q5(t)}async function t9(t){let e=await(await vk).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function _k(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await e9(t),r=await t9(e);return{code_verifier:e,code_challenge:r}}var cr=MC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:WC.custom,message:"URL must be parseable",fatal:!0}),Vp}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),wO=hr({resource:w().url(),authorization_servers:V(cr).optional(),jwks_uri:w().url().optional(),scopes_supported:V(w()).optional(),bearer_methods_supported:V(w()).optional(),resource_signing_alg_values_supported:V(w()).optional(),resource_name:w().optional(),resource_documentation:w().optional(),resource_policy_uri:w().url().optional(),resource_tos_uri:w().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:V(w()).optional(),dpop_signing_alg_values_supported:V(w()).optional(),dpop_bound_access_tokens_required:mt().optional()}),Sk=hr({issuer:w(),authorization_endpoint:cr,token_endpoint:cr,registration_endpoint:cr.optional(),scopes_supported:V(w()).optional(),response_types_supported:V(w()),response_modes_supported:V(w()).optional(),grant_types_supported:V(w()).optional(),token_endpoint_auth_methods_supported:V(w()).optional(),token_endpoint_auth_signing_alg_values_supported:V(w()).optional(),service_documentation:cr.optional(),revocation_endpoint:cr.optional(),revocation_endpoint_auth_methods_supported:V(w()).optional(),revocation_endpoint_auth_signing_alg_values_supported:V(w()).optional(),introspection_endpoint:w().optional(),introspection_endpoint_auth_methods_supported:V(w()).optional(),introspection_endpoint_auth_signing_alg_values_supported:V(w()).optional(),code_challenge_methods_supported:V(w()).optional(),client_id_metadata_document_supported:mt().optional()}),r9=hr({issuer:w(),authorization_endpoint:cr,token_endpoint:cr,userinfo_endpoint:cr.optional(),jwks_uri:cr,registration_endpoint:cr.optional(),scopes_supported:V(w()).optional(),response_types_supported:V(w()),response_modes_supported:V(w()).optional(),grant_types_supported:V(w()).optional(),acr_values_supported:V(w()).optional(),subject_types_supported:V(w()),id_token_signing_alg_values_supported:V(w()),id_token_encryption_alg_values_supported:V(w()).optional(),id_token_encryption_enc_values_supported:V(w()).optional(),userinfo_signing_alg_values_supported:V(w()).optional(),userinfo_encryption_alg_values_supported:V(w()).optional(),userinfo_encryption_enc_values_supported:V(w()).optional(),request_object_signing_alg_values_supported:V(w()).optional(),request_object_encryption_alg_values_supported:V(w()).optional(),request_object_encryption_enc_values_supported:V(w()).optional(),token_endpoint_auth_methods_supported:V(w()).optional(),token_endpoint_auth_signing_alg_values_supported:V(w()).optional(),display_values_supported:V(w()).optional(),claim_types_supported:V(w()).optional(),claims_supported:V(w()).optional(),service_documentation:w().optional(),claims_locales_supported:V(w()).optional(),ui_locales_supported:V(w()).optional(),claims_parameter_supported:mt().optional(),request_parameter_supported:mt().optional(),request_uri_parameter_supported:mt().optional(),require_request_uri_registration:mt().optional(),op_policy_uri:cr.optional(),op_tos_uri:cr.optional(),client_id_metadata_document_supported:mt().optional()}),kO=F({...r9.shape,...Sk.pick({code_challenge_methods_supported:!0}).shape}),xO=F({access_token:w(),id_token:w().optional(),token_type:w(),expires_in:wm.number().optional(),scope:w().optional(),refresh_token:w().optional()}).strip(),EO=F({error:w(),error_description:w().optional(),error_uri:w().optional()}),SO=cr.optional().or(ee("").transform(()=>{})),n9=F({redirect_uris:V(cr),token_endpoint_auth_method:w().optional(),grant_types:V(w()).optional(),response_types:V(w()).optional(),client_name:w().optional(),client_uri:cr.optional(),logo_uri:SO,scope:w().optional(),contacts:V(w()).optional(),tos_uri:SO,policy_uri:w().optional(),jwks_uri:cr.optional(),jwks:LC().optional(),software_id:w().optional(),software_version:w().optional(),software_statement:w().optional()}).strip(),i9=F({client_id:w(),client_secret:w().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),TO=n9.merge(i9),Hde=F({error:w(),error_description:w().optional()}).strip(),qde=F({token:w(),token_type_hint:w().optional()}).strip();function CO(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function IO({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(a)}var Dt=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},id=class extends Dt{};id.errorCode="invalid_request";var No=class extends Dt{};No.errorCode="invalid_client";var Oo=class extends Dt{};Oo.errorCode="invalid_grant";var Do=class extends Dt{};Do.errorCode="unauthorized_client";var ad=class extends Dt{};ad.errorCode="unsupported_grant_type";var od=class extends Dt{};od.errorCode="invalid_scope";var sd=class extends Dt{};sd.errorCode="access_denied";var Ki=class extends Dt{};Ki.errorCode="server_error";var ld=class extends Dt{};ld.errorCode="temporarily_unavailable";var cd=class extends Dt{};cd.errorCode="unsupported_response_type";var ud=class extends Dt{};ud.errorCode="unsupported_token_type";var dd=class extends Dt{};dd.errorCode="invalid_token";var pd=class extends Dt{};pd.errorCode="method_not_allowed";var md=class extends Dt{};md.errorCode="too_many_requests";var Mo=class extends Dt{};Mo.errorCode="invalid_client_metadata";var hd=class extends Dt{};hd.errorCode="insufficient_scope";var fd=class extends Dt{};fd.errorCode="invalid_target";var AO={[id.errorCode]:id,[No.errorCode]:No,[Oo.errorCode]:Oo,[Do.errorCode]:Do,[ad.errorCode]:ad,[od.errorCode]:od,[sd.errorCode]:sd,[Ki.errorCode]:Ki,[ld.errorCode]:ld,[cd.errorCode]:cd,[ud.errorCode]:ud,[dd.errorCode]:dd,[pd.errorCode]:pd,[md.errorCode]:md,[Mo.errorCode]:Mo,[hd.errorCode]:hd,[fd.errorCode]:fd};var Rr=class extends Error{constructor(e){super(e??"Unauthorized")}};function a9(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var wk="code",kk="S256";function o9(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&a9(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function s9(t,e,r,n){let{client_id:i,client_secret:a}=e;switch(t){case"client_secret_basic":l9(i,a,r);return;case"client_secret_post":c9(i,a,n);return;case"none":u9(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function l9(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function c9(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function u9(t,e){e.set("client_id",t)}async function RO(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=EO.parse(JSON.parse(r)),{error:i,error_description:a,error_uri:o}=n,s=AO[i]||Ki;return new s(a||"",o)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ki(i)}}async function Ji(t,e){var r,n;try{return await xk(t,e)}catch(i){if(i instanceof No||i instanceof Do)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await xk(t,e);if(i instanceof Oo)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await xk(t,e);throw i}}async function xk(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:a}){var o,s;let l,c;try{l=await m9(e,{resourceMetadataUrl:i},a),l.authorization_servers&&l.authorization_servers.length>0&&(c=l.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await p9(e,t,l),d=await b9(c,{fetchFn:a}),m=await Promise.resolve(t.clientInformation());if(!m){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let x=d?.client_id_metadata_document_supported===!0,v=t.clientMetadataUrl;if(v&&!d9(v))throw new Mo(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(x&&v)m={client_id:v},await((o=t.saveClientInformation)===null||o===void 0?void 0:o.call(t,m));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let T=await k9(c,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(T),m=T}}let p=!t.redirectUrl;if(r!==void 0||p){let x=await w9(t,c,{metadata:d,resource:u,authorizationCode:r,fetchFn:a});return await t.saveTokens(x),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let x=await S9(c,{metadata:d,clientInformation:m,refreshToken:h.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(x),"AUTHORIZED"}catch(x){if(!(!(x instanceof Dt)||x instanceof Ki))throw x}let f=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await v9(c,{metadata:d,clientInformation:m,state:f,redirectUrl:t.redirectUrl,scope:n||((s=l?.scopes_supported)===null||s===void 0?void 0:s.join(" "))||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function d9(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function p9(t,e,r){let n=CO(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!IO({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Il(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=Ek(t,"resource_metadata")||void 0,a;if(i)try{a=new URL(i)}catch{}let o=Ek(t,"scope")||void 0,s=Ek(t,"error")||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function Ek(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function m9(t,e,r=fetch){var n,i;let a=await g9(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!a||a.status===404)throw await((n=a?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!a.ok)throw await((i=a.body)===null||i===void 0?void 0:i.cancel()),new Error(`HTTP ${a.status} trying to load well-known OAuth protected resource metadata.`);return wO.parse(await a.json())}async function Tk(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Tk(t,void 0,r):void 0;throw n}}function h9(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function PO(t,e,r=fetch){return await Tk(t,{"MCP-Protocol-Version":e},r)}function f9(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function g9(t,e,r,n){var i,a;let o=new URL(t),s=(i=n?.protocolVersion)!==null&&i!==void 0?i:Ks,l;if(n?.metadataUrl)l=new URL(n.metadataUrl);else{let u=h9(e,o.pathname);l=new URL(u,(a=n?.metadataServerUrl)!==null&&a!==void 0?a:o),l.search=o.search}let c=await PO(l,s,r);if(!n?.metadataUrl&&f9(c,o.pathname)){let u=new URL(`/.well-known/${e}`,o);c=await PO(u,s,r)}return c}function y9(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function b9(t,{fetchFn:e=fetch,protocolVersion:r=Ks}={}){var n;let i={"MCP-Protocol-Version":r,Accept:"application/json"},a=y9(t);for(let{url:o,type:s}of a){let l=await Tk(o,i,e);if(l){if(!l.ok){if(await((n=l.body)===null||n===void 0?void 0:n.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?Sk.parse(await l.json()):kO.parse(await l.json())}}}async function v9(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:a,resource:o}){let s;if(e){if(s=new URL(e.authorization_endpoint),!e.response_types_supported.includes(wk))throw new Error(`Incompatible auth server: does not support response type ${wk}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(kk))throw new Error(`Incompatible auth server: does not support code challenge method ${kk}`)}else s=new URL("/authorize",t);let l=await _k(),c=l.code_verifier,u=l.code_challenge;return s.searchParams.set("response_type",wk),s.searchParams.set("client_id",r.client_id),s.searchParams.set("code_challenge",u),s.searchParams.set("code_challenge_method",kk),s.searchParams.set("redirect_uri",String(n)),a&&s.searchParams.set("state",a),i&&s.searchParams.set("scope",i),i?.includes("offline_access")&&s.searchParams.append("prompt","consent"),o&&s.searchParams.set("resource",o.href),{authorizationUrl:s,codeVerifier:c}}function _9(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function NO(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:o}){var s;let l=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(a&&r.set("resource",a.href),i)await i(c,r,l,e);else if(n){let d=(s=e?.token_endpoint_auth_methods_supported)!==null&&s!==void 0?s:[],m=o9(n,d);s9(m,n,c,r)}let u=await(o??fetch)(l,{method:"POST",headers:c,body:r});if(!u.ok)throw await RO(u);return xO.parse(await u.json())}async function S9(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:a,fetchFn:o}){let s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await NO(t,{metadata:e,tokenRequestParams:s,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:o});return{refresh_token:n,...l}}async function w9(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:a}={}){let o=t.clientMetadata.scope,s;if(t.prepareTokenRequest&&(s=await t.prepareTokenRequest(o)),!s){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();s=_9(i,c,t.redirectUrl)}let l=await t.clientInformation();return NO(e,{metadata:r,tokenRequestParams:s,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:a})}async function k9(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let a=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await RO(a);return TO.parse(await a.json())}var Yh=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Ck(t){}function Qh(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ck,onError:r=Ck,onRetry:n=Ck,onComment:i}=t,a="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[g,x]=x9(`${a}${y}`);for(let v of g)d(v);a=x,o=!1}function d(f){if(f===""){p();return}if(f.startsWith(":")){i&&i(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let g=f.slice(0,y),x=f[y+1]===" "?2:1,v=f.slice(y+x);m(g,v,f);return}m(f,"",f)}function m(f,y,g){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3311
|
+
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new Yh(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:g}));break;default:r(new Yh(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:y,line:g}));break}}function p(){l.length>0&&e({id:s,event:c||void 0,data:l.endsWith(`
|
|
3312
|
+
`)?l.slice(0,-1):l}),s=void 0,l="",c=""}function h(f={}){a&&f.consume&&d(a),o=!0,s=void 0,l="",c="",a=""}return{feed:u,reset:h}}function x9(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),a=t.indexOf(`
|
|
3313
|
+
`,n),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i!==-1?o=i:a!==-1&&(o=a),o===-1){r=t.slice(n);break}else{let s=t.slice(n,o);e.push(s),n=o+1,t[n-1]==="\r"&&t[n]===`
|
|
3314
|
+
`&&n++}}return[e,r]}var ef=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(a){i=Qh({onEvent:o=>{a.enqueue(o)},onError(o){e==="terminate"?a.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:n})},transform(a){i.feed(a)}})}};var E9={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},$a=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},tf=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Xh(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:E9}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Cl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i,a;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let l=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!l.ok){if(await((i=l.body)===null||i===void 0?void 0:i.cancel()),l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new $a(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:a}=r,o,s=!1,l=!1;(async()=>{var u,d,m,p;try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new ef({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){let{value:g,done:x}=await h.read();if(x)break;if(g.id&&(o=g.id,s=!0,i?.(g.id)),!!g.data&&(!g.event||g.event==="message"))try{let v=Js.parse(JSON.parse(g.data));lo(v)&&(l=!0,a!==void 0&&(v.id=a)),(u=this.onmessage)===null||u===void 0||u.call(this,v)}catch(v){(d=this.onerror)===null||d===void 0||d.call(this,v)}}(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(h){if((m=this.onerror)===null||m===void 0||m.call(this,new Error(`SSE stream disconnected: ${h}`)),(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(g){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,a,o,s,l,c;try{let{resumptionToken:u,onresumptiontoken:d}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:qc(e)?e.id:void 0}).catch(v=>{var I;return(I=this.onerror)===null||I===void 0?void 0:I.call(this,v)});return}let m=await this._commonHeaders();m.set("content-type","application/json"),m.set("accept","application/json, text/event-stream");let p={...this._requestInit,method:"POST",headers:m,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},h=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,p),f=h.headers.get("mcp-session-id");if(f&&(this._sessionId=f),!h.ok){let v=await h.text().catch(()=>null);if(h.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $a(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:I,scope:T}=Il(h);if(this._resourceMetadataUrl=I,this._scope=T,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(h.status===403&&this._authProvider){let{resourceMetadataUrl:I,scope:T,error:C}=Il(h);if(C==="insufficient_scope"){let M=h.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===M)throw new $a(403,"Server returned 403 after trying upscoping");if(T&&(this._scope=T),I&&(this._resourceMetadataUrl=I),this._lastUpscopingHeader=M??void 0,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rr;return this.send(e)}}throw new $a(h.status,`Error POSTing to endpoint: ${v}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,h.status===202){await((a=h.body)===null||a===void 0?void 0:a.cancel()),oI(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var I;return(I=this.onerror)===null||I===void 0?void 0:I.call(this,v)});return}let g=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,x=h.headers.get("content-type");if(g)if(x?.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:d},!1);else if(x?.includes("application/json")){let v=await h.json(),I=Array.isArray(v)?v.map(T=>Js.parse(T)):[Js.parse(v)];for(let T of I)(o=this.onmessage)===null||o===void 0||o.call(this,T)}else throw await((s=h.body)===null||s===void 0?void 0:s.cancel()),new $a(-1,`Unexpected content type: ${x}`);else await((l=h.body)===null||l===void 0?void 0:l.cancel())}catch(u){throw(c=this.onerror)===null||c===void 0||c.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,i;if(this._sessionId)try{let a=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(await((n=s.body)===null||n===void 0?void 0:n.cancel()),!s.ok&&s.status!==405)throw new $a(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var nf=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(OO(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(OO(this),r)}};function T9(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Ik(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Ik).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Ik(t.cause)}`:t.message:`${t}`}function OO(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var MO=t=>{throw TypeError(t)},$k=(t,e,r)=>e.has(t)||MO("Cannot "+r),De=(t,e,r)=>($k(t,e,"read from private field"),r?r.call(t):e.get(t)),Vt=(t,e,r)=>e.has(t)?MO("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),wt=(t,e,r,n)=>($k(t,e,"write to private field"),e.set(t,r),r),Xi=(t,e,r)=>($k(t,e,"access private method"),r),Wr,$o,Al,rf,af,bd,Nl,vd,La,Pl,Ol,Rl,gd,Kn,Ak,Pk,Rk,DO,Nk,Ok,yd,Dk,Mk,Lo=class extends EventTarget{constructor(e,r){var n,i;super(),Vt(this,Kn),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Vt(this,Wr),Vt(this,$o),Vt(this,Al),Vt(this,rf),Vt(this,af),Vt(this,bd),Vt(this,Nl),Vt(this,vd,null),Vt(this,La),Vt(this,Pl),Vt(this,Ol,null),Vt(this,Rl,null),Vt(this,gd,null),Vt(this,Pk,async a=>{var o;De(this,Pl).reset();let{body:s,redirected:l,status:c,headers:u}=a;if(c===204){Xi(this,Kn,yd).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?wt(this,Al,new URL(a.url)):wt(this,Al,void 0),c!==200){Xi(this,Kn,yd).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Xi(this,Kn,yd).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.OPEN);let d=new Event("open");if((o=De(this,gd))==null||o.call(this,d),this.dispatchEvent(d),typeof s!="object"||!s||!("getReader"in s)){Xi(this,Kn,yd).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,p=s.getReader(),h=!0;do{let{done:f,value:y}=await p.read();y&&De(this,Pl).feed(m.decode(y,{stream:!f})),f&&(h=!1,De(this,Pl).reset(),Xi(this,Kn,Dk).call(this))}while(h)}),Vt(this,Rk,a=>{wt(this,La,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Xi(this,Kn,Dk).call(this,Ik(a))}),Vt(this,Nk,a=>{typeof a.id=="string"&&wt(this,vd,a.id);let o=new MessageEvent(a.event||"message",{data:a.data,origin:De(this,Al)?De(this,Al).origin:De(this,$o).origin,lastEventId:a.id||""});De(this,Rl)&&(!a.event||a.event==="message")&&De(this,Rl).call(this,o),this.dispatchEvent(o)}),Vt(this,Ok,a=>{wt(this,bd,a)}),Vt(this,Mk,()=>{wt(this,Nl,void 0),De(this,Wr)===this.CONNECTING&&Xi(this,Kn,Ak).call(this)});try{if(e instanceof URL)wt(this,$o,e);else if(typeof e=="string")wt(this,$o,new URL(e,C9()));else throw new Error("Invalid URL")}catch{throw T9("An invalid or illegal string was specified")}wt(this,Pl,Qh({onEvent:De(this,Nk),onRetry:De(this,Ok)})),wt(this,Wr,this.CONNECTING),wt(this,bd,3e3),wt(this,af,(n=r?.fetch)!=null?n:globalThis.fetch),wt(this,rf,(i=r?.withCredentials)!=null?i:!1),Xi(this,Kn,Ak).call(this)}get readyState(){return De(this,Wr)}get url(){return De(this,$o).href}get withCredentials(){return De(this,rf)}get onerror(){return De(this,Ol)}set onerror(e){wt(this,Ol,e)}get onmessage(){return De(this,Rl)}set onmessage(e){wt(this,Rl,e)}get onopen(){return De(this,gd)}set onopen(e){wt(this,gd,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){De(this,Nl)&&clearTimeout(De(this,Nl)),De(this,Wr)!==this.CLOSED&&(De(this,La)&&De(this,La).abort(),wt(this,Wr,this.CLOSED),wt(this,La,void 0))}};Wr=new WeakMap,$o=new WeakMap,Al=new WeakMap,rf=new WeakMap,af=new WeakMap,bd=new WeakMap,Nl=new WeakMap,vd=new WeakMap,La=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,Rl=new WeakMap,gd=new WeakMap,Kn=new WeakSet,Ak=function(){wt(this,Wr,this.CONNECTING),wt(this,La,new AbortController),De(this,af)(De(this,$o),Xi(this,Kn,DO).call(this)).then(De(this,Pk)).catch(De(this,Rk))},Pk=new WeakMap,Rk=new WeakMap,DO=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...De(this,vd)?{"Last-Event-ID":De(this,vd)}:void 0},cache:"no-store",signal:(t=De(this,La))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Nk=new WeakMap,Ok=new WeakMap,yd=function(t,e){var r;De(this,Wr)!==this.CLOSED&&wt(this,Wr,this.CLOSED);let n=new nf("error",{code:e,message:t});(r=De(this,Ol))==null||r.call(this,n),this.dispatchEvent(n)},Dk=function(t,e){var r;if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.CONNECTING);let n=new nf("error",{code:e,message:t});(r=De(this,Ol))==null||r.call(this,n),this.dispatchEvent(n),wt(this,Nl,setTimeout(De(this,Mk),De(this,bd)))},Mk=new WeakMap,Lo.CONNECTING=0,Lo.OPEN=1,Lo.CLOSED=2;function C9(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Lk=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},of=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Xh(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Cl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((a,o)=>{this._eventSource=new Lo(this._url.href,{...this._eventSourceInit,fetch:async(s,l)=>{let c=await this._commonHeaders();c.set("Accept","text/event-stream");let u=await i(s,{...l,headers:c});if(u.status===401&&u.headers.has("www-authenticate")){let{resourceMetadataUrl:d,scope:m}=Il(u);this._resourceMetadataUrl=d,this._scope=m}return u}}),this._abortController=new AbortController,this._eventSource.onerror=s=>{var l;if(s.code===401&&this._authProvider){this._authThenStart().then(a,o);return}let c=new Lk(s.code,s.message,s);o(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",s=>{var l;let c=s;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){o(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}a()}),this._eventSource.onmessage=s=>{var l,c;let u=s,d;try{d=Js.parse(JSON.parse(u.data))}catch(m){(l=this.onerror)===null||l===void 0||l.call(this,m);return}(c=this.onmessage)===null||c===void 0||c.call(this,d)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i,a;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},l=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!l.ok){let c=await l.text().catch(()=>null);if(l.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=Il(l);if(this._resourceMetadataUrl=u,this._scope=d,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}await((i=l.body)===null||i===void 0?void 0:i.cancel())}catch(o){throw(a=this.onerror)===null||a===void 0||a.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}};var Yi={name:"@intelliweave/embedded",version:"2.0.70",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.60.0","@modelcontextprotocol/sdk":"^1.24.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ht=new Re("MCPKnowledgeClient"),sf=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ht.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new nd({name:Yi.name,version:Yi.version}),n=new tf(new URL(this.config.baseURL));return await r.connect(n),Ht.debug("Connected with HTTP streaming mode"),r}).catch(async r=>{let n=new nd({name:Yi.name,version:Yi.version}),i=new of(new URL(this.config.baseURL));return await n.connect(i),Ht.debug("Connected with SSE mode"),n});return await this.disconnect(),this.client=e,e.onerror=r=>{Ht.error(`MCP client error: ${r.message}`)},e.onclose=()=>{Ht.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(Gv,r=>{r.params.level=="critical"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="error"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="warning"?Ht.warn(`[Server] ${r.params.data}`):r.params.level=="info"?Ht.info(`[Server] ${r.params.data}`):r.params.level=="debug"?Ht.debug(`[Server] ${r.params.data}`):Ht.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(Uv,r=>{Ht.debug("Tool list changed",r),this.fetchTools()}),Ht.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let i=await this.client.listTools({cursor:r});r=i.nextCursor;for(let a of i.tools||[])e.push(a);if(!i?.tools?.length||!r)break}let n=[];for(let i of e){let a=!!(this.config.searchToolName&&i.name==this.config.searchToolName&&!this.config.searchToolVisible);n.push({id:i.name,name:i.name,content:i.description||"",type:"action",isContext:!0,parameters:i.inputSchema,action:o=>this.performToolCall(i.name,o),disabled:a})}Ht.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,Ht.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(a=>a.name==this.config.searchToolName);if(!n)return Ht.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let a=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let a=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];r.push({id:this.config.id+":"+this.config.searchToolName+":"+a,name:`Search result ${a+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),Ht.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw Ht.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var A9=new Re("Statistics"),_d=[];async function Nr(t,e){let r={...e,event_id:_t(),event_date:new Date().toISOString(),sdk_version:Yi.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(_d.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),_d.length===0))return;let n=_d.slice();_d.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){A9.warn("Failed to submit analytics event:",i),_d.push(...n);return}}var zo=new Re("KnowledgeBase"),zk=1,lf=class t{constructor(e){this._sources=[{id:"core.internal",query:async()=>PT(this.ai)}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${zk++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return ht().knowledgeBaseSources&&(e=e.concat(ht().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(r=>!r.disabled),e}async search(e){let r=Date.now();zo.debug(`Searching knowledge base for: ${e}`);let n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],typeof document<"u"&&document.dispatchEvent(n),this._windowSources=n.sources;let a=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),d=await c.query(e);return zo.debug(`Source '${c.id}' took ${Date.now()-u}ms`),d||[]}catch(u){return zo.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();a=a.concat(n.entries),a=a.concat(this.manualEntries),ht().knowledgeBase&&(a=a.concat(ht().knowledgeBase)),a=a.filter(c=>c&&!c.disabled);for(let c=0;c<a.length;c++){let u=a[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=d=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=d=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let o=new AT({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});o.addAll(a);let l=o.search(e).map(c=>a.find(u=>u.id==c.id));for(let c of a)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Nr(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),zo.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${zk++}`),zo.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],a=!0,o=async(l,c)=>{zo.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){zo.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>o(c,d)})}};this.registerSource(r,async l=>{if(a&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,i.includes(l)||i.push(l),s(d.items),n})}clone(){let e=new t(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${zk++}`);let r=new sf(e);return this.registerSource(e.id,n=>r.search(n)),r}};var cf=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
3282
3315
|
|
|
3283
|
-
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(
|
|
3316
|
+
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(r.toLowerCase().includes("true"))return!0;if(r.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+r)}async choose(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
3284
3317
|
|
|
3285
3318
|
Reply only with one of the following options:
|
|
3286
|
-
${e.options.map(
|
|
3319
|
+
${e.options.map(n=>`- "${n}"`).join(`
|
|
3287
3320
|
`)}
|
|
3288
3321
|
|
|
3289
|
-
Do not include any additional text or explanations.`});return e.options.includes(
|
|
3322
|
+
Do not include any additional text or explanations.`});return e.options.includes(r)?r:e.options.find(n=>r.toLowerCase().includes(n.toLowerCase()))}async extract(e){let r=`
|
|
3290
3323
|
You will receive some data. Extraction instructions: ${e.instruction}
|
|
3291
3324
|
|
|
3292
3325
|
${e.allowMultiple?"Return a JSONL string only, one JSON object on each line.":"Return a valid JSON object only."}
|
|
3293
3326
|
|
|
3294
3327
|
Objects should have the following keys:
|
|
3295
|
-
${e.extractions.map(
|
|
3328
|
+
${e.extractions.map(i=>`- ${i.name} (${i.type}): ${i.description||"No description provided."}`).join(`
|
|
3296
3329
|
`)}
|
|
3297
|
-
`,
|
|
3298
|
-
`).map(
|
|
3299
|
-
You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time).${
|
|
3330
|
+
`,n=await this.instruct({...e,instruction:r});if(n=n.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),e.allowMultiple){let i=n.split(`
|
|
3331
|
+
`).map(o=>o.trim()).filter(o=>!!o.trim()),a=[];for(let o of i)try{a.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return a}else return[JSON.parse(n.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let r=this.ai.clone();return r.resetConversation(),r.getContextPrefix=async()=>e.instruction,e.callback&&r.addEventListener("output",n=>{e.callback(n.detail.message)}),e.allowKB||(r.knowledgeBase._sources=[]),await r.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var Jn=new Re("Main"),$O=new Set,Fo=class Fo extends EventTarget{constructor(){super(...arguments);this.conversationID=_t();this.knowledgeBase=new lf(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new cf(this);this.userID=oE();this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1;this._lastTrackedTokens=0}get loaded(){return!!(this.config&&this.currentModel)}get flags(){return this.config?.flags||{}}getBuiltInActionsInfo(){return{version:Fo.builtInActionsVersion,availableActions:["ui.openURL - Open URLs in new tabs","ui.changeRoute - Change page routes","ui.sendEmail - Send emails via mailto links","search - Search knowledge base"],enabledFlags:this.flags}}async load(r){if(this.apiKey=r,!r)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Jn.debug("Loading configuration...");let n=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:r})});if(!n.ok)throw new Error(`Failed to load configuration: ${n.status} ${n.statusText}`);try{this.config=await n.json(),Jn.debug("Config loaded successfully:",this.config),this.config&&Jn.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(i){Jn.error("Failed to parse JSON response:",i);try{let a=await n.clone().text();Jn.error("Raw response that failed parsing:",a)}catch{Jn.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${i}`)}})(),(async()=>{try{let n=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!n.ok)throw new Error(`Failed to load VAD model: ${n.status} ${n.statusText}`);this.vadModel=await n.blob()}catch(n){Jn.warn(`Failed to load VAD model, some features will be unavailable. ${n.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let n of this.config.knowledge||[])n.url&&n.backendType=="mcp"?this.knowledgeBase.registerMCPSource({id:n.id,searchToolName:n.mcpSearchToolName,baseURL:n.url}):n.url&&this.knowledgeBase.registerSourceFromURL(n.url);for(let n of this.config.knowledge||[])n.entries?.length&&this.knowledgeBase.registerSource(n.id,()=>n.entries||[]);if(this.config.mcpServers)for(let n of this.config.mcpServers)this.knowledgeBase.registerMCPSource(n);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(n){throw Jn.warn("Failed to load:",n),this.error=n,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:n}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:n}})),n}}setModel(r){let n=this.models.find(a=>a.id==r);if(!n)throw new Error(`Model with ID "${r}" not found.`);let i={...n.config,stream:!0,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(a,o)=>{let s=this.knowledgeBase.getCachedEntry(a);this.onAIToolStart?.(s?.id||a,o)}};n.config.providerID==="anthropic"?this.currentModel=new Lp(i):this.currentModel=new up(i),this.currentModel.id=n.id,this.currentModel.metadata=n}async getContextPrefix(){let r=ht().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof r=="function"&&(r=await r()),r}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let r=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;let n=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:n}),this.currentModel.contextGroup.add({id:"_iw_kb_only_rule",sortOrder:2,cannotRemove:!0,disabled:!this.flags.onlyUseKnowledgeBase,content:"Important rule: Only use knowledge from your knowledge base to answer questions, do not speak about anything that is not included in your knowledge base."}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:`# Knowledge Database
|
|
3332
|
+
You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time).${r.length==0?`
|
|
3300
3333
|
|
|
3301
|
-
(no items found)`:""}`});for(let a of
|
|
3302
|
-
${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeof a.content=="function"?a.content():a.content),params:Cp(a.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!a.removeFromMessageHistory,callback:o=>this.toolRunKBAction(a,o),kb:a};this.currentModel.registerTool(s)}else continue;let n=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=n&&(this._lastSystemMsg=n,this.submitAnalyticsEvent({type:"system-msg",txt:n}))}processIncomingMessage(t,i){if(!i){let n=this.currentModel?.stats?.tokensUsed||0,a=n-(this._lastTrackedTokens||0);this._lastTrackedTokens=n,wt(this,{event_type:"message_receive",value:a,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:n}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:i,message:t}})),this.onAIMessage?.(t,!!i)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return mr.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{this._messageStartTime=Date.now(),Mf.has(this.conversationID)||(Mf.add(this.conversationID),wt(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,wt(this,{event_type:"message_send",value_str:"",event_properties:{message_length:t.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),this.submitAnalyticsEvent({type:"message",role:"user",message:t,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()});let i=await this.currentModel.sendMessage(t);return i&&typeof i=="string"&&i.trim().length>0&&this.submitAnalyticsEvent({type:"message",role:"assistant",message:i,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()}),i}finally{this.isProcessing=!1}}async toolRunKBAction(t,i){let n=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:i,ai:this}}));let a=await t.action(i,this),s=Date.now()-n;return wt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:i,execution_time_ms:s,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,result:a}})),a}catch(a){let s=Date.now()-n;throw wt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:i,execution_time_ms:s,success:!1,error_message:a.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,error:a}})),a}}submitAnalyticsEvent(t){Be().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(i=>{mr.debug("Failed to submit analytics event:",i)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=Ge(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(t)}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let i of t.messages)this.currentModel.messageGroup.add({id:Ge(),content:JSON.stringify(i),customData:i})}clone(){let t=new Zn;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.knowledgeBase=this.knowledgeBase.clone(),t}};Zn.version=Wr.version,Zn.builtInActionsVersion="1.0.0",mr.debug("\u{1F6A8}\u{1F6A8}\u{1F6A8} NEW SDK BUILD LOADED - Built-in Actions Version:",Zn.builtInActionsVersion);var ea=Zn;var zt=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},i=""){this.register();let n=document.createElement(this.tagName);for(let a in t)n.setAttribute(a,t[a]);return n.onBeforeCreate(),n.innerHTML=i,n}static add(t={},i=""){this.register();let n=a=>a.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(t).map(a=>`${a}="${n(t[a]+"")}"`).join(" ")}>${i}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,i,n){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(t,i)=>this.getAttribute(i.toString())||"",set:(t,i,n)=>(this.getAttribute(i.toString())===n||(n?this.setAttribute(i.toString(),n):this.removeAttribute(i.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,i)=>this._state[i],set:(t,i,n)=>(this._state[i]=n,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let i=this.root?.getElementById(t);if(!i)throw new Error(`Child with ID ${t} not found`);return i}};zt.observedAttributes=[],zt.tagName="",zt._isRegistered=!1;var Of='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var Nf='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Lf='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Za=class extends zt{constructor(){super(...arguments);this.html=()=>`
|
|
3334
|
+
(no items found)`:""}`});for(let a of r)if(a.type=="info"||a.type=="tour"||a.type=="input-event"){let o=yg(typeof a.content=="function"?a.content():a.content);this.currentModel.contextGroup.add({id:a.id,customData:a,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:`## ${a.type}: ${a.name}
|
|
3335
|
+
${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:yg(typeof a.content=="function"?a.content():a.content),params:sE(a.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!a.removeFromMessageHistory,callback:s=>this.toolRunKBAction(a,s),kb:a};this.currentModel.registerTool(o)}else continue;let i=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=i&&(this._lastSystemMsg=i,this.submitAnalyticsEvent({type:"system-msg",txt:i}))}processIncomingMessage(r,n){if(!n){let i=this.currentModel?.stats?.tokensUsed||0,a=i-(this._lastTrackedTokens||0);this._lastTrackedTokens=i,Nr(this,{event_type:"message_receive",value:a,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:n,message:r}})),this.onAIMessage?.(r,!!n)}async sendMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Jn.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{this._messageStartTime=Date.now(),$O.has(this.conversationID)||($O.add(this.conversationID),Nr(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,Nr(this,{event_type:"message_send",value_str:"",event_properties:{message_length:r.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:r}})),this.submitAnalyticsEvent({type:"message",role:"user",message:r,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()});let n=await this.currentModel.sendMessage(r);return n&&typeof n=="string"&&n.trim().length>0&&this.submitAnalyticsEvent({type:"message",role:"assistant",message:n,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()}),n}finally{this.isProcessing=!1}}async toolRunKBAction(r,n){let i=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:r,input:n,ai:this}}));let a=await r.action(n,this),o=Date.now()-i;return Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,result:a}})),a}catch(a){let o=Date.now()-i;throw Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!1,error_message:a.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,error:a}})),a}}submitAnalyticsEvent(r){ht().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(n=>{Jn.debug("Failed to submit analytics event:",n)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=_t(),this._lastSystemMsg="")}insertAssistantMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(r)}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(r=>r.customData)}}importState(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(r?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${r.type}`);this.conversationID=r.conversationID;for(let n of r.messages)this.currentModel.messageGroup.add({id:_t(),content:JSON.stringify(n),customData:n})}clone(){let r=new Fo;return r.apiKey=this.apiKey,r.config=this.config,r.models=this.models,this.config?.id&&r.setModel(this.config.id),r.audio=this.audio,r.vadModel=this.vadModel,r.userID=this.userID,r.knowledgeBase=this.knowledgeBase.clone(),r}};Fo.version=Yi.version,Fo.builtInActionsVersion="1.0.0",Jn.debug("\u{1F6A8}\u{1F6A8}\u{1F6A8} NEW SDK BUILD LOADED - Built-in Actions Version:",Fo.builtInActionsVersion);var Dl=Fo;var an=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(r={},n=""){this.register();let i=document.createElement(this.tagName);for(let a in r)i.setAttribute(a,r[a]);return i.onBeforeCreate(),i.innerHTML=n,i}static add(r={},n=""){this.register();let i=a=>a.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(r).map(a=>`${a}="${i(r[a]+"")}"`).join(" ")}>${n}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(r,n,i){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(r,n)=>this.getAttribute(n.toString())||"",set:(r,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(r,n)=>this._state[n],set:(r,n,i)=>(this._state[n]=i,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(r){return!!this.root?.getElementById(r)}child(r){let n=this.root?.getElementById(r);if(!n)throw new Error(`Child with ID ${r} not found`);return n}};an.observedAttributes=[],an.tagName="",an._isRegistered=!1;var LO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var zO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var FO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Sd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3303
3336
|
|
|
3304
3337
|
<!-- Styling -->
|
|
3305
3338
|
<style>
|
|
@@ -3339,7 +3372,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3339
3372
|
}
|
|
3340
3373
|
|
|
3341
3374
|
:host #loader {
|
|
3342
|
-
background-image: url('${
|
|
3375
|
+
background-image: url('${LO}');
|
|
3343
3376
|
background-size: 64px 64px;
|
|
3344
3377
|
background-position: center;
|
|
3345
3378
|
background-repeat: no-repeat;
|
|
@@ -3362,7 +3395,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3362
3395
|
}
|
|
3363
3396
|
|
|
3364
3397
|
:host #microphone-button {
|
|
3365
|
-
background-image: url('${
|
|
3398
|
+
background-image: url('${zO}');
|
|
3366
3399
|
z-index: 2;
|
|
3367
3400
|
margin-right: -10px;
|
|
3368
3401
|
}
|
|
@@ -3386,7 +3419,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3386
3419
|
}
|
|
3387
3420
|
|
|
3388
3421
|
:host #cancel-speech-button {
|
|
3389
|
-
background-image: url('${
|
|
3422
|
+
background-image: url('${FO}');
|
|
3390
3423
|
z-index: 2;
|
|
3391
3424
|
}
|
|
3392
3425
|
|
|
@@ -3410,7 +3443,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3410
3443
|
<!-- Loader bar -->
|
|
3411
3444
|
<div id='loader'></div>
|
|
3412
3445
|
|
|
3413
|
-
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",
|
|
3446
|
+
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",r=>this.onInputKeyPress(r),{capture:!0}),this.child("input-field").addEventListener("keydown",r=>r.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",r=>this.onLLMButtonClick(r)),this.child("microphone-button").addEventListener("click",r=>this.onMicButtonClick(r)),this.child("cancel-speech-button").addEventListener("click",r=>this.onCancelSpeechButtonClick(r))}connectAI(r){this.ai=r,this.ai.audio?.speechRecognition.addEventListener("speech",n=>this.onSpeechEvent(n)),this.ai.audio?.speechRecognition.addEventListener("start",n=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",n=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let r=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;r&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!r&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(n=>n.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(r){if(r.stopPropagation(),r.key!="Enter")return;let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onLLMButtonClick(r){r.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(r){r.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let r="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(r="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(r="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(r="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(r="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(r="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(r="rgba(0, 255, 0, 0.5)");let n=this.ai?.audio?.speechRecognition.volumeLevel||0,i=30,a=6,o=Math.round(n*(i-a)+a),s=document.createElement("div");s.posX=50,s.style.cssText=`position: absolute; top: calc(50% - ${o}px/2); left: 0px; width: 6px; height: ${o}px; background-color: ${r}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(s),this.voiceAnimationPieces.push(s)}for(let r=0;r<this.voiceAnimationPieces.length;r++){let n=this.voiceAnimationPieces[r];n.posX+=2,n.style.transform=`translate(${n.posX}px, 0px)`,!(n.posX<400)&&(this.voiceAnimationPieces.splice(r--,1),n.remove())}}}onSpeechEvent(r){this.attr.loading||r.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:r.detail.transcript}))}onCancelSpeechButtonClick(r){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};Sd.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var BO='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var wd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3414
3447
|
|
|
3415
3448
|
<!-- Styling -->
|
|
3416
3449
|
<style>
|
|
@@ -3420,23 +3453,31 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3420
3453
|
}
|
|
3421
3454
|
|
|
3422
3455
|
#root {
|
|
3423
|
-
position:
|
|
3456
|
+
position: absolute;
|
|
3424
3457
|
top: 0px;
|
|
3425
|
-
|
|
3426
|
-
width:
|
|
3427
|
-
height:
|
|
3458
|
+
left: 0px;
|
|
3459
|
+
width: 100%;
|
|
3460
|
+
height: 100%;
|
|
3428
3461
|
z-index: 200001;
|
|
3429
|
-
transition:
|
|
3430
|
-
animation: web-weaver-logo-hover 5s infinite ease-in-out;
|
|
3462
|
+
transition: width 0.25s, height 0.25s;
|
|
3431
3463
|
cursor: pointer;
|
|
3432
3464
|
overflow: visible!important;
|
|
3433
3465
|
object-fit: contain;
|
|
3434
3466
|
}
|
|
3435
3467
|
|
|
3468
|
+
#root.focused-mode {
|
|
3469
|
+
position: fixed;
|
|
3470
|
+
transition: top 0.15s ease-out, left 0.15s ease-out, width 0.25s, height 0.25s;
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3436
3473
|
@keyframes web-weaver-logo-hover {
|
|
3437
|
-
0% { transform: translate(0px, -
|
|
3438
|
-
50% { transform: translate(0px,
|
|
3439
|
-
100% { transform: translate(0px, -
|
|
3474
|
+
0% { transform: translate(0px, -1px); }
|
|
3475
|
+
50% { transform: translate(0px, 1px); }
|
|
3476
|
+
100% { transform: translate(0px, -1px); }
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
#root:not(.focused-mode) {
|
|
3480
|
+
animation: web-weaver-logo-hover 5s infinite ease-in-out;
|
|
3440
3481
|
}
|
|
3441
3482
|
|
|
3442
3483
|
#root #web-weaver-logo {
|
|
@@ -3455,12 +3496,12 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3455
3496
|
<!-- Logo -->
|
|
3456
3497
|
<img id='root' />
|
|
3457
3498
|
|
|
3458
|
-
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let i=this.attr.logo||Bf;this._lastLogoSrc!=i&&(this._lastLogoSrc=i,t.src=i);let n=window.visualViewport?.offsetTop||0,a=window.visualViewport?.offsetLeft||0,s=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(s){let o=s.getBoundingClientRect();if(!o)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(o.x+o.width/2-128/2+a)+"px",t.style.top=Math.round(o.y+o.height/2-128/2+n)+"px"}else{let o=this.getBoundingClientRect();if(!o)return;t.style.width=o.width+"px",t.style.height=o.height+"px",t.style.left=Math.round(o.x+a)+"px",t.style.top=Math.round(o.y+n)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Qa.observedAttributes=["logo","focusID"];var Ff=typeof self=="object"?self:globalThis,PC=(r,e)=>{let t=(n,a)=>(r.set(a,n),n),i=n=>{if(r.has(n))return r.get(n);let[a,s]=e[n];switch(a){case 0:case-1:return t(s,n);case 1:{let o=t([],n);for(let l of s)o.push(i(l));return o}case 2:{let o=t({},n);for(let[l,c]of s)o[i(l)]=i(c);return o}case 3:return t(new Date(s),n);case 4:{let{source:o,flags:l}=s;return t(new RegExp(o,l),n)}case 5:{let o=t(new Map,n);for(let[l,c]of s)o.set(i(l),i(c));return o}case 6:{let o=t(new Set,n);for(let l of s)o.add(i(l));return o}case 7:{let{name:o,message:l}=s;return t(new Ff[o](l),n)}case 8:return t(BigInt(s),n);case"BigInt":return t(Object(BigInt(s)),n)}return t(new Ff[a](s),n)};return i},sd=r=>PC(new Map,r)(0);var ta="",{toString:DC}={},{keys:MC}=Object,ns=r=>{let e=typeof r;if(e!=="object"||!r)return[0,e];let t=DC.call(r).slice(8,-1);switch(t){case"Array":return[1,ta];case"Object":return[2,ta];case"Date":return[3,ta];case"RegExp":return[4,ta];case"Map":return[5,ta];case"Set":return[6,ta]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},dl=([r,e])=>r===0&&(e==="function"||e==="symbol"),OC=(r,e,t,i)=>{let n=(s,o)=>{let l=i.push(s)-1;return t.set(o,l),l},a=s=>{if(t.has(s))return t.get(s);let[o,l]=ns(s);switch(o){case 0:{let u=s;switch(l){case"bigint":o=8,u=s.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return n([-1],s)}return n([o,u],s)}case 1:{if(l)return n([l,[...s]],s);let u=[],p=n([o,u],s);for(let m of s)u.push(a(m));return p}case 2:{if(l)switch(l){case"BigInt":return n([l,s.toString()],s);case"Boolean":case"Number":case"String":return n([l,s.valueOf()],s)}if(e&&"toJSON"in s)return a(s.toJSON());let u=[],p=n([o,u],s);for(let m of MC(s))(r||!dl(ns(s[m])))&&u.push([a(m),a(s[m])]);return p}case 3:return n([o,s.toISOString()],s);case 4:{let{source:u,flags:p}=s;return n([o,{source:u,flags:p}],s)}case 5:{let u=[],p=n([o,u],s);for(let[m,d]of s)(r||!(dl(ns(m))||dl(ns(d))))&&u.push([a(m),a(d)]);return p}case 6:{let u=[],p=n([o,u],s);for(let m of s)(r||!dl(ns(m)))&&u.push(a(m));return p}}let{message:c}=s;return n([o,{name:l,message:c}],s)};return a},od=(r,{json:e,lossy:t}={})=>{let i=[];return OC(!(e||t),!!e,new Map,i)(r),i};var kr=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?sd(od(r,e)):structuredClone(r):(r,e)=>sd(od(r,e));var Cr=function(r,e,t,i,n){let a=xr(e);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(i!=null&&(!i.type||!i.children))throw new Error("Expected valid `parent`");if(t==null!=(i==null))throw new Error("Expected both `index` and `parent`");return Gf(r)?a.call(n,r,t,i):!1},xr=function(r){if(r==null)return BC;if(typeof r=="string")return LC(r);if(typeof r=="object")return NC(r);if(typeof r=="function")return ld(r);throw new Error("Expected function, string, or array as `test`")};function NC(r){let e=[],t=-1;for(;++t<r.length;)e[t]=xr(r[t]);return ld(i);function i(...n){let a=-1;for(;++a<e.length;)if(e[a].apply(this,n))return!0;return!1}}function LC(r){return ld(e);function e(t){return t.tagName===r}}function ld(r){return e;function e(t,i,n){return!!(Gf(t)&&r.call(this,t,typeof i=="number"?i:void 0,n||void 0))}}function BC(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function Gf(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}var FC=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,GC=/^[a-zA-Z]:\\/;function cd(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return GC.test(r)?!1:FC.test(r)}function zf(r){let e=String(r||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Uf(r){return r.join(" ").trim()}var ra=function(r){if(r==null)return VC;if(typeof r=="function")return pl(r);if(typeof r=="object")return Array.isArray(r)?zC(r):UC(r);if(typeof r=="string")return HC(r);throw new Error("Expected function, string, or object as test")};function zC(r){let e=[],t=-1;for(;++t<r.length;)e[t]=ra(r[t]);return pl(i);function i(...n){let a=-1;for(;++a<e.length;)if(e[a].apply(this,n))return!0;return!1}}function UC(r){let e=r;return pl(t);function t(i){let n=i,a;for(a in r)if(n[a]!==e[a])return!1;return!0}}function HC(r){return pl(e);function e(t){return t&&t.type===r}}function pl(r){return e;function e(t,i,n){return!!(WC(t)&&r.call(this,t,typeof i=="number"?i:void 0,n||void 0))}}function VC(){return!0}function WC(r){return r!==null&&typeof r=="object"&&"type"in r}var Hf=[],ud=!0,ml=!1,is="skip";function as(r,e,t,i){let n;typeof e=="function"&&typeof t!="function"?(i=t,t=e):n=e;let a=ra(n),s=i?-1:1;o(r,void 0,[])();function o(l,c,u){let p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){let d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=Hf,g,f,y;if((!e||a(l,c,u[u.length-1]||void 0))&&(d=jC(t(l,u)),d[0]===ml))return d;if("children"in l&&l.children){let b=l;if(b.children&&d[0]!==is)for(f=(i?b.children.length:-1)+s,y=u.concat(b);f>-1&&f<b.children.length;){let x=b.children[f];if(g=o(x,f,y)(),g[0]===ml)return g;f=typeof g[1]=="number"?g[1]:f+s}}return d}}}function jC(r){return Array.isArray(r)?r:typeof r=="number"?[ud,r]:r==null?Hf:[r]}function ss(r,e,t,i){let n,a,s;typeof e=="function"&&typeof t!="function"?(a=void 0,s=e,n=t):(a=e,s=t,n=i),as(r,a,o,n);function o(l,c){let u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return s(l,p,u)}}var qC=["http","https"],$C=["nofollow"],KC={};function hl(r){let e=r||KC,t=e.protocols||qC,i=xr(e.test);return function(n){ss(n,"element",function(a,s,o){if(a.tagName==="a"&&typeof a.properties.href=="string"&&i(a,s,o)){let l=a.properties.href;if(cd(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=os(e.content,a),u=c&&!Array.isArray(c)?[c]:c,p=os(e.rel,a)||$C,m=typeof p=="string"?zf(p):p,d=os(e.target,a),g=os(e.properties,a);if(g&&Object.assign(a.properties,kr(g)),m.length>0&&(a.properties.rel=[...m]),d&&(a.properties.target=d),u){let f=os(e.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:kr(f),children:kr(u)})}}}})}}function os(r,e){return typeof r=="function"?r(e):r}var Qn=xr(function(r){return r.tagName==="audio"||r.tagName==="canvas"||r.tagName==="embed"||r.tagName==="iframe"||r.tagName==="img"||r.tagName==="math"||r.tagName==="object"||r.tagName==="picture"||r.tagName==="svg"||r.tagName==="video"});var XC={}.hasOwnProperty;function dd(r,e){let t=r.type==="element"&&XC.call(r.properties,e)&&r.properties[e];return t!=null&&t!==!1}var YC=new Set(["pingback","prefetch","stylesheet"]);function pd(r){if(r.type!=="element"||r.tagName!=="link")return!1;if(r.properties.itemProp)return!0;let e=r.properties.rel,t=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++t<e.length;)if(!YC.has(String(e[t])))return!1;return!0}var JC=xr(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),ZC=xr("meta");function md(r){return!!(r.type==="text"||JC(r)||Qn(r)||pd(r)||ZC(r)&&dd(r,"itemProp"))}var QC=/[ \t\n\f\r]/g;function Ut(r){return typeof r=="object"?r.type==="text"?Vf(r.value):!1:Vf(r)}function Vf(r){return r.replace(QC,"")===""}var hd=["pre","script","style","textarea"];var Wf=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var jf=["button","input","select","textarea"];var qf=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var ex={},gd=ra(["doctype","comment"]);function gl(r){let t=ox((r||ex).newlines?ax:sx);return function(i){Kf(i,{collapse:t,whitespace:"normal"})}}function Kf(r,e){if("children"in r){let t={...e};return(r.type==="root"||Jf(r))&&(t.before=!0,t.after=!0),t.whitespace=lx(r,e),rx(r,t)}if(r.type==="text"){if(e.whitespace==="normal")return tx(r,e);e.whitespace==="nowrap"&&(r.value=e.collapse(r.value))}return{ignore:gd(r),stripAtStart:!1,remove:!1}}function tx(r,e){let t=e.collapse(r.value),i={ignore:!1,stripAtStart:!1,remove:!1},n=0,a=t.length;return e.before&&$f(t.charAt(0))&&n++,n!==a&&$f(t.charAt(a-1))&&(e.after?a--:i.stripAtStart=!0),n===a?i.remove=!0:r.value=t.slice(n,a),i}function rx(r,e){let t=e.before,i=e.after,n=r.children,a=n.length,s=-1;for(;++s<a;){let o=Kf(n[s],{...e,after:Xf(n,s,i),before:t});o.remove?(n.splice(s,1),s--,a--):o.ignore||(t=o.stripAtStart),Yf(n[s])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||i),remove:!1}}function Xf(r,e,t){for(;++e<r.length;){let i=r[e],n=nx(i);if(n===void 0&&"children"in i&&!ix(i)&&(n=Xf(i.children,-1)),typeof n=="boolean")return n}return t}function nx(r){if(r.type==="element"){if(Yf(r))return!1;if(Jf(r))return!0}else if(r.type==="text"){if(!Ut(r))return!1}else if(!gd(r))return!1}function Yf(r){return Qn(r)||Cr(r,jf)}function Jf(r){return Cr(r,Wf)}function ix(r){return!!(r.type==="element"&&r.properties.hidden)||gd(r)||Cr(r,qf)}function $f(r){return r===" "||r===`
|
|
3459
|
-
`}function
|
|
3460
|
-
`)&&(
|
|
3499
|
+
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),100)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let r=this.child("root");if(!r)return;let n=this.attr.logo||BO;this._lastLogoSrc!=n&&(this._lastLogoSrc=n,r.src=n);let i=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(i){let a=window.visualViewport?.offsetTop||0,o=window.visualViewport?.offsetLeft||0,s=i.getBoundingClientRect();if(!s)return;r.classList.add("focused-mode"),r.style.width="128px",r.style.height="128px",r.style.left=Math.round(s.x+s.width/2-128/2+o)+"px",r.style.top=Math.round(s.y+s.height/2-128/2+a)+"px"}else r.classList.remove("focused-mode"),r.style.width="",r.style.height="",r.style.left="",r.style.top=""}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};wd.observedAttributes=["logo","focusID"];var jO=typeof self=="object"?self:globalThis,D9=(t,e)=>{let r=(i,a)=>(t.set(a,i),i),n=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case-1:return r(o,i);case 1:{let s=r([],i);for(let l of o)s.push(n(l));return s}case 2:{let s=r({},i);for(let[l,c]of o)s[n(l)]=n(c);return s}case 3:return r(new Date(o),i);case 4:{let{source:s,flags:l}=o;return r(new RegExp(s,l),i)}case 5:{let s=r(new Map,i);for(let[l,c]of o)s.set(n(l),n(c));return s}case 6:{let s=r(new Set,i);for(let l of o)s.add(n(l));return s}case 7:{let{name:s,message:l}=o;return r(new jO[s](l),i)}case 8:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i)}return r(new jO[a](o),i)};return n},Uk=t=>D9(new Map,t)(0);var Ml="",{toString:M9}={},{keys:$9}=Object,Td=t=>{let e=typeof t;if(e!=="object"||!t)return[0,e];let r=M9.call(t).slice(8,-1);switch(r){case"Array":return[1,Ml];case"Object":return[2,Ml];case"Date":return[3,Ml];case"RegExp":return[4,Ml];case"Map":return[5,Ml];case"Set":return[6,Ml]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},hf=([t,e])=>t===0&&(e==="function"||e==="symbol"),L9=(t,e,r,n)=>{let i=(o,s)=>{let l=n.push(o)-1;return r.set(s,l),l},a=o=>{if(r.has(o))return r.get(o);let[s,l]=Td(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],o)}return i([s,u],o)}case 1:{if(l)return i([l,[...o]],o);let u=[],d=i([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return a(o.toJSON());let u=[],d=i([s,u],o);for(let m of $9(o))(t||!hf(Td(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return i([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return i([s,{source:u,flags:d}],o)}case 5:{let u=[],d=i([s,u],o);for(let[m,p]of o)(t||!(hf(Td(m))||hf(Td(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=i([s,u],o);for(let m of o)(t||!hf(Td(m)))&&u.push(a(m));return d}}let{message:c}=o;return i([s,{name:l,message:c}],o)};return a},Gk=(t,{json:e,lossy:r}={})=>{let n=[];return L9(!(e||r),!!e,new Map,n)(t),n};var gi=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Uk(Gk(t,e)):structuredClone(t):(t,e)=>Uk(Gk(t,e));var yi=function(t,e,r,n,i){let a=bi(e);if(r!=null&&(typeof r!="number"||r<0||r===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(n!=null&&(!n.type||!n.children))throw new Error("Expected valid `parent`");if(r==null!=(n==null))throw new Error("Expected both `index` and `parent`");return UO(t)?a.call(i,t,r,n):!1},bi=function(t){if(t==null)return B9;if(typeof t=="string")return F9(t);if(typeof t=="object")return z9(t);if(typeof t=="function")return Vk(t);throw new Error("Expected function, string, or array as `test`")};function z9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=bi(t[r]);return Vk(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function F9(t){return Vk(e);function e(r){return r.tagName===t}}function Vk(t){return e;function e(r,n,i){return!!(UO(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function B9(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function UO(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}var j9=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,U9=/^[a-zA-Z]:\\/;function Hk(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return U9.test(t)?!1:j9.test(t)}function GO(t){let e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function VO(t){return t.join(" ").trim()}var $l=function(t){if(t==null)return q9;if(typeof t=="function")return ff(t);if(typeof t=="object")return Array.isArray(t)?G9(t):V9(t);if(typeof t=="string")return H9(t);throw new Error("Expected function, string, or object as test")};function G9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=$l(t[r]);return ff(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function V9(t){let e=t;return ff(r);function r(n){let i=n,a;for(a in t)if(i[a]!==e[a])return!1;return!0}}function H9(t){return ff(e);function e(r){return r&&r.type===t}}function ff(t){return e;function e(r,n,i){return!!(W9(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function q9(){return!0}function W9(t){return t!==null&&typeof t=="object"&&"type"in t}var HO=[],qk=!0,gf=!1,Cd="skip";function Id(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;let a=$l(i),o=n?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=HO,h,f,y;if((!e||a(l,c,u[u.length-1]||void 0))&&(p=Z9(r(l,u)),p[0]===gf))return p;if("children"in l&&l.children){let g=l;if(g.children&&p[0]!==Cd)for(f=(n?g.children.length:-1)+o,y=u.concat(g);f>-1&&f<g.children.length;){let x=g.children[f];if(h=s(x,f,y)(),h[0]===gf)return h;f=typeof h[1]=="number"?h[1]:f+o}}return p}}}function Z9(t){return Array.isArray(t)?t:typeof t=="number"?[qk,t]:t==null?HO:[t]}function Ad(t,e,r,n){let i,a,o;typeof e=="function"&&typeof r!="function"?(a=void 0,o=e,i=r):(a=e,o=r,i=n),Id(t,a,s,i);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var K9=["http","https"],J9=["nofollow"],X9={};function yf(t){let e=t||X9,r=e.protocols||K9,n=bi(e.test);return function(i){Ad(i,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&n(a,o,s)){let l=a.properties.href;if(Hk(l)?r.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Pd(e.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Pd(e.rel,a)||J9,m=typeof d=="string"?GO(d):d,p=Pd(e.target,a),h=Pd(e.properties,a);if(h&&Object.assign(a.properties,gi(h)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let f=Pd(e.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:gi(f),children:gi(u)})}}}})}}function Pd(t,e){return typeof t=="function"?t(e):t}var Bo=bi(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"});var Y9={}.hasOwnProperty;function Wk(t,e){let r=t.type==="element"&&Y9.call(t.properties,e)&&t.properties[e];return r!=null&&r!==!1}var Q9=new Set(["pingback","prefetch","stylesheet"]);function Zk(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;let e=t.properties.rel,r=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++r<e.length;)if(!Q9.has(String(e[r])))return!1;return!0}var eZ=bi(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),tZ=bi("meta");function Kk(t){return!!(t.type==="text"||eZ(t)||Bo(t)||Zk(t)||tZ(t)&&Wk(t,"itemProp"))}var rZ=/[ \t\n\f\r]/g;function on(t){return typeof t=="object"?t.type==="text"?qO(t.value):!1:qO(t)}function qO(t){return t.replace(rZ,"")===""}var Jk=["pre","script","style","textarea"];var WO=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var ZO=["button","input","select","textarea"];var KO=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nZ={},Xk=$l(["doctype","comment"]);function bf(t){let r=uZ((t||nZ).newlines?lZ:cZ);return function(n){XO(n,{collapse:r,whitespace:"normal"})}}function XO(t,e){if("children"in t){let r={...e};return(t.type==="root"||e1(t))&&(r.before=!0,r.after=!0),r.whitespace=dZ(t,e),aZ(t,r)}if(t.type==="text"){if(e.whitespace==="normal")return iZ(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Xk(t),stripAtStart:!1,remove:!1}}function iZ(t,e){let r=e.collapse(t.value),n={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=r.length;return e.before&&JO(r.charAt(0))&&i++,i!==a&&JO(r.charAt(a-1))&&(e.after?a--:n.stripAtStart=!0),i===a?n.remove=!0:t.value=r.slice(i,a),n}function aZ(t,e){let r=e.before,n=e.after,i=t.children,a=i.length,o=-1;for(;++o<a;){let s=XO(i[o],{...e,after:YO(i,o,n),before:r});s.remove?(i.splice(o,1),o--,a--):s.ignore||(r=s.stripAtStart),QO(i[o])&&(r=!1)}return{ignore:!1,stripAtStart:!!(r||n),remove:!1}}function YO(t,e,r){for(;++e<t.length;){let n=t[e],i=oZ(n);if(i===void 0&&"children"in n&&!sZ(n)&&(i=YO(n.children,-1)),typeof i=="boolean")return i}return r}function oZ(t){if(t.type==="element"){if(QO(t))return!1;if(e1(t))return!0}else if(t.type==="text"){if(!on(t))return!1}else if(!Xk(t))return!1}function QO(t){return Bo(t)||yi(t,ZO)}function e1(t){return yi(t,WO)}function sZ(t){return!!(t.type==="element"&&t.properties.hidden)||Xk(t)||yi(t,KO)}function JO(t){return t===" "||t===`
|
|
3500
|
+
`}function lZ(t){let e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function cZ(){return" "}function uZ(t){return e;function e(r){return String(r).replace(/[\t\n\v\f\r ]+/g,t)}}function dZ(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap";default:}return e.whitespace}var pZ={},mZ=bf({newlines:!0});function vf(t){let e=t||pZ,r=e.indent||2,n=e.indentInitial;return typeof r=="number"&&(r=" ".repeat(r)),n==null&&(n=!0),function(o){let s;mZ(o),Id(o,function(l,c){let u=-1;if(!("children"in l))return;if(yi(l,"head")&&(s=!0),s&&yi(l,"body")&&(s=void 0),yi(l,Jk))return Cd;let d=l.children,m=c.length;if(d.length===0||!Yk(l,s))return;n||m--;let p;for(;++u<d.length;){let y=d[u];(y.type==="text"||y.type==="comment")&&(y.value.includes(`
|
|
3501
|
+
`)&&(p=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(r).repeat(m)))}let h=[],f;for(u=-1;++u<d.length;){let y=d[u];(Yk(y,s)||p&&!u)&&(i(h,m,y),p=!0),f=y,h.push(y)}f&&(p||Yk(f,s))&&(on(f)&&(h.pop(),f=h[h.length-1]),i(h,m-1)),l.children=h})};function i(o,s,l){let c=o[o.length-1],u=c&&on(c)?o[o.length-2]:c,d=(a(u)&&a(l)?`
|
|
3461
3502
|
|
|
3462
3503
|
`:`
|
|
3463
|
-
`)+String(t).repeat(Math.max(o,0));c&&c.type==="text"?c.value=Ut(c)?p:c.value+p:s.push({type:"text",value:p})}function a(s){return!!(s&&s.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(s.tagName))}}function fd(r,e){return r.type==="root"||(r.type==="element"?e||Cr(r,"script")||Qn(r)||!md(r):!1)}var Zf=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var jr=class{constructor(e,t,i){this.property=e,this.normal=t,i&&(this.space=i)}};jr.prototype.property={};jr.prototype.normal={};jr.prototype.space=null;function yd(r,e){let t={},i={},n=-1;for(;++n<r.length;)Object.assign(t,r[n].property),Object.assign(i,r[n].normal);return new jr(t,i,e)}function ls(r){return r.toLowerCase()}var bt=class{constructor(e,t){this.property=e,this.attribute=t}};bt.prototype.space=null;bt.prototype.boolean=!1;bt.prototype.booleanish=!1;bt.prototype.overloadedBoolean=!1;bt.prototype.number=!1;bt.prototype.commaSeparated=!1;bt.prototype.spaceSeparated=!1;bt.prototype.commaOrSpaceSeparated=!1;bt.prototype.mustUseProperty=!1;bt.prototype.defined=!1;var cs={};uc(cs,{boolean:()=>oe,booleanish:()=>qe,commaOrSpaceSeparated:()=>Mt,commaSeparated:()=>hn,number:()=>V,overloadedBoolean:()=>bd,spaceSeparated:()=>Ie});var dx=0,oe=ei(),qe=ei(),bd=ei(),V=ei(),Ie=ei(),hn=ei(),Mt=ei();function ei(){return 2**++dx}var vd=Object.keys(cs),ti=class extends bt{constructor(e,t,i,n){let a=-1;if(super(e,t),Qf(this,"space",n),typeof i=="number")for(;++a<vd.length;){let s=vd[a];Qf(this,vd[a],(i&cs[s])===cs[s])}}};ti.prototype.defined=!0;function Qf(r,e,t){t&&(r[e]=t)}var px={}.hasOwnProperty;function ir(r){let e={},t={},i;for(i in r.properties)if(px.call(r.properties,i)){let n=r.properties[i],a=new ti(i,r.transform(r.attributes||{},i),n,r.space);r.mustUseProperty&&r.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),e[i]=a,t[ls(i)]=i,t[ls(a.attribute)]=i}return new jr(e,t,r.space)}var _d=ir({space:"xlink",transform(r,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Sd=ir({space:"xml",transform(r,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function yl(r,e){return e in r?r[e]:e}function bl(r,e){return yl(r,e.toLowerCase())}var Ed=ir({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:bl,properties:{xmlns:null,xmlnsXLink:null}});var wd=ir({transform(r,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:qe,ariaAutoComplete:null,ariaBusy:qe,ariaChecked:qe,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:Ie,ariaCurrent:null,ariaDescribedBy:Ie,ariaDetails:null,ariaDisabled:qe,ariaDropEffect:Ie,ariaErrorMessage:null,ariaExpanded:qe,ariaFlowTo:Ie,ariaGrabbed:qe,ariaHasPopup:null,ariaHidden:qe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ie,ariaLevel:V,ariaLive:null,ariaModal:qe,ariaMultiLine:qe,ariaMultiSelectable:qe,ariaOrientation:null,ariaOwns:Ie,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:qe,ariaReadOnly:qe,ariaRelevant:null,ariaRequired:qe,ariaRoleDescription:Ie,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:qe,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null}});var ey=ir({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:bl,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hn,acceptCharset:Ie,accessKey:Ie,action:null,allow:null,allowFullScreen:oe,allowPaymentRequest:oe,allowUserMedia:oe,alt:null,as:null,async:oe,autoCapitalize:null,autoComplete:Ie,autoFocus:oe,autoPlay:oe,blocking:Ie,capture:null,charSet:null,checked:oe,cite:null,className:Ie,cols:V,colSpan:null,content:null,contentEditable:qe,controls:oe,controlsList:Ie,coords:V|hn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oe,defer:oe,dir:null,dirName:null,disabled:oe,download:bd,draggable:qe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oe,formTarget:null,headers:Ie,height:V,hidden:oe,high:V,href:null,hrefLang:null,htmlFor:Ie,httpEquiv:Ie,id:null,imageSizes:null,imageSrcSet:null,inert:oe,inputMode:null,integrity:null,is:null,isMap:oe,itemId:null,itemProp:Ie,itemRef:Ie,itemScope:oe,itemType:Ie,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oe,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:oe,muted:oe,name:null,nonce:null,noModule:oe,noValidate:oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oe,optimum:V,pattern:null,ping:Ie,placeholder:null,playsInline:oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oe,referrerPolicy:null,rel:Ie,required:oe,reversed:oe,rows:V,rowSpan:V,sandbox:Ie,scope:null,scoped:oe,seamless:oe,selected:oe,shadowRootClonable:oe,shadowRootDelegatesFocus:oe,shadowRootMode:null,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:qe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:oe,useMap:null,value:qe,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ie,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oe,declare:oe,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:oe,noHref:oe,noShade:oe,noWrap:oe,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:qe,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:oe,disableRemotePlayback:oe,prefix:null,property:null,results:V,security:null,unselectable:null}});var ty=ir({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:yl,properties:{about:Mt,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:Ie,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hn,g2:hn,glyphName:hn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Mt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ie,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mt,rev:Mt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mt,requiredFeatures:Mt,requiredFonts:Mt,requiredFormats:Mt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Mt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mt,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var mx=/^data[-\w.:]+$/i,ry=/-[a-z]/g,hx=/[A-Z]/g;function kd(r,e){let t=ls(e),i=e,n=bt;if(t in r.normal)return r.property[r.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&mx.test(e)){if(e.charAt(4)==="-"){let a=e.slice(5).replace(ry,fx);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=e.slice(4);if(!ry.test(a)){let s=a.replace(hx,gx);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}n=ti}return new n(i,e)}function gx(r){return"-"+r.toLowerCase()}function fx(r){return r.charAt(1).toUpperCase()}var ny=yd([Sd,_d,Ed,wd,ey],"html"),vl=yd([Sd,_d,Ed,wd,ty],"svg");var iy={}.hasOwnProperty;function ay(r,e){let t=e||{};function i(n,...a){let s=i.invalid,o=i.handlers;if(n&&iy.call(n,r)){let l=String(n[r]);s=iy.call(o,l)?o[l]:i.unknown}if(s)return s.call(this,n,...a)}return i.handlers=t.handlers||{},i.invalid=t.invalid,i.unknown=t.unknown,i}var yx=/["&'<>`]/g,bx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,vx=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,_x=/[|\\{}()[\]^$+*?.]/g,sy=new WeakMap;function oy(r,e){if(r=r.replace(e.subset?Sx(e.subset):yx,i),e.subset||e.escapeOnly)return r;return r.replace(bx,t).replace(vx,i);function t(n,a,s){return e.format((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)-56320+65536,s.charCodeAt(a+2),e)}function i(n,a,s){return e.format(n.charCodeAt(0),s.charCodeAt(a+1),e)}}function Sx(r){let e=sy.get(r);return e||(e=Ex(r),sy.set(r,e)),e}function Ex(r){let e=[],t=-1;for(;++t<r.length;)e.push(r[t].replace(_x,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var wx=/[\dA-Fa-f]/;function ly(r,e,t){let i="&#x"+r.toString(16).toUpperCase();return t&&e&&!wx.test(String.fromCharCode(e))?i:i+";"}var kx=/\d/;function cy(r,e,t){let i="&#"+String(r);return t&&e&&!kx.test(String.fromCharCode(e))?i:i+";"}var uy=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var _l={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var dy=["cent","copy","divide","gt","lt","not","para","times"];var py={}.hasOwnProperty,Cd={},Sl;for(Sl in _l)py.call(_l,Sl)&&(Cd[_l[Sl]]=Sl);var Cx=/[^\dA-Za-z]/;function my(r,e,t,i){let n=String.fromCharCode(r);if(py.call(Cd,n)){let a=Cd[n],s="&"+a;return t&&uy.includes(a)&&!dy.includes(a)&&(!i||e&&e!==61&&Cx.test(String.fromCharCode(e)))?s:s+";"}return""}function hy(r,e,t){let i=ly(r,e,t.omitOptionalSemicolons),n;if((t.useNamedReferences||t.useShortestReferences)&&(n=my(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!n)&&t.useShortestReferences){let a=cy(r,e,t.omitOptionalSemicolons);a.length<i.length&&(i=a)}return n&&(!t.useShortestReferences||n.length<i.length)?n:i}function qr(r,e){return oy(r,Object.assign({format:hy},e))}var xx=/^>|^->|<!--|-->|--!>|<!-$/g,Tx=[">"],Ax=["<",">"];function gy(r,e,t,i){return i.settings.bogusComments?"<?"+qr(r.value,Object.assign({},i.settings.characterReferences,{subset:Tx}))+">":"<!--"+r.value.replace(xx,n)+"-->";function n(a){return qr(a,Object.assign({},i.settings.characterReferences,{subset:Ax}))}}function fy(r,e,t,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function xd(r,e){let t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let i=0,n=t.indexOf(e);for(;n!==-1;)i++,n=t.indexOf(e,n+e.length);return i}function yy(r,e){let t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var Ke=by(1),Td=by(-1),Ix=[];function by(r){return e;function e(t,i,n){let a=t?t.children:Ix,s=(i||0)+r,o=a[s];if(!n)for(;o&&Ut(o);)s+=r,o=a[s];return o}}var Rx={}.hasOwnProperty;function El(r){return e;function e(t,i,n){return Rx.call(r,t.tagName)&&r[t.tagName](t,i,n)}}var us=El({body:Dx,caption:Ad,colgroup:Ad,dd:Lx,dt:Nx,head:Ad,html:Px,li:Ox,optgroup:Bx,option:Fx,p:Mx,rp:vy,rt:vy,tbody:zx,td:_y,tfoot:Ux,th:_y,thead:Gx,tr:Hx});function Ad(r,e,t){let i=Ke(t,e,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&Ut(i.value.charAt(0)))}function Px(r,e,t){let i=Ke(t,e);return!i||i.type!=="comment"}function Dx(r,e,t){let i=Ke(t,e);return!i||i.type!=="comment"}function Mx(r,e,t){let i=Ke(t,e);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Ox(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&i.tagName==="li"}function Nx(r,e,t){let i=Ke(t,e);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function Lx(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function vy(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function Bx(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&i.tagName==="optgroup"}function Fx(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function Gx(r,e,t){let i=Ke(t,e);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function zx(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function Ux(r,e,t){return!Ke(t,e)}function Hx(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&i.tagName==="tr"}function _y(r,e,t){let i=Ke(t,e);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}var Sy=El({body:jx,colgroup:qx,head:Wx,html:Vx,tbody:$x});function Vx(r){let e=Ke(r,-1);return!e||e.type!=="comment"}function Wx(r){let e=r.children,t=[],i=-1;for(;++i<e.length;){let n=e[i];if(n.type==="element"&&(n.tagName==="title"||n.tagName==="base")){if(t.includes(n.tagName))return!1;t.push(n.tagName)}}return e.length>0}function jx(r){let e=Ke(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Ut(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function qx(r,e,t){let i=Td(t,e),n=Ke(r,-1,!0);return t&&i&&i.type==="element"&&i.tagName==="colgroup"&&us(i,t.children.indexOf(i),t)?!1:!!(n&&n.type==="element"&&n.tagName==="col")}function $x(r,e,t){let i=Td(t,e),n=Ke(r,-1);return t&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&us(i,t.children.indexOf(i),t)?!1:!!(n&&n.type==="element"&&n.tagName==="tr")}var wl={name:[[`
|
|
3504
|
+
`)+String(r).repeat(Math.max(s,0));c&&c.type==="text"?c.value=on(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function Yk(t,e){return t.type==="root"||(t.type==="element"?e||yi(t,"script")||Bo(t)||!Kk(t):!1)}var t1=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Qi=class{constructor(e,r,n){this.property=e,this.normal=r,n&&(this.space=n)}};Qi.prototype.property={};Qi.prototype.normal={};Qi.prototype.space=null;function Qk(t,e){let r={},n={},i=-1;for(;++i<t.length;)Object.assign(r,t[i].property),Object.assign(n,t[i].normal);return new Qi(r,n,e)}function Rd(t){return t.toLowerCase()}var Sr=class{constructor(e,r){this.property=e,this.attribute=r}};Sr.prototype.space=null;Sr.prototype.boolean=!1;Sr.prototype.booleanish=!1;Sr.prototype.overloadedBoolean=!1;Sr.prototype.number=!1;Sr.prototype.commaSeparated=!1;Sr.prototype.spaceSeparated=!1;Sr.prototype.commaOrSpaceSeparated=!1;Sr.prototype.mustUseProperty=!1;Sr.prototype.defined=!1;var Nd={};rc(Nd,{boolean:()=>ye,booleanish:()=>It,commaOrSpaceSeparated:()=>Zr,commaSeparated:()=>za,number:()=>z,overloadedBoolean:()=>ex,spaceSeparated:()=>tt});var hZ=0,ye=jo(),It=jo(),ex=jo(),z=jo(),tt=jo(),za=jo(),Zr=jo();function jo(){return 2**++hZ}var tx=Object.keys(Nd),Uo=class extends Sr{constructor(e,r,n,i){let a=-1;if(super(e,r),r1(this,"space",i),typeof n=="number")for(;++a<tx.length;){let o=tx[a];r1(this,tx[a],(n&Nd[o])===Nd[o])}}};Uo.prototype.defined=!0;function r1(t,e,r){r&&(t[e]=r)}var fZ={}.hasOwnProperty;function In(t){let e={},r={},n;for(n in t.properties)if(fZ.call(t.properties,n)){let i=t.properties[n],a=new Uo(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),e[n]=a,r[Rd(n)]=n,r[Rd(a.attribute)]=n}return new Qi(e,r,t.space)}var rx=In({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var nx=In({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function _f(t,e){return e in t?t[e]:e}function Sf(t,e){return _f(t,e.toLowerCase())}var ix=In({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Sf,properties:{xmlns:null,xmlnsXLink:null}});var ax=In({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:tt,ariaCurrent:null,ariaDescribedBy:tt,ariaDetails:null,ariaDisabled:It,ariaDropEffect:tt,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:tt,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tt,ariaLevel:z,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:tt,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:tt,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:It,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null}});var n1=In({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Sf,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:za,acceptCharset:tt,accessKey:tt,action:null,allow:null,allowFullScreen:ye,allowPaymentRequest:ye,allowUserMedia:ye,alt:null,as:null,async:ye,autoCapitalize:null,autoComplete:tt,autoFocus:ye,autoPlay:ye,blocking:tt,capture:null,charSet:null,checked:ye,cite:null,className:tt,cols:z,colSpan:null,content:null,contentEditable:It,controls:ye,controlsList:tt,coords:z|za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ye,defer:ye,dir:null,dirName:null,disabled:ye,download:ex,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ye,formTarget:null,headers:tt,height:z,hidden:ye,high:z,href:null,hrefLang:null,htmlFor:tt,httpEquiv:tt,id:null,imageSizes:null,imageSrcSet:null,inert:ye,inputMode:null,integrity:null,is:null,isMap:ye,itemId:null,itemProp:tt,itemRef:tt,itemScope:ye,itemType:tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ye,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:ye,muted:ye,name:null,nonce:null,noModule:ye,noValidate:ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ye,optimum:z,pattern:null,ping:tt,placeholder:null,playsInline:ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ye,referrerPolicy:null,rel:tt,required:ye,reversed:ye,rows:z,rowSpan:z,sandbox:tt,scope:null,scoped:ye,seamless:ye,selected:ye,shadowRootClonable:ye,shadowRootDelegatesFocus:ye,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:ye,useMap:null,value:It,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tt,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ye,declare:ye,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:ye,noHref:ye,noShade:ye,noWrap:ye,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ye,disableRemotePlayback:ye,prefix:null,property:null,results:z,security:null,unselectable:null}});var i1=In({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:_f,properties:{about:Zr,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:za,g2:za,glyphName:za,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:Zr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zr,rev:Zr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zr,requiredFeatures:Zr,requiredFonts:Zr,requiredFormats:Zr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:Zr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zr,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var gZ=/^data[-\w.:]+$/i,a1=/-[a-z]/g,yZ=/[A-Z]/g;function ox(t,e){let r=Rd(e),n=e,i=Sr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&gZ.test(e)){if(e.charAt(4)==="-"){let a=e.slice(5).replace(a1,vZ);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=e.slice(4);if(!a1.test(a)){let o=a.replace(yZ,bZ);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Uo}return new i(n,e)}function bZ(t){return"-"+t.toLowerCase()}function vZ(t){return t.charAt(1).toUpperCase()}var o1=Qk([nx,rx,ix,ax,n1],"html"),wf=Qk([nx,rx,ix,ax,i1],"svg");var s1={}.hasOwnProperty;function l1(t,e){let r=e||{};function n(i,...a){let o=n.invalid,s=n.handlers;if(i&&s1.call(i,t)){let l=String(i[t]);o=s1.call(s,l)?s[l]:n.unknown}if(o)return o.call(this,i,...a)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}var _Z=/["&'<>`]/g,SZ=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wZ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,kZ=/[|\\{}()[\]^$+*?.]/g,c1=new WeakMap;function u1(t,e){if(t=t.replace(e.subset?xZ(e.subset):_Z,n),e.subset||e.escapeOnly)return t;return t.replace(SZ,r).replace(wZ,n);function r(i,a,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),e)}function n(i,a,o){return e.format(i.charCodeAt(0),o.charCodeAt(a+1),e)}}function xZ(t){let e=c1.get(t);return e||(e=EZ(t),c1.set(t,e)),e}function EZ(t){let e=[],r=-1;for(;++r<t.length;)e.push(t[r].replace(kZ,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var TZ=/[\dA-Fa-f]/;function d1(t,e,r){let n="&#x"+t.toString(16).toUpperCase();return r&&e&&!TZ.test(String.fromCharCode(e))?n:n+";"}var CZ=/\d/;function p1(t,e,r){let n="&#"+String(t);return r&&e&&!CZ.test(String.fromCharCode(e))?n:n+";"}var m1=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var kf={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var h1=["cent","copy","divide","gt","lt","not","para","times"];var f1={}.hasOwnProperty,sx={},xf;for(xf in kf)f1.call(kf,xf)&&(sx[kf[xf]]=xf);var IZ=/[^\dA-Za-z]/;function g1(t,e,r,n){let i=String.fromCharCode(t);if(f1.call(sx,i)){let a=sx[i],o="&"+a;return r&&m1.includes(a)&&!h1.includes(a)&&(!n||e&&e!==61&&IZ.test(String.fromCharCode(e)))?o:o+";"}return""}function y1(t,e,r){let n=d1(t,e,r.omitOptionalSemicolons),i;if((r.useNamedReferences||r.useShortestReferences)&&(i=g1(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!i)&&r.useShortestReferences){let a=p1(t,e,r.omitOptionalSemicolons);a.length<n.length&&(n=a)}return i&&(!r.useShortestReferences||i.length<n.length)?i:n}function ea(t,e){return u1(t,Object.assign({format:y1},e))}var AZ=/^>|^->|<!--|-->|--!>|<!-$/g,PZ=[">"],RZ=["<",">"];function b1(t,e,r,n){return n.settings.bogusComments?"<?"+ea(t.value,Object.assign({},n.settings.characterReferences,{subset:PZ}))+">":"<!--"+t.value.replace(AZ,i)+"-->";function i(a){return ea(a,Object.assign({},n.settings.characterReferences,{subset:RZ}))}}function v1(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function lx(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function _1(t,e){let r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}var Mt=S1(1),cx=S1(-1),NZ=[];function S1(t){return e;function e(r,n,i){let a=r?r.children:NZ,o=(n||0)+t,s=a[o];if(!i)for(;s&&on(s);)o+=t,s=a[o];return s}}var OZ={}.hasOwnProperty;function Ef(t){return e;function e(r,n,i){return OZ.call(t,r.tagName)&&t[r.tagName](r,n,i)}}var Od=Ef({body:MZ,caption:ux,colgroup:ux,dd:FZ,dt:zZ,head:ux,html:DZ,li:LZ,optgroup:BZ,option:jZ,p:$Z,rp:w1,rt:w1,tbody:GZ,td:k1,tfoot:VZ,th:k1,thead:UZ,tr:HZ});function ux(t,e,r){let n=Mt(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&on(n.value.charAt(0)))}function DZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function MZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function $Z(t,e,r){let n=Mt(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function LZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="li"}function zZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function FZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function w1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function BZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function jZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function UZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function GZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function VZ(t,e,r){return!Mt(r,e)}function HZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function k1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var x1=Ef({body:ZZ,colgroup:KZ,head:WZ,html:qZ,tbody:JZ});function qZ(t){let e=Mt(t,-1);return!e||e.type!=="comment"}function WZ(t){let e=t.children,r=[],n=-1;for(;++n<e.length;){let i=e[n];if(i.type==="element"&&(i.tagName==="title"||i.tagName==="base")){if(r.includes(i.tagName))return!1;r.push(i.tagName)}}return e.length>0}function ZZ(t){let e=Mt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&on(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function KZ(t,e,r){let n=cx(r,e),i=Mt(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&Od(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function JZ(t,e,r){let n=cx(r,e),i=Mt(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Od(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var Tf={name:[[`
|
|
3464
3505
|
\f\r &/=>`.split(""),`
|
|
3465
3506
|
\f\r "&'/=>\``.split("")],[`\0
|
|
3466
3507
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -3468,19 +3509,19 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3468
3509
|
\f\r &>`.split(""),`\0
|
|
3469
3510
|
\f\r "&'<=>\``.split("")],[`\0
|
|
3470
3511
|
\f\r "&'<=>\``.split(""),`\0
|
|
3471
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Ey(r,e,t,i){let n=i.schema,a=n.space==="svg"?!1:i.settings.omitOptionalTags,s=n.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(r.tagName.toLowerCase()),o=[],l;n.space==="html"&&r.tagName==="svg"&&(i.schema=vl);let c=Kx(i,r.properties),u=i.all(n.space==="html"&&r.tagName==="template"?r.content:r);return i.schema=n,u&&(s=!1),(c||!a||!Sy(r,e,t))&&(o.push("<",r.tagName,c?" "+c:""),s&&(n.space==="svg"||i.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!i.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(u),!s&&(!a||!us(r,e,t))&&o.push("</"+r.tagName+">"),o.join("")}function Kx(r,e){let t=[],i=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let a=Xx(r,n,e[n]);a&&t.push(a)}}for(;++i<t.length;){let a=r.settings.tightAttributes?t[i].charAt(t[i].length-1):void 0;i!==t.length-1&&a!=='"'&&a!=="'"&&(t[i]+=" ")}return t.join("")}function Xx(r,e,t){let i=kd(r.schema,e),n=r.settings.allowParseErrors&&r.schema.space==="html"?0:1,a=r.settings.allowDangerousCharacters?0:1,s=r.quote,o;if(i.overloadedBoolean&&(t===i.attribute||t==="")?t=!0:(i.boolean||i.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=qr(i.attribute,Object.assign({},r.settings.characterReferences,{subset:wl.name[n][a]}));return t===!0||(t=Array.isArray(t)?(i.commaSeparated?yy:Uf)(t,{padLeft:!r.settings.tightCommaSeparatedLists}):String(t),r.settings.collapseEmptyAttributes&&!t)?l:(r.settings.preferUnquoted&&(o=qr(t,Object.assign({},r.settings.characterReferences,{attribute:!0,subset:wl.unquoted[n][a]}))),o!==t&&(r.settings.quoteSmart&&xd(t,s)>xd(t,r.alternative)&&(s=r.alternative),o=s+qr(t,Object.assign({},r.settings.characterReferences,{subset:(s==="'"?wl.single:wl.double)[n][a],attribute:!0}))+s),l+(o&&"="+o))}var Yx=["<","&"];function kl(r,e,t,i){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:qr(r.value,Object.assign({},i.settings.characterReferences,{subset:Yx}))}function wy(r,e,t,i){return i.settings.allowDangerousHtml?r.value:kl(r,e,t,i)}function ky(r,e,t,i){return i.all(r)}var Cy=ay("type",{invalid:Jx,unknown:Zx,handlers:{comment:gy,doctype:fy,element:Ey,raw:wy,root:ky,text:kl}});function Jx(r){throw new Error("Expected node, not `"+r+"`")}function Zx(r){let e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}var Qx={},eT={},tT=[];function Id(r,e){let t=e||Qx,i=t.quote||'"',n=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:rT,all:nT,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||Zf,characterReferences:t.characterReferences||eT,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?vl:ny,quote:i,alternative:n}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function rT(r,e,t){return Cy(r,e,t,this)}function nT(r){let e=[],t=r&&r.children||tT,i=-1;for(;++i<t.length;)e[i]=this.one(t[i],i,r);return e.join("")}function Cl(r){let e=this,t={...e.data("settings"),...r};e.compiler=i;function i(n){return Id(n,t)}}var iT={};function Rd(r,e){let t=e||iT,i=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,n=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Ty(r,i,n)}function Ty(r,e,t){if(aT(r)){if("value"in r)return r.type==="html"&&!t?"":r.value;if(e&&"alt"in r&&r.alt)return r.alt;if("children"in r)return xy(r.children,e,t)}return Array.isArray(r)?xy(r,e,t):""}function xy(r,e,t){let i=[],n=-1;for(;++n<r.length;)i[n]=Ty(r[n],e,t);return i.join("")}function aT(r){return!!(r&&typeof r=="object")}var Ay=document.createElement("i");function na(r){let e="&"+r+";";Ay.innerHTML=e;let t=Ay.textContent;return t.charCodeAt(t.length-1)===59&&r!=="semi"||t===e?!1:t}function vt(r,e,t,i){let n=r.length,a=0,s;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,t=t>0?t:0,i.length<1e4)s=Array.from(i),s.unshift(e,t),r.splice(...s);else for(t&&r.splice(e,t);a<i.length;)s=i.slice(a,a+1e4),s.unshift(e,0),r.splice(...s),a+=1e4,e+=1e4}function kt(r,e){return r.length>0?(vt(r,r.length,0,e),r):e}var Iy={}.hasOwnProperty;function Ry(r){let e={},t=-1;for(;++t<r.length;)sT(e,r[t]);return e}function sT(r,e){let t;for(t in e){let n=(Iy.call(r,t)?r[t]:void 0)||(r[t]={}),a=e[t],s;if(a)for(s in a){Iy.call(n,s)||(n[s]=[]);let o=a[s];oT(n[s],Array.isArray(o)?o:o?[o]:[])}}}function oT(r,e){let t=-1,i=[];for(;++t<e.length;)(e[t].add==="after"?r:i).push(e[t]);vt(r,0,0,i)}function xl(r,e){let t=Number.parseInt(r,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function $r(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Ht=gn(/[A-Za-z]/),st=gn(/[\dA-Za-z]/),Py=gn(/[#-'*+\--9=?A-Z^-~]/);function ds(r){return r!==null&&(r<32||r===127)}var ps=gn(/\d/),Dy=gn(/[\dA-Fa-f]/),My=gn(/[!-/:-@[-`{-~]/);function X(r){return r!==null&&r<-2}function Xe(r){return r!==null&&(r<0||r===32)}function le(r){return r===-2||r===-1||r===32}var Oy=gn(/\p{P}|\p{S}/u),Ny=gn(/\s/);function gn(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function ar(r){let e=[],t=-1,i=0,n=0;for(;++t<r.length;){let a=r.charCodeAt(t),s="";if(a===37&&st(r.charCodeAt(t+1))&&st(r.charCodeAt(t+2)))n=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){let o=r.charCodeAt(t+1);a<56320&&o>56319&&o<57344?(s=String.fromCharCode(a,o),n=1):s="\uFFFD"}else s=String.fromCharCode(a);s&&(e.push(r.slice(i,t),encodeURIComponent(s)),i=t+n+1,s=""),n&&(t+=n,n=0)}return e.join("")+r.slice(i)}function ce(r,e,t,i){let n=i?i-1:Number.POSITIVE_INFINITY,a=0;return s;function s(l){return le(l)?(r.enter(t),o(l)):e(l)}function o(l){return le(l)&&a++<n?(r.consume(l),o):(r.exit(t),e(l))}}var Ly={tokenize:lT};function lT(r){let e=r.attempt(this.parser.constructs.contentInitial,i,n),t;return e;function i(o){if(o===null){r.consume(o);return}return r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),ce(r,e,"linePrefix")}function n(o){return r.enter("paragraph"),a(o)}function a(o){let l=r.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,s(o)}function s(o){if(o===null){r.exit("chunkText"),r.exit("paragraph"),r.consume(o);return}return X(o)?(r.consume(o),r.exit("chunkText"),a):(r.consume(o),s)}}var Fy={tokenize:cT},By={tokenize:uT};function cT(r){let e=this,t=[],i=0,n,a,s;return o;function o(S){if(i<t.length){let A=t[i];return e.containerState=A[1],r.attempt(A[0].continuation,l,c)(S)}return c(S)}function l(S){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&x();let A=e.events.length,R=A,k;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){k=e.events[R][1].end;break}b(i);let O=A;for(;O<e.events.length;)e.events[O][1].end=Object.assign({},k),O++;return vt(e.events,R+1,0,e.events.slice(A)),e.events.length=O,c(S)}return o(S)}function c(S){if(i===t.length){if(!n)return m(S);if(n.currentConstruct&&n.currentConstruct.concrete)return g(S);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},r.check(By,u,p)(S)}function u(S){return n&&x(),b(i),m(S)}function p(S){return e.parser.lazy[e.now().line]=i!==t.length,s=e.now().offset,g(S)}function m(S){return e.containerState={},r.attempt(By,d,g)(S)}function d(S){return i++,t.push([e.currentConstruct,e.containerState]),m(S)}function g(S){if(S===null){n&&x(),b(0),r.consume(S);return}return n=n||e.parser.flow(e.now()),r.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:n}),f(S)}function f(S){if(S===null){y(r.exit("chunkFlow"),!0),b(0),r.consume(S);return}return X(S)?(r.consume(S),y(r.exit("chunkFlow")),i=0,e.interrupt=void 0,o):(r.consume(S),f)}function y(S,A){let R=e.sliceStream(S);if(A&&R.push(null),S.previous=a,a&&(a.next=S),a=S,n.defineSkip(S.start),n.write(R),e.parser.lazy[S.start.line]){let k=n.events.length;for(;k--;)if(n.events[k][1].start.offset<s&&(!n.events[k][1].end||n.events[k][1].end.offset>s))return;let O=e.events.length,B=O,P,G;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){if(P){G=e.events[B][1].end;break}P=!0}for(b(i),k=O;k<e.events.length;)e.events[k][1].end=Object.assign({},G),k++;vt(e.events,B+1,0,e.events.slice(O)),e.events.length=k}}function b(S){let A=t.length;for(;A-- >S;){let R=t[A];e.containerState=R[1],R[0].exit.call(e,r)}t.length=S}function x(){n.write([null]),a=void 0,n=void 0,e.containerState._closeFlow=void 0}}function uT(r,e,t){return ce(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pd(r){if(r===null||Xe(r)||Ny(r))return 1;if(Oy(r))return 2}function ia(r,e,t){let i=[],n=-1;for(;++n<r.length;){let a=r[n].resolveAll;a&&!i.includes(a)&&(e=a(e,t),i.push(a))}return e}var ms={name:"attention",tokenize:pT,resolveAll:dT};function dT(r,e){let t=-1,i,n,a,s,o,l,c,u;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="attentionSequence"&&r[t][1]._close){for(i=t;i--;)if(r[i][0]==="exit"&&r[i][1].type==="attentionSequence"&&r[i][1]._open&&e.sliceSerialize(r[i][1]).charCodeAt(0)===e.sliceSerialize(r[t][1]).charCodeAt(0)){if((r[i][1]._close||r[t][1]._open)&&(r[t][1].end.offset-r[t][1].start.offset)%3&&!((r[i][1].end.offset-r[i][1].start.offset+r[t][1].end.offset-r[t][1].start.offset)%3))continue;l=r[i][1].end.offset-r[i][1].start.offset>1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;let p=Object.assign({},r[i][1].end),m=Object.assign({},r[t][1].start);Gy(p,-l),Gy(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},r[i][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},r[t][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},r[i][1].end),end:Object.assign({},r[t][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},r[i][1].end=Object.assign({},s.start),r[t][1].start=Object.assign({},o.end),c=[],r[i][1].end.offset-r[i][1].start.offset&&(c=kt(c,[["enter",r[i][1],e],["exit",r[i][1],e]])),c=kt(c,[["enter",n,e],["enter",s,e],["exit",s,e],["enter",a,e]]),c=kt(c,ia(e.parser.constructs.insideSpan.null,r.slice(i+1,t),e)),c=kt(c,[["exit",a,e],["enter",o,e],["exit",o,e],["exit",n,e]]),r[t][1].end.offset-r[t][1].start.offset?(u=2,c=kt(c,[["enter",r[t][1],e],["exit",r[t][1],e]])):u=0,vt(r,i-1,t-i+3,c),t=i+c.length-u-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="attentionSequence"&&(r[t][1].type="data");return r}function pT(r,e){let t=this.parser.constructs.attentionMarkers.null,i=this.previous,n=Pd(i),a;return s;function s(l){return a=l,r.enter("attentionSequence"),o(l)}function o(l){if(l===a)return r.consume(l),o;let c=r.exit("attentionSequence"),u=Pd(l),p=!u||u===2&&n||t.includes(l),m=!n||n===2&&u||t.includes(i);return c._open=!!(a===42?p:p&&(n||!m)),c._close=!!(a===42?m:m&&(u||!p)),e(l)}}function Gy(r,e){r.column+=e,r.offset+=e,r._bufferIndex+=e}var Dd={name:"autolink",tokenize:mT};function mT(r,e,t){let i=0;return n;function n(d){return r.enter("autolink"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.enter("autolinkProtocol"),a}function a(d){return Ht(d)?(r.consume(d),s):d===64?t(d):c(d)}function s(d){return d===43||d===45||d===46||st(d)?(i=1,o(d)):c(d)}function o(d){return d===58?(r.consume(d),i=0,l):(d===43||d===45||d===46||st(d))&&i++<32?(r.consume(d),o):(i=0,c(d))}function l(d){return d===62?(r.exit("autolinkProtocol"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):d===null||d===32||d===60||ds(d)?t(d):(r.consume(d),l)}function c(d){return d===64?(r.consume(d),u):Py(d)?(r.consume(d),c):t(d)}function u(d){return st(d)?p(d):t(d)}function p(d){return d===46?(r.consume(d),i=0,u):d===62?(r.exit("autolinkProtocol").type="autolinkEmail",r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):m(d)}function m(d){if((d===45||st(d))&&i++<63){let g=d===45?m:p;return r.consume(d),g}return t(d)}}var fn={tokenize:hT,partial:!0};function hT(r,e,t){return i;function i(a){return le(a)?ce(r,n,"linePrefix")(a):n(a)}function n(a){return a===null||X(a)?e(a):t(a)}}var Tl={name:"blockQuote",tokenize:gT,continuation:{tokenize:fT},exit:yT};function gT(r,e,t){let i=this;return n;function n(s){if(s===62){let o=i.containerState;return o.open||(r.enter("blockQuote",{_container:!0}),o.open=!0),r.enter("blockQuotePrefix"),r.enter("blockQuoteMarker"),r.consume(s),r.exit("blockQuoteMarker"),a}return t(s)}function a(s){return le(s)?(r.enter("blockQuotePrefixWhitespace"),r.consume(s),r.exit("blockQuotePrefixWhitespace"),r.exit("blockQuotePrefix"),e):(r.exit("blockQuotePrefix"),e(s))}}function fT(r,e,t){let i=this;return n;function n(s){return le(s)?ce(r,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return r.attempt(Tl,e,t)(s)}}function yT(r){r.exit("blockQuote")}var Al={name:"characterEscape",tokenize:bT};function bT(r,e,t){return i;function i(a){return r.enter("characterEscape"),r.enter("escapeMarker"),r.consume(a),r.exit("escapeMarker"),n}function n(a){return My(a)?(r.enter("characterEscapeValue"),r.consume(a),r.exit("characterEscapeValue"),r.exit("characterEscape"),e):t(a)}}var Il={name:"characterReference",tokenize:vT};function vT(r,e,t){let i=this,n=0,a,s;return o;function o(p){return r.enter("characterReference"),r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),l}function l(p){return p===35?(r.enter("characterReferenceMarkerNumeric"),r.consume(p),r.exit("characterReferenceMarkerNumeric"),c):(r.enter("characterReferenceValue"),a=31,s=st,u(p))}function c(p){return p===88||p===120?(r.enter("characterReferenceMarkerHexadecimal"),r.consume(p),r.exit("characterReferenceMarkerHexadecimal"),r.enter("characterReferenceValue"),a=6,s=Dy,u):(r.enter("characterReferenceValue"),a=7,s=ps,u(p))}function u(p){if(p===59&&n){let m=r.exit("characterReferenceValue");return s===st&&!na(i.sliceSerialize(m))?t(p):(r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),r.exit("characterReference"),e)}return s(p)&&n++<a?(r.consume(p),u):t(p)}}var zy={tokenize:ST,partial:!0},Rl={name:"codeFenced",tokenize:_T,concrete:!0};function _T(r,e,t){let i=this,n={tokenize:R,partial:!0},a=0,s=0,o;return l;function l(k){return c(k)}function c(k){let O=i.events[i.events.length-1];return a=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,o=k,r.enter("codeFenced"),r.enter("codeFencedFence"),r.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===o?(s++,r.consume(k),u):s<3?t(k):(r.exit("codeFencedFenceSequence"),le(k)?ce(r,p,"whitespace")(k):p(k))}function p(k){return k===null||X(k)?(r.exit("codeFencedFence"),i.interrupt?e(k):r.check(zy,f,A)(k)):(r.enter("codeFencedFenceInfo"),r.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||X(k)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),p(k)):le(k)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),ce(r,d,"whitespace")(k)):k===96&&k===o?t(k):(r.consume(k),m)}function d(k){return k===null||X(k)?p(k):(r.enter("codeFencedFenceMeta"),r.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||X(k)?(r.exit("chunkString"),r.exit("codeFencedFenceMeta"),p(k)):k===96&&k===o?t(k):(r.consume(k),g)}function f(k){return r.attempt(n,A,y)(k)}function y(k){return r.enter("lineEnding"),r.consume(k),r.exit("lineEnding"),b}function b(k){return a>0&&le(k)?ce(r,x,"linePrefix",a+1)(k):x(k)}function x(k){return k===null||X(k)?r.check(zy,f,A)(k):(r.enter("codeFlowValue"),S(k))}function S(k){return k===null||X(k)?(r.exit("codeFlowValue"),x(k)):(r.consume(k),S)}function A(k){return r.exit("codeFenced"),e(k)}function R(k,O,B){let P=0;return G;function G(F){return k.enter("lineEnding"),k.consume(F),k.exit("lineEnding"),U}function U(F){return k.enter("codeFencedFence"),le(F)?ce(k,N,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):N(F)}function N(F){return F===o?(k.enter("codeFencedFenceSequence"),T(F)):B(F)}function T(F){return F===o?(P++,k.consume(F),T):P>=s?(k.exit("codeFencedFenceSequence"),le(F)?ce(k,I,"whitespace")(F):I(F)):B(F)}function I(F){return F===null||X(F)?(k.exit("codeFencedFence"),O(F)):B(F)}}}function ST(r,e,t){let i=this;return n;function n(s){return s===null?t(s):(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),a)}function a(s){return i.parser.lazy[i.now().line]?t(s):e(s)}}var hs={name:"codeIndented",tokenize:wT},ET={tokenize:kT,partial:!0};function wT(r,e,t){let i=this;return n;function n(c){return r.enter("codeIndented"),ce(r,a,"linePrefix",5)(c)}function a(c){let u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):t(c)}function s(c){return c===null?l(c):X(c)?r.attempt(ET,s,l)(c):(r.enter("codeFlowValue"),o(c))}function o(c){return c===null||X(c)?(r.exit("codeFlowValue"),s(c)):(r.consume(c),o)}function l(c){return r.exit("codeIndented"),e(c)}}function kT(r,e,t){let i=this;return n;function n(s){return i.parser.lazy[i.now().line]?t(s):X(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),n):ce(r,a,"linePrefix",5)(s)}function a(s){let o=i.events[i.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):X(s)?n(s):t(s)}}var Md={name:"codeText",tokenize:TT,resolve:CT,previous:xT};function CT(r){let e=r.length-4,t=3,i,n;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(i=t;++i<e;)if(r[i][1].type==="codeTextData"){r[t][1].type="codeTextPadding",r[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(i=t-1,e++;++i<=e;)n===void 0?i!==e&&r[i][1].type!=="lineEnding"&&(n=i):(i===e||r[i][1].type==="lineEnding")&&(r[n][1].type="codeTextData",i!==n+2&&(r[n][1].end=r[i-1][1].end,r.splice(n+2,i-n-2),e-=i-n-2,i=n+2),n=void 0);return r}function xT(r){return r!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TT(r,e,t){let i=this,n=0,a,s;return o;function o(m){return r.enter("codeText"),r.enter("codeTextSequence"),l(m)}function l(m){return m===96?(r.consume(m),n++,l):(r.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(r.enter("space"),r.consume(m),r.exit("space"),c):m===96?(s=r.enter("codeTextSequence"),a=0,p(m)):X(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),c):(r.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||X(m)?(r.exit("codeTextData"),c(m)):(r.consume(m),u)}function p(m){return m===96?(r.consume(m),a++,p):a===n?(r.exit("codeTextSequence"),r.exit("codeText"),e(m)):(s.type="codeTextData",u(m))}}var Pl=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let i=t??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(e,i):e>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){let n=t||0;this.setCursor(Math.trunc(e));let a=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return i&&gs(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),gs(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),gs(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);gs(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);gs(this.left,t.reverse())}}};function gs(r,e){let t=0;if(e.length<1e4)r.push(...e);else for(;t<e.length;)r.push(...e.slice(t,t+1e4)),t+=1e4}function Dl(r){let e={},t=-1,i,n,a,s,o,l,c,u=new Pl(r);for(;++t<u.length;){for(;t in e;)t=e[t];if(i=u.get(t),t&&i[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=i[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(e,AT(u,t)),t=e[t],c=!0);else if(i[1]._container){for(a=t,n=void 0;a--&&(s=u.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),s[1].type="lineEnding",n=a);n&&(i[1].end=Object.assign({},u.get(n)[1].start),o=u.slice(n,t),o.unshift(i),u.splice(n,t-n+1,o))}}return vt(r,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function AT(r,e){let t=r.get(e)[1],i=r.get(e)[2],n=e-1,a=[],s=t._tokenizer||i.parser[t.contentType](t.start),o=s.events,l=[],c={},u,p,m=-1,d=t,g=0,f=0,y=[f];for(;d;){for(;r.get(++n)[1]!==d;);a.push(n),d._tokenizer||(u=i.sliceStream(d),d.next||u.push(null),p&&s.defineSkip(d.start),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=t;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,y.push(f),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(s.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),m=y.length;m--;){let b=o.slice(y[m],y[m+1]),x=a.pop();l.push([x,x+b.length-1]),r.splice(x,2,b)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}var Od={tokenize:PT,resolve:RT},IT={tokenize:DT,partial:!0};function RT(r){return Dl(r),r}function PT(r,e){let t;return i;function i(o){return r.enter("content"),t=r.enter("chunkContent",{contentType:"content"}),n(o)}function n(o){return o===null?a(o):X(o)?r.check(IT,s,a)(o):(r.consume(o),n)}function a(o){return r.exit("chunkContent"),r.exit("content"),e(o)}function s(o){return r.consume(o),r.exit("chunkContent"),t.next=r.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,n}}function DT(r,e,t){let i=this;return n;function n(s){return r.exit("chunkContent"),r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),ce(r,a,"linePrefix")}function a(s){if(s===null||X(s))return t(s);let o=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):r.interrupt(i.parser.constructs.flow,t,e)(s)}}function Ml(r,e,t,i,n,a,s,o,l){let c=l||Number.POSITIVE_INFINITY,u=0;return p;function p(b){return b===60?(r.enter(i),r.enter(n),r.enter(a),r.consume(b),r.exit(a),m):b===null||b===32||b===41||ds(b)?t(b):(r.enter(i),r.enter(s),r.enter(o),r.enter("chunkString",{contentType:"string"}),f(b))}function m(b){return b===62?(r.enter(a),r.consume(b),r.exit(a),r.exit(n),r.exit(i),e):(r.enter(o),r.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===62?(r.exit("chunkString"),r.exit(o),m(b)):b===null||b===60||X(b)?t(b):(r.consume(b),b===92?g:d)}function g(b){return b===60||b===62||b===92?(r.consume(b),d):d(b)}function f(b){return!u&&(b===null||b===41||Xe(b))?(r.exit("chunkString"),r.exit(o),r.exit(s),r.exit(i),e(b)):u<c&&b===40?(r.consume(b),u++,f):b===41?(r.consume(b),u--,f):b===null||b===32||b===40||ds(b)?t(b):(r.consume(b),b===92?y:f)}function y(b){return b===40||b===41||b===92?(r.consume(b),f):f(b)}}function Ol(r,e,t,i,n,a){let s=this,o=0,l;return c;function c(d){return r.enter(i),r.enter(n),r.consume(d),r.exit(n),r.enter(a),u}function u(d){return o>999||d===null||d===91||d===93&&!l||d===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?t(d):d===93?(r.exit(a),r.enter(n),r.consume(d),r.exit(n),r.exit(i),e):X(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),u):(r.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||X(d)||o++>999?(r.exit("chunkString"),u(d)):(r.consume(d),l||(l=!le(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(r.consume(d),o++,p):p(d)}}function Nl(r,e,t,i,n,a){let s;return o;function o(m){return m===34||m===39||m===40?(r.enter(i),r.enter(n),r.consume(m),r.exit(n),s=m===40?41:m,l):t(m)}function l(m){return m===s?(r.enter(n),r.consume(m),r.exit(n),r.exit(i),e):(r.enter(a),c(m))}function c(m){return m===s?(r.exit(a),l(s)):m===null?t(m):X(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),ce(r,c,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===s||m===null||X(m)?(r.exit("chunkString"),c(m)):(r.consume(m),m===92?p:u)}function p(m){return m===s||m===92?(r.consume(m),u):u(m)}}function ri(r,e){let t;return i;function i(n){return X(n)?(r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),t=!0,i):le(n)?ce(r,i,t?"linePrefix":"lineSuffix")(n):e(n)}}var Nd={name:"definition",tokenize:OT},MT={tokenize:NT,partial:!0};function OT(r,e,t){let i=this,n;return a;function a(d){return r.enter("definition"),s(d)}function s(d){return Ol.call(i,r,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return n=$r(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),d===58?(r.enter("definitionMarker"),r.consume(d),r.exit("definitionMarker"),l):t(d)}function l(d){return Xe(d)?ri(r,c)(d):c(d)}function c(d){return Ml(r,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return r.attempt(MT,p,p)(d)}function p(d){return le(d)?ce(r,m,"whitespace")(d):m(d)}function m(d){return d===null||X(d)?(r.exit("definition"),i.parser.defined.push(n),e(d)):t(d)}}function NT(r,e,t){return i;function i(o){return Xe(o)?ri(r,n)(o):t(o)}function n(o){return Nl(r,a,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return le(o)?ce(r,s,"whitespace")(o):s(o)}function s(o){return o===null||X(o)?e(o):t(o)}}var Ld={name:"hardBreakEscape",tokenize:LT};function LT(r,e,t){return i;function i(a){return r.enter("hardBreakEscape"),r.consume(a),n}function n(a){return X(a)?(r.exit("hardBreakEscape"),e(a)):t(a)}}var Bd={name:"headingAtx",tokenize:FT,resolve:BT};function BT(r,e){let t=r.length-2,i=3,n,a;return r[i][1].type==="whitespace"&&(i+=2),t-2>i&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&r[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i&&(n={type:"atxHeadingText",start:r[i][1].start,end:r[t][1].end},a={type:"chunkText",start:r[i][1].start,end:r[t][1].end,contentType:"text"},vt(r,i,t-i+1,[["enter",n,e],["enter",a,e],["exit",a,e],["exit",n,e]])),r}function FT(r,e,t){let i=0;return n;function n(u){return r.enter("atxHeading"),a(u)}function a(u){return r.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&i++<6?(r.consume(u),s):u===null||Xe(u)?(r.exit("atxHeadingSequence"),o(u)):t(u)}function o(u){return u===35?(r.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(r.exit("atxHeading"),e(u)):le(u)?ce(r,o,"whitespace")(u):(r.enter("atxHeadingText"),c(u))}function l(u){return u===35?(r.consume(u),l):(r.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||Xe(u)?(r.exit("atxHeadingText"),o(u)):(r.consume(u),c)}}var Uy=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Fd=["pre","script","style","textarea"];var Gd={name:"htmlFlow",tokenize:HT,resolveTo:UT,concrete:!0},GT={tokenize:WT,partial:!0},zT={tokenize:VT,partial:!0};function UT(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function HT(r,e,t){let i=this,n,a,s,o,l;return c;function c(E){return u(E)}function u(E){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(E),p}function p(E){return E===33?(r.consume(E),m):E===47?(r.consume(E),a=!0,f):E===63?(r.consume(E),n=3,i.interrupt?e:_):Ht(E)?(r.consume(E),s=String.fromCharCode(E),y):t(E)}function m(E){return E===45?(r.consume(E),n=2,d):E===91?(r.consume(E),n=5,o=0,g):Ht(E)?(r.consume(E),n=4,i.interrupt?e:_):t(E)}function d(E){return E===45?(r.consume(E),i.interrupt?e:_):t(E)}function g(E){let se="CDATA[";return E===se.charCodeAt(o++)?(r.consume(E),o===se.length?i.interrupt?e:N:g):t(E)}function f(E){return Ht(E)?(r.consume(E),s=String.fromCharCode(E),y):t(E)}function y(E){if(E===null||E===47||E===62||Xe(E)){let se=E===47,Re=s.toLowerCase();return!se&&!a&&Fd.includes(Re)?(n=1,i.interrupt?e(E):N(E)):Uy.includes(s.toLowerCase())?(n=6,se?(r.consume(E),b):i.interrupt?e(E):N(E)):(n=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(E):a?x(E):S(E))}return E===45||st(E)?(r.consume(E),s+=String.fromCharCode(E),y):t(E)}function b(E){return E===62?(r.consume(E),i.interrupt?e:N):t(E)}function x(E){return le(E)?(r.consume(E),x):G(E)}function S(E){return E===47?(r.consume(E),G):E===58||E===95||Ht(E)?(r.consume(E),A):le(E)?(r.consume(E),S):G(E)}function A(E){return E===45||E===46||E===58||E===95||st(E)?(r.consume(E),A):R(E)}function R(E){return E===61?(r.consume(E),k):le(E)?(r.consume(E),R):S(E)}function k(E){return E===null||E===60||E===61||E===62||E===96?t(E):E===34||E===39?(r.consume(E),l=E,O):le(E)?(r.consume(E),k):B(E)}function O(E){return E===l?(r.consume(E),l=null,P):E===null||X(E)?t(E):(r.consume(E),O)}function B(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Xe(E)?R(E):(r.consume(E),B)}function P(E){return E===47||E===62||le(E)?S(E):t(E)}function G(E){return E===62?(r.consume(E),U):t(E)}function U(E){return E===null||X(E)?N(E):le(E)?(r.consume(E),U):t(E)}function N(E){return E===45&&n===2?(r.consume(E),Y):E===60&&n===1?(r.consume(E),K):E===62&&n===4?(r.consume(E),ve):E===63&&n===3?(r.consume(E),_):E===93&&n===5?(r.consume(E),Z):X(E)&&(n===6||n===7)?(r.exit("htmlFlowData"),r.check(GT,Me,T)(E)):E===null||X(E)?(r.exit("htmlFlowData"),T(E)):(r.consume(E),N)}function T(E){return r.check(zT,I,Me)(E)}function I(E){return r.enter("lineEnding"),r.consume(E),r.exit("lineEnding"),F}function F(E){return E===null||X(E)?T(E):(r.enter("htmlFlowData"),N(E))}function Y(E){return E===45?(r.consume(E),_):N(E)}function K(E){return E===47?(r.consume(E),s="",ee):N(E)}function ee(E){if(E===62){let se=s.toLowerCase();return Fd.includes(se)?(r.consume(E),ve):N(E)}return Ht(E)&&s.length<8?(r.consume(E),s+=String.fromCharCode(E),ee):N(E)}function Z(E){return E===93?(r.consume(E),_):N(E)}function _(E){return E===62?(r.consume(E),ve):E===45&&n===2?(r.consume(E),_):N(E)}function ve(E){return E===null||X(E)?(r.exit("htmlFlowData"),Me(E)):(r.consume(E),ve)}function Me(E){return r.exit("htmlFlow"),e(E)}}function VT(r,e,t){let i=this;return n;function n(s){return X(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),a):t(s)}function a(s){return i.parser.lazy[i.now().line]?t(s):e(s)}}function WT(r,e,t){return i;function i(n){return r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),r.attempt(fn,e,t)}}var zd={name:"htmlText",tokenize:jT};function jT(r,e,t){let i=this,n,a,s;return o;function o(_){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(_),l}function l(_){return _===33?(r.consume(_),c):_===47?(r.consume(_),R):_===63?(r.consume(_),S):Ht(_)?(r.consume(_),B):t(_)}function c(_){return _===45?(r.consume(_),u):_===91?(r.consume(_),a=0,g):Ht(_)?(r.consume(_),x):t(_)}function u(_){return _===45?(r.consume(_),d):t(_)}function p(_){return _===null?t(_):_===45?(r.consume(_),m):X(_)?(s=p,K(_)):(r.consume(_),p)}function m(_){return _===45?(r.consume(_),d):p(_)}function d(_){return _===62?Y(_):_===45?m(_):p(_)}function g(_){let ve="CDATA[";return _===ve.charCodeAt(a++)?(r.consume(_),a===ve.length?f:g):t(_)}function f(_){return _===null?t(_):_===93?(r.consume(_),y):X(_)?(s=f,K(_)):(r.consume(_),f)}function y(_){return _===93?(r.consume(_),b):f(_)}function b(_){return _===62?Y(_):_===93?(r.consume(_),b):f(_)}function x(_){return _===null||_===62?Y(_):X(_)?(s=x,K(_)):(r.consume(_),x)}function S(_){return _===null?t(_):_===63?(r.consume(_),A):X(_)?(s=S,K(_)):(r.consume(_),S)}function A(_){return _===62?Y(_):S(_)}function R(_){return Ht(_)?(r.consume(_),k):t(_)}function k(_){return _===45||st(_)?(r.consume(_),k):O(_)}function O(_){return X(_)?(s=O,K(_)):le(_)?(r.consume(_),O):Y(_)}function B(_){return _===45||st(_)?(r.consume(_),B):_===47||_===62||Xe(_)?P(_):t(_)}function P(_){return _===47?(r.consume(_),Y):_===58||_===95||Ht(_)?(r.consume(_),G):X(_)?(s=P,K(_)):le(_)?(r.consume(_),P):Y(_)}function G(_){return _===45||_===46||_===58||_===95||st(_)?(r.consume(_),G):U(_)}function U(_){return _===61?(r.consume(_),N):X(_)?(s=U,K(_)):le(_)?(r.consume(_),U):P(_)}function N(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(r.consume(_),n=_,T):X(_)?(s=N,K(_)):le(_)?(r.consume(_),N):(r.consume(_),I)}function T(_){return _===n?(r.consume(_),n=void 0,F):_===null?t(_):X(_)?(s=T,K(_)):(r.consume(_),T)}function I(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||Xe(_)?P(_):(r.consume(_),I)}function F(_){return _===47||_===62||Xe(_)?P(_):t(_)}function Y(_){return _===62?(r.consume(_),r.exit("htmlTextData"),r.exit("htmlText"),e):t(_)}function K(_){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(_),r.exit("lineEnding"),ee}function ee(_){return le(_)?ce(r,Z,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return r.enter("htmlTextData"),s(_)}}var ni={name:"labelEnd",tokenize:JT,resolveTo:YT,resolveAll:XT},qT={tokenize:ZT},$T={tokenize:QT},KT={tokenize:eA};function XT(r){let e=-1;for(;++e<r.length;){let t=r[e][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(r.splice(e+1,t.type==="labelImage"?4:2),t.type="data",e++)}return r}function YT(r,e){let t=r.length,i=0,n,a,s,o;for(;t--;)if(n=r[t][1],a){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;r[t][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(s){if(r[t][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(a=t,n.type!=="labelLink")){i=2;break}}else n.type==="labelEnd"&&(s=t);let l={type:r[a][1].type==="labelLink"?"link":"image",start:Object.assign({},r[a][1].start),end:Object.assign({},r[r.length-1][1].end)},c={type:"label",start:Object.assign({},r[a][1].start),end:Object.assign({},r[s][1].end)},u={type:"labelText",start:Object.assign({},r[a+i+2][1].end),end:Object.assign({},r[s-2][1].start)};return o=[["enter",l,e],["enter",c,e]],o=kt(o,r.slice(a+1,a+i+3)),o=kt(o,[["enter",u,e]]),o=kt(o,ia(e.parser.constructs.insideSpan.null,r.slice(a+i+4,s-3),e)),o=kt(o,[["exit",u,e],r[s-2],r[s-1],["exit",c,e]]),o=kt(o,r.slice(s+1)),o=kt(o,[["exit",l,e]]),vt(r,a,r.length,o),r}function JT(r,e,t){let i=this,n=i.events.length,a,s;for(;n--;)if((i.events[n][1].type==="labelImage"||i.events[n][1].type==="labelLink")&&!i.events[n][1]._balanced){a=i.events[n][1];break}return o;function o(m){return a?a._inactive?p(m):(s=i.parser.defined.includes($r(i.sliceSerialize({start:a.end,end:i.now()}))),r.enter("labelEnd"),r.enter("labelMarker"),r.consume(m),r.exit("labelMarker"),r.exit("labelEnd"),l):t(m)}function l(m){return m===40?r.attempt(qT,u,s?u:p)(m):m===91?r.attempt($T,u,s?c:p)(m):s?u(m):p(m)}function c(m){return r.attempt(KT,u,p)(m)}function u(m){return e(m)}function p(m){return a._balanced=!0,t(m)}}function ZT(r,e,t){return i;function i(p){return r.enter("resource"),r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),n}function n(p){return Xe(p)?ri(r,a)(p):a(p)}function a(p){return p===41?u(p):Ml(r,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function s(p){return Xe(p)?ri(r,l)(p):u(p)}function o(p){return t(p)}function l(p){return p===34||p===39||p===40?Nl(r,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return Xe(p)?ri(r,u)(p):u(p)}function u(p){return p===41?(r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),r.exit("resource"),e):t(p)}}function QT(r,e,t){let i=this;return n;function n(o){return Ol.call(i,r,a,s,"reference","referenceMarker","referenceString")(o)}function a(o){return i.parser.defined.includes($r(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(o):t(o)}function s(o){return t(o)}}function eA(r,e,t){return i;function i(a){return r.enter("reference"),r.enter("referenceMarker"),r.consume(a),r.exit("referenceMarker"),n}function n(a){return a===93?(r.enter("referenceMarker"),r.consume(a),r.exit("referenceMarker"),r.exit("reference"),e):t(a)}}var Ud={name:"labelStartImage",tokenize:tA,resolveAll:ni.resolveAll};function tA(r,e,t){let i=this;return n;function n(o){return r.enter("labelImage"),r.enter("labelImageMarker"),r.consume(o),r.exit("labelImageMarker"),a}function a(o){return o===91?(r.enter("labelMarker"),r.consume(o),r.exit("labelMarker"),r.exit("labelImage"),s):t(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(o):e(o)}}var Hd={name:"labelStartLink",tokenize:rA,resolveAll:ni.resolveAll};function rA(r,e,t){let i=this;return n;function n(s){return r.enter("labelLink"),r.enter("labelMarker"),r.consume(s),r.exit("labelMarker"),r.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(s):e(s)}}var fs={name:"lineEnding",tokenize:nA};function nA(r,e){return t;function t(i){return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),ce(r,e,"linePrefix")}}var ii={name:"thematicBreak",tokenize:iA};function iA(r,e,t){let i=0,n;return a;function a(c){return r.enter("thematicBreak"),s(c)}function s(c){return n=c,o(c)}function o(c){return c===n?(r.enter("thematicBreakSequence"),l(c)):i>=3&&(c===null||X(c))?(r.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===n?(r.consume(c),i++,l):(r.exit("thematicBreakSequence"),le(c)?ce(r,o,"whitespace")(c):o(c))}}var _t={name:"list",tokenize:oA,continuation:{tokenize:lA},exit:uA},aA={tokenize:dA,partial:!0},sA={tokenize:cA,partial:!0};function oA(r,e,t){let i=this,n=i.events[i.events.length-1],a=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,s=0;return o;function o(d){let g=i.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!i.containerState.marker||d===i.containerState.marker:ps(d)){if(i.containerState.type||(i.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),d===42||d===45?r.check(ii,t,c)(d):c(d);if(!i.interrupt||d===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(d)}return t(d)}function l(d){return ps(d)&&++s<10?(r.consume(d),l):(!i.interrupt||s<2)&&(i.containerState.marker?d===i.containerState.marker:d===41||d===46)?(r.exit("listItemValue"),c(d)):t(d)}function c(d){return r.enter("listItemMarker"),r.consume(d),r.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||d,r.check(fn,i.interrupt?t:u,r.attempt(aA,m,p))}function u(d){return i.containerState.initialBlankLine=!0,a++,m(d)}function p(d){return le(d)?(r.enter("listItemPrefixWhitespace"),r.consume(d),r.exit("listItemPrefixWhitespace"),m):t(d)}function m(d){return i.containerState.size=a+i.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(d)}}function lA(r,e,t){let i=this;return i.containerState._closeFlow=void 0,r.check(fn,n,a);function n(o){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ce(r,e,"listItemIndent",i.containerState.size+1)(o)}function a(o){return i.containerState.furtherBlankLines||!le(o)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,s(o)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,r.attempt(sA,e,s)(o))}function s(o){return i.containerState._closeFlow=!0,i.interrupt=void 0,ce(r,r.attempt(_t,e,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function cA(r,e,t){let i=this;return ce(r,n,"listItemIndent",i.containerState.size+1);function n(a){let s=i.events[i.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===i.containerState.size?e(a):t(a)}}function uA(r){r.exit(this.containerState.type)}function dA(r,e,t){let i=this;return ce(r,n,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(a){let s=i.events[i.events.length-1];return!le(a)&&s&&s[1].type==="listItemPrefixWhitespace"?e(a):t(a)}}var Ll={name:"setextUnderline",tokenize:mA,resolveTo:pA};function pA(r,e){let t=r.length,i,n,a;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){i=t;break}r[t][1].type==="paragraph"&&(n=t)}else r[t][1].type==="content"&&r.splice(t,1),!a&&r[t][1].type==="definition"&&(a=t);let s={type:"setextHeading",start:Object.assign({},r[n][1].start),end:Object.assign({},r[r.length-1][1].end)};return r[n][1].type="setextHeadingText",a?(r.splice(n,0,["enter",s,e]),r.splice(a+1,0,["exit",r[i][1],e]),r[i][1].end=Object.assign({},r[a][1].end)):r[i][1]=s,r.push(["exit",s,e]),r}function mA(r,e,t){let i=this,n;return a;function a(c){let u=i.events.length,p;for(;u--;)if(i.events[u][1].type!=="lineEnding"&&i.events[u][1].type!=="linePrefix"&&i.events[u][1].type!=="content"){p=i.events[u][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(r.enter("setextHeadingLine"),n=c,s(c)):t(c)}function s(c){return r.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===n?(r.consume(c),o):(r.exit("setextHeadingLineSequence"),le(c)?ce(r,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(r.exit("setextHeadingLine"),e(c)):t(c)}}var Hy={tokenize:hA};function hA(r){let e=this,t=r.attempt(fn,i,r.attempt(this.parser.constructs.flowInitial,n,ce(r,r.attempt(this.parser.constructs.flow,n,r.attempt(Od,n)),"linePrefix")));return t;function i(a){if(a===null){r.consume(a);return}return r.enter("lineEndingBlank"),r.consume(a),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function n(a){if(a===null){r.consume(a);return}return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),e.currentConstruct=void 0,t}}var Vy={resolveAll:$y()},Wy=qy("string"),jy=qy("text");function qy(r){return{tokenize:e,resolveAll:$y(r==="text"?gA:void 0)};function e(t){let i=this,n=this.parser.constructs[r],a=t.attempt(n,s,o);return s;function s(u){return c(u)?a(u):o(u)}function o(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),a(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let p=n[u],m=-1;if(p)for(;++m<p.length;){let d=p[m];if(!d.previous||d.previous.call(i,i.previous))return!0}return!1}}}function $y(r){return e;function e(t,i){let n=-1,a;for(;++n<=t.length;)a===void 0?t[n]&&t[n][1].type==="data"&&(a=n,n++):(!t[n]||t[n][1].type!=="data")&&(n!==a+2&&(t[a][1].end=t[n-1][1].end,t.splice(a+2,n-a-2),n=a+2),a=void 0);return r?r(t,i):t}}function gA(r,e){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){let i=r[t-1][1],n=e.sliceStream(i),a=n.length,s=-1,o=0,l;for(;a--;){let c=n[a];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(c===-2)l=!0,o++;else if(c!==-1){a++;break}}if(o){let c={type:t===r.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-o,offset:i.end.offset-o,_index:i.start._index+a,_bufferIndex:a?s:i.start._bufferIndex+s},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(r.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return r}function Ky(r,e,t){let i=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},a=[],s=[],o=[],l=!0,c={consume:A,enter:R,exit:k,attempt:P(O),check:P(B),interrupt:P(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:r,sliceStream:f,sliceSerialize:g,now:y,defineSkip:b,write:d},p=e.tokenize.call(u,c),m;return e.resolveAll&&a.push(e),u;function d(T){return s=kt(s,T),x(),s[s.length-1]!==null?[]:(G(e,0),u.events=ia(a,u.events,u),u.events)}function g(T,I){return yA(f(T),I)}function f(T){return fA(s,T)}function y(){let{line:T,column:I,offset:F,_index:Y,_bufferIndex:K}=i;return{line:T,column:I,offset:F,_index:Y,_bufferIndex:K}}function b(T){n[T.line]=T.column,N()}function x(){let T;for(;i._index<s.length;){let I=s[i._index];if(typeof I=="string")for(T=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===T&&i._bufferIndex<I.length;)S(I.charCodeAt(i._bufferIndex));else S(I)}}function S(T){l=void 0,m=T,p=p(T)}function A(T){X(T)?(i.line++,i.column=1,i.offset+=T===-3?2:1,N()):T!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===s[i._index].length&&(i._bufferIndex=-1,i._index++)),u.previous=T,l=!0}function R(T,I){let F=I||{};return F.type=T,F.start=y(),u.events.push(["enter",F,u]),o.push(F),F}function k(T){let I=o.pop();return I.end=y(),u.events.push(["exit",I,u]),I}function O(T,I){G(T,I.from)}function B(T,I){I.restore()}function P(T,I){return F;function F(Y,K,ee){let Z,_,ve,Me;return Array.isArray(Y)?se(Y):"tokenize"in Y?se([Y]):E(Y);function E(Oe){return St;function St(Ce){let Ae=Ce!==null&&Oe[Ce],xt=Ce!==null&&Oe.null,Je=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(xt)?xt:xt?[xt]:[]];return se(Je)(Ce)}}function se(Oe){return Z=Oe,_=0,Oe.length===0?ee:Re(Oe[_])}function Re(Oe){return St;function St(Ce){return Me=U(),ve=Oe,Oe.partial||(u.currentConstruct=Oe),Oe.name&&u.parser.constructs.disable.null.includes(Oe.name)?Ye(Ce):Oe.tokenize.call(I?Object.assign(Object.create(u),I):u,c,We,Ye)(Ce)}}function We(Oe){return l=!0,T(ve,Me),K}function Ye(Oe){return l=!0,Me.restore(),++_<Z.length?Re(Z[_]):ee}}}function G(T,I){T.resolveAll&&!a.includes(T)&&a.push(T),T.resolve&&vt(u.events,I,u.events.length-I,T.resolve(u.events.slice(I),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function U(){let T=y(),I=u.previous,F=u.currentConstruct,Y=u.events.length,K=Array.from(o);return{restore:ee,from:Y};function ee(){i=T,u.previous=I,u.currentConstruct=F,u.events.length=Y,o=K,N()}}function N(){i.line in n&&i.column<2&&(i.column=n[i.line],i.offset+=n[i.line]-1)}}function fA(r,e){let t=e.start._index,i=e.start._bufferIndex,n=e.end._index,a=e.end._bufferIndex,s;if(t===n)s=[r[t].slice(i,a)];else{if(s=r.slice(t,n),i>-1){let o=s[0];typeof o=="string"?s[0]=o.slice(i):s.shift()}a>0&&s.push(r[n].slice(0,a))}return s}function yA(r,e){let t=-1,i=[],n;for(;++t<r.length;){let a=r[t],s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
|
|
3472
|
-
`;break}case-3:{
|
|
3473
|
-
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&n)continue;s=" ";break}default:s=String.fromCharCode(a)}n=a===-2,i.push(s)}return i.join("")}var Vd={};uc(Vd,{attentionMarkers:()=>CA,contentInitial:()=>vA,disable:()=>xA,document:()=>bA,flow:()=>SA,flowInitial:()=>_A,insideSpan:()=>kA,string:()=>EA,text:()=>wA});var bA={42:_t,43:_t,45:_t,48:_t,49:_t,50:_t,51:_t,52:_t,53:_t,54:_t,55:_t,56:_t,57:_t,62:Tl},vA={91:Nd},_A={[-2]:hs,[-1]:hs,32:hs},SA={35:Bd,42:ii,45:[Ll,ii],60:Gd,61:Ll,95:ii,96:Rl,126:Rl},EA={38:Il,92:Al},wA={[-5]:fs,[-4]:fs,[-3]:fs,33:Ud,38:Il,42:ms,60:[Dd,zd],91:Hd,92:[Ld,Al],93:ni,95:ms,96:Md},kA={null:[ms,Vy]},CA={null:[42,95]},xA={null:[]};function Wd(r){let t=Ry([Vd,...(r||{}).extensions||[]]),i={defined:[],lazy:{},constructs:t,content:n(Ly),document:n(Fy),flow:n(Hy),string:n(Wy),text:n(jy)};return i;function n(a){return s;function s(o){return Ky(i,a,o)}}}function jd(r){for(;!Dl(r););return r}var Xy=/[\0\t\n\r]/g;function qd(){let r=1,e="",t=!0,i;return n;function n(a,s,o){let l=[],c,u,p,m,d;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),p=0,e="",t&&(a.charCodeAt(0)===65279&&p++,t=void 0);p<a.length;){if(Xy.lastIndex=p,c=Xy.exec(a),m=c&&c.index!==void 0?c.index:a.length,d=a.charCodeAt(m),!c){e=a.slice(p);break}if(d===10&&p===m&&i)l.push(-3),i=void 0;else switch(i&&(l.push(-5),i=void 0),p<m&&(l.push(a.slice(p,m)),r+=m-p),d){case 0:{l.push(65533),r++;break}case 9:{for(u=Math.ceil(r/4)*4,l.push(-2);r++<u;)l.push(-1);break}case 10:{l.push(-4),r=1;break}default:i=!0,r=1}p=m+1}return o&&(i&&l.push(-5),e&&l.push(e),l.push(null)),l}}var TA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Yy(r){return r.replace(TA,AA)}function AA(r,e,t){if(e)return e;if(t.charCodeAt(0)===35){let n=t.charCodeAt(1),a=n===120||n===88;return xl(t.slice(a?2:1),a?16:10)}return na(t)||r}function yn(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?Jy(r.position):"start"in r||"end"in r?Jy(r):"line"in r||"column"in r?$d(r):""}function $d(r){return Zy(r&&r.line)+":"+Zy(r&&r.column)}function Jy(r){return $d(r&&r.start)+"-"+$d(r&&r.end)}function Zy(r){return r&&typeof r=="number"?r:1}var eb={}.hasOwnProperty;function Kd(r,e,t){return typeof e!="string"&&(t=e,e=void 0),IA(t)(jd(Wd(t).document().write(qd()(r,e,!0))))}function IA(r){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(fr),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(_e),blockQuote:a(St),characterEscape:P,characterReference:P,codeFenced:a(Ce),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(Ce,s),codeText:a(Ae,s),codeTextData:P,data:P,codeFlowValue:P,definition:a(xt),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(Je),hardBreakEscape:a(sr),hardBreakTrailing:a(sr),htmlFlow:a(Wt,s),htmlFlowData:P,htmlText:a(Wt,s),htmlTextData:P,image:a(Ar),label:s,link:a(fr),listItem:a(Tt),listItemValue:m,listOrdered:a(Ze,p),listUnordered:a(Ze),paragraph:a(ht),reference:E,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(_e),strong:a(lt),thematicBreak:a(Et)},exit:{atxHeading:l(),atxHeadingSequence:R,autolink:l(),autolinkEmail:Oe,autolinkProtocol:Ye,blockQuote:l(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:We,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:G,codeIndented:l(b),codeText:l(F),codeTextData:G,data:G,definition:l(),definitionDestinationString:A,definitionLabelString:x,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(T),htmlFlowData:G,htmlText:l(I),htmlTextData:G,image:l(K),label:Z,labelText:ee,lineEnding:U,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:_,resourceTitleString:ve,resource:Me,setextHeading:l(B),setextHeadingLineSequence:O,setextHeadingText:k,strong:l(),thematicBreak:l()}};tb(e,(r||{}).mdastExtensions||[]);let t={};return i;function i(L){let W={type:"root",children:[]},Q={stack:[W],tokenStack:[],config:e,enter:o,exit:c,buffer:s,resume:u,data:t},de=[],xe=-1;for(;++xe<L.length;)if(L[xe][1].type==="listOrdered"||L[xe][1].type==="listUnordered")if(L[xe][0]==="enter")de.push(xe);else{let At=de.pop();xe=n(L,At,xe)}for(xe=-1;++xe<L.length;){let At=e[L[xe][0]];eb.call(At,L[xe][1].type)&&At[L[xe][1].type].call(Object.assign({sliceSerialize:L[xe][2].sliceSerialize},Q),L[xe][1])}if(Q.tokenStack.length>0){let At=Q.tokenStack[Q.tokenStack.length-1];(At[1]||Qy).call(Q,void 0,At[0])}for(W.position={start:bn(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:bn(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<e.transforms.length;)W=e.transforms[xe](W)||W;return W}function n(L,W,Q){let de=W-1,xe=-1,At=!1,Ot,qt,vn,_n;for(;++de<=Q;){let gt=L[de];switch(gt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{gt[0]==="enter"?xe++:xe--,_n=void 0;break}case"lineEndingBlank":{gt[0]==="enter"&&(Ot&&!_n&&!xe&&!vn&&(vn=de),_n=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_n=void 0}if(!xe&>[0]==="enter"&>[1].type==="listItemPrefix"||xe===-1&>[0]==="exit"&&(gt[1].type==="listUnordered"||gt[1].type==="listOrdered")){if(Ot){let ct=de;for(qt=void 0;ct--;){let or=L[ct];if(or[1].type==="lineEnding"||or[1].type==="lineEndingBlank"){if(or[0]==="exit")continue;qt&&(L[qt][1].type="lineEndingBlank",At=!0),or[1].type="lineEnding",qt=ct}else if(!(or[1].type==="linePrefix"||or[1].type==="blockQuotePrefix"||or[1].type==="blockQuotePrefixWhitespace"||or[1].type==="blockQuoteMarker"||or[1].type==="listItemIndent"))break}vn&&(!qt||vn<qt)&&(Ot._spread=!0),Ot.end=Object.assign({},qt?L[qt][1].start:gt[1].end),L.splice(qt||de,0,["exit",Ot,gt[2]]),de++,Q++}if(gt[1].type==="listItemPrefix"){let ct={type:"listItem",_spread:!1,start:Object.assign({},gt[1].start),end:void 0};Ot=ct,L.splice(de,0,["enter",ct,gt[2]]),de++,Q++,vn=void 0,_n=!0}}}return L[W][1]._spread=At,Q}function a(L,W){return Q;function Q(de){o.call(this,L(de),de),W&&W.call(this,de)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(L,W,Q){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([W,Q]),L.position={start:bn(W.start),end:void 0}}function l(L){return W;function W(Q){L&&L.call(this,Q),c.call(this,Q)}}function c(L,W){let Q=this.stack.pop(),de=this.tokenStack.pop();if(de)de[0].type!==L.type&&(W?W.call(this,L,de[0]):(de[1]||Qy).call(this,L,de[0]));else throw new Error("Cannot close `"+L.type+"` ("+yn({start:L.start,end:L.end})+"): it\u2019s not open");Q.position.end=bn(L.end)}function u(){return Rd(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(L){if(this.data.expectingFirstListItemValue){let W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function d(){let L=this.resume(),W=this.stack[this.stack.length-1];W.lang=L}function g(){let L=this.resume(),W=this.stack[this.stack.length-1];W.meta=L}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let L=this.resume(),W=this.stack[this.stack.length-1];W.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){let L=this.resume(),W=this.stack[this.stack.length-1];W.value=L.replace(/(\r?\n|\r)$/g,"")}function x(L){let W=this.resume(),Q=this.stack[this.stack.length-1];Q.label=W,Q.identifier=$r(this.sliceSerialize(L)).toLowerCase()}function S(){let L=this.resume(),W=this.stack[this.stack.length-1];W.title=L}function A(){let L=this.resume(),W=this.stack[this.stack.length-1];W.url=L}function R(L){let W=this.stack[this.stack.length-1];if(!W.depth){let Q=this.sliceSerialize(L).length;W.depth=Q}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function O(L){let W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function P(L){let Q=this.stack[this.stack.length-1].children,de=Q[Q.length-1];(!de||de.type!=="text")&&(de=jt(),de.position={start:bn(L.start),end:void 0},Q.push(de)),this.stack.push(de)}function G(L){let W=this.stack.pop();W.value+=this.sliceSerialize(L),W.position.end=bn(L.end)}function U(L){let W=this.stack[this.stack.length-1];if(this.data.atHardBreak){let Q=W.children[W.children.length-1];Q.position.end=bn(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(W.type)&&(P.call(this,L),G.call(this,L))}function N(){this.data.atHardBreak=!0}function T(){let L=this.resume(),W=this.stack[this.stack.length-1];W.value=L}function I(){let L=this.resume(),W=this.stack[this.stack.length-1];W.value=L}function F(){let L=this.resume(),W=this.stack[this.stack.length-1];W.value=L}function Y(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let W=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=W,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function K(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let W=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=W,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function ee(L){let W=this.sliceSerialize(L),Q=this.stack[this.stack.length-2];Q.label=Yy(W),Q.identifier=$r(W).toLowerCase()}function Z(){let L=this.stack[this.stack.length-1],W=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){let de=L.children;Q.children=de}else Q.alt=W}function _(){let L=this.resume(),W=this.stack[this.stack.length-1];W.url=L}function ve(){let L=this.resume(),W=this.stack[this.stack.length-1];W.title=L}function Me(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function se(L){let W=this.resume(),Q=this.stack[this.stack.length-1];Q.label=W,Q.identifier=$r(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function Re(L){this.data.characterReferenceType=L.type}function We(L){let W=this.sliceSerialize(L),Q=this.data.characterReferenceType,de;Q?(de=xl(W,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):de=na(W);let xe=this.stack.pop();xe.value+=de,xe.position.end=bn(L.end)}function Ye(L){G.call(this,L);let W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(L)}function Oe(L){G.call(this,L);let W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(L)}function St(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Ae(){return{type:"inlineCode",value:""}}function xt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Je(){return{type:"emphasis",children:[]}}function _e(){return{type:"heading",depth:0,children:[]}}function sr(){return{type:"break"}}function Wt(){return{type:"html",value:""}}function Ar(){return{type:"image",title:null,url:"",alt:null}}function fr(){return{type:"link",title:null,url:"",children:[]}}function Ze(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function Tt(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function ht(){return{type:"paragraph",children:[]}}function lt(){return{type:"strong",children:[]}}function jt(){return{type:"text",value:""}}function Et(){return{type:"thematicBreak"}}}function bn(r){return{line:r.line,column:r.column,offset:r.offset}}function tb(r,e){let t=-1;for(;++t<e.length;){let i=e[t];Array.isArray(i)?tb(r,i):RA(r,i)}}function RA(r,e){let t;for(t in e)if(eb.call(e,t))switch(t){case"canContainEols":{let i=e[t];i&&r[t].push(...i);break}case"transforms":{let i=e[t];i&&r[t].push(...i);break}case"enter":case"exit":{let i=e[t];i&&Object.assign(r[t],i);break}}}function Qy(r,e){throw r?new Error("Cannot close `"+r.type+"` ("+yn({start:r.start,end:r.end})+"): a different token (`"+e.type+"`, "+yn({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+yn({start:e.start,end:e.end})+") is still open")}function Bl(r){let e=this;e.parser=t;function t(i){return Kd(i,{...e.data("settings"),...r,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function rb(r,e){let t={type:"element",tagName:"blockquote",properties:{},children:r.wrap(r.all(e),!0)};return r.patch(e,t),r.applyData(e,t)}function nb(r,e){let t={type:"element",tagName:"br",properties:{},children:[]};return r.patch(e,t),[r.applyData(e,t),{type:"text",value:`
|
|
3474
|
-
`}]}function
|
|
3475
|
-
`:"",
|
|
3476
|
-
`}),u.type==="element"&&u.tagName==="p"&&!
|
|
3477
|
-
`});let c={type:"element",tagName:"li",properties:a,children:
|
|
3478
|
-
`},{type:"element",tagName:"ol",properties:{},children:
|
|
3479
|
-
`}]}}var
|
|
3480
|
-
`});++
|
|
3481
|
-
`}),
|
|
3482
|
-
`}),
|
|
3483
|
-
`},n)),a}function Vl(r,e){return r&&"run"in r?async function(t,i){let n=Hl(t,{file:i,...e});await r.run(n,i)}:function(t,i){return Hl(t,{file:i,...e||r})}}function Jd(r){if(r)throw r}var ql=dc(Ub(),1);function ys(r){if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Zd(){let r=[],e={run:t,use:i};return e;function t(...n){let a=-1,s=n.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...n);function o(l,...c){let u=r[++a],p=-1;if(l){s(l);return}for(;++p<n.length;)(c[p]===null||c[p]===void 0)&&(c[p]=n[p]);n=c,u?Hb(u,o)(...c):s(null,...c)}}function i(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return r.push(n),e}}function Hb(r,e){let t;return i;function i(...s){let o=r.length>s.length,l;o&&s.push(n);try{l=r.apply(this,s)}catch(c){let u=c;if(o&&t)throw u;return n(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,n):l instanceof Error?n(l):a(l))}function n(s,...o){t||(t=!0,e(s,...o))}function a(s){n(null,s)}}var ot=class extends Error{constructor(e,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let n="",a={},s=!1;if(t&&("line"in t&&"column"in t?a={place:t}:"start"in t&&"end"in t?a={place:t}:"type"in t?a={ancestors:[t],place:t.position}:a={...t}),typeof e=="string"?n=e:!a.cause&&e&&(s=!0,n=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof i=="string"){let l=i.indexOf(":");l===-1?a.ruleId=i:(a.source=i.slice(0,l),a.ruleId=i.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=o?o.line:void 0,this.name=yn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};ot.prototype.file="";ot.prototype.name="";ot.prototype.reason="";ot.prototype.message="";ot.prototype.stack="";ot.prototype.column=void 0;ot.prototype.line=void 0;ot.prototype.ancestors=void 0;ot.prototype.cause=void 0;ot.prototype.fatal=void 0;ot.prototype.place=void 0;ot.prototype.ruleId=void 0;ot.prototype.source=void 0;var hr={basename:GA,dirname:zA,extname:UA,join:HA,sep:"/"};function GA(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');bs(r);let t=0,i=-1,n=r.length,a;if(e===void 0||e.length===0||e.length>r.length){for(;n--;)if(r.codePointAt(n)===47){if(a){t=n+1;break}}else i<0&&(a=!0,i=n+1);return i<0?"":r.slice(t,i)}if(e===r)return"";let s=-1,o=e.length-1;for(;n--;)if(r.codePointAt(n)===47){if(a){t=n+1;break}}else s<0&&(a=!0,s=n+1),o>-1&&(r.codePointAt(n)===e.codePointAt(o--)?o<0&&(i=n):(o=-1,i=s));return t===i?i=s:i<0&&(i=r.length),r.slice(t,i)}function zA(r){if(bs(r),r.length===0)return".";let e=-1,t=r.length,i;for(;--t;)if(r.codePointAt(t)===47){if(i){e=t;break}}else i||(i=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function UA(r){bs(r);let e=r.length,t=-1,i=0,n=-1,a=0,s;for(;e--;){let o=r.codePointAt(e);if(o===47){if(s){i=e+1;break}continue}t<0&&(s=!0,t=e+1),o===46?n<0?n=e:a!==1&&(a=1):n>-1&&(a=-1)}return n<0||t<0||a===0||a===1&&n===t-1&&n===i+1?"":r.slice(n,t)}function HA(...r){let e=-1,t;for(;++e<r.length;)bs(r[e]),r[e]&&(t=t===void 0?r[e]:t+"/"+r[e]);return t===void 0?".":VA(t)}function VA(r){bs(r);let e=r.codePointAt(0)===47,t=WA(r,!e);return t.length===0&&!e&&(t="."),t.length>0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function WA(r,e){let t="",i=0,n=-1,a=0,s=-1,o,l;for(;++s<=r.length;){if(s<r.length)o=r.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(n===s-1||a===1))if(n!==s-1&&a===2){if(t.length<2||i!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",i=0):(t=t.slice(0,l),i=t.length-1-t.lastIndexOf("/")),n=s,a=0;continue}}else if(t.length>0){t="",i=0,n=s,a=0;continue}}e&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+r.slice(n+1,s):t=r.slice(n+1,s),i=s-n-1;n=s,a=0}else o===46&&a>-1?a++:a=-1}return t}function bs(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}var Vb={cwd:jA};function jA(){return"/"}function aa(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function Wb(r){if(typeof r=="string")r=new URL(r);else if(!aa(r)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return qA(r)}function qA(r){if(r.hostname!==""){let i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}let e=r.pathname,t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){let i=e.codePointAt(t+2);if(i===70||i===102){let n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(e)}var Qd=["history","path","basename","stem","extname","dirname"],vs=class{constructor(e){let t;e?aa(e)?t={path:e}:typeof e=="string"||$A(e)?t={value:e}:t=e:t={},this.cwd=Vb.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Qd.length;){let a=Qd[i];a in t&&t[a]!==void 0&&t[a]!==null&&(this[a]=a==="history"?[...t[a]]:t[a])}let n;for(n in t)Qd.includes(n)||(this[n]=t[n])}get basename(){return typeof this.path=="string"?hr.basename(this.path):void 0}set basename(e){tp(e,"basename"),ep(e,"basename"),this.path=hr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?hr.dirname(this.path):void 0}set dirname(e){jb(this.basename,"dirname"),this.path=hr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?hr.extname(this.path):void 0}set extname(e){if(ep(e,"extname"),jb(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=hr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){aa(e)&&(e=Wb(e)),tp(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?hr.basename(this.path,this.extname):void 0}set stem(e){tp(e,"stem"),ep(e,"stem"),this.path=hr.join(this.dirname||"",e+(this.extname||""))}fail(e,t,i){let n=this.message(e,t,i);throw n.fatal=!0,n}info(e,t,i){let n=this.message(e,t,i);return n.fatal=void 0,n}message(e,t,i){let n=new ot(e,t,i);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function ep(r,e){if(r&&r.includes(hr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+hr.sep+"`")}function tp(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function jb(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}function $A(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var qb=function(r){let i=this.constructor.prototype,n=i[r],a=function(){return n.apply(a,arguments)};Object.setPrototypeOf(a,i);let s=Object.getOwnPropertyNames(n);for(let o of s){let l=Object.getOwnPropertyDescriptor(n,o);l&&Object.defineProperty(a,o,l)}return a};var KA={}.hasOwnProperty,ap=class r extends qb{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Zd()}copy(){let e=new r,t=-1;for(;++t<this.attachers.length;){let i=this.attachers[t];e.use(...i)}return e.data((0,ql.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(ip("data",this.frozen),this.namespace[e]=t,this):KA.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ip("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);let n=t.call(e,...i);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=jl(e),i=this.parser||this.Parser;return rp("parse",i),i(String(t),t)}process(e,t){let i=this;return this.freeze(),rp("process",this.parser||this.Parser),np("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(a,s){let o=jl(e),l=i.parse(o);i.run(l,o,function(u,p,m){if(u||!p||!m)return c(u);let d=p,g=i.stringify(d,m);YA(g)?m.value=g:m.result=g,c(u,m)});function c(u,p){u||!p?s(u):a?a(p):t(void 0,p)}}}processSync(e){let t=!1,i;return this.freeze(),rp("processSync",this.parser||this.Parser),np("processSync",this.compiler||this.Compiler),this.process(e,n),Kb("processSync","process",t),i;function n(a,s){t=!0,Jd(a),i=s}}run(e,t,i){$b(e),this.freeze();let n=this.transformers;return!i&&typeof t=="function"&&(i=t,t=void 0),i?a(void 0,i):new Promise(a);function a(s,o){let l=jl(t);n.run(e,l,c);function c(u,p,m){let d=p||e;u?o(u):s?s(d):i(void 0,d,m)}}}runSync(e,t){let i=!1,n;return this.run(e,t,a),Kb("runSync","run",i),n;function a(s,o){Jd(s),n=o,i=!0}}stringify(e,t){this.freeze();let i=jl(t),n=this.compiler||this.Compiler;return np("stringify",n),$b(e),n(e,i)}use(e,...t){let i=this.attachers,n=this.namespace;if(ip("use",this.frozen),e!=null)if(typeof e=="function")l(e,t);else if(typeof e=="object")Array.isArray(e)?o(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...p]=c;l(u,p)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(n.settings=(0,ql.default)(!0,n.settings,c.settings))}function o(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let p=c[u];a(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,m=-1;for(;++p<i.length;)if(i[p][0]===c){m=p;break}if(m===-1)i.push([c,...u]);else if(u.length>0){let[d,...g]=u,f=i[m][1];ys(f)&&ys(d)&&(d=(0,ql.default)(!0,f,d)),i[m]=[c,d,...g]}}}},sp=new ap().freeze();function rp(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function np(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function ip(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $b(r){if(!ys(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function Kb(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function jl(r){return XA(r)?r:new vs(r)}function XA(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function YA(r){return typeof r=="string"||JA(r)}function JA(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var _s=class extends zt{constructor(){super(...arguments);this.html=()=>`
|
|
3512
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function E1(t,e,r,n){let i=n.schema,a=i.space==="svg"?!1:n.settings.omitOptionalTags,o=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(t.tagName.toLowerCase()),s=[],l;i.space==="html"&&t.tagName==="svg"&&(n.schema=wf);let c=XZ(n,t.properties),u=n.all(i.space==="html"&&t.tagName==="template"?t.content:t);return n.schema=i,u&&(o=!1),(c||!a||!x1(t,e,r))&&(s.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||n.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Od(t,e,r))&&s.push("</"+t.tagName+">"),s.join("")}function XZ(t,e){let r=[],n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let a=YZ(t,i,e[i]);a&&r.push(a)}}for(;++n<r.length;){let a=t.settings.tightAttributes?r[n].charAt(r[n].length-1):void 0;n!==r.length-1&&a!=='"'&&a!=="'"&&(r[n]+=" ")}return r.join("")}function YZ(t,e,r){let n=ox(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,a=t.settings.allowDangerousCharacters?0:1,o=t.quote,s;if(n.overloadedBoolean&&(r===n.attribute||r==="")?r=!0:(n.boolean||n.overloadedBoolean&&typeof r!="string")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";let l=ea(n.attribute,Object.assign({},t.settings.characterReferences,{subset:Tf.name[i][a]}));return r===!0||(r=Array.isArray(r)?(n.commaSeparated?_1:VO)(r,{padLeft:!t.settings.tightCommaSeparatedLists}):String(r),t.settings.collapseEmptyAttributes&&!r)?l:(t.settings.preferUnquoted&&(s=ea(r,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Tf.unquoted[i][a]}))),s!==r&&(t.settings.quoteSmart&&lx(r,o)>lx(r,t.alternative)&&(o=t.alternative),s=o+ea(r,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?Tf.single:Tf.double)[i][a],attribute:!0}))+o),l+(s&&"="+s))}var QZ=["<","&"];function Cf(t,e,r,n){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?t.value:ea(t.value,Object.assign({},n.settings.characterReferences,{subset:QZ}))}function T1(t,e,r,n){return n.settings.allowDangerousHtml?t.value:Cf(t,e,r,n)}function C1(t,e,r,n){return n.all(t)}var I1=l1("type",{invalid:eK,unknown:tK,handlers:{comment:b1,doctype:v1,element:E1,raw:T1,root:C1,text:Cf}});function eK(t){throw new Error("Expected node, not `"+t+"`")}function tK(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var rK={},nK={},iK=[];function dx(t,e){let r=e||rK,n=r.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:aK,all:oK,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||t1,characterReferences:r.characterReferences||nK,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?wf:o1,quote:n,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function aK(t,e,r){return I1(t,e,r,this)}function oK(t){let e=[],r=t&&t.children||iK,n=-1;for(;++n<r.length;)e[n]=this.one(r[n],n,t);return e.join("")}function If(t){let e=this,r={...e.data("settings"),...t};e.compiler=n;function n(i){return dx(i,r)}}var sK={};function px(t,e){let r=e||sK,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return P1(t,n,i)}function P1(t,e,r){if(lK(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return A1(t.children,e,r)}return Array.isArray(t)?A1(t,e,r):""}function A1(t,e,r){let n=[],i=-1;for(;++i<t.length;)n[i]=P1(t[i],e,r);return n.join("")}function lK(t){return!!(t&&typeof t=="object")}var R1=document.createElement("i");function Ll(t){let e="&"+t+";";R1.innerHTML=e;let r=R1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wr(t,e,r,n){let i=t.length,a=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);a<n.length;)o=n.slice(a,a+1e4),o.unshift(e,0),t.splice(...o),a+=1e4,e+=1e4}function Or(t,e){return t.length>0?(wr(t,t.length,0,e),t):e}var N1={}.hasOwnProperty;function O1(t){let e={},r=-1;for(;++r<t.length;)cK(e,t[r]);return e}function cK(t,e){let r;for(r in e){let i=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),a=e[r],o;if(a)for(o in a){N1.call(i,o)||(i[o]=[]);let s=a[o];uK(i[o],Array.isArray(s)?s:s?[s]:[])}}}function uK(t,e){let r=-1,n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wr(t,0,0,n)}function Af(t,e){let r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var sn=Fa(/[A-Za-z]/),Kt=Fa(/[\dA-Za-z]/),D1=Fa(/[#-'*+\--9=?A-Z^-~]/);function Dd(t){return t!==null&&(t<32||t===127)}var Md=Fa(/\d/),M1=Fa(/[\dA-Fa-f]/),$1=Fa(/[!-/:-@[-`{-~]/);function X(t){return t!==null&&t<-2}function $t(t){return t!==null&&(t<0||t===32)}function be(t){return t===-2||t===-1||t===32}var L1=Fa(/\p{P}|\p{S}/u),z1=Fa(/\s/);function Fa(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function An(t){let e=[],r=-1,n=0,i=0;for(;++r<t.length;){let a=t.charCodeAt(r),o="";if(a===37&&Kt(t.charCodeAt(r+1))&&Kt(t.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=t.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function ve(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return be(l)?(t.enter(r),s(l)):e(l)}function s(l){return be(l)&&a++<i?(t.consume(l),s):(t.exit(r),e(l))}}var F1={tokenize:dK};function dK(t){let e=t.attempt(this.parser.constructs.contentInitial,n,i),r;return e;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ve(t,e,"linePrefix")}function i(s){return t.enter("paragraph"),a(s)}function a(s){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(s)}function o(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return X(s)?(t.consume(s),t.exit("chunkText"),a):(t.consume(s),o)}}var j1={tokenize:pK},B1={tokenize:mK};function pK(t){let e=this,r=[],n=0,i,a,o;return s;function s(v){if(n<r.length){let I=r[n];return e.containerState=I[1],t.attempt(I[0].continuation,l,c)(v)}return c(v)}function l(v){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&x();let I=e.events.length,T=I,C;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){C=e.events[T][1].end;break}g(n);let M=I;for(;M<e.events.length;)e.events[M][1].end=Object.assign({},C),M++;return wr(e.events,T+1,0,e.events.slice(I)),e.events.length=M,c(v)}return s(v)}function c(v){if(n===r.length){if(!i)return m(v);if(i.currentConstruct&&i.currentConstruct.concrete)return h(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(B1,u,d)(v)}function u(v){return i&&x(),g(n),m(v)}function d(v){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,h(v)}function m(v){return e.containerState={},t.attempt(B1,p,h)(v)}function p(v){return n++,r.push([e.currentConstruct,e.containerState]),m(v)}function h(v){if(v===null){i&&x(),g(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(v)}function f(v){if(v===null){y(t.exit("chunkFlow"),!0),g(0),t.consume(v);return}return X(v)?(t.consume(v),y(t.exit("chunkFlow")),n=0,e.interrupt=void 0,s):(t.consume(v),f)}function y(v,I){let T=e.sliceStream(v);if(I&&T.push(null),v.previous=a,a&&(a.next=v),a=v,i.defineSkip(v.start),i.write(T),e.parser.lazy[v.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;let M=e.events.length,W=M,$,B;for(;W--;)if(e.events[W][0]==="exit"&&e.events[W][1].type==="chunkFlow"){if($){B=e.events[W][1].end;break}$=!0}for(g(n),C=M;C<e.events.length;)e.events[C][1].end=Object.assign({},B),C++;wr(e.events,W+1,0,e.events.slice(M)),e.events.length=C}}function g(v){let I=r.length;for(;I-- >v;){let T=r[I];e.containerState=T[1],T[0].exit.call(e,t)}r.length=v}function x(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function mK(t,e,r){return ve(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function mx(t){if(t===null||$t(t)||z1(t))return 1;if(L1(t))return 2}function zl(t,e,r){let n=[],i=-1;for(;++i<t.length;){let a=t[i].resolveAll;a&&!n.includes(a)&&(e=a(e,r),n.push(a))}return e}var $d={name:"attention",tokenize:fK,resolveAll:hK};function hK(t,e){let r=-1,n,i,a,o,s,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[n][1].end),m=Object.assign({},t[r][1].start);U1(d,-l),U1(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[n][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[r][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},t[n][1].end=Object.assign({},o.start),t[r][1].start=Object.assign({},s.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Or(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Or(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",a,e]]),c=Or(c,zl(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Or(c,[["exit",a,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Or(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,wr(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function fK(t,e){let r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=mx(n),a;return o;function o(l){return a=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===a)return t.consume(l),s;let c=t.exit("attentionSequence"),u=mx(l),d=!u||u===2&&i||r.includes(l),m=!i||i===2&&u||r.includes(n);return c._open=!!(a===42?d:d&&(i||!m)),c._close=!!(a===42?m:m&&(u||!d)),e(l)}}function U1(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var hx={name:"autolink",tokenize:gK};function gK(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(p){return sn(p)?(t.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Kt(p)?(n=1,s(p)):c(p)}function s(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||Kt(p))&&n++<32?(t.consume(p),s):(n=0,c(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Dd(p)?r(p):(t.consume(p),l)}function c(p){return p===64?(t.consume(p),u):D1(p)?(t.consume(p),c):r(p)}function u(p){return Kt(p)?d(p):r(p)}function d(p){return p===46?(t.consume(p),n=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):m(p)}function m(p){if((p===45||Kt(p))&&n++<63){let h=p===45?m:d;return t.consume(p),h}return r(p)}}var Ba={tokenize:yK,partial:!0};function yK(t,e,r){return n;function n(a){return be(a)?ve(t,i,"linePrefix")(a):i(a)}function i(a){return a===null||X(a)?e(a):r(a)}}var Pf={name:"blockQuote",tokenize:bK,continuation:{tokenize:vK},exit:_K};function bK(t,e,r){let n=this;return i;function i(o){if(o===62){let s=n.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),a}return r(o)}function a(o){return be(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function vK(t,e,r){let n=this;return i;function i(o){return be(o)?ve(t,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return t.attempt(Pf,e,r)(o)}}function _K(t){t.exit("blockQuote")}var Rf={name:"characterEscape",tokenize:SK};function SK(t,e,r){return n;function n(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),i}function i(a){return $1(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(a)}}var Nf={name:"characterReference",tokenize:wK};function wK(t,e,r){let n=this,i=0,a,o;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),a=31,o=Kt,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,o=M1,u):(t.enter("characterReferenceValue"),a=7,o=Md,u(d))}function u(d){if(d===59&&i){let m=t.exit("characterReferenceValue");return o===Kt&&!Ll(n.sliceSerialize(m))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<a?(t.consume(d),u):r(d)}}var G1={tokenize:xK,partial:!0},Of={name:"codeFenced",tokenize:kK,concrete:!0};function kK(t,e,r){let n=this,i={tokenize:T,partial:!0},a=0,o=0,s;return l;function l(C){return c(C)}function c(C){let M=n.events[n.events.length-1];return a=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,s=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,t.consume(C),u):o<3?r(C):(t.exit("codeFencedFenceSequence"),be(C)?ve(t,d,"whitespace")(C):d(C))}function d(C){return C===null||X(C)?(t.exit("codeFencedFence"),n.interrupt?e(C):t.check(G1,f,I)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(C)):be(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ve(t,p,"whitespace")(C)):C===96&&C===s?r(C):(t.consume(C),m)}function p(C){return C===null||X(C)?d(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(C))}function h(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(C)):C===96&&C===s?r(C):(t.consume(C),h)}function f(C){return t.attempt(i,I,y)(C)}function y(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),g}function g(C){return a>0&&be(C)?ve(t,x,"linePrefix",a+1)(C):x(C)}function x(C){return C===null||X(C)?t.check(G1,f,I)(C):(t.enter("codeFlowValue"),v(C))}function v(C){return C===null||X(C)?(t.exit("codeFlowValue"),x(C)):(t.consume(C),v)}function I(C){return t.exit("codeFenced"),e(C)}function T(C,M,W){let $=0;return B;function B(ae){return C.enter("lineEnding"),C.consume(ae),C.exit("lineEnding"),Y}function Y(ae){return C.enter("codeFencedFence"),be(ae)?ve(C,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ae):H(ae)}function H(ae){return ae===s?(C.enter("codeFencedFenceSequence"),j(ae)):W(ae)}function j(ae){return ae===s?($++,C.consume(ae),j):$>=o?(C.exit("codeFencedFenceSequence"),be(ae)?ve(C,Z,"whitespace")(ae):Z(ae)):W(ae)}function Z(ae){return ae===null||X(ae)?(C.exit("codeFencedFence"),M(ae)):W(ae)}}}function xK(t,e,r){let n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}var Ld={name:"codeIndented",tokenize:TK},EK={tokenize:CK,partial:!0};function TK(t,e,r){let n=this;return i;function i(c){return t.enter("codeIndented"),ve(t,a,"linePrefix",5)(c)}function a(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):X(c)?t.attempt(EK,o,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||X(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function CK(t,e,r){let n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):ve(t,a,"linePrefix",5)(o)}function a(o){let s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):X(o)?i(o):r(o)}}var fx={name:"codeText",tokenize:PK,resolve:IK,previous:AK};function IK(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function AK(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PK(t,e,r){let n=this,i=0,a,o;return s;function s(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),i++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?r(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(o=t.enter("codeTextSequence"),a=0,d(m)):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||X(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),u)}function d(m){return m===96?(t.consume(m),a++,d):a===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var Df=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){let i=r||0;this.setCursor(Math.trunc(e));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&zd(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),zd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);zd(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);zd(this.left,r.reverse())}}};function zd(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Mf(t){let e={},r=-1,n,i,a,o,s,l,c,u=new Df(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,RK(u,r)),r=e[r],c=!0);else if(n[1]._container){for(a=r,i=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);i&&(n[1].end=Object.assign({},u.get(i)[1].start),s=u.slice(i,r),s.unshift(n),u.splice(i,r-i+1,s))}}return wr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function RK(t,e){let r=t.get(e)[1],n=t.get(e)[2],i=e-1,a=[],o=r._tokenizer||n.parser[r.contentType](r.start),s=o.events,l=[],c={},u,d,m=-1,p=r,h=0,f=0,y=[f];for(;p;){for(;t.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=n.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){let g=s.slice(y[m],y[m+1]),x=a.pop();l.push([x,x+g.length-1]),t.splice(x,2,g)}for(l.reverse(),m=-1;++m<l.length;)c[h+l[m][0]]=h+l[m][1],h+=l[m][1]-l[m][0]-1;return c}var gx={tokenize:DK,resolve:OK},NK={tokenize:MK,partial:!0};function OK(t){return Mf(t),t}function DK(t,e){let r;return n;function n(s){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?a(s):X(s)?t.check(NK,o,a)(s):(t.consume(s),i)}function a(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function o(s){return t.consume(s),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function MK(t,e,r){let n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),ve(t,a,"linePrefix")}function a(o){if(o===null||X(o))return r(o);let s=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function $f(t,e,r,n,i,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(g){return g===60?(t.enter(n),t.enter(i),t.enter(a),t.consume(g),t.exit(a),m):g===null||g===32||g===41||Dd(g)?r(g):(t.enter(n),t.enter(o),t.enter(s),t.enter("chunkString",{contentType:"string"}),f(g))}function m(g){return g===62?(t.enter(a),t.consume(g),t.exit(a),t.exit(i),t.exit(n),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(s),m(g)):g===null||g===60||X(g)?r(g):(t.consume(g),g===92?h:p)}function h(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function f(g){return!u&&(g===null||g===41||$t(g))?(t.exit("chunkString"),t.exit(s),t.exit(o),t.exit(n),e(g)):u<c&&g===40?(t.consume(g),u++,f):g===41?(t.consume(g),u--,f):g===null||g===32||g===40||Dd(g)?r(g):(t.consume(g),g===92?y:f)}function y(g){return g===40||g===41||g===92?(t.consume(g),f):f(g)}}function Lf(t,e,r,n,i,a){let o=this,s=0,l;return c;function c(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(a),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):X(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||X(p)||s++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!be(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(t.consume(p),s++,d):d(p)}}function zf(t,e,r,n,i,a){let o;return s;function s(m){return m===34||m===39||m===40?(t.enter(n),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):r(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(n),e):(t.enter(a),c(m))}function c(m){return m===o?(t.exit(a),l(o)):m===null?r(m):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),ve(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||X(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(t.consume(m),u):u(m)}}function Go(t,e){let r;return n;function n(i){return X(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):be(i)?ve(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}var yx={name:"definition",tokenize:LK},$K={tokenize:zK,partial:!0};function LK(t,e,r){let n=this,i;return a;function a(p){return t.enter("definition"),o(p)}function o(p){return Lf.call(n,t,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return $t(p)?Go(t,c)(p):c(p)}function c(p){return $f(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt($K,d,d)(p)}function d(p){return be(p)?ve(t,m,"whitespace")(p):m(p)}function m(p){return p===null||X(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function zK(t,e,r){return n;function n(s){return $t(s)?Go(t,i)(s):r(s)}function i(s){return zf(t,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return be(s)?ve(t,o,"whitespace")(s):o(s)}function o(s){return s===null||X(s)?e(s):r(s)}}var bx={name:"hardBreakEscape",tokenize:FK};function FK(t,e,r){return n;function n(a){return t.enter("hardBreakEscape"),t.consume(a),i}function i(a){return X(a)?(t.exit("hardBreakEscape"),e(a)):r(a)}}var vx={name:"headingAtx",tokenize:jK,resolve:BK};function BK(t,e){let r=t.length-2,n=3,i,a;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},a={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},wr(t,n,r-n+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),t}function jK(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),a(u)}function a(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||$t(u)?(t.exit("atxHeadingSequence"),s(u)):r(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(t.exit("atxHeading"),e(u)):be(u)?ve(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||$t(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var V1=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_x=["pre","script","style","textarea"];var Sx={name:"htmlFlow",tokenize:HK,resolveTo:VK,concrete:!0},UK={tokenize:WK,partial:!0},GK={tokenize:qK,partial:!0};function VK(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function HK(t,e,r){let n=this,i,a,o,s,l;return c;function c(k){return u(k)}function u(k){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(k),d}function d(k){return k===33?(t.consume(k),m):k===47?(t.consume(k),a=!0,f):k===63?(t.consume(k),i=3,n.interrupt?e:S):sn(k)?(t.consume(k),o=String.fromCharCode(k),y):r(k)}function m(k){return k===45?(t.consume(k),i=2,p):k===91?(t.consume(k),i=5,s=0,h):sn(k)?(t.consume(k),i=4,n.interrupt?e:S):r(k)}function p(k){return k===45?(t.consume(k),n.interrupt?e:S):r(k)}function h(k){let Lt="CDATA[";return k===Lt.charCodeAt(s++)?(t.consume(k),s===Lt.length?n.interrupt?e:H:h):r(k)}function f(k){return sn(k)?(t.consume(k),o=String.fromCharCode(k),y):r(k)}function y(k){if(k===null||k===47||k===62||$t(k)){let Lt=k===47,zt=o.toLowerCase();return!Lt&&!a&&_x.includes(zt)?(i=1,n.interrupt?e(k):H(k)):V1.includes(o.toLowerCase())?(i=6,Lt?(t.consume(k),g):n.interrupt?e(k):H(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):a?x(k):v(k))}return k===45||Kt(k)?(t.consume(k),o+=String.fromCharCode(k),y):r(k)}function g(k){return k===62?(t.consume(k),n.interrupt?e:H):r(k)}function x(k){return be(k)?(t.consume(k),x):B(k)}function v(k){return k===47?(t.consume(k),B):k===58||k===95||sn(k)?(t.consume(k),I):be(k)?(t.consume(k),v):B(k)}function I(k){return k===45||k===46||k===58||k===95||Kt(k)?(t.consume(k),I):T(k)}function T(k){return k===61?(t.consume(k),C):be(k)?(t.consume(k),T):v(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(t.consume(k),l=k,M):be(k)?(t.consume(k),C):W(k)}function M(k){return k===l?(t.consume(k),l=null,$):k===null||X(k)?r(k):(t.consume(k),M)}function W(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||$t(k)?T(k):(t.consume(k),W)}function $(k){return k===47||k===62||be(k)?v(k):r(k)}function B(k){return k===62?(t.consume(k),Y):r(k)}function Y(k){return k===null||X(k)?H(k):be(k)?(t.consume(k),Y):r(k)}function H(k){return k===45&&i===2?(t.consume(k),$e):k===60&&i===1?(t.consume(k),Xe):k===62&&i===4?(t.consume(k),xr):k===63&&i===3?(t.consume(k),S):k===93&&i===5?(t.consume(k),kt):X(k)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(UK,Pn,j)(k)):k===null||X(k)?(t.exit("htmlFlowData"),j(k)):(t.consume(k),H)}function j(k){return t.check(GK,Z,Pn)(k)}function Z(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),ae}function ae(k){return k===null||X(k)?j(k):(t.enter("htmlFlowData"),H(k))}function $e(k){return k===45?(t.consume(k),S):H(k)}function Xe(k){return k===47?(t.consume(k),o="",At):H(k)}function At(k){if(k===62){let Lt=o.toLowerCase();return _x.includes(Lt)?(t.consume(k),xr):H(k)}return sn(k)&&o.length<8?(t.consume(k),o+=String.fromCharCode(k),At):H(k)}function kt(k){return k===93?(t.consume(k),S):H(k)}function S(k){return k===62?(t.consume(k),xr):k===45&&i===2?(t.consume(k),S):H(k)}function xr(k){return k===null||X(k)?(t.exit("htmlFlowData"),Pn(k)):(t.consume(k),xr)}function Pn(k){return t.exit("htmlFlow"),e(k)}}function qK(t,e,r){let n=this;return i;function i(o){return X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a):r(o)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function WK(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ba,e,r)}}var wx={name:"htmlText",tokenize:ZK};function ZK(t,e,r){let n=this,i,a,o;return s;function s(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),T):S===63?(t.consume(S),v):sn(S)?(t.consume(S),W):r(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),a=0,h):sn(S)?(t.consume(S),x):r(S)}function u(S){return S===45?(t.consume(S),p):r(S)}function d(S){return S===null?r(S):S===45?(t.consume(S),m):X(S)?(o=d,Xe(S)):(t.consume(S),d)}function m(S){return S===45?(t.consume(S),p):d(S)}function p(S){return S===62?$e(S):S===45?m(S):d(S)}function h(S){let xr="CDATA[";return S===xr.charCodeAt(a++)?(t.consume(S),a===xr.length?f:h):r(S)}function f(S){return S===null?r(S):S===93?(t.consume(S),y):X(S)?(o=f,Xe(S)):(t.consume(S),f)}function y(S){return S===93?(t.consume(S),g):f(S)}function g(S){return S===62?$e(S):S===93?(t.consume(S),g):f(S)}function x(S){return S===null||S===62?$e(S):X(S)?(o=x,Xe(S)):(t.consume(S),x)}function v(S){return S===null?r(S):S===63?(t.consume(S),I):X(S)?(o=v,Xe(S)):(t.consume(S),v)}function I(S){return S===62?$e(S):v(S)}function T(S){return sn(S)?(t.consume(S),C):r(S)}function C(S){return S===45||Kt(S)?(t.consume(S),C):M(S)}function M(S){return X(S)?(o=M,Xe(S)):be(S)?(t.consume(S),M):$e(S)}function W(S){return S===45||Kt(S)?(t.consume(S),W):S===47||S===62||$t(S)?$(S):r(S)}function $(S){return S===47?(t.consume(S),$e):S===58||S===95||sn(S)?(t.consume(S),B):X(S)?(o=$,Xe(S)):be(S)?(t.consume(S),$):$e(S)}function B(S){return S===45||S===46||S===58||S===95||Kt(S)?(t.consume(S),B):Y(S)}function Y(S){return S===61?(t.consume(S),H):X(S)?(o=Y,Xe(S)):be(S)?(t.consume(S),Y):$(S)}function H(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),i=S,j):X(S)?(o=H,Xe(S)):be(S)?(t.consume(S),H):(t.consume(S),Z)}function j(S){return S===i?(t.consume(S),i=void 0,ae):S===null?r(S):X(S)?(o=j,Xe(S)):(t.consume(S),j)}function Z(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||$t(S)?$(S):(t.consume(S),Z)}function ae(S){return S===47||S===62||$t(S)?$(S):r(S)}function $e(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):r(S)}function Xe(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),At}function At(S){return be(S)?ve(t,kt,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):kt(S)}function kt(S){return t.enter("htmlTextData"),o(S)}}var Vo={name:"labelEnd",tokenize:e8,resolveTo:QK,resolveAll:YK},KK={tokenize:t8},JK={tokenize:r8},XK={tokenize:n8};function YK(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function QK(t,e){let r=t.length,n=0,i,a,o,s;for(;r--;)if(i=t[r][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);let l={type:t[a][1].type==="labelLink"?"link":"image",start:Object.assign({},t[a][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[a][1].start),end:Object.assign({},t[o][1].end)},u={type:"labelText",start:Object.assign({},t[a+n+2][1].end),end:Object.assign({},t[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=Or(s,t.slice(a+1,a+n+3)),s=Or(s,[["enter",u,e]]),s=Or(s,zl(e.parser.constructs.insideSpan.null,t.slice(a+n+4,o-3),e)),s=Or(s,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),s=Or(s,t.slice(o+1)),s=Or(s,[["exit",l,e]]),wr(t,a,t.length,s),t}function e8(t,e,r){let n=this,i=n.events.length,a,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){a=n.events[i][1];break}return s;function s(m){return a?a._inactive?d(m):(o=n.parser.defined.includes(ta(n.sliceSerialize({start:a.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):r(m)}function l(m){return m===40?t.attempt(KK,u,o?u:d)(m):m===91?t.attempt(JK,u,o?c:d)(m):o?u(m):d(m)}function c(m){return t.attempt(XK,u,d)(m)}function u(m){return e(m)}function d(m){return a._balanced=!0,r(m)}}function t8(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return $t(d)?Go(t,a)(d):a(d)}function a(d){return d===41?u(d):$f(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return $t(d)?Go(t,l)(d):u(d)}function s(d){return r(d)}function l(d){return d===34||d===39||d===40?zf(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return $t(d)?Go(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function r8(t,e,r){let n=this;return i;function i(s){return Lf.call(n,t,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return n.parser.defined.includes(ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(s):r(s)}function o(s){return r(s)}}function n8(t,e,r){return n;function n(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),i}function i(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):r(a)}}var kx={name:"labelStartImage",tokenize:i8,resolveAll:Vo.resolveAll};function i8(t,e,r){let n=this;return i;function i(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),a}function a(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),o):r(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(s):e(s)}}var xx={name:"labelStartLink",tokenize:a8,resolveAll:Vo.resolveAll};function a8(t,e,r){let n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}var Fd={name:"lineEnding",tokenize:o8};function o8(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),ve(t,e,"linePrefix")}}var Ho={name:"thematicBreak",tokenize:s8};function s8(t,e,r){let n=0,i;return a;function a(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,s(c)}function s(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||X(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),be(c)?ve(t,s,"whitespace")(c):s(c))}}var kr={name:"list",tokenize:u8,continuation:{tokenize:d8},exit:m8},l8={tokenize:h8,partial:!0},c8={tokenize:p8,partial:!0};function u8(t,e,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(p){let h=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Md(p)){if(n.containerState.type||(n.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Ho,r,c)(p):c(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return Md(p)&&++o<10?(t.consume(p),l):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):r(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(Ba,n.interrupt?r:u,t.attempt(l8,m,d))}function u(p){return n.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return be(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):r(p)}function m(p){return n.containerState.size=a+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function d8(t,e,r){let n=this;return n.containerState._closeFlow=void 0,t.check(Ba,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ve(t,e,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!be(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(c8,e,o)(s))}function o(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ve(t,t.attempt(kr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function p8(t,e,r){let n=this;return ve(t,i,"listItemIndent",n.containerState.size+1);function i(a){let o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(a):r(a)}}function m8(t){t.exit(this.containerState.type)}function h8(t,e,r){let n=this;return ve(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=n.events[n.events.length-1];return!be(a)&&o&&o[1].type==="listItemPrefixWhitespace"?e(a):r(a)}}var Ff={name:"setextUnderline",tokenize:g8,resolveTo:f8};function f8(t,e){let r=t.length,n,i,a;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!a&&t[r][1].type==="definition"&&(a=r);let o={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",a?(t.splice(i,0,["enter",o,e]),t.splice(a+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[a][1].end)):t[n][1]=o,t.push(["exit",o,e]),t}function g8(t,e,r){let n=this,i;return a;function a(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),be(c)?ve(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var H1={tokenize:y8};function y8(t){let e=this,r=t.attempt(Ba,n,t.attempt(this.parser.constructs.flowInitial,i,ve(t,t.attempt(this.parser.constructs.flow,i,t.attempt(gx,i)),"linePrefix")));return r;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var q1={resolveAll:J1()},W1=K1("string"),Z1=K1("text");function K1(t){return{tokenize:e,resolveAll:J1(t==="text"?b8:void 0)};function e(r){let n=this,i=this.parser.constructs[t],a=r.attempt(i,o,s);return o;function o(u){return c(u)?a(u):s(u)}function s(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),a(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=i[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function J1(t){return e;function e(r,n){let i=-1,a;for(;++i<=r.length;)a===void 0?r[i]&&r[i][1].type==="data"&&(a=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==a+2&&(r[a][1].end=r[i-1][1].end,r.splice(a+2,i-a-2),i=a+2),a=void 0);return t?t(r,n):r}}function b8(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let n=t[r-1][1],i=e.sliceStream(n),a=i.length,o=-1,s=0,l;for(;a--;){let c=i[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){a++;break}}if(s){let c={type:r===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-s,offset:n.end.offset-s,_index:n.start._index+a,_bufferIndex:a?o:n.start._bufferIndex+o},end:Object.assign({},n.end)};n.end=Object.assign({},c.start),n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function X1(t,e,r){let n=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},a=[],o=[],s=[],l=!0,c={consume:I,enter:T,exit:C,attempt:$(M),check:$(W),interrupt:$(W,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:f,sliceSerialize:h,now:y,defineSkip:g,write:p},d=e.tokenize.call(u,c),m;return e.resolveAll&&a.push(e),u;function p(j){return o=Or(o,j),x(),o[o.length-1]!==null?[]:(B(e,0),u.events=zl(a,u.events,u),u.events)}function h(j,Z){return _8(f(j),Z)}function f(j){return v8(o,j)}function y(){let{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}=n;return{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}}function g(j){i[j.line]=j.column,H()}function x(){let j;for(;n._index<o.length;){let Z=o[n._index];if(typeof Z=="string")for(j=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===j&&n._bufferIndex<Z.length;)v(Z.charCodeAt(n._bufferIndex));else v(Z)}}function v(j){l=void 0,m=j,d=d(j)}function I(j){X(j)?(n.line++,n.column=1,n.offset+=j===-3?2:1,H()):j!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=j,l=!0}function T(j,Z){let ae=Z||{};return ae.type=j,ae.start=y(),u.events.push(["enter",ae,u]),s.push(ae),ae}function C(j){let Z=s.pop();return Z.end=y(),u.events.push(["exit",Z,u]),Z}function M(j,Z){B(j,Z.from)}function W(j,Z){Z.restore()}function $(j,Z){return ae;function ae($e,Xe,At){let kt,S,xr,Pn;return Array.isArray($e)?Lt($e):"tokenize"in $e?Lt([$e]):k($e);function k(Pt){return _i;function _i($r){let Si=$r!==null&&Pt[$r],ra=$r!==null&&Pt.null,Zl=[...Array.isArray(Si)?Si:Si?[Si]:[],...Array.isArray(ra)?ra:ra?[ra]:[]];return Lt(Zl)($r)}}function Lt(Pt){return kt=Pt,S=0,Pt.length===0?At:zt(Pt[S])}function zt(Pt){return _i;function _i($r){return Pn=Y(),xr=Pt,Pt.partial||(u.currentConstruct=Pt),Pt.name&&u.parser.constructs.disable.null.includes(Pt.name)?Rn($r):Pt.tokenize.call(Z?Object.assign(Object.create(u),Z):u,c,Mr,Rn)($r)}}function Mr(Pt){return l=!0,j(xr,Pn),Xe}function Rn(Pt){return l=!0,Pn.restore(),++S<kt.length?zt(kt[S]):At}}}function B(j,Z){j.resolveAll&&!a.includes(j)&&a.push(j),j.resolve&&wr(u.events,Z,u.events.length-Z,j.resolve(u.events.slice(Z),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function Y(){let j=y(),Z=u.previous,ae=u.currentConstruct,$e=u.events.length,Xe=Array.from(s);return{restore:At,from:$e};function At(){n=j,u.previous=Z,u.currentConstruct=ae,u.events.length=$e,s=Xe,H()}}function H(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function v8(t,e){let r=e.start._index,n=e.start._bufferIndex,i=e.end._index,a=e.end._bufferIndex,o;if(r===i)o=[t[r].slice(n,a)];else{if(o=t.slice(r,i),n>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(n):o.shift()}a>0&&o.push(t[i].slice(0,a))}return o}function _8(t,e){let r=-1,n=[],i;for(;++r<t.length;){let a=t[r],o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
|
|
3513
|
+
`;break}case-3:{o=`\r
|
|
3514
|
+
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,n.push(o)}return n.join("")}var Ex={};rc(Ex,{attentionMarkers:()=>I8,contentInitial:()=>w8,disable:()=>A8,document:()=>S8,flow:()=>x8,flowInitial:()=>k8,insideSpan:()=>C8,string:()=>E8,text:()=>T8});var S8={42:kr,43:kr,45:kr,48:kr,49:kr,50:kr,51:kr,52:kr,53:kr,54:kr,55:kr,56:kr,57:kr,62:Pf},w8={91:yx},k8={[-2]:Ld,[-1]:Ld,32:Ld},x8={35:vx,42:Ho,45:[Ff,Ho],60:Sx,61:Ff,95:Ho,96:Of,126:Of},E8={38:Nf,92:Rf},T8={[-5]:Fd,[-4]:Fd,[-3]:Fd,33:kx,38:Nf,42:$d,60:[hx,wx],91:xx,92:[bx,Rf],93:Vo,95:$d,96:fx},C8={null:[$d,q1]},I8={null:[42,95]},A8={null:[]};function Tx(t){let r=O1([Ex,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(F1),document:i(j1),flow:i(H1),string:i(W1),text:i(Z1)};return n;function i(a){return o;function o(s){return X1(n,a,s)}}}function Cx(t){for(;!Mf(t););return t}var Y1=/[\0\t\n\r]/g;function Ix(){let t=1,e="",r=!0,n;return i;function i(a,o,s){let l=[],c,u,d,m,p;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,e="",r&&(a.charCodeAt(0)===65279&&d++,r=void 0);d<a.length;){if(Y1.lastIndex=d,c=Y1.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){e=a.slice(d);break}if(p===10&&d===m&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<m&&(l.push(a.slice(d,m)),t+=m-d),p){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=m+1}return s&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}var P8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Q1(t){return t.replace(P8,R8)}function R8(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let i=r.charCodeAt(1),a=i===120||i===88;return Af(r.slice(a?2:1),a?16:10)}return Ll(r)||t}function ja(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?eD(t.position):"start"in t||"end"in t?eD(t):"line"in t||"column"in t?Ax(t):""}function Ax(t){return tD(t&&t.line)+":"+tD(t&&t.column)}function eD(t){return Ax(t&&t.start)+"-"+Ax(t&&t.end)}function tD(t){return t&&typeof t=="number"?t:1}var nD={}.hasOwnProperty;function Px(t,e,r){return typeof e!="string"&&(r=e,e=void 0),N8(r)(Cx(Tx(r).document().write(Ix()(t,e,!0))))}function N8(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Jl),autolinkProtocol:$,autolinkEmail:$,atxHeading:a(cn),blockQuote:a(_i),characterEscape:$,characterReference:$,codeFenced:a($r),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a($r,o),codeText:a(Si,o),codeTextData:$,data:$,codeFlowValue:$,definition:a(ra),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Zl),hardBreakEscape:a(Wd),hardBreakTrailing:a(Wd),htmlFlow:a(Kl,o),htmlFlowData:$,htmlText:a(Kl,o),htmlTextData:$,image:a(Zd),label:o,link:a(Jl),listItem:a(na),listItemValue:m,listOrdered:a(Kd,d),listUnordered:a(Kd),paragraph:a(un),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(cn),strong:a(Jd),thematicBreak:a(dg)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Pt,autolinkProtocol:Rn,blockQuote:l(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:zt,characterReferenceMarkerNumeric:zt,characterReferenceValue:Mr,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:B,codeIndented:l(g),codeText:l(ae),codeTextData:B,data:B,definition:l(),definitionDestinationString:I,definitionLabelString:x,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(H),hardBreakTrailing:l(H),htmlFlow:l(j),htmlFlowData:B,htmlText:l(Z),htmlTextData:B,image:l(Xe),label:kt,labelText:At,lineEnding:Y,link:l($e),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Lt,resourceDestinationString:S,resourceTitleString:xr,resource:Pn,setextHeading:l(W),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};iD(e,(t||{}).mdastExtensions||[]);let r={};return n;function n(O){let G={type:"root",children:[]},oe={stack:[G],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:r},Se=[],Je=-1;for(;++Je<O.length;)if(O[Je][1].type==="listOrdered"||O[Je][1].type==="listUnordered")if(O[Je][0]==="enter")Se.push(Je);else{let Lr=Se.pop();Je=i(O,Lr,Je)}for(Je=-1;++Je<O.length;){let Lr=e[O[Je][0]];nD.call(Lr,O[Je][1].type)&&Lr[O[Je][1].type].call(Object.assign({sliceSerialize:O[Je][2].sliceSerialize},oe),O[Je][1])}if(oe.tokenStack.length>0){let Lr=oe.tokenStack[oe.tokenStack.length-1];(Lr[1]||rD).call(oe,void 0,Lr[0])}for(G.position={start:Ua(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Ua(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<e.transforms.length;)G=e.transforms[Je](G)||G;return G}function i(O,G,oe){let Se=G-1,Je=-1,Lr=!1,Kr,dn,Ga,Va;for(;++Se<=oe;){let ur=O[Se];switch(ur[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ur[0]==="enter"?Je++:Je--,Va=void 0;break}case"lineEndingBlank":{ur[0]==="enter"&&(Kr&&!Va&&!Je&&!Ga&&(Ga=Se),Va=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Va=void 0}if(!Je&&ur[0]==="enter"&&ur[1].type==="listItemPrefix"||Je===-1&&ur[0]==="exit"&&(ur[1].type==="listUnordered"||ur[1].type==="listOrdered")){if(Kr){let Xt=Se;for(dn=void 0;Xt--;){let Nn=O[Xt];if(Nn[1].type==="lineEnding"||Nn[1].type==="lineEndingBlank"){if(Nn[0]==="exit")continue;dn&&(O[dn][1].type="lineEndingBlank",Lr=!0),Nn[1].type="lineEnding",dn=Xt}else if(!(Nn[1].type==="linePrefix"||Nn[1].type==="blockQuotePrefix"||Nn[1].type==="blockQuotePrefixWhitespace"||Nn[1].type==="blockQuoteMarker"||Nn[1].type==="listItemIndent"))break}Ga&&(!dn||Ga<dn)&&(Kr._spread=!0),Kr.end=Object.assign({},dn?O[dn][1].start:ur[1].end),O.splice(dn||Se,0,["exit",Kr,ur[2]]),Se++,oe++}if(ur[1].type==="listItemPrefix"){let Xt={type:"listItem",_spread:!1,start:Object.assign({},ur[1].start),end:void 0};Kr=Xt,O.splice(Se,0,["enter",Xt,ur[2]]),Se++,oe++,Ga=void 0,Va=!0}}}return O[G][1]._spread=Lr,oe}function a(O,G){return oe;function oe(Se){s.call(this,O(Se),Se),G&&G.call(this,Se)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(O,G,oe){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([G,oe]),O.position={start:Ua(G.start),end:void 0}}function l(O){return G;function G(oe){O&&O.call(this,oe),c.call(this,oe)}}function c(O,G){let oe=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==O.type&&(G?G.call(this,O,Se[0]):(Se[1]||rD).call(this,O,Se[0]));else throw new Error("Cannot close `"+O.type+"` ("+ja({start:O.start,end:O.end})+"): it\u2019s not open");oe.position.end=Ua(O.end)}function u(){return px(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(O){if(this.data.expectingFirstListItemValue){let G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),G=this.stack[this.stack.length-1];G.lang=O}function h(){let O=this.resume(),G=this.stack[this.stack.length-1];G.meta=O}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/(\r?\n|\r)$/g,"")}function x(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase()}function v(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function I(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function T(O){let G=this.stack[this.stack.length-1];if(!G.depth){let oe=this.sliceSerialize(O).length;G.depth=oe}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(O){let G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function $(O){let oe=this.stack[this.stack.length-1].children,Se=oe[oe.length-1];(!Se||Se.type!=="text")&&(Se=ug(),Se.position={start:Ua(O.start),end:void 0},oe.push(Se)),this.stack.push(Se)}function B(O){let G=this.stack.pop();G.value+=this.sliceSerialize(O),G.position.end=Ua(O.end)}function Y(O){let G=this.stack[this.stack.length-1];if(this.data.atHardBreak){let oe=G.children[G.children.length-1];oe.position.end=Ua(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(G.type)&&($.call(this,O),B.call(this,O))}function H(){this.data.atHardBreak=!0}function j(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function Z(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function ae(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function $e(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function Xe(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function At(O){let G=this.sliceSerialize(O),oe=this.stack[this.stack.length-2];oe.label=Q1(G),oe.identifier=ta(G).toLowerCase()}function kt(){let O=this.stack[this.stack.length-1],G=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){let Se=O.children;oe.children=Se}else oe.alt=G}function S(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function xr(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function Pn(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function Lt(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function zt(O){this.data.characterReferenceType=O.type}function Mr(O){let G=this.sliceSerialize(O),oe=this.data.characterReferenceType,Se;oe?(Se=Af(G,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=Ll(G);let Je=this.stack.pop();Je.value+=Se,Je.position.end=Ua(O.end)}function Rn(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(O)}function Pt(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(O)}function _i(){return{type:"blockquote",children:[]}}function $r(){return{type:"code",lang:null,meta:null,value:""}}function Si(){return{type:"inlineCode",value:""}}function ra(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Zl(){return{type:"emphasis",children:[]}}function cn(){return{type:"heading",depth:0,children:[]}}function Wd(){return{type:"break"}}function Kl(){return{type:"html",value:""}}function Zd(){return{type:"image",title:null,url:"",alt:null}}function Jl(){return{type:"link",title:null,url:"",children:[]}}function Kd(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function na(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function un(){return{type:"paragraph",children:[]}}function Jd(){return{type:"strong",children:[]}}function ug(){return{type:"text",value:""}}function dg(){return{type:"thematicBreak"}}}function Ua(t){return{line:t.line,column:t.column,offset:t.offset}}function iD(t,e){let r=-1;for(;++r<e.length;){let n=e[r];Array.isArray(n)?iD(t,n):O8(t,n)}}function O8(t,e){let r;for(r in e)if(nD.call(e,r))switch(r){case"canContainEols":{let n=e[r];n&&t[r].push(...n);break}case"transforms":{let n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{let n=e[r];n&&Object.assign(t[r],n);break}}}function rD(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ja({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is still open")}function Bf(t){let e=this;e.parser=r;function r(n){return Px(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function aD(t,e){let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function oD(t,e){let r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
3515
|
+
`}]}function sD(t,e){let r=e.value?e.value+`
|
|
3516
|
+
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function lD(t,e){let r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function cD(t,e){let r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function uD(t,e){let r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=An(n.toLowerCase()),a=t.footnoteOrder.indexOf(n),o,s=t.footnoteCounts.get(n);s===void 0?(s=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=a+1,s+=1,t.footnoteCounts.set(n,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function dD(t,e){let r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function pD(t,e){if(t.options.allowDangerousHtml){let r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function jf(t,e){let r=e.referenceType,n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];let i=t.all(e),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function mD(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return jf(t,e);let i={src:An(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);let a={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,a),t.applyData(e,a)}function hD(t,e){let r={src:An(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function fD(t,e){let r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function gD(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return jf(t,e);let i={href:An(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);let a={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function yD(t,e){let r={href:An(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function bD(t,e,r){let n=t.all(e),i=r?D8(r):vD(e),a={},o=[];if(typeof e.checked=="boolean"){let u=n[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let u=n[s];(i||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
3517
|
+
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}let l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
3518
|
+
`});let c={type:"element",tagName:"li",properties:a,children:o};return t.patch(e,c),t.applyData(e,c)}function D8(t){let e=!1;if(t.type==="list"){e=t.spread||!1;let r=t.children,n=-1;for(;!e&&++n<r.length;)e=vD(r[n])}return e}function vD(t){let e=t.spread;return e??t.children.length>1}function _D(t,e){let r={},n=t.all(e),i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){let o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let a={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,a),t.applyData(e,a)}function SD(t,e){let r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function wD(t,e){let r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function kD(t,e){let r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}var Uf=xD("end"),Gf=xD("start");function xD(t){return e;function e(r){let n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Rx(t){let e=Gf(t),r=Uf(t);if(e&&r)return{start:e,end:r}}function ED(t,e){let r=t.all(e),n=r.shift(),i=[];if(n){let o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){let o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},s=Gf(e.children[1]),l=Uf(e.children[e.children.length-1]);s&&l&&(o.position={start:s,end:l}),i.push(o)}let a={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,a),t.applyData(e,a)}function TD(t,e,r){let n=r?r.children:void 0,a=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,s=o?o.length:e.children.length,l=-1,c=[];for(;++l<s;){let d=e.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let h={type:"element",tagName:a,properties:m,children:[]};d&&(h.children=t.all(d),t.patch(d,h),h=t.applyData(d,h)),c.push(h)}let u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function CD(t,e){let r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function AD(t){let e=String(t),r=/\r?\n|\r/g,n=r.exec(e),i=0,a=[];for(;n;)a.push(ID(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return a.push(ID(e.slice(i),i>0,!1)),a.join("")}function ID(t,e,r){let n=0,i=t.length;if(e){let a=t.codePointAt(n);for(;a===9||a===32;)n++,a=t.codePointAt(n)}if(r){let a=t.codePointAt(i-1);for(;a===9||a===32;)i--,a=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function PD(t,e){let r={type:"text",value:AD(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function RD(t,e){let r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}var ND={blockquote:aD,break:oD,code:sD,delete:lD,emphasis:cD,footnoteReference:uD,heading:dD,html:pD,imageReference:mD,image:hD,inlineCode:fD,linkReference:gD,link:yD,listItem:bD,list:_D,paragraph:SD,root:wD,strong:kD,table:ED,tableCell:CD,tableRow:TD,text:PD,thematicBreak:RD,toml:Vf,yaml:Vf,definition:Vf,footnoteDefinition:Vf};function Vf(){}function M8(t,e){let r=[{type:"text",value:"\u21A9"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function $8(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function OD(t){let e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||M8,n=t.options.footnoteBackLabel||$8,i=t.options.footnoteLabel||"Footnotes",a=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<t.footnoteOrder.length;){let c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;let u=t.all(c),d=String(c.identifier).toUpperCase(),m=An(d.toLowerCase()),p=0,h=[],f=t.footnoteCounts.get(d);for(;f!==void 0&&++p<=f;){h.length>0&&h.push({type:"text",value:" "});let x=typeof r=="string"?r:r(l,p);typeof x=="string"&&(x={type:"text",value:x}),h.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}let y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){let x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...h)}else u.push(...h);let g={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(u,!0)};t.patch(c,g),s.push(g)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...gi(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
3519
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:`
|
|
3520
|
+
`}]}}var Nx={}.hasOwnProperty,L8={};function MD(t,e){let r=e||L8,n=new Map,i=new Map,a=new Map,o={...ND,...r.handlers},s={all:c,applyData:F8,definitionById:n,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:r,patch:z8,wrap:j8};return Ad(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let d=u.type==="definition"?n:i,m=String(u.identifier).toUpperCase();d.has(m)||d.set(m,u)}}),s;function l(u,d){let m=u.type,p=s.handlers[m];if(Nx.call(s.handlers,m)&&p)return p(s,u,d);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in u){let{children:f,...y}=u,g=gi(y);return g.children=s.all(u),g}return gi(u)}return(s.options.unknownHandler||B8)(s,u,d)}function c(u){let d=[];if("children"in u){let m=u.children,p=-1;for(;++p<m.length;){let h=s.one(m[p],u);if(h){if(p&&m[p-1].type==="break"&&(!Array.isArray(h)&&h.type==="text"&&(h.value=DD(h.value)),!Array.isArray(h)&&h.type==="element")){let f=h.children[0];f&&f.type==="text"&&(f.value=DD(f.value))}Array.isArray(h)?d.push(...h):d.push(h)}}}return d}}function z8(t,e){t.position&&(e.position=Rx(t))}function F8(t,e){let r=e;if(t&&t.data){let n=t.data.hName,i=t.data.hChildren,a=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{let o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&a&&Object.assign(r.properties,gi(a)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function B8(t,e){let r=e.data||{},n="value"in e&&!(Nx.call(r,"hProperties")||Nx.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function j8(t,e){let r=[],n=-1;for(e&&r.push({type:"text",value:`
|
|
3521
|
+
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
3522
|
+
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
3523
|
+
`}),r}function DD(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Hf(t,e){let r=MD(t,e),n=r.one(t,void 0),i=OD(r),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&("children"in a,a.children.push({type:"text",value:`
|
|
3524
|
+
`},i)),a}function qf(t,e){return t&&"run"in t?async function(r,n){let i=Hf(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Hf(r,{file:n,...e||t})}}function Ox(t){if(t)throw t}var Kf=ep(VD(),1);function Bd(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Dx(){let t=[],e={run:r,use:n};return e;function r(...i){let a=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...c){let u=t[++a],d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?HD(u,s)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function HD(t,e){let r;return n;function n(...o){let s=t.length>o.length,l;s&&o.push(i);try{l=t.apply(this,o)}catch(c){let u=c;if(s&&r)throw u;return i(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){r||(r=!0,e(o,...s))}function a(o){i(null,o)}}var Jt=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof e=="string"?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=ja(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;var Xn={basename:U8,dirname:G8,extname:V8,join:H8,sep:"/"};function U8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');jd(t);let r=0,n=-1,i=t.length,a;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(n=i):(s=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function G8(t){if(jd(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function V8(t){jd(t);let e=t.length,r=-1,n=0,i=-1,a=0,o;for(;e--;){let s=t.codePointAt(e);if(s===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),s===46?i<0?i=e:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function H8(...t){let e=-1,r;for(;++e<t.length;)jd(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":q8(r)}function q8(t){jd(t);let e=t.codePointAt(0)===47,r=W8(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function W8(t,e){let r="",n=0,i=-1,a=0,o=-1,s,l;for(;++o<=t.length;){if(o<t.length)s=t.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length>0){r="",n=0,i=o,a=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return r}function jd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var qD={cwd:Z8};function Z8(){return"/"}function Fl(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function WD(t){if(typeof t=="string")t=new URL(t);else if(!Fl(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return K8(t)}function K8(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){let n=e.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var Mx=["history","path","basename","stem","extname","dirname"],Ud=class{constructor(e){let r;e?Fl(e)?r={path:e}:typeof e=="string"||J8(e)?r={value:e}:r=e:r={},this.cwd=qD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Mx.length;){let a=Mx[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)Mx.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(e){Lx(e,"basename"),$x(e,"basename"),this.path=Xn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(e){ZD(this.basename,"dirname"),this.path=Xn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(e){if($x(e,"extname"),ZD(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Fl(e)&&(e=WD(e)),Lx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(e){Lx(e,"stem"),$x(e,"stem"),this.path=Xn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){let i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){let i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){let i=new Jt(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function $x(t,e){if(t&&t.includes(Xn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xn.sep+"`")}function Lx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function ZD(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function J8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var KD=function(t){let n=this.constructor.prototype,i=n[t],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,n);let o=Object.getOwnPropertyNames(i);for(let s of o){let l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(a,s,l)}return a};var X8={}.hasOwnProperty,jx=class t extends KD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Dx()}copy(){let e=new t,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];e.use(...n)}return e.data((0,Kf.default)(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Bx("data",this.frozen),this.namespace[e]=r,this):X8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bx("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let r=Zf(e),n=this.parser||this.Parser;return zx("parse",n),n(String(r),r)}process(e,r){let n=this;return this.freeze(),zx("process",this.parser||this.Parser),Fx("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(a,o){let s=Zf(e),l=n.parse(s);n.run(l,s,function(u,d,m){if(u||!d||!m)return c(u);let p=d,h=n.stringify(p,m);Q8(h)?m.value=h:m.result=h,c(u,m)});function c(u,d){u||!d?o(u):a?a(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),zx("processSync",this.parser||this.Parser),Fx("processSync",this.compiler||this.Compiler),this.process(e,i),XD("processSync","process",r),n;function i(a,o){r=!0,Ox(a),n=o}}run(e,r,n){JD(e),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?a(void 0,n):new Promise(a);function a(o,s){let l=Zf(r);i.run(e,l,c);function c(u,d,m){let p=d||e;u?s(u):o?o(p):n(void 0,p,m)}}}runSync(e,r){let n=!1,i;return this.run(e,r,a),XD("runSync","run",n),i;function a(o,s){Ox(o),i=s,n=!0}}stringify(e,r){this.freeze();let n=Zf(r),i=this.compiler||this.Compiler;return Fx("stringify",i),JD(e),i(e,n)}use(e,...r){let n=this.attachers,i=this.namespace;if(Bx("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(i.settings=(0,Kf.default)(!0,i.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];a(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,m=-1;for(;++d<n.length;)if(n[d][0]===c){m=d;break}if(m===-1)n.push([c,...u]);else if(u.length>0){let[p,...h]=u,f=n[m][1];Bd(f)&&Bd(p)&&(p=(0,Kf.default)(!0,f,p)),n[m]=[c,p,...h]}}}},Ux=new jx().freeze();function zx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Fx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bx(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function JD(t){if(!Bd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function XD(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Zf(t){return Y8(t)?t:new Ud(t)}function Y8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Q8(t){return typeof t=="string"||e7(t)}function e7(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Gd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3484
3525
|
|
|
3485
3526
|
<!-- Styling -->
|
|
3486
3527
|
<style>
|
|
@@ -3563,11 +3604,11 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3563
3604
|
<div id='llm-selector-list'></div>
|
|
3564
3605
|
</div>
|
|
3565
3606
|
|
|
3566
|
-
`}onUpdate(){this.child("llm-selector-panel").className=this.attr.open?"open":"closed";let
|
|
3567
|
-
<div class='llm-selector-item-icon' style="background-image: url('${
|
|
3568
|
-
<div class='llm-selector-item-name'>${
|
|
3569
|
-
<div class='llm-selector-item-provider'>${
|
|
3570
|
-
`,n.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:i.id}))}),t.appendChild(n)}}};_s.observedAttributes=["open"];var sa=new ge("ONNXModel"),gr=class r{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,sa.debug(`Model input parameters: ${e.inputNames.join(", ")}`),sa.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!r.lib}static async load(e){if(!r.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(sa.debug("Loading ONNX runtime"),this.onnx=await r.lib()),sa.debug(`Loading model: ${e}`);let t=await this.onnx.InferenceSession.create(e);return new r(t)}makeTensor(e,t,i=0){let n=1;for(let s of t)n*=s;let a;if(e=="float32")a=new r.onnx.Tensor(new Float32Array(n),t);else if(e=="int8")a=new r.onnx.Tensor(new Int8Array(n),t);else if(e=="int16")a=new r.onnx.Tensor(new Int16Array(n),t);else if(e=="int32")a=new r.onnx.Tensor(new Int32Array(n),t);else if(e=="int64")a=new r.onnx.Tensor(new BigInt64Array(n),t);else if(e=="uint8")a=new r.onnx.Tensor(new Uint8Array(n),t);else if(e=="uint16")a=new r.onnx.Tensor(new Uint16Array(n),t);else if(e=="uint32")a=new r.onnx.Tensor(new Uint32Array(n),t);else if(e=="uint64")a=new r.onnx.Tensor(new BigUint64Array(n),t);else throw new Error(`Invalid type: ${e}`);return i!==0&&(e=="int64"||e=="uint64")?a.data.fill(BigInt(i)):i!==0&&a.data.fill(i),a}registerConstant(e,t){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=t,t}makeConstant(e,t,i,n=0){return this.registerConstant(e,this.makeTensor(t,i,n))}registerState(e,t,i){if(t||(t=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[e]={outputName:t,tensor:i},i}makeState(e,t,i,n,a=0){return this.registerState(e,t,this.makeTensor(i,n,a))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return sa.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)e[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)e[t]=this.constantTensors[t];try{let t=await this.session.run(e);for(let i in this.stateTensors){let n=t[this.stateTensors[i].outputName];this.stateTensors[i].tensor=n}return t}finally{this._runActive=!1}}resetState(){sa.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var Xb="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var QA=new ge("PCMPlayerNode"),oa=class extends AudioWorkletNode{constructor(t,i,n){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!n||n!="int16"&&n!="float32")throw new Error(`Invalid format: ${n}`);this.sampleRate=i,this.format=n,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:i,outputSampleRate:t.sampleRate,format:n})}static async registerModule(t){await t.audioWorklet.addModule(Xb)}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(i=>this._playPromiseResolve=i),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let i=t.getReader();for(;!this.isCancelled;){let{done:n,value:a}=await i.read();if(n||!a)break;this.feed(a)}}catch(i){QA.warn("Stream error:",i),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:i}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var $l=new ge("SpeechOutput"),Yb=.5,eI=.8,Kl=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",i=>this.onTextOutputFromAI(i)),this.ai.audio?.speechRecognition.addEventListener("speechstart",i=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return $l.warn("No voice provider configured");let i=`speech-${tI++}`;await this.ai.audio.beginAccess(i);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(i)}}async _speakWithLock(t){let i=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:t}});if(this.dispatchEvent(i),t=i.detail.message,i.defaultPrevented||!t)return;this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=eI);let n=this.ai?._voiceTracker||$l.timer(`${this.ai.config.voice.providerID} voice`);n(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let a=new oa(this.ai.audio.context,24e3,"int16");this.currentPlayer=a,a.connect(this.analyserNode),a.addEventListener("end",o=>{let l=o;n(`PCM stream ${l.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==a&&!l.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let s;if(this.ai.config.voice.providerID=="openai")s=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")s=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{$l.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(n(`Received response ${s.status} ${s.statusText}`),!s.ok){$l.warn(`Failed to generate voice sample: ${s.status} ${s.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),n("Playing PCM stream"),await a.play(s.body),n("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,i=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Yb);let n=400;t.gain.linearRampToValueAtTime(0,n/1e3),await new Promise(a=>setTimeout(a,n+250)),t.disconnect(),i?.stop(),i?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Yb)}},tI=1;function Xl(r,e){let t=e.reduce((l,c)=>l+c.byteLength,0),i=new DataView(new ArrayBuffer(44));i.setUint8(0,82),i.setUint8(1,73),i.setUint8(2,70),i.setUint8(3,70),i.setUint32(4,44+t,!0),i.setUint8(8,87),i.setUint8(9,65),i.setUint8(10,86),i.setUint8(11,69);let n=1,a=32,s=n*a/8,o=r*s;return i.setUint8(12,102),i.setUint8(13,109),i.setUint8(14,116),i.setUint8(15,32),i.setUint32(16,16,!0),i.setUint16(20,3,!0),i.setUint16(22,n,!0),i.setUint32(24,r,!0),i.setUint32(28,o,!0),i.setUint16(32,s,!0),i.setUint16(34,a,!0),i.setUint8(36,100),i.setUint8(37,97),i.setUint8(38,116),i.setUint8(39,97),i.setUint32(40,t,!0),new File([i,...e],"audio.wav",{type:"audio/wav"})}var Jb="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var la=class extends AudioWorkletNode{constructor(t,i,n,a){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=n;let s=["int16","int64","float32"];if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!s.includes(n))throw new Error(`Invalid format ${n}, must be one of: ${s.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=o=>this.onWorkletMessage(o),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:i,format:n,bufferSize:a})}static async registerModule(t){await t.audioWorklet.addModule(Jb)}onWorkletMessage(t){if(t.data.action=="data"){let i=null;if(this.format=="int16"&&(i=new Int16Array(t.data.buffer)),this.format=="int64"&&(i=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(i=new Float32Array(t.data.buffer)),!i)throw new Error(`Invalid format: ${this.format}`);this.onData(i),this.dispatchEvent(new CustomEvent("data",{detail:{data:i}}))}}onData(t){}};var op=16e3,Yl=256,ca=8,Ss=new ge("VoiceDetectionNode"),Es=class Es extends la{constructor(t){super(t,op,"float32",Yl*ca);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Es.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return op}get numberOfSamples(){return Yl}get numberOfSampleChunks(){return ca}get outputBufferSize(){return Yl*ca}get isModelLoaded(){return!!this.vad}async loadModel(){Ss.debug("Loading VAD model"),this.vad=await gr.load(Es.vadModelURL),this.vad.ignoreIfBusy=!0,Ss.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],op),this.vad.makeState("h","hn","float32",[2,ca,64]),this.vad.makeState("c","cn","float32",[2,ca,64])}async onData(t){if(this.vad)try{let i=await this.vad.run({input:new gr.onnx.Tensor(t,[ca,Yl])});if(!i)return;this.currentProbability=0;for(let s=0;s<i.output.data.length;s++)i.output.data[s]>this.currentProbability&&(this.currentProbability=i.output.data[s]);let n=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>n;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),Ss.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),Ss.debug("Stopped speaking after timeout")),!a){let s=Date.now();s>this.nextVadReset&&(this.nextVadReset=s+5e3,this.vad.resetState())}}catch(i){Ss.error("VAD failed:",i)}}onSpeechStart(){}onSpeechEnd(){}};Es.vadModelURL="";var ua=Es;var Zb=new ge("VoiceChunkOutputNode"),da=class extends ua{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,i)=>t+i.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){Zb.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let i of this.buffers)this.recordedBuffers.push(i),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:i,isFinal:!1}})),this.onVoiceChunk(i);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let i=this.recordedBuffers.reduce((n,a)=>n+a.length,0);Zb.debug(`Voice complete, recorded ${(i/8e3).toFixed(2)} seconds of audio, ${i*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var Jl=new ge("OpenAITranscriptionNode"),Zl=class extends da{constructor(t,i){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=i}async onVoiceEnd(t){let i=Jl.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let n=Xl(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let s=new FormData;s.append("file",n),s.append("model","whisper-1"),s.append("response_format","text");let o=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s,signal:this.lastRequestAbortController.signal});if(!o.ok)throw new Error(`Failed to generate voice sample: ${o.status} ${o.statusText}`);i("Response received"),a=await o.text(),i("Content received: "+a),this.lastRequestAbortController=void 0}catch(s){Jl.error(`Failed to transcribe speech: ${s.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return Jl.debug("Transcription complete, but no text was found");Jl.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(t){}};var Ql=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var Tr=new ge("IntelliWeaveTranscriptionNode"),nI="wss://speech.intelliweave.ai/api/v1/transcribe",tc=class tc extends da{constructor(t,i){super(t);this.apiAddress=nI;this.apiKey="";this.isTranscribing=!1;this.apiKey=i}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(Tr.debug("Opening WebSocket connection"),this.ws=new Ql(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{Tr.debug("WebSocket connection opened")},this.ws.addEventListener("message",n=>{let a=JSON.parse(n.data);if(a.error)return Tr.warn("Error: "+a.error);if(a.type!="transcription")return Tr.warn("Invalid response type",a);if(a.streaming&&!a.final)return Tr.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return Tr.warn(`Empty transcription (${a.processingTime}ms)`);Tr.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",n=>Tr.warn("WebSocket error")));let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{Tr.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},i)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),tc.debugExportWav){let i=Xl(this.sampleRate,t),n=document.createElement("a");n.href=URL.createObjectURL(i),n.download="recording.wav",n.click()}}onVoiceTranscription(t){}onSocketClose(){Tr.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};tc.debugExportWav=!1;var ec=tc;var lp=new ge("SpeechRecognition"),rc=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async i=>{i.enable?await this.start():this.stop()}}])}get isSupported(){if(!gr.lib||!this.ai?.vadModel||!Kr().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),ua.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new Zl(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ec(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",i=>{this.ai._voiceTracker=lp.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),wt(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("speechend",i=>{this.ai._voiceTracker?.("Speech ended");let n=this.recordingStartTime?Date.now()-this.recordingStartTime:0;wt(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:n}}),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("transcription",i=>{this.ai._voiceTracker?.(`Transcription: ${i.detail.text}`),wt(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:i.detail.confidence||void 0}}),this.onTranscription(i)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){lp.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let i=t.detail.text;lp.debug("Heard:",i),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:i,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var nc=new ge("AudioSystem"),pa=class r{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new rc(this.ai),this.speechOutput=new Kl(this.ai)}static get isSupported(){return!(!gr.lib||!Kr().AudioWorkletNode)}static async registerModules(e){await Promise.all([oa.registerModule(e),la.registerModule(e)])}async beginAccess(e){nc.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(nc.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await r.registerModules(this.context))}endAccess(e){nc.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(t=>t!=e),!this.locks.length&&(nc.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var JH=new ge("Stream");var ai=dc(pv(),1);var sV=new ge("React");var oV=(0,ai.createContext)(void 0);var Vt=new ge("Embed"),si=class extends zt{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3607
|
+
`}onUpdate(){this.child("llm-selector-panel").className=this.attr.open?"open":"closed";let r=this.child("llm-selector-list");for(;r.lastChild;)r.lastChild.remove();for(let n of this.state.items||[]){let i=document.createElement("div");i.className="llm-selector-item"+(n.id==this.state.selectedID?" selected":""),i.innerHTML=`
|
|
3608
|
+
<div class='llm-selector-item-icon' style="background-image: url('${n.icon}'); "></div>
|
|
3609
|
+
<div class='llm-selector-item-name'>${n.name}</div>
|
|
3610
|
+
<div class='llm-selector-item-provider'>${n.provider}</div>
|
|
3611
|
+
`,i.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:n.id}))}),r.appendChild(i)}}};Gd.observedAttributes=["open"];var Bl=new Re("ONNXModel"),Yn=class t{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,Bl.debug(`Model input parameters: ${e.inputNames.join(", ")}`),Bl.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!t.lib}static async load(e){if(!t.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(Bl.debug("Loading ONNX runtime"),this.onnx=await t.lib()),Bl.debug(`Loading model: ${e}`);let r=await this.onnx.InferenceSession.create(e);return new t(r)}makeTensor(e,r,n=0){let i=1;for(let o of r)i*=o;let a;if(e=="float32")a=new t.onnx.Tensor(new Float32Array(i),r);else if(e=="int8")a=new t.onnx.Tensor(new Int8Array(i),r);else if(e=="int16")a=new t.onnx.Tensor(new Int16Array(i),r);else if(e=="int32")a=new t.onnx.Tensor(new Int32Array(i),r);else if(e=="int64")a=new t.onnx.Tensor(new BigInt64Array(i),r);else if(e=="uint8")a=new t.onnx.Tensor(new Uint8Array(i),r);else if(e=="uint16")a=new t.onnx.Tensor(new Uint16Array(i),r);else if(e=="uint32")a=new t.onnx.Tensor(new Uint32Array(i),r);else if(e=="uint64")a=new t.onnx.Tensor(new BigUint64Array(i),r);else throw new Error(`Invalid type: ${e}`);return n!==0&&(e=="int64"||e=="uint64")?a.data.fill(BigInt(n)):n!==0&&a.data.fill(n),a}registerConstant(e,r){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=r,r}makeConstant(e,r,n,i=0){return this.registerConstant(e,this.makeTensor(r,n,i))}registerState(e,r,n){if(r||(r=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(r))throw new Error(`Model does not have an output named: ${r}`);return this.stateTensors[e]={outputName:r,tensor:n},n}makeState(e,r,n,i,a=0){return this.registerState(e,r,this.makeTensor(n,i,a))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return Bl.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let r in this.stateTensors)e[r]=this.stateTensors[r].tensor;for(let r in this.constantTensors)e[r]=this.constantTensors[r];try{let r=await this.session.run(e);for(let n in this.stateTensors){let i=r[this.stateTensors[n].outputName];this.stateTensors[n].tensor=i}return r}finally{this._runActive=!1}}resetState(){Bl.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var YD="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var r7=new Re("PCMPlayerNode"),jl=class extends AudioWorkletNode{constructor(r,n,i){super(r,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!i||i!="int16"&&i!="float32")throw new Error(`Invalid format: ${i}`);this.sampleRate=n,this.format=i,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:n,outputSampleRate:r.sampleRate,format:i})}static async registerModule(r){await r.audioWorklet.addModule(YD)}feed(r){this.port.postMessage({action:"data",buffer:r.buffer},[r.buffer])}async play(r){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(n=>this._playPromiseResolve=n),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:r}}));try{let n=r.getReader();for(;!this.isCancelled;){let{done:i,value:a}=await n.read();if(i||!a)break;this.feed(a)}}catch(n){r7.warn("Stream error:",n),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:r,error:n}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(r){r.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var Jf=new Re("SpeechOutput"),QD=.5,n7=.8,Xf=class extends EventTarget{constructor(r){super();this.maxVolumeHeard=0;this.ai=r,this.ai.addEventListener("output",n=>this.onTextOutputFromAI(n)),this.ai.audio?.speechRecognition.addEventListener("speechstart",n=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(r){r.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(r.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}async speak(r){if(!this.ai?.config?.voice?.providerID)return Jf.warn("No voice provider configured");let n=`speech-${i7++}`;await this.ai.audio.beginAccess(n);try{await this._speakWithLock(r)}finally{this.ai.audio.endAccess(n)}}async _speakWithLock(r){let n=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:r}});if(this.dispatchEvent(n),r=n.detail.message,n.defaultPrevented||!r)return;this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=n7);let i=this.ai?._voiceTracker||Jf.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${r}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let a=new jl(this.ai.audio.context,24e3,"int16");this.currentPlayer=a,a.connect(this.analyserNode),a.addEventListener("end",s=>{let l=s;i(`PCM stream ${l.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==a&&!l.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let o;if(this.ai.config.voice.providerID=="openai")o=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:r,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")o=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:r})});else{Jf.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(i(`Received response ${o.status} ${o.statusText}`),!o.ok){Jf.warn(`Failed to generate voice sample: ${o.status} ${o.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:r}})),i("Playing PCM stream"),await a.play(o.body),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let r=this.currentPlayerVolume,n=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=QD);let i=400;r.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(a=>setTimeout(a,i+250)),r.disconnect(),n?.stop(),n?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=QD)}},i7=1;function Yf(t,e){let r=e.reduce((l,c)=>l+c.byteLength,0),n=new DataView(new ArrayBuffer(44));n.setUint8(0,82),n.setUint8(1,73),n.setUint8(2,70),n.setUint8(3,70),n.setUint32(4,44+r,!0),n.setUint8(8,87),n.setUint8(9,65),n.setUint8(10,86),n.setUint8(11,69);let i=1,a=32,o=i*a/8,s=t*o;return n.setUint8(12,102),n.setUint8(13,109),n.setUint8(14,116),n.setUint8(15,32),n.setUint32(16,16,!0),n.setUint16(20,3,!0),n.setUint16(22,i,!0),n.setUint32(24,t,!0),n.setUint32(28,s,!0),n.setUint16(32,o,!0),n.setUint16(34,a,!0),n.setUint8(36,100),n.setUint8(37,97),n.setUint8(38,116),n.setUint8(39,97),n.setUint32(40,r,!0),new File([n,...e],"audio.wav",{type:"audio/wav"})}var eM="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var Ul=class extends AudioWorkletNode{constructor(r,n,i,a){super(r,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=i;let o=["int16","int64","float32"];if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!o.includes(i))throw new Error(`Invalid format ${i}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:r.sampleRate,outputSampleRate:n,format:i,bufferSize:a})}static async registerModule(r){await r.audioWorklet.addModule(eM)}onWorkletMessage(r){if(r.data.action=="data"){let n=null;if(this.format=="int16"&&(n=new Int16Array(r.data.buffer)),this.format=="int64"&&(n=new BigInt64Array(r.data.buffer)),this.format=="float32"&&(n=new Float32Array(r.data.buffer)),!n)throw new Error(`Invalid format: ${this.format}`);this.onData(n),this.dispatchEvent(new CustomEvent("data",{detail:{data:n}}))}}onData(r){}};var Gx=16e3,Qf=256,Gl=8,Vd=new Re("VoiceDetectionNode"),Hd=class Hd extends Ul{constructor(r){super(r,Gx,"float32",Qf*Gl);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Hd.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return Gx}get numberOfSamples(){return Qf}get numberOfSampleChunks(){return Gl}get outputBufferSize(){return Qf*Gl}get isModelLoaded(){return!!this.vad}async loadModel(){Vd.debug("Loading VAD model"),this.vad=await Yn.load(Hd.vadModelURL),this.vad.ignoreIfBusy=!0,Vd.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],Gx),this.vad.makeState("h","hn","float32",[2,Gl,64]),this.vad.makeState("c","cn","float32",[2,Gl,64])}async onData(r){if(this.vad)try{let n=await this.vad.run({input:new Yn.onnx.Tensor(r,[Gl,Qf])});if(!n)return;this.currentProbability=0;for(let o=0;o<n.output.data.length;o++)n.output.data[o]>this.currentProbability&&(this.currentProbability=n.output.data[o]);let i=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>i;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),Vd.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),Vd.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(n){Vd.error("VAD failed:",n)}}onSpeechStart(){}onSpeechEnd(){}};Hd.vadModelURL="";var Vl=Hd;var tM=new Re("VoiceChunkOutputNode"),Hl=class extends Vl{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((r,n)=>r+n.length,0)/8e3}async onData(r){if(await super.onData(r),this.isVoiceActive&&!this._voiceRecording){tM.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let n of this.buffers)this.recordedBuffers.push(n),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:n,isFinal:!1}})),this.onVoiceChunk(n);this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!0}})),this.onVoiceChunk(r),this._voiceRecording=!1;let n=this.recordedBuffers.reduce((i,a)=>i+a.length,0);tM.debug(`Voice complete, recorded ${(n/8e3).toFixed(2)} seconds of audio, ${n*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(r);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(r){}onVoiceEnd(r){}};var eg=new Re("OpenAITranscriptionNode"),tg=class extends Hl{constructor(r,n){super(r);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=n}async onVoiceEnd(r){let n=eg.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...r);let i=Yf(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",i),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);n("Response received"),a=await s.text(),n("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){eg.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return eg.debug("Transcription complete, but no text was found");eg.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(r){}};var rg=class extends WebSocket{constructor(r){super(r);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(r){this.readyState==WebSocket.OPEN?super.send(r):this.pendingData.push(r)}_onOpen(){for(let r of this.pendingData)super.send(r);this.pendingData=[]}};var vi=new Re("IntelliWeaveTranscriptionNode"),o7="wss://speech.intelliweave.ai/api/v1/transcribe",ig=class ig extends Hl{constructor(r,n){super(r);this.apiAddress=o7;this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0,this.ws?this.ws.send(r):(vi.debug("Opening WebSocket connection"),this.ws=new rg(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(r.buffer),this.ws.onopen=()=>{vi.debug("WebSocket connection opened")},this.ws.addEventListener("message",i=>{let a=JSON.parse(i.data);if(a.error)return vi.warn("Error: "+a.error);if(a.type!="transcription")return vi.warn("Invalid response type",a);if(a.streaming&&!a.final)return vi.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return vi.warn(`Empty transcription (${a.processingTime}ms)`);vi.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",i=>vi.warn("WebSocket error")));let n=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{vi.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},n)}async onVoiceEnd(r){if(this.ws?.send(JSON.stringify({type:"end"})),ig.debugExportWav){let n=Yf(this.sampleRate,r),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download="recording.wav",i.click()}}onVoiceTranscription(r){}onSocketClose(){vi.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};ig.debugExportWav=!1;var ng=ig;var Vx=new Re("SpeechRecognition"),ag=class extends EventTarget{constructor(r){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=r,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async n=>{n.enable?await this.start():this.stop()}}])}get isSupported(){if(!Yn.lib||!this.ai?.vadModel||!ia().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let r=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,r.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),Vl.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new tg(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):(this.voiceDetection=new ng(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,r.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",n=>{this.ai._voiceTracker=Vx.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Nr(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("speechend",n=>{this.ai._voiceTracker?.("Speech ended");let i=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Nr(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:i}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("transcription",n=>{this.ai._voiceTracker?.(`Transcription: ${n.detail.text}`),Nr(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:n.detail.confidence||void 0}}),this.onTranscription(n)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(r){Vx.error("Failed to start speech recognition:",r),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(r=>r.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(r){let n=r.detail.text;Vx.debug("Heard:",n),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:n,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(r){throw this._skipEvents=!1,r}}}};var og=new Re("AudioSystem"),ql=class t{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new ag(this.ai),this.speechOutput=new Xf(this.ai)}static get isSupported(){return!(!Yn.lib||!ia().AudioWorkletNode)}static async registerModules(e){await Promise.all([jl.registerModule(e),Ul.registerModule(e)])}async beginAccess(e){og.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(og.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await t.registerModules(this.context))}endAccess(e){og.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(r=>r!=e),!this.locks.length&&(og.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var oke=new Re("Stream");var qo=ep(fM(),1);var fke=new Re("React");var gke=(0,qo.createContext)(void 0);var ln=new Re("Embed"),Wo=class extends an{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3571
3612
|
|
|
3572
3613
|
<!-- Styling -->
|
|
3573
3614
|
<style>
|
|
@@ -3740,7 +3781,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3740
3781
|
<div id='root' class='hidden'>
|
|
3741
3782
|
|
|
3742
3783
|
<!-- Logo -->
|
|
3743
|
-
${
|
|
3784
|
+
${wd.add({id:"web-weaver-logo",logo:this.attr.logo})}
|
|
3744
3785
|
<div id='pulseanim' class="circle pulse"></div>
|
|
3745
3786
|
|
|
3746
3787
|
<!-- Inner container contains all the UI when the panel is open -->
|
|
@@ -3748,10 +3789,10 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3748
3789
|
</div>
|
|
3749
3790
|
|
|
3750
3791
|
<!-- LLM selector panel -->
|
|
3751
|
-
${
|
|
3792
|
+
${Gd.add({id:"llm-selector-panel"})}
|
|
3752
3793
|
|
|
3753
3794
|
<!-- Interaction panel -->
|
|
3754
|
-
${
|
|
3795
|
+
${Sd.add({id:"interaction-bar"})}
|
|
3755
3796
|
|
|
3756
3797
|
|
|
3757
3798
|
<!-- Powered by IW banner -->
|
|
@@ -3761,7 +3802,7 @@ ${s}`})}else if(a.type=="action"){let s={name:a._functionID,description:hc(typeo
|
|
|
3761
3802
|
|
|
3762
3803
|
</div>
|
|
3763
3804
|
|
|
3764
|
-
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._lastDisplayMode="";this._lastPositioningMode="";this._lastPositionX="";this._lastPositionY="";this._isProcessing=!1;this.ai=new ea,pa.isSupported&&(this.ai.audio=new pa(this.ai))}onCreate(){Be().embed&&Vt.warn("Only one <web-weaver-embed> element should be on the page."),Be().embed=this;let t=Be();Vt.debug("[WebWeaverEmbed] Client config:",t),t.displayMode&&!this.attr.displayMode&&(Vt.debug("[WebWeaverEmbed] Setting displayMode from client config:",t.displayMode),this.attr.displayMode=t.displayMode),t.positioningMode&&!this.attr.positioningMode&&(Vt.debug("[WebWeaverEmbed] Setting positioningMode from client config:",t.positioningMode),this.attr.positioningMode=t.positioningMode),t.positionX&&!this.attr.positionX&&(Vt.debug("[WebWeaverEmbed] Setting positionX from client config:",t.positionX),this.attr.positionX=t.positionX),t.positionY&&!this.attr.positionY&&(Vt.debug("[WebWeaverEmbed] Setting positionY from client config:",t.positionY),this.attr.positionY=t.positionY),t.offsetX!==void 0&&!this.attr.offsetX&&(Vt.debug("[WebWeaverEmbed] Setting offsetX from client config:",t.offsetX),this.attr.offsetX=String(t.offsetX)),t.offsetY!==void 0&&!this.attr.offsetY&&(Vt.debug("[WebWeaverEmbed] Setting offsetY from client config:",t.offsetY),this.attr.offsetY=String(t.offsetY)),Vt.debug("[WebWeaverEmbed] Attributes after setting:",{displayMode:this.attr.displayMode,positionX:this.attr.positionX,positionY:this.attr.positionY,offsetX:this.attr.offsetX,offsetY:this.attr.offsetY}),this.applyConfigStylesAndAttributes(),this.child("root").addEventListener("click",a=>this.onContainerClick(a)),this.child("web-weaver-logo").addEventListener("click",a=>this.onLogoClick(a)),this.child("interaction-bar").addEventListener("input-message",a=>this.processInput(a.detail)),this.child("interaction-bar").addEventListener("llm-button-click",a=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",a=>this.onLLMModelSelect(a)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:a=>(this.suggestions.push(a.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:a.text}),"Suggestion button added")});let n=this.attr.apiKey||Be().apiKey;if(!n)return Vt.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(n).then(a=>{this.config=a,Be().introductionMessage=this.config.introductionMessage,Be().analytics=this.config.analytics!==void 0?!!this.config.analytics:Be().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(a=>{Vt.error("Failed to load AI configuration:",a),this.state.loading=!1;let s=this.child("web-weaver-embed-inner");s&&(s.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let t=this.config,i=this.child("root");if(!i)return;let n=!1,s=this.attr.logo||t.logo;if(s&&s!==this._lastLogo){this._lastLogo=s,n=!0;let B=this.child("web-weaver-logo");B&&B.setAttribute("logo",s)}let l=this.attr.background||t.background;l!==this._lastBackground&&(this._lastBackground=l,n=!0,l?i.style.background=l:i.style.background="");let u=this.attr.textColor||t.textColor,p=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,n=!0,u?(i.style.color=u,p&&p.setAttribute("textColor",u)):(i.style.color="",p&&p.removeAttribute("textColor")));let d=this.attr.displayMode||t.displayMode||"closed";d!==this._lastDisplayMode&&(this._lastDisplayMode=d,n=!0,d==="open"&&!this.attr.open&&(this.attr.open=!0));let f=this.attr.positioningMode||t.positioningMode||"fixed";f!==this._lastPositioningMode&&(this._lastPositioningMode=f,n=!0);let b=this.attr.positionX||t.positionX||"right";b!==this._lastPositionX&&(this._lastPositionX=b,n=!0);let S=this.attr.positionY||t.positionY||"bottom";S!==this._lastPositionY&&(this._lastPositionY=S,n=!0);let A=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,R=A!==void 0?A:t.offsetX!==void 0?t.offsetX:20;R!==this._lastOffsetX&&(this._lastOffsetX=R,n=!0);let k=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,O=k!==void 0?k:t.offsetY!==void 0?t.offsetY:20;O!==this._lastOffsetY&&(this._lastOffsetY=O,n=!0),n&&Vt.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:s,finalBackground:i.style.background,finalTextColor:i.style.color,finalDisplayMode:d,finalPositioningMode:f,finalPositionX:b,finalPositionY:S,finalOffsetX:R,finalOffsetY:O})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),wt(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let l=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;wt(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:l}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open");let t=this.child("root"),i=this._lastPositioningMode||"fixed",n=this._lastPositionX||"right",a=this._lastPositionY||"bottom",s=this._lastOffsetX!==void 0?this._lastOffsetX:20,o=this._lastOffsetY!==void 0?this._lastOffsetY:20;i==="container"?(t.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):t.classList.remove("container-mode"),i!=="container"&&(t.style.left="",t.style.right="",t.style.top="",t.style.bottom="",n==="left"?t.style.left=s+"px":t.style.right=s+"px",a==="top"?t.style.top=o+"px":t.style.bottom=o+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((l,c)=>(c.priority||0)-(l.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){Be().embed==this&&(Be().embed=void 0)}onContainerClick(t){(this._lastDisplayMode||"closed")!=="open"&&(this.attr.open||(t.preventDefault(),this.attr.open=!0))}onLogoClick(t){if(t.preventDefault(),t.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{if((this._lastDisplayMode||"closed")==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let t=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;t.children.length>0;)t.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let i=document.createElement("div");i.className="introduction-message",i.innerHTML=Be().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,t.appendChild(i),this.ai.insertAssistantMessage(i.innerText);for(let n of Be().introductionSuggestions||[]){let a=document.createElement("div");a.className="suggestion-button",a.innerText=n,a.addEventListener("click",s=>this.onSuggestionClick(s,n)),t.appendChild(a)}}async processInput(t){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let i=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(i.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let n=document.createElement("div");n.className="input",n.innerText=t,i.appendChild(n),this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output",this.currentOutputElement.style.display="none",this.currentOutputElement.innerHTML="",i.appendChild(this.currentOutputElement),i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(t);for(let a of this.suggestions){let s=document.createElement("div");s.className="suggestion-button",s.innerText=a,s.addEventListener("click",o=>this.onSuggestionClick(o,a)),i.appendChild(s)}i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(n){Vt.error("Failed to process input:",n);let a=document.createElement("div");a.className="output",a.innerText="Sorry, there was a problem getting a response. "+n.message,i.appendChild(a);let s=document.createElement("div");s.className="suggestion-button",s.innerText="Reset conversation",s.addEventListener("click",o=>this.resetConversation()),i.appendChild(s)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(t){let i=await sp().use(Bl).use(Vl).use(hl,{target:"_blank",rel:["noopener","noreferrer"]}).use(fl).use(Cl).processSync(t);this.currentOutputElement&&(this.currentOutputElement.style.display="",this.currentOutputElement.innerHTML=i.toString("utf-8"));let n=this.child("web-weaver-embed-inner");for(let a of Array.from(n.querySelectorAll(".tool")))a.remove();n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(t,i){let n=`Running: ${t}`;t=="search"&&(n=`Searching: ${i?.query}`),t=="ui.focusElement"&&(n=`Focusing: #${i?.elementID}`),t=="ui.suggestResponse"&&(n=`Suggested response: ${i?.text}`);let a=this.child("web-weaver-embed-inner"),s=document.createElement("div");s.className="tool",s.innerText=n,a.appendChild(s),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(t,i){this.processInput(i)}onLLMModelSelect(t){t.preventDefault(),this.ai.setModel(t.detail),this.state.llmPanelOpen=!1}};si.tagName="intelliweave-embed",si.observedAttributes=["logo","focusID","open","background","textColor","displayMode","positioningMode","positionX","positionY","offsetX","offsetY"];gr.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(si.create());
|
|
3805
|
+
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._lastDisplayMode="";this._lastPositioningMode="";this._lastPositionX="";this._lastPositionY="";this._isProcessing=!1;this.ai=new Dl,ql.isSupported&&(this.ai.audio=new ql(this.ai))}onCreate(){ht().embed&&ln.warn("Only one <web-weaver-embed> element should be on the page."),ht().embed=this;let r=ht();ln.debug("[WebWeaverEmbed] Client config:",r),r.displayMode&&!this.attr.displayMode&&(ln.debug("[WebWeaverEmbed] Setting displayMode from client config:",r.displayMode),this.attr.displayMode=r.displayMode),r.positioningMode&&!this.attr.positioningMode&&(ln.debug("[WebWeaverEmbed] Setting positioningMode from client config:",r.positioningMode),this.attr.positioningMode=r.positioningMode),r.positionX&&!this.attr.positionX&&(ln.debug("[WebWeaverEmbed] Setting positionX from client config:",r.positionX),this.attr.positionX=r.positionX),r.positionY&&!this.attr.positionY&&(ln.debug("[WebWeaverEmbed] Setting positionY from client config:",r.positionY),this.attr.positionY=r.positionY),r.offsetX!==void 0&&!this.attr.offsetX&&(ln.debug("[WebWeaverEmbed] Setting offsetX from client config:",r.offsetX),this.attr.offsetX=String(r.offsetX)),r.offsetY!==void 0&&!this.attr.offsetY&&(ln.debug("[WebWeaverEmbed] Setting offsetY from client config:",r.offsetY),this.attr.offsetY=String(r.offsetY)),ln.debug("[WebWeaverEmbed] Attributes after setting:",{displayMode:this.attr.displayMode,positionX:this.attr.positionX,positionY:this.attr.positionY,offsetX:this.attr.offsetX,offsetY:this.attr.offsetY}),this.applyConfigStylesAndAttributes(),this.child("root").addEventListener("click",a=>this.onContainerClick(a)),this.child("web-weaver-logo").addEventListener("click",a=>this.onLogoClick(a)),this.child("interaction-bar").addEventListener("input-message",a=>this.processInput(a.detail)),this.child("interaction-bar").addEventListener("llm-button-click",a=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",a=>this.onLLMModelSelect(a)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:a=>(this.suggestions.push(a.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:a.text}),"Suggestion button added")});let i=this.attr.apiKey||ht().apiKey;if(!i)return ln.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(i).then(a=>{this.config=a,ht().introductionMessage=this.config.introductionMessage,ht().analytics=this.config.analytics!==void 0?!!this.config.analytics:ht().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(a=>{ln.error("Failed to load AI configuration:",a),this.state.loading=!1;let o=this.child("web-weaver-embed-inner");o&&(o.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let r=this.config,n=this.child("root");if(!n)return;let i=!1,o=this.attr.logo||r.logo;if(o&&o!==this._lastLogo){this._lastLogo=o,i=!0;let W=this.child("web-weaver-logo");W&&W.setAttribute("logo",o)}let l=this.attr.background||r.background;l!==this._lastBackground&&(this._lastBackground=l,i=!0,l?n.style.background=l:n.style.background="");let u=this.attr.textColor||r.textColor,d=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,i=!0,u?(n.style.color=u,d&&d.setAttribute("textColor",u)):(n.style.color="",d&&d.removeAttribute("textColor")));let p=this.attr.displayMode||r.displayMode||"closed";p!==this._lastDisplayMode&&(this._lastDisplayMode=p,i=!0,p==="open"&&!this.attr.open&&(this.attr.open=!0));let f=this.attr.positioningMode||r.positioningMode||"fixed";f!==this._lastPositioningMode&&(this._lastPositioningMode=f,i=!0);let g=this.attr.positionX||r.positionX||"right";g!==this._lastPositionX&&(this._lastPositionX=g,i=!0);let v=this.attr.positionY||r.positionY||"bottom";v!==this._lastPositionY&&(this._lastPositionY=v,i=!0);let I=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,T=I!==void 0?I:r.offsetX!==void 0?r.offsetX:20;T!==this._lastOffsetX&&(this._lastOffsetX=T,i=!0);let C=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,M=C!==void 0?C:r.offsetY!==void 0?r.offsetY:20;M!==this._lastOffsetY&&(this._lastOffsetY=M,i=!0),i&&ln.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:n.style.background,finalTextColor:n.style.color,finalDisplayMode:p,finalPositioningMode:f,finalPositionX:g,finalPositionY:v,finalOffsetX:T,finalOffsetY:M})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Nr(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let l=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Nr(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:l}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open");let r=this.child("root"),n=this._lastPositioningMode||"fixed",i=this._lastPositionX||"right",a=this._lastPositionY||"bottom",o=this._lastOffsetX!==void 0?this._lastOffsetX:20,s=this._lastOffsetY!==void 0?this._lastOffsetY:20;n==="container"?(r.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):r.classList.remove("container-mode"),n!=="container"&&(r.style.left="",r.style.right="",r.style.top="",r.style.bottom="",i==="left"?r.style.left=o+"px":r.style.right=o+"px",a==="top"?r.style.top=s+"px":r.style.bottom=s+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((l,c)=>(c.priority||0)-(l.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){ht().embed==this&&(ht().embed=void 0)}onContainerClick(r){(this._lastDisplayMode||"closed")!=="open"&&(this.attr.open||(r.preventDefault(),this.attr.open=!0))}onLogoClick(r){if(r.preventDefault(),r.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{if((this._lastDisplayMode||"closed")==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let r=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;r.children.length>0;)r.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let n=document.createElement("div");n.className="introduction-message",n.innerHTML=ht().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,r.appendChild(n),this.ai.insertAssistantMessage(n.innerText);for(let i of ht().introductionSuggestions||[]){let a=document.createElement("div");a.className="suggestion-button",a.innerText=i,a.addEventListener("click",o=>this.onSuggestionClick(o,i)),r.appendChild(a)}}async processInput(r){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let n=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(n.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let i=document.createElement("div");i.className="input",i.innerText=r,n.appendChild(i),this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output",this.currentOutputElement.style.display="none",this.currentOutputElement.innerHTML="",n.appendChild(this.currentOutputElement),n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(r);for(let a of this.suggestions){let o=document.createElement("div");o.className="suggestion-button",o.innerText=a,o.addEventListener("click",s=>this.onSuggestionClick(s,a)),n.appendChild(o)}n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(i){ln.error("Failed to process input:",i);let a=document.createElement("div");a.className="output",a.innerText="Sorry, there was a problem getting a response. "+i.message,n.appendChild(a);let o=document.createElement("div");o.className="suggestion-button",o.innerText="Reset conversation",o.addEventListener("click",s=>this.resetConversation()),n.appendChild(o)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(r){let n=await Ux().use(Bf).use(qf).use(yf,{target:"_blank",rel:["noopener","noreferrer"]}).use(vf).use(If).processSync(r);this.currentOutputElement&&(this.currentOutputElement.style.display="",this.currentOutputElement.innerHTML=n.toString("utf-8"));let i=this.child("web-weaver-embed-inner");for(let a of Array.from(i.querySelectorAll(".tool")))a.remove();i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(r,n){let i=`Running: ${r}`;r=="search"&&(i=`Searching: ${n?.query}`),r=="ui.focusElement"&&(i=`Focusing: #${n?.elementID}`),r=="ui.suggestResponse"&&(i=`Suggested response: ${n?.text}`);let a=this.child("web-weaver-embed-inner"),o=document.createElement("div");o.className="tool",o.innerText=i,a.appendChild(o),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(r,n){this.processInput(n)}onLLMModelSelect(r){r.preventDefault(),this.ai.setModel(r.detail),this.state.llmPanelOpen=!1}};Wo.tagName="intelliweave-embed",Wo.observedAttributes=["logo","focusID","open","background","textColor","displayMode","positioningMode","positionX","positionY","offsetX","offsetY"];Yn.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(Wo.create());
|
|
3765
3806
|
/*! Bundled license information:
|
|
3766
3807
|
|
|
3767
3808
|
uri-js/dist/es5/uri.all.js:
|