playwright-core 1.58.0-alpha-2025-12-04 → 1.58.0-alpha-2025-12-05
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/ThirdPartyNotices.txt +166 -120
- package/browsers.json +3 -3
- package/lib/mcpBundleImpl/index.js +78 -44
- package/lib/server/deviceDescriptorsSource.json +2 -2
- package/lib/vite/htmlReport/index.html +10 -10
- package/lib/vite/recorder/assets/{codeMirrorModule-DIZWNkLa.js → codeMirrorModule-mRN5opiq.js} +1 -1
- package/lib/vite/recorder/assets/{index-D4haJlGv.js → index-DAlURJuJ.js} +3 -3
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-CvSe_Ehm.js → codeMirrorModule-D7ZzvGBV.js} +1 -1
- package/lib/vite/traceViewer/assets/{defaultSettingsView-DTAwf90E.js → defaultSettingsView-CFbbG_bM.js} +3 -3
- package/lib/vite/traceViewer/index.B_hycly9.js +2 -0
- package/lib/vite/traceViewer/index.html +2 -2
- package/lib/vite/traceViewer/{uiMode.Cayus9z3.js → uiMode.CA0bvrCl.js} +1 -1
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/package.json +1 -1
- package/types/types.d.ts +1 -1
- package/lib/vite/traceViewer/index.H3S_T-cq.js +0 -2
|
@@ -1,83 +1,117 @@
|
|
|
1
|
-
"use strict";var dp=Object.create;var ds=Object.defineProperty;var hp=Object.getOwnPropertyDescriptor;var fp=Object.getOwnPropertyNames;var pp=Object.getPrototypeOf,mp=Object.prototype.hasOwnProperty;var vp=(r,e,t)=>e in r?ds(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var D=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Rl=(r,e)=>{for(var t in e)ds(r,t,{get:e[t],enumerable:!0})},Ys=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of fp(e))!mp.call(r,a)&&a!==t&&ds(r,a,{get:()=>e[a],enumerable:!(s=hp(e,a))||s.enumerable});return r},Ca=(r,e,t)=>(Ys(r,e,"default"),t&&Ys(t,e,"default")),Tt=(r,e,t)=>(t=r!=null?dp(pp(r)):{},Ys(e||!r||!r.__esModule?ds(t,"default",{value:r,enumerable:!0}):t,r)),gp=r=>Ys(ds({},"__esModule",{value:!0}),r);var dt=(r,e,t)=>vp(r,typeof e!="symbol"?e+"":e,t);var tc=D((pn,ec)=>{(function(r,e){typeof pn=="object"&&typeof ec!="undefined"?e(pn):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(pn,(function(r){"use strict";function e(){for(var S=arguments.length,g=Array(S),x=0;x<S;x++)g[x]=arguments[x];if(g.length>1){g[0]=g[0].slice(0,-1);for(var R=g.length-1,T=1;T<R;++T)g[T]=g[T].slice(1,-1);return g[R]=g[R].slice(1),g.join("")}else return g[0]}function t(S){return"(?:"+S+")"}function s(S){return S===void 0?"undefined":S===null?"null":Object.prototype.toString.call(S).split(" ").pop().split("]").shift().toLowerCase()}function a(S){return S.toUpperCase()}function n(S){return S!=null?S instanceof Array?S:typeof S.length!="number"||S.split||S.setInterval||S.call?[S]:Array.prototype.slice.call(S):[]}function o(S,g){var x=S;if(g)for(var R in g)x[R]=g[R];return x}function i(S){var g="[A-Za-z]",x="[\\x0D]",R="[0-9]",T="[\\x22]",F=e(R,"[A-Fa-f]"),ne="[\\x0A]",pe="[\\x20]",_e=t(t("%[EFef]"+F+"%"+F+F+"%"+F+F)+"|"+t("%[89A-Fa-f]"+F+"%"+F+F)+"|"+t("%"+F+F)),je="[\\:\\/\\?\\#\\[\\]\\@]",fe="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Te=e(je,fe),De=S?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ee=S?"[\\uE000-\\uF8FF]":"[]",ve=e(g,R,"[\\-\\.\\_\\~]",De),Ce=t(g+e(g,R,"[\\+\\-\\.]")+"*"),Se=t(t(_e+"|"+e(ve,fe,"[\\:]"))+"*"),Or=t(t("25[0-5]")+"|"+t("2[0-4]"+R)+"|"+t("1"+R+R)+"|"+t("[1-9]"+R)+"|"+R),ct=t(t("25[0-5]")+"|"+t("2[0-4]"+R)+"|"+t("1"+R+R)+"|"+t("0?[1-9]"+R)+"|0?0?"+R),mt=t(ct+"\\."+ct+"\\."+ct+"\\."+ct),xe=t(F+"{1,4}"),ut=t(t(xe+"\\:"+xe)+"|"+mt),vt=t(t(xe+"\\:")+"{6}"+ut),Dt=t("\\:\\:"+t(xe+"\\:")+"{5}"+ut),kr=t(t(xe)+"?\\:\\:"+t(xe+"\\:")+"{4}"+ut),Jt=t(t(t(xe+"\\:")+"{0,1}"+xe)+"?\\:\\:"+t(xe+"\\:")+"{3}"+ut),os=t(t(t(xe+"\\:")+"{0,2}"+xe)+"?\\:\\:"+t(xe+"\\:")+"{2}"+ut),Gs=t(t(t(xe+"\\:")+"{0,3}"+xe)+"?\\:\\:"+xe+"\\:"+ut),Qs=t(t(t(xe+"\\:")+"{0,4}"+xe)+"?\\:\\:"+ut),xa=t(t(t(xe+"\\:")+"{0,5}"+xe)+"?\\:\\:"+xe),wa=t(t(t(xe+"\\:")+"{0,6}"+xe)+"?\\:\\:"),Wt=t([vt,Dt,kr,Jt,os,Gs,Qs,xa,wa].join("|")),Ea=t(t(ve+"|"+_e)+"+"),mo=t(Wt+"\\%25"+Ea),Ar=t(Wt+t("\\%25|\\%(?!"+F+"{2})")+Ea),sp=t("[vV]"+F+"+\\."+e(ve,fe,"[\\:]")+"+"),np=t("\\["+t(Ar+"|"+Wt+"|"+sp)+"\\]"),xl=t(t(_e+"|"+e(ve,fe))+"*"),is=t(np+"|"+mt+"(?!"+xl+")|"+xl),ls=t(R+"*"),wl=t(t(Se+"@")+"?"+is+t("\\:"+ls)+"?"),cs=t(_e+"|"+e(ve,fe,"[\\:\\@]")),op=t(cs+"*"),El=t(cs+"+"),ip=t(t(_e+"|"+e(ve,fe,"[\\@]"))+"+"),Gt=t(t("\\/"+op)+"*"),Pa=t("\\/"+t(El+Gt)+"?"),vo=t(ip+Gt),Ks=t(El+Gt),Ra="(?!"+cs+")",Qb=t(Gt+"|"+Pa+"|"+vo+"|"+Ks+"|"+Ra),Ta=t(t(cs+"|"+e("[\\/\\?]",Ee))+"*"),us=t(t(cs+"|[\\/\\?]")+"*"),Pl=t(t("\\/\\/"+wl+Gt)+"|"+Pa+"|"+Ks+"|"+Ra),lp=t(Ce+"\\:"+Pl+t("\\?"+Ta)+"?"+t("\\#"+us)+"?"),cp=t(t("\\/\\/"+wl+Gt)+"|"+Pa+"|"+vo+"|"+Ra),up=t(cp+t("\\?"+Ta)+"?"+t("\\#"+us)+"?"),Kb=t(lp+"|"+up),Yb=t(Ce+"\\:"+Pl+t("\\?"+Ta)+"?"),Xb="^("+Ce+")\\:"+t(t("\\/\\/("+t("("+Se+")@")+"?("+is+")"+t("\\:("+ls+")")+"?)")+"?("+Gt+"|"+Pa+"|"+Ks+"|"+Ra+")")+t("\\?("+Ta+")")+"?"+t("\\#("+us+")")+"?$",eS="^(){0}"+t(t("\\/\\/("+t("("+Se+")@")+"?("+is+")"+t("\\:("+ls+")")+"?)")+"?("+Gt+"|"+Pa+"|"+vo+"|"+Ra+")")+t("\\?("+Ta+")")+"?"+t("\\#("+us+")")+"?$",tS="^("+Ce+")\\:"+t(t("\\/\\/("+t("("+Se+")@")+"?("+is+")"+t("\\:("+ls+")")+"?)")+"?("+Gt+"|"+Pa+"|"+Ks+"|"+Ra+")")+t("\\?("+Ta+")")+"?$",rS="^"+t("\\#("+us+")")+"?$",aS="^"+t("("+Se+")@")+"?("+is+")"+t("\\:("+ls+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",g,R,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ve,fe),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ve,fe),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ve,fe),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ve,fe),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ve,fe,"[\\:\\@\\/\\?]",Ee),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ve,fe,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ve,fe),"g"),UNRESERVED:new RegExp(ve,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ve,Te),"g"),PCT_ENCODED:new RegExp(_e,"g"),IPV4ADDRESS:new RegExp("^("+mt+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Wt+")"+t(t("\\%25|\\%(?!"+F+"{2})")+"("+Ea+")")+"?\\]?$")}}var c=i(!1),l=i(!0),d=(function(){function S(g,x){var R=[],T=!0,F=!1,ne=void 0;try{for(var pe=g[Symbol.iterator](),_e;!(T=(_e=pe.next()).done)&&(R.push(_e.value),!(x&&R.length===x));T=!0);}catch(je){F=!0,ne=je}finally{try{!T&&pe.return&&pe.return()}finally{if(F)throw ne}}return R}return function(g,x){if(Array.isArray(g))return g;if(Symbol.iterator in Object(g))return S(g,x);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),m=function(S){if(Array.isArray(S)){for(var g=0,x=Array(S.length);g<S.length;g++)x[g]=S[g];return x}else return Array.from(S)},v=2147483647,p=36,b=1,y=26,_=38,w=700,C=72,I=128,O="-",k=/^xn--/,A=/[^\0-\x7E]/,K=/[\x2E\u3002\uFF0E\uFF61]/g,J={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=p-b,W=Math.floor,B=String.fromCharCode;function V(S){throw new RangeError(J[S])}function j(S,g){for(var x=[],R=S.length;R--;)x[R]=g(S[R]);return x}function L(S,g){var x=S.split("@"),R="";x.length>1&&(R=x[0]+"@",S=x[1]),S=S.replace(K,".");var T=S.split("."),F=j(T,g).join(".");return R+F}function H(S){for(var g=[],x=0,R=S.length;x<R;){var T=S.charCodeAt(x++);if(T>=55296&&T<=56319&&x<R){var F=S.charCodeAt(x++);(F&64512)==56320?g.push(((T&1023)<<10)+(F&1023)+65536):(g.push(T),x--)}else g.push(T)}return g}var ye=function(g){return String.fromCodePoint.apply(String,m(g))},le=function(g){return g-48<10?g-22:g-65<26?g-65:g-97<26?g-97:p},he=function(g,x){return g+22+75*(g<26)-((x!=0)<<5)},ie=function(g,x,R){var T=0;for(g=R?W(g/w):g>>1,g+=W(g/x);g>M*y>>1;T+=p)g=W(g/M);return W(T+(M+1)*g/(g+_))},Y=function(g){var x=[],R=g.length,T=0,F=I,ne=C,pe=g.lastIndexOf(O);pe<0&&(pe=0);for(var _e=0;_e<pe;++_e)g.charCodeAt(_e)>=128&&V("not-basic"),x.push(g.charCodeAt(_e));for(var je=pe>0?pe+1:0;je<R;){for(var fe=T,Te=1,De=p;;De+=p){je>=R&&V("invalid-input");var Ee=le(g.charCodeAt(je++));(Ee>=p||Ee>W((v-T)/Te))&&V("overflow"),T+=Ee*Te;var ve=De<=ne?b:De>=ne+y?y:De-ne;if(Ee<ve)break;var Ce=p-ve;Te>W(v/Ce)&&V("overflow"),Te*=Ce}var Se=x.length+1;ne=ie(T-fe,Se,fe==0),W(T/Se)>v-F&&V("overflow"),F+=W(T/Se),T%=Se,x.splice(T++,0,F)}return String.fromCodePoint.apply(String,x)},Ie=function(g){var x=[];g=H(g);var R=g.length,T=I,F=0,ne=C,pe=!0,_e=!1,je=void 0;try{for(var fe=g[Symbol.iterator](),Te;!(pe=(Te=fe.next()).done);pe=!0){var De=Te.value;De<128&&x.push(B(De))}}catch(Ar){_e=!0,je=Ar}finally{try{!pe&&fe.return&&fe.return()}finally{if(_e)throw je}}var Ee=x.length,ve=Ee;for(Ee&&x.push(O);ve<R;){var Ce=v,Se=!0,Or=!1,ct=void 0;try{for(var mt=g[Symbol.iterator](),xe;!(Se=(xe=mt.next()).done);Se=!0){var ut=xe.value;ut>=T&&ut<Ce&&(Ce=ut)}}catch(Ar){Or=!0,ct=Ar}finally{try{!Se&&mt.return&&mt.return()}finally{if(Or)throw ct}}var vt=ve+1;Ce-T>W((v-F)/vt)&&V("overflow"),F+=(Ce-T)*vt,T=Ce;var Dt=!0,kr=!1,Jt=void 0;try{for(var os=g[Symbol.iterator](),Gs;!(Dt=(Gs=os.next()).done);Dt=!0){var Qs=Gs.value;if(Qs<T&&++F>v&&V("overflow"),Qs==T){for(var xa=F,wa=p;;wa+=p){var Wt=wa<=ne?b:wa>=ne+y?y:wa-ne;if(xa<Wt)break;var Ea=xa-Wt,mo=p-Wt;x.push(B(he(Wt+Ea%mo,0))),xa=W(Ea/mo)}x.push(B(he(xa,0))),ne=ie(F,vt,ve==Ee),F=0,++ve}}}catch(Ar){kr=!0,Jt=Ar}finally{try{!Dt&&os.return&&os.return()}finally{if(kr)throw Jt}}++F,++T}return x.join("")},Ve=function(g){return L(g,function(x){return k.test(x)?Y(x.slice(4).toLowerCase()):x})},Ge=function(g){return L(g,function(x){return A.test(x)?"xn--"+Ie(x):x})},me={version:"2.1.0",ucs2:{decode:H,encode:ye},decode:Y,encode:Ie,toASCII:Ge,toUnicode:Ve},Ne={};function Le(S){var g=S.charCodeAt(0),x=void 0;return g<16?x="%0"+g.toString(16).toUpperCase():g<128?x="%"+g.toString(16).toUpperCase():g<2048?x="%"+(g>>6|192).toString(16).toUpperCase()+"%"+(g&63|128).toString(16).toUpperCase():x="%"+(g>>12|224).toString(16).toUpperCase()+"%"+(g>>6&63|128).toString(16).toUpperCase()+"%"+(g&63|128).toString(16).toUpperCase(),x}function Qe(S){for(var g="",x=0,R=S.length;x<R;){var T=parseInt(S.substr(x+1,2),16);if(T<128)g+=String.fromCharCode(T),x+=3;else if(T>=194&&T<224){if(R-x>=6){var F=parseInt(S.substr(x+4,2),16);g+=String.fromCharCode((T&31)<<6|F&63)}else g+=S.substr(x,6);x+=6}else if(T>=224){if(R-x>=9){var ne=parseInt(S.substr(x+4,2),16),pe=parseInt(S.substr(x+7,2),16);g+=String.fromCharCode((T&15)<<12|(ne&63)<<6|pe&63)}else g+=S.substr(x,9);x+=9}else g+=S.substr(x,3),x+=3}return g}function ir(S,g){function x(R){var T=Qe(R);return T.match(g.UNRESERVED)?T:R}return S.scheme&&(S.scheme=String(S.scheme).replace(g.PCT_ENCODED,x).toLowerCase().replace(g.NOT_SCHEME,"")),S.userinfo!==void 0&&(S.userinfo=String(S.userinfo).replace(g.PCT_ENCODED,x).replace(g.NOT_USERINFO,Le).replace(g.PCT_ENCODED,a)),S.host!==void 0&&(S.host=String(S.host).replace(g.PCT_ENCODED,x).toLowerCase().replace(g.NOT_HOST,Le).replace(g.PCT_ENCODED,a)),S.path!==void 0&&(S.path=String(S.path).replace(g.PCT_ENCODED,x).replace(S.scheme?g.NOT_PATH:g.NOT_PATH_NOSCHEME,Le).replace(g.PCT_ENCODED,a)),S.query!==void 0&&(S.query=String(S.query).replace(g.PCT_ENCODED,x).replace(g.NOT_QUERY,Le).replace(g.PCT_ENCODED,a)),S.fragment!==void 0&&(S.fragment=String(S.fragment).replace(g.PCT_ENCODED,x).replace(g.NOT_FRAGMENT,Le).replace(g.PCT_ENCODED,a)),S}function Ht(S){return S.replace(/^0*(.*)/,"$1")||"0"}function $e(S,g){var x=S.match(g.IPV4ADDRESS)||[],R=d(x,2),T=R[1];return T?T.split(".").map(Ht).join("."):S}function Oe(S,g){var x=S.match(g.IPV6ADDRESS)||[],R=d(x,3),T=R[1],F=R[2];if(T){for(var ne=T.toLowerCase().split("::").reverse(),pe=d(ne,2),_e=pe[0],je=pe[1],fe=je?je.split(":").map(Ht):[],Te=_e.split(":").map(Ht),De=g.IPV4ADDRESS.test(Te[Te.length-1]),Ee=De?7:8,ve=Te.length-Ee,Ce=Array(Ee),Se=0;Se<Ee;++Se)Ce[Se]=fe[Se]||Te[ve+Se]||"";De&&(Ce[Ee-1]=$e(Ce[Ee-1],g));var Or=Ce.reduce(function(vt,Dt,kr){if(!Dt||Dt==="0"){var Jt=vt[vt.length-1];Jt&&Jt.index+Jt.length===kr?Jt.length++:vt.push({index:kr,length:1})}return vt},[]),ct=Or.sort(function(vt,Dt){return Dt.length-vt.length})[0],mt=void 0;if(ct&&ct.length>1){var xe=Ce.slice(0,ct.index),ut=Ce.slice(ct.index+ct.length);mt=xe.join(":")+"::"+ut.join(":")}else mt=Ce.join(":");return F&&(mt+="%"+F),mt}else return S}var Tr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,He="".match(/(){0}/)[1]===void 0;function ge(S){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x={},R=g.iri!==!1?l:c;g.reference==="suffix"&&(S=(g.scheme?g.scheme+":":"")+"//"+S);var T=S.match(Tr);if(T){He?(x.scheme=T[1],x.userinfo=T[3],x.host=T[4],x.port=parseInt(T[5],10),x.path=T[6]||"",x.query=T[7],x.fragment=T[8],isNaN(x.port)&&(x.port=T[5])):(x.scheme=T[1]||void 0,x.userinfo=S.indexOf("@")!==-1?T[3]:void 0,x.host=S.indexOf("//")!==-1?T[4]:void 0,x.port=parseInt(T[5],10),x.path=T[6]||"",x.query=S.indexOf("?")!==-1?T[7]:void 0,x.fragment=S.indexOf("#")!==-1?T[8]:void 0,isNaN(x.port)&&(x.port=S.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?T[4]:void 0)),x.host&&(x.host=Oe($e(x.host,R),R)),x.scheme===void 0&&x.userinfo===void 0&&x.host===void 0&&x.port===void 0&&!x.path&&x.query===void 0?x.reference="same-document":x.scheme===void 0?x.reference="relative":x.fragment===void 0?x.reference="absolute":x.reference="uri",g.reference&&g.reference!=="suffix"&&g.reference!==x.reference&&(x.error=x.error||"URI is not a "+g.reference+" reference.");var F=Ne[(g.scheme||x.scheme||"").toLowerCase()];if(!g.unicodeSupport&&(!F||!F.unicodeSupport)){if(x.host&&(g.domainHost||F&&F.domainHost))try{x.host=me.toASCII(x.host.replace(R.PCT_ENCODED,Qe).toLowerCase())}catch(ne){x.error=x.error||"Host's domain name can not be converted to ASCII via punycode: "+ne}ir(x,c)}else ir(x,R);F&&F.parse&&F.parse(x,g)}else x.error=x.error||"URI can not be parsed.";return x}function lr(S,g){var x=g.iri!==!1?l:c,R=[];return S.userinfo!==void 0&&(R.push(S.userinfo),R.push("@")),S.host!==void 0&&R.push(Oe($e(String(S.host),x),x).replace(x.IPV6ADDRESS,function(T,F,ne){return"["+F+(ne?"%25"+ne:"")+"]"})),(typeof S.port=="number"||typeof S.port=="string")&&(R.push(":"),R.push(String(S.port))),R.length?R.join(""):void 0}var Bt=/^\.\.?\//,Cr=/^\/\.(\/|$)/,Ir=/^\/\.\.(\/|$)/,Ze=/^\/?(?:.|\n)*?(?=\/|$)/;function pt(S){for(var g=[];S.length;)if(S.match(Bt))S=S.replace(Bt,"");else if(S.match(Cr))S=S.replace(Cr,"/");else if(S.match(Ir))S=S.replace(Ir,"/"),g.pop();else if(S==="."||S==="..")S="";else{var x=S.match(Ze);if(x){var R=x[0];S=S.slice(R.length),g.push(R)}else throw new Error("Unexpected dot segment condition")}return g.join("")}function et(S){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=g.iri?l:c,R=[],T=Ne[(g.scheme||S.scheme||"").toLowerCase()];if(T&&T.serialize&&T.serialize(S,g),S.host&&!x.IPV6ADDRESS.test(S.host)){if(g.domainHost||T&&T.domainHost)try{S.host=g.iri?me.toUnicode(S.host):me.toASCII(S.host.replace(x.PCT_ENCODED,Qe).toLowerCase())}catch(pe){S.error=S.error||"Host's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+pe}}ir(S,x),g.reference!=="suffix"&&S.scheme&&(R.push(S.scheme),R.push(":"));var F=lr(S,g);if(F!==void 0&&(g.reference!=="suffix"&&R.push("//"),R.push(F),S.path&&S.path.charAt(0)!=="/"&&R.push("/")),S.path!==void 0){var ne=S.path;!g.absolutePath&&(!T||!T.absolutePath)&&(ne=pt(ne)),F===void 0&&(ne=ne.replace(/^\/\//,"/%2F")),R.push(ne)}return S.query!==void 0&&(R.push("?"),R.push(S.query)),S.fragment!==void 0&&(R.push("#"),R.push(S.fragment)),R.join("")}function Ke(S,g){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=arguments[3],T={};return R||(S=ge(et(S,x),x),g=ge(et(g,x),x)),x=x||{},!x.tolerant&&g.scheme?(T.scheme=g.scheme,T.userinfo=g.userinfo,T.host=g.host,T.port=g.port,T.path=pt(g.path||""),T.query=g.query):(g.userinfo!==void 0||g.host!==void 0||g.port!==void 0?(T.userinfo=g.userinfo,T.host=g.host,T.port=g.port,T.path=pt(g.path||""),T.query=g.query):(g.path?(g.path.charAt(0)==="/"?T.path=pt(g.path):((S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)&&!S.path?T.path="/"+g.path:S.path?T.path=S.path.slice(0,S.path.lastIndexOf("/")+1)+g.path:T.path=g.path,T.path=pt(T.path)),T.query=g.query):(T.path=S.path,g.query!==void 0?T.query=g.query:T.query=S.query),T.userinfo=S.userinfo,T.host=S.host,T.port=S.port),T.scheme=S.scheme),T.fragment=g.fragment,T}function $t(S,g,x){var R=o({scheme:"null"},x);return et(Ke(ge(S,R),ge(g,R),R,!0),R)}function lt(S,g){return typeof S=="string"?S=et(ge(S,g),g):s(S)==="object"&&(S=ge(et(S,g),g)),S}function Ws(S,g,x){return typeof S=="string"?S=et(ge(S,x),x):s(S)==="object"&&(S=et(S,x)),typeof g=="string"?g=et(ge(g,x),x):s(g)==="object"&&(g=et(g,x)),S===g}function fo(S,g){return S&&S.toString().replace(!g||!g.iri?c.ESCAPE:l.ESCAPE,Le)}function Rt(S,g){return S&&S.toString().replace(!g||!g.iri?c.PCT_ENCODED:l.PCT_ENCODED,Qe)}var ss={scheme:"http",domainHost:!0,parse:function(g,x){return g.host||(g.error=g.error||"HTTP URIs must have a host."),g},serialize:function(g,x){var R=String(g.scheme).toLowerCase()==="https";return(g.port===(R?443:80)||g.port==="")&&(g.port=void 0),g.path||(g.path="/"),g}},pl={scheme:"https",domainHost:ss.domainHost,parse:ss.parse,serialize:ss.serialize};function ml(S){return typeof S.secure=="boolean"?S.secure:String(S.scheme).toLowerCase()==="wss"}var ns={scheme:"ws",domainHost:!0,parse:function(g,x){var R=g;return R.secure=ml(R),R.resourceName=(R.path||"/")+(R.query?"?"+R.query:""),R.path=void 0,R.query=void 0,R},serialize:function(g,x){if((g.port===(ml(g)?443:80)||g.port==="")&&(g.port=void 0),typeof g.secure=="boolean"&&(g.scheme=g.secure?"wss":"ws",g.secure=void 0),g.resourceName){var R=g.resourceName.split("?"),T=d(R,2),F=T[0],ne=T[1];g.path=F&&F!=="/"?F:void 0,g.query=ne,g.resourceName=void 0}return g.fragment=void 0,g}},vl={scheme:"wss",domainHost:ns.domainHost,parse:ns.parse,serialize:ns.serialize},Bf={},Jf=!0,gl="[A-Za-z0-9\\-\\.\\_\\~"+(Jf?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",jt="[0-9A-Fa-f]",Wf=t(t("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+t("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+t("%"+jt+jt)),Gf="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Qf="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Kf=e(Qf,'[\\"\\\\]'),Yf="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Xf=new RegExp(gl,"g"),Sa=new RegExp(Wf,"g"),ep=new RegExp(e("[^]",Gf,"[\\.]",'[\\"]',Kf),"g"),_l=new RegExp(e("[^]",gl,Yf),"g"),tp=_l;function po(S){var g=Qe(S);return g.match(Xf)?g:S}var yl={scheme:"mailto",parse:function(g,x){var R=g,T=R.to=R.path?R.path.split(","):[];if(R.path=void 0,R.query){for(var F=!1,ne={},pe=R.query.split("&"),_e=0,je=pe.length;_e<je;++_e){var fe=pe[_e].split("=");switch(fe[0]){case"to":for(var Te=fe[1].split(","),De=0,Ee=Te.length;De<Ee;++De)T.push(Te[De]);break;case"subject":R.subject=Rt(fe[1],x);break;case"body":R.body=Rt(fe[1],x);break;default:F=!0,ne[Rt(fe[0],x)]=Rt(fe[1],x);break}}F&&(R.headers=ne)}R.query=void 0;for(var ve=0,Ce=T.length;ve<Ce;++ve){var Se=T[ve].split("@");if(Se[0]=Rt(Se[0]),x.unicodeSupport)Se[1]=Rt(Se[1],x).toLowerCase();else try{Se[1]=me.toASCII(Rt(Se[1],x).toLowerCase())}catch(Or){R.error=R.error||"Email address's domain name can not be converted to ASCII via punycode: "+Or}T[ve]=Se.join("@")}return R},serialize:function(g,x){var R=g,T=n(g.to);if(T){for(var F=0,ne=T.length;F<ne;++F){var pe=String(T[F]),_e=pe.lastIndexOf("@"),je=pe.slice(0,_e).replace(Sa,po).replace(Sa,a).replace(ep,Le),fe=pe.slice(_e+1);try{fe=x.iri?me.toUnicode(fe):me.toASCII(Rt(fe,x).toLowerCase())}catch(ve){R.error=R.error||"Email address's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+ve}T[F]=je+"@"+fe}R.path=T.join(",")}var Te=g.headers=g.headers||{};g.subject&&(Te.subject=g.subject),g.body&&(Te.body=g.body);var De=[];for(var Ee in Te)Te[Ee]!==Bf[Ee]&&De.push(Ee.replace(Sa,po).replace(Sa,a).replace(_l,Le)+"="+Te[Ee].replace(Sa,po).replace(Sa,a).replace(tp,Le));return De.length&&(R.query=De.join("&")),R}},rp=/^([^\:]+)\:(.*)/,bl={scheme:"urn",parse:function(g,x){var R=g.path&&g.path.match(rp),T=g;if(R){var F=x.scheme||T.scheme||"urn",ne=R[1].toLowerCase(),pe=R[2],_e=F+":"+(x.nid||ne),je=Ne[_e];T.nid=ne,T.nss=pe,T.path=void 0,je&&(T=je.parse(T,x))}else T.error=T.error||"URN can not be parsed.";return T},serialize:function(g,x){var R=x.scheme||g.scheme||"urn",T=g.nid,F=R+":"+(x.nid||T),ne=Ne[F];ne&&(g=ne.serialize(g,x));var pe=g,_e=g.nss;return pe.path=(T||x.nid)+":"+_e,pe}},ap=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Sl={scheme:"urn:uuid",parse:function(g,x){var R=g;return R.uuid=R.nss,R.nss=void 0,!x.tolerant&&(!R.uuid||!R.uuid.match(ap))&&(R.error=R.error||"UUID is not valid."),R},serialize:function(g,x){var R=g;return R.nss=(g.uuid||"").toLowerCase(),R}};Ne[ss.scheme]=ss,Ne[pl.scheme]=pl,Ne[ns.scheme]=ns,Ne[vl.scheme]=vl,Ne[yl.scheme]=yl,Ne[bl.scheme]=bl,Ne[Sl.scheme]=Sl,r.SCHEMES=Ne,r.pctEncChar=Le,r.pctDecChars=Qe,r.parse=ge,r.removeDotSegments=pt,r.serialize=et,r.resolveComponents=Ke,r.resolve=$t,r.normalize=lt,r.equal=Ws,r.escapeComponent=fo,r.unescapeComponent=Rt,Object.defineProperty(r,"__esModule",{value:!0})}))});var mn=D((US,rc)=>{"use strict";rc.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 s,a,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(a=s;a--!==0;)if(!r(e[a],t[a]))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(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=s;a--!==0;){var o=n[a];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var sc=D((FS,ac)=>{"use strict";ac.exports=function(e){for(var t=0,s=e.length,a=0,n;a<s;)t++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<s&&(n=e.charCodeAt(a),(n&64512)==56320&&a++);return t}});var Kr=D((VS,ic)=>{"use strict";ic.exports={copy:pv,checkDataType:Lo,checkDataTypes:mv,coerceToTypes:vv,toHash:Zo,getProperty:Uo,escapeQuotes:Fo,equal:mn(),ucs2length:sc(),varOccurences:yv,varReplace:bv,schemaHasRules:Sv,schemaHasRulesExcept:xv,schemaUnknownRules:wv,toQuotedString:qo,getPathExpr:Ev,getPath:Pv,getData:Cv,unescapeFragment:Iv,unescapeJsonPointer:Ho,escapeFragment:Ov,escapeJsonPointer:Vo};function pv(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function Lo(r,e,t,s){var a=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(r){case"null":return e+a+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+a+'"object"'+n+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+a+'"number"'+n+i+"("+e+" % 1)"+n+e+a+e+(t?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+a+'"'+r+'"'+(t?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+a+'"'+r+'"'}}function mv(r,e,t){switch(r.length){case 1:return Lo(r[0],e,t,!0);default:var s="",a=Zo(r);a.array&&a.object&&(s=a.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete a.null,delete a.array,delete a.object),a.number&&delete a.integer;for(var n in a)s+=(s?" && ":"")+Lo(n,e,t,!0);return s}}var nc=Zo(["string","number","integer","boolean","null"]);function vv(r,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var a=e[s];(nc[a]||r==="array"&&a==="array")&&(t[t.length]=a)}if(t.length)return t}else{if(nc[e])return[e];if(r==="array"&&e==="array")return["array"]}}function Zo(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var gv=/^[a-z$_][a-z$_0-9]*$/i,_v=/'|\\/g;function Uo(r){return typeof r=="number"?"["+r+"]":gv.test(r)?"."+r:"['"+Fo(r)+"']"}function Fo(r){return r.replace(_v,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function yv(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function bv(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function Sv(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function xv(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var s in r)if(s!=t&&e[s])return!0}function wv(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function qo(r){return"'"+Fo(r)+"'"}function Ev(r,e,t,s){var a=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return oc(r,a)}function Pv(r,e,t){var s=qo(t?"/"+Vo(e):Uo(e));return oc(r,s)}var Rv=/^\/(?:[^~]|~0|~1)*$/,Tv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Cv(r,e,t){var s,a,n,o;if(r==="")return"rootData";if(r[0]=="/"){if(!Rv.test(r))throw new Error("Invalid JSON-pointer: "+r);a=r,n="rootData"}else{if(o=r.match(Tv),!o)throw new Error("Invalid JSON-pointer: "+r);if(s=+o[1],a=o[2],a=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!a)return n}for(var i=n,c=a.split("/"),l=0;l<c.length;l++){var d=c[l];d&&(n+=Uo(Ho(d)),i+=" && "+n)}return i}function oc(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Iv(r){return Ho(decodeURIComponent(r))}function Ov(r){return encodeURIComponent(Vo(r))}function Vo(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function Ho(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var Bo=D((HS,lc)=>{"use strict";var kv=Kr();lc.exports=Av;function Av(r){kv.copy(r,this)}});var uc=D((BS,cc)=>{"use strict";var pr=cc.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},a=t.post||function(){};vn(e,s,a,r,"",r)};pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};pr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};pr.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 vn(r,e,t,s,a,n,o,i,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,a,n,o,i,c,l);for(var d in s){var m=s[d];if(Array.isArray(m)){if(d in pr.arrayKeywords)for(var v=0;v<m.length;v++)vn(r,e,t,m[v],a+"/"+d+"/"+v,n,a,d,s,v)}else if(d in pr.propsKeywords){if(m&&typeof m=="object")for(var p in m)vn(r,e,t,m[p],a+"/"+d+"/"+Nv(p),n,a,d,s,p)}else(d in pr.keywords||r.allKeys&&!(d in pr.skipKeywords))&&vn(r,e,t,m,a+"/"+d,n,a,d,s)}t(s,a,n,o,i,c,l)}}function Nv(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var xn=D((JS,pc)=>{"use strict";var _s=tc(),dc=mn(),bn=Kr(),gn=Bo(),$v=uc();pc.exports=vr;vr.normalizeId=mr;vr.fullPath=_n;vr.url=yn;vr.ids=Lv;vr.inlineRef=Jo;vr.schema=Sn;function vr(r,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return vr.call(this,r,e,s);if(s=s||this._schemas[t],s instanceof gn)return Jo(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var a=Sn.call(this,e,t),n,o,i;return a&&(n=a.schema,e=a.root,i=a.baseId),n instanceof gn?o=n.validate||r.call(this,n.schema,e,void 0,i):n!==void 0&&(o=Jo(n,this._opts.inlineRefs)?n:r.call(this,n,e,void 0,i)),o}function Sn(r,e){var t=_s.parse(e),s=fc(t),a=_n(this._getId(r.schema));if(Object.keys(r.schema).length===0||s!==a){var n=mr(s),o=this._refs[n];if(typeof o=="string")return jv.call(this,r,o,t);if(o instanceof gn)o.validate||this._compile(o),r=o;else if(o=this._schemas[n],o instanceof gn){if(o.validate||this._compile(o),n==mr(e))return{schema:o,root:r,baseId:a};r=o}else return;if(!r.schema)return;a=_n(this._getId(r.schema))}return hc.call(this,t,a,r.schema,r)}function jv(r,e,t){var s=Sn.call(this,r,e);if(s){var a=s.schema,n=s.baseId;r=s.root;var o=this._getId(a);return o&&(n=yn(n,o)),hc.call(this,t,n,a,r)}}var Dv=bn.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function hc(r,e,t,s){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var a=r.fragment.split("/"),n=1;n<a.length;n++){var o=a[n];if(o){if(o=bn.unescapeFragment(o),t=t[o],t===void 0)break;var i;if(!Dv[o]&&(i=this._getId(t),i&&(e=yn(e,i)),t.$ref)){var c=yn(e,t.$ref),l=Sn.call(this,s,c);l&&(t=l.schema,s=l.root,e=l.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var zv=bn.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Jo(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return Wo(r);if(e)return Go(r)<=e}function Wo(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!Wo(e))return!1}else for(var s in r)if(s=="$ref"||(e=r[s],typeof e=="object"&&!Wo(e)))return!1;return!0}function Go(r){var e=0,t;if(Array.isArray(r)){for(var s=0;s<r.length;s++)if(t=r[s],typeof t=="object"&&(e+=Go(t)),e==1/0)return 1/0}else for(var a in r){if(a=="$ref")return 1/0;if(zv[a])e++;else if(t=r[a],typeof t=="object"&&(e+=Go(t)+1),e==1/0)return 1/0}return e}function _n(r,e){e!==!1&&(r=mr(r));var t=_s.parse(r);return fc(t)}function fc(r){return _s.serialize(r).split("#")[0]+"#"}var Mv=/#\/?$/;function mr(r){return r?r.replace(Mv,""):""}function yn(r,e){return e=mr(e),_s.resolve(r,e)}function Lv(r){var e=mr(this._getId(r)),t={"":e},s={"":_n(e,!1)},a={},n=this;return $v(r,{allKeys:!0},function(o,i,c,l,d,m,v){if(i!==""){var p=n._getId(o),b=t[l],y=s[l]+"/"+d;if(v!==void 0&&(y+="/"+(typeof v=="number"?v:bn.escapeFragment(v))),typeof p=="string"){p=b=mr(b?_s.resolve(b,p):p);var _=n._refs[p];if(typeof _=="string"&&(_=n._refs[_]),_&&_.schema){if(!dc(o,_.schema))throw new Error('id "'+p+'" resolves to more than one schema')}else if(p!=mr(y))if(p[0]=="#"){if(a[p]&&!dc(o,a[p]))throw new Error('id "'+p+'" resolves to more than one schema');a[p]=o}else n._refs[p]=y}t[i]=b,s[i]=y}}),a}});var wn=D((WS,vc)=>{"use strict";var Qo=xn();vc.exports={Validation:mc(qv),MissingRef:mc(Ko)};function qv(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}Ko.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function Ko(r,e,t){this.message=t||Ko.message(r,e),this.missingRef=Qo.url(r,e),this.missingSchema=Qo.normalizeId(Qo.fullPath(this.missingRef))}function mc(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var Yo=D((GS,gc)=>{"use strict";gc.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&(function(n){return function(o){return function(i,c){var l={key:i,value:o[i]},d={key:c,value:o[c]};return n(l,d)}}})(e.cmp),a=[];return(function n(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,c;if(Array.isArray(o)){for(c="[",i=0;i<o.length;i++)i&&(c+=","),c+=n(o[i])||"null";return c+"]"}if(o===null)return"null";if(a.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=a.push(o)-1,d=Object.keys(o).sort(s&&s(o));for(c="",i=0;i<d.length;i++){var m=d[i],v=n(o[m]);v&&(c&&(c+=","),c+=JSON.stringify(m)+":"+v)}return a.splice(l,1),"{"+c+"}"}})(r)}});var Xo=D((QS,_c)=>{"use strict";_c.exports=function(e,t,s){var a="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var l="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(l);else throw new Error(l)}}if(e.isTop&&(a+=" var validate = ",n&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",d=e.level,m=e.dataLevel,v=e.schema[t],p=e.schemaPath+e.util.getProperty(t),b=e.errSchemaPath+"/"+t,k=!e.opts.allErrors,J,y="data"+(m||""),O="valid"+d;if(e.schema===!1){e.isTop?k=!0:a+=" var "+O+" = false; ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(J||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(b)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),a+=" } "):a+=" {} ";var w=a;a=_.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+O+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var C=e.isTop,d=e.level=0,m=e.dataLevel=0,y="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 I="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,m=e.dataLevel,y="data"+(m||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+d+" = errors;"}var O="valid"+d,k=!e.opts.allErrors,A="",K="",J,M=e.schema.type,W=Array.isArray(M);if(M&&e.opts.nullable&&e.schema.nullable===!0&&(W?M.indexOf("null")==-1&&(M=M.concat("null")):M!="null"&&(M=[M,"null"],W=!0)),W&&M.length==1&&(M=M[0],W=!1),e.schema.$ref&&o){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&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),M){if(e.opts.coerceTypes)var B=e.util.coerceToTypes(e.opts.coerceTypes,M);var V=e.RULES.types[M];if(B||W||V===!0||V&&!Ze(V)){var p=e.schemaPath+".type",b=e.errSchemaPath+"/type",p=e.schemaPath+".type",b=e.errSchemaPath+"/type",j=W?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[j](M,y,e.opts.strictNumbers,!0)+") { ",B){var L="dataType"+d,H="coerced"+d;a+=" var "+L+" = typeof "+y+"; var "+H+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+L+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+L+" = typeof "+y+"; if ("+e.util.checkDataType(e.schema.type,y,e.opts.strictNumbers)+") "+H+" = "+y+"; } "),a+=" if ("+H+" !== undefined) ; ";var ye=B;if(ye)for(var le,he=-1,ie=ye.length-1;he<ie;)le=ye[he+=1],le=="string"?a+=" else if ("+L+" == 'number' || "+L+" == 'boolean') "+H+" = '' + "+y+"; else if ("+y+" === null) "+H+" = ''; ":le=="number"||le=="integer"?(a+=" else if ("+L+" == 'boolean' || "+y+" === null || ("+L+" == 'string' && "+y+" && "+y+" == +"+y+" ",le=="integer"&&(a+=" && !("+y+" % 1)"),a+=")) "+H+" = +"+y+"; "):le=="boolean"?a+=" else if ("+y+" === 'false' || "+y+" === 0 || "+y+" === null) "+H+" = false; else if ("+y+" === 'true' || "+y+" === 1) "+H+" = true; ":le=="null"?a+=" else if ("+y+" === '' || "+y+" === 0 || "+y+" === false) "+H+" = null; ":e.opts.coerceTypes=="array"&&le=="array"&&(a+=" else if ("+L+" == 'string' || "+L+" == 'number' || "+L+" == 'boolean' || "+y+" == null) "+H+" = ["+y+"]; ");a+=" else { ";var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(b)+" , params: { type: '",W?a+=""+M.join(","):a+=""+M,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+M.join(","):a+=""+M,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),a+=" } "):a+=" {} ";var w=a;a=_.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+H+" !== undefined) { ";var Y=m?"data"+(m-1||""):"parentData",Ie=m?e.dataPathArr[m]:"parentDataProperty";a+=" "+y+" = "+H+"; ",m||(a+="if ("+Y+" !== undefined)"),a+=" "+Y+"["+Ie+"] = "+H+"; } "}else{var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(b)+" , params: { type: '",W?a+=""+M.join(","):a+=""+M,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+M.join(","):a+=""+M,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),a+=" } "):a+=" {} ";var w=a;a=_.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!o)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",k&&(a+=" } if (errors === ",C?a+="0":a+="errs_"+d,a+=") { ",K+="}");else{var Ve=e.RULES;if(Ve){for(var V,Ge=-1,me=Ve.length-1;Ge<me;)if(V=Ve[Ge+=1],Ze(V)){if(V.type&&(a+=" if ("+e.util.checkDataType(V.type,y,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(V.type=="object"&&e.schema.properties){var v=e.schema.properties,Ne=Object.keys(v),Le=Ne;if(Le)for(var Qe,ir=-1,Ht=Le.length-1;ir<Ht;){Qe=Le[ir+=1];var $e=v[Qe];if($e.default!==void 0){var Oe=y+e.util.getProperty(Qe);if(e.compositeRule){if(e.opts.strictDefaults){var I="default is ignored for: "+Oe;if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}}else a+=" if ("+Oe+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+Oe+" === null || "+Oe+" === '' "),a+=" ) "+Oe+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault($e.default)+" ":a+=" "+JSON.stringify($e.default)+" ",a+="; "}}}else if(V.type=="array"&&Array.isArray(e.schema.items)){var Tr=e.schema.items;if(Tr){for(var $e,he=-1,He=Tr.length-1;he<He;)if($e=Tr[he+=1],$e.default!==void 0){var Oe=y+"["+he+"]";if(e.compositeRule){if(e.opts.strictDefaults){var I="default is ignored for: "+Oe;if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}}else a+=" if ("+Oe+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+Oe+" === null || "+Oe+" === '' "),a+=" ) "+Oe+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault($e.default)+" ":a+=" "+JSON.stringify($e.default)+" ",a+="; "}}}}var ge=V.rules;if(ge){for(var lr,Bt=-1,Cr=ge.length-1;Bt<Cr;)if(lr=ge[Bt+=1],pt(lr)){var Ir=lr.code(e,lr.keyword,V.type);Ir&&(a+=" "+Ir+" ",k&&(A+="}"))}}if(k&&(a+=" "+A+" ",A=""),V.type&&(a+=" } ",M&&M===V.type&&!B)){a+=" else { ";var p=e.schemaPath+".type",b=e.errSchemaPath+"/type",_=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(b)+" , params: { type: '",W?a+=""+M.join(","):a+=""+M,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+M.join(","):a+=""+M,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),a+=" } "):a+=" {} ";var w=a;a=_.pop(),!e.compositeRule&&k?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}k&&(a+=" if (errors === ",C?a+="0":a+="errs_"+d,a+=") { ",K+="}")}}}k&&(a+=" "+K+" "),C?(n?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+O+" = errors === errs_"+d+";";function Ze(Ke){for(var $t=Ke.rules,lt=0;lt<$t.length;lt++)if(pt($t[lt]))return!0}function pt(Ke){return e.schema[Ke.keyword]!==void 0||Ke.implements&&et(Ke)}function et(Ke){for(var $t=Ke.implements,lt=0;lt<$t.length;lt++)if(e.schema[$t[lt]]!==void 0)return!0}return a}});var wc=D((KS,xc)=>{"use strict";var En=xn(),Rn=Kr(),bc=wn(),Zv=Yo(),yc=Xo(),Uv=Rn.ucs2length,Fv=mn(),Vv=bc.Validation;xc.exports=ei;function ei(r,e,t,s){var a=this,n=this._opts,o=[void 0],i={},c=[],l={},d=[],m={},v=[];e=e||{schema:r,refVal:o,refs:i};var p=Hv.call(this,r,e,s),b=this._compilations[p.index];if(p.compiling)return b.callValidate=I;var y=this._formats,_=this.RULES;try{var w=O(r,e,t,s);b.validate=w;var C=b.callValidate;return C&&(C.schema=w.schema,C.errors=null,C.refs=w.refs,C.refVal=w.refVal,C.root=w.root,C.$async=w.$async,n.sourceCode&&(C.source=w.source)),w}finally{Bv.call(this,r,e,s)}function I(){var j=b.validate,L=j.apply(this,arguments);return I.errors=j.errors,L}function O(j,L,H,ye){var le=!L||L&&L.schema==j;if(L.schema!=e.schema)return ei.call(a,j,L,H,ye);var he=j.$async===!0,ie=yc({isTop:!0,schema:j,isRoot:le,baseId:ye,root:L,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:bc.MissingRef,RULES:_,validate:yc,util:Rn,resolve:En,resolveRef:k,usePattern:W,useDefault:B,useCustomRule:V,opts:n,formats:y,logger:a.logger,self:a});ie=Pn(o,Gv)+Pn(c,Jv)+Pn(d,Wv)+Pn(v,Qv)+ie,n.processCode&&(ie=n.processCode(ie,j));var Y;try{var Ie=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",ie);Y=Ie(a,_,y,e,o,d,v,Fv,Uv,Vv),o[0]=Y}catch(Ve){throw a.logger.error("Error compiling schema, function code:",ie),Ve}return Y.schema=j,Y.errors=null,Y.refs=i,Y.refVal=o,Y.root=le?Y:L,he&&(Y.$async=!0),n.sourceCode===!0&&(Y.source={code:ie,patterns:c,defaults:d}),Y}function k(j,L,H){L=En.url(j,L);var ye=i[L],le,he;if(ye!==void 0)return le=o[ye],he="refVal["+ye+"]",M(le,he);if(!H&&e.refs){var ie=e.refs[L];if(ie!==void 0)return le=e.refVal[ie],he=A(L,le),M(le,he)}he=A(L);var Y=En.call(a,O,e,L);if(Y===void 0){var Ie=t&&t[L];Ie&&(Y=En.inlineRef(Ie,n.inlineRefs)?Ie:ei.call(a,Ie,e,t,j))}if(Y===void 0)K(L);else return J(L,Y),M(Y,he)}function A(j,L){var H=o.length;return o[H]=L,i[j]=H,"refVal"+H}function K(j){delete i[j]}function J(j,L){var H=i[j];o[H]=L}function M(j,L){return typeof j=="object"||typeof j=="boolean"?{code:L,schema:j,inline:!0}:{code:L,$async:j&&!!j.$async}}function W(j){var L=l[j];return L===void 0&&(L=l[j]=c.length,c[L]=j),"pattern"+L}function B(j){switch(typeof j){case"boolean":case"number":return""+j;case"string":return Rn.toQuotedString(j);case"object":if(j===null)return"null";var L=Zv(j),H=m[L];return H===void 0&&(H=m[L]=d.length,d[H]=j),"default"+H}}function V(j,L,H,ye){if(a._opts.validateSchema!==!1){var le=j.definition.dependencies;if(le&&!le.every(function(Le){return Object.prototype.hasOwnProperty.call(H,Le)}))throw new Error("parent schema must have all required keywords: "+le.join(","));var he=j.definition.validateSchema;if(he){var ie=he(L);if(!ie){var Y="keyword schema is invalid: "+a.errorsText(he.errors);if(a._opts.validateSchema=="log")a.logger.error(Y);else throw new Error(Y)}}}var Ie=j.definition.compile,Ve=j.definition.inline,Ge=j.definition.macro,me;if(Ie)me=Ie.call(a,L,H,ye);else if(Ge)me=Ge.call(a,L,H,ye),n.validateSchema!==!1&&a.validateSchema(me,!0);else if(Ve)me=Ve.call(a,ye,j.keyword,L,H);else if(me=j.definition.validate,!me)return;if(me===void 0)throw new Error('custom keyword "'+j.keyword+'"failed to compile');var Ne=v.length;return v[Ne]=me,{code:"customRule"+Ne,validate:me}}}function Hv(r,e,t){var s=Sc.call(this,r,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:r,root:e,baseId:t},{index:s,compiling:!1})}function Bv(r,e,t){var s=Sc.call(this,r,e,t);s>=0&&this._compilations.splice(s,1)}function Sc(r,e,t){for(var s=0;s<this._compilations.length;s++){var a=this._compilations[s];if(a.schema==r&&a.root==e&&a.baseId==t)return s}return-1}function Jv(r,e){return"var pattern"+r+" = new RegExp("+Rn.toQuotedString(e[r])+");"}function Wv(r){return"var default"+r+" = defaults["+r+"];"}function Gv(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function Qv(r){return"var customRule"+r+" = customRules["+r+"];"}function Pn(r,e){if(!r.length)return"";for(var t="",s=0;s<r.length;s++)t+=e(s,r);return t}});var Pc=D((YS,Ec)=>{"use strict";var Tn=Ec.exports=function(){this._cache={}};Tn.prototype.put=function(e,t){this._cache[e]=t};Tn.prototype.get=function(e){return this._cache[e]};Tn.prototype.del=function(e){delete this._cache[e]};Tn.prototype.clear=function(){this._cache={}}});var zc=D((XS,Dc)=>{"use strict";var Kv=Kr(),Yv=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Xv=[0,31,28,31,30,31,30,31,31,30,31,30,31],eg=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Rc=/^(?=.{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,tg=/^(?:[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,rg=/^(?:[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,Tc=/^(?:(?:[^\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,Cc=/^(?:(?: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,Ic=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Oc=/^(?:\/(?:[^~/]|~0|~1)*)*$/,kc=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Ac=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Dc.exports=Cn;function Cn(r){return r=r=="full"?"full":"fast",Kv.copy(Cn[r])}Cn.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":Tc,url:Cc,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:Rc,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:jc,uuid:Ic,"json-pointer":Oc,"json-pointer-uri-fragment":kc,"relative-json-pointer":Ac};Cn.full={date:Nc,time:$c,"date-time":ng,uri:ig,"uri-reference":rg,"uri-template":Tc,url:Cc,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:Rc,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:jc,uuid:Ic,"json-pointer":Oc,"json-pointer-uri-fragment":kc,"relative-json-pointer":Ac};function ag(r){return r%4===0&&(r%100!==0||r%400===0)}function Nc(r){var e=r.match(Yv);if(!e)return!1;var t=+e[1],s=+e[2],a=+e[3];return s>=1&&s<=12&&a>=1&&a<=(s==2&&ag(t)?29:Xv[s])}function $c(r,e){var t=r.match(eg);if(!t)return!1;var s=t[1],a=t[2],n=t[3],o=t[5];return(s<=23&&a<=59&&n<=59||s==23&&a==59&&n==60)&&(!e||o)}var sg=/t|\s/i;function ng(r){var e=r.split(sg);return e.length==2&&Nc(e[0])&&$c(e[1],!0)}var og=/\/|:/;function ig(r){return og.test(r)&&tg.test(r)}var lg=/[^\\]\\Z/;function jc(r){if(lg.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var Lc=D((ex,Mc)=>{"use strict";Mc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,d="data"+(o||""),m="valid"+n,v,p;if(i=="#"||i=="#/")e.isRoot?(v=e.async,p="validate"):(v=e.root.schema.$async===!0,p="root.refVal[0]");else{var b=e.resolveRef(e.baseId,i,e.isRoot);if(b===void 0){var y=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(y);var _=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var w=a;a=_.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(y),l&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,y)}else if(b.inline){var C=e.util.copy(e);C.level++;var I="valid"+C.level;C.schema=b.schema,C.schemaPath="",C.errSchemaPath=i;var O=e.validate(C).replace(/validate\.schema/g,b.code);a+=" "+O+" ",l&&(a+=" if ("+I+") { ")}else v=b.$async===!0||e.async&&b.$async!==!1,p=b.code}if(p){var _=_||[];_.push(a),a="",e.opts.passContext?a+=" "+p+".call(this, ":a+=" "+p+"( ",a+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var k=o?"data"+(o-1||""):"parentData",A=o?e.dataPathArr[o]:"parentDataProperty";a+=" , "+k+" , "+A+", rootData) ";var K=a;if(a=_.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");l&&(a+=" var "+m+"; "),a+=" try { await "+K+"; ",l&&(a+=" "+m+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",l&&(a+=" "+m+" = false; "),a+=" } ",l&&(a+=" if ("+m+") { ")}else a+=" if (!"+K+") { if (vErrors === null) vErrors = "+p+".errors; else vErrors = vErrors.concat("+p+".errors); errors = vErrors.length; } ",l&&(a+=" else { ")}return a}});var Zc=D((tx,qc)=>{"use strict";qc.exports=function(e,t,s){var a=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),i=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l=e.util.copy(e),d="";l.level++;var m="valid"+l.level,v=l.baseId,p=!0,b=n;if(b)for(var y,_=-1,w=b.length-1;_<w;)y=b[_+=1],(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all))&&(p=!1,l.schema=y,l.schemaPath=o+"["+_+"]",l.errSchemaPath=i+"/"+_,a+=" "+e.validate(l)+" ",l.baseId=v,c&&(a+=" if ("+m+") { ",d+="}"));return c&&(p?a+=" if (true) { ":a+=" "+d.slice(0,-1)+" "),a}});var Fc=D((rx,Uc)=>{"use strict";Uc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p="errs__"+n,b=e.util.copy(e),y="";b.level++;var _="valid"+b.level,w=i.every(function(J){return e.opts.strictKeywords?typeof J=="object"&&Object.keys(J).length>0||J===!1:e.util.schemaHasRules(J,e.RULES.all)});if(w){var C=b.baseId;a+=" var "+p+" = errors; var "+v+" = false; ";var I=e.compositeRule;e.compositeRule=b.compositeRule=!0;var O=i;if(O)for(var k,A=-1,K=O.length-1;A<K;)k=O[A+=1],b.schema=k,b.schemaPath=c+"["+A+"]",b.errSchemaPath=l+"/"+A,a+=" "+e.validate(b)+" ",b.baseId=C,a+=" "+v+" = "+v+" || "+_+"; if (!"+v+") { ",y+="}";e.compositeRule=b.compositeRule=I,a+=" "+y+" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else d&&(a+=" if (true) { ");return a}});var Hc=D((ax,Vc)=>{"use strict";Vc.exports=function(e,t,s){var a=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,i=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?a+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+c+", "+e.util.toQuotedString(o)+", validate.root.schema);"),a}});var Jc=D((sx,Bc)=>{"use strict";Bc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p=e.opts.$data&&i&&i.$data,b;p?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",b="schema"+n):b=i,p||(a+=" var schema"+n+" = validate.schema"+c+";"),a+="var "+v+" = equal("+m+", schema"+n+"); if (!"+v+") { ";var y=y||[];y.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var _=a;return a=y.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+_+"]); ":a+=" validate.errors = ["+_+"]; return false; ":a+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",d&&(a+=" else { "),a}});var Gc=D((nx,Wc)=>{"use strict";Wc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p="errs__"+n,b=e.util.copy(e),y="";b.level++;var _="valid"+b.level,w="i"+n,C=b.dataLevel=e.dataLevel+1,I="data"+C,O=e.baseId,k=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(a+="var "+p+" = errors;var "+v+";",k){var A=e.compositeRule;e.compositeRule=b.compositeRule=!0,b.schema=i,b.schemaPath=c,b.errSchemaPath=l,a+=" var "+_+" = false; for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",b.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var K=m+"["+w+"]";b.dataPathArr[C]=w;var J=e.validate(b);b.baseId=O,e.util.varOccurences(J,I)<2?a+=" "+e.util.varReplace(J,I,K)+" ":a+=" var "+I+" = "+K+"; "+J+" ",a+=" if ("+_+") break; } ",e.compositeRule=b.compositeRule=A,a+=" "+y+" if (!"+_+") {"}else a+=" if ("+m+".length == 0) {";var M=M||[];M.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var W=a;return a=M.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",k&&(a+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}});var Kc=D((ox,Qc)=>{"use strict";Qc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="errs__"+n,p=e.util.copy(e),b="";p.level++;var y="valid"+p.level,_={},w={},C=e.opts.ownProperties;for(A in i)if(A!="__proto__"){var I=i[A],O=Array.isArray(I)?w:_;O[A]=I}a+="var "+v+" = errors;";var k=e.errorPath;a+="var missing"+n+";";for(var A in w)if(O=w[A],O.length){if(a+=" if ( "+m+e.util.getProperty(A)+" !== undefined ",C&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(A)+"') "),d){a+=" && ( ";var K=O;if(K)for(var J,M=-1,W=K.length-1;M<W;){J=K[M+=1],M&&(a+=" || ");var B=e.util.getProperty(J),V=m+B;a+=" ( ( "+V+" === undefined ",C&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(J)+"') "),a+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?J:B)+") ) "}a+=")) { ";var j="missing"+n,L="' + "+j+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,j,!0):k+" + "+j);var H=H||[];H.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+L+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",O.length==1?a+="property "+e.util.escapeQuotes(O[0]):a+="properties "+e.util.escapeQuotes(O.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var ye=a;a=H.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+ye+"]); ":a+=" validate.errors = ["+ye+"]; return false; ":a+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var le=O;if(le)for(var J,he=-1,ie=le.length-1;he<ie;){J=le[he+=1];var B=e.util.getProperty(J),L=e.util.escapeQuotes(J),V=m+B;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,J,e.opts.jsonPointers)),a+=" if ( "+V+" === undefined ",C&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(J)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+L+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",O.length==1?a+="property "+e.util.escapeQuotes(O[0]):a+="properties "+e.util.escapeQuotes(O.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",d&&(b+="}",a+=" else { ")}e.errorPath=k;var Y=p.baseId;for(var A in _){var I=_[A];(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))&&(a+=" "+y+" = true; if ( "+m+e.util.getProperty(A)+" !== undefined ",C&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(A)+"') "),a+=") { ",p.schema=I,p.schemaPath=c+e.util.getProperty(A),p.errSchemaPath=l+"/"+e.util.escapeFragment(A),a+=" "+e.validate(p)+" ",p.baseId=Y,a+=" } ",d&&(a+=" if ("+y+") { ",b+="}"))}return d&&(a+=" "+b+" if ("+v+" == errors) {"),a}});var Xc=D((ix,Yc)=>{"use strict";Yc.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p=e.opts.$data&&i&&i.$data,b;p?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",b="schema"+n):b=i;var y="i"+n,_="schema"+n;p||(a+=" var "+_+" = validate.schema"+c+";"),a+="var "+v+";",p&&(a+=" if (schema"+n+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+n+")) "+v+" = false; else {"),a+=""+v+" = false;for (var "+y+"=0; "+y+"<"+_+".length; "+y+"++) if (equal("+m+", "+_+"["+y+"])) { "+v+" = true; break; }",p&&(a+=" } "),a+=" if (!"+v+") { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var C=a;return a=w.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+C+"]); ":a+=" validate.errors = ["+C+"]; return false; ":a+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",d&&(a+=" else { "),a}});var tu=D((lx,eu)=>{"use strict";eu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||"");if(e.opts.format===!1)return d&&(a+=" if (true) { "),a;var v=e.opts.$data&&i&&i.$data,p;v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i;var b=e.opts.unknownFormats,y=Array.isArray(b);if(v){var _="format"+n,w="isObject"+n,C="formatType"+n;a+=" var "+_+" = formats["+p+"]; var "+w+" = typeof "+_+" == 'object' && !("+_+" instanceof RegExp) && "+_+".validate; var "+C+" = "+w+" && "+_+".type || 'string'; if ("+w+") { ",e.async&&(a+=" var async"+n+" = "+_+".async; "),a+=" "+_+" = "+_+".validate; } if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),a+=" (",b!="ignore"&&(a+=" ("+p+" && !"+_+" ",y&&(a+=" && self._opts.unknownFormats.indexOf("+p+") == -1 "),a+=") || "),a+=" ("+_+" && "+C+" == '"+s+"' && !(typeof "+_+" == 'function' ? ",e.async?a+=" (async"+n+" ? await "+_+"("+m+") : "+_+"("+m+")) ":a+=" "+_+"("+m+") ",a+=" : "+_+".test("+m+"))))) {"}else{var _=e.formats[i];if(!_){if(b=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(a+=" if (true) { "),a;if(y&&b.indexOf(i)>=0)return d&&(a+=" if (true) { "),a;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var w=typeof _=="object"&&!(_ instanceof RegExp)&&_.validate,C=w&&_.type||"string";if(w){var I=_.async===!0;_=_.validate}if(C!=s)return d&&(a+=" if (true) { "),a;if(I){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(i)+".validate";a+=" if (!(await "+O+"("+m+"))) { "}else{a+=" if (! ";var O="formats"+e.util.getProperty(i);w&&(O+=".validate"),typeof _=="function"?a+=" "+O+"("+m+") ":a+=" "+O+".test("+m+") ",a+=") { "}}var k=k||[];k.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",v?a+=""+p:a+=""+e.util.toQuotedString(i),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,v?a+="' + "+p+" + '":a+=""+e.util.escapeQuotes(i),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var A=a;return a=k.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d&&(a+=" else { "),a}});var au=D((cx,ru)=>{"use strict";ru.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p="errs__"+n,b=e.util.copy(e);b.level++;var y="valid"+b.level,_=e.schema.then,w=e.schema.else,C=_!==void 0&&(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all)),I=w!==void 0&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all)),O=b.baseId;if(C||I){var k;b.createErrors=!1,b.schema=i,b.schemaPath=c,b.errSchemaPath=l,a+=" var "+p+" = errors; var "+v+" = true; ";var A=e.compositeRule;e.compositeRule=b.compositeRule=!0,a+=" "+e.validate(b)+" ",b.baseId=O,b.createErrors=!0,a+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.compositeRule=b.compositeRule=A,C?(a+=" if ("+y+") { ",b.schema=e.schema.then,b.schemaPath=e.schemaPath+".then",b.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(b)+" ",b.baseId=O,a+=" "+v+" = "+y+"; ",C&&I?(k="ifClause"+n,a+=" var "+k+" = 'then'; "):k="'then'",a+=" } ",I&&(a+=" else { ")):a+=" if (!"+y+") { ",I&&(b.schema=e.schema.else,b.schemaPath=e.schemaPath+".else",b.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(b)+" ",b.baseId=O,a+=" "+v+" = "+y+"; ",C&&I?(k="ifClause"+n,a+=" var "+k+" = 'else'; "):k="'else'",a+=" } "),a+=" if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+k+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+k+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",d&&(a+=" else { ")}else d&&(a+=" if (true) { ");return a}});var nu=D((ux,su)=>{"use strict";su.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p="errs__"+n,b=e.util.copy(e),y="";b.level++;var _="valid"+b.level,w="i"+n,C=b.dataLevel=e.dataLevel+1,I="data"+C,O=e.baseId;if(a+="var "+p+" = errors;var "+v+";",Array.isArray(i)){var k=e.schema.additionalItems;if(k===!1){a+=" "+v+" = "+m+".length <= "+i.length+"; ";var A=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+v+") { ";var K=K||[];K.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var J=a;a=K.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+J+"]); ":a+=" validate.errors = ["+J+"]; return false; ":a+=" var err = "+J+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=A,d&&(y+="}",a+=" else { ")}var M=i;if(M){for(var W,B=-1,V=M.length-1;B<V;)if(W=M[B+=1],e.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:e.util.schemaHasRules(W,e.RULES.all)){a+=" "+_+" = true; if ("+m+".length > "+B+") { ";var j=m+"["+B+"]";b.schema=W,b.schemaPath=c+"["+B+"]",b.errSchemaPath=l+"/"+B,b.errorPath=e.util.getPathExpr(e.errorPath,B,e.opts.jsonPointers,!0),b.dataPathArr[C]=B;var L=e.validate(b);b.baseId=O,e.util.varOccurences(L,I)<2?a+=" "+e.util.varReplace(L,I,j)+" ":a+=" var "+I+" = "+j+"; "+L+" ",a+=" } ",d&&(a+=" if ("+_+") { ",y+="}")}}if(typeof k=="object"&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))){b.schema=k,b.schemaPath=e.schemaPath+".additionalItems",b.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+_+" = true; if ("+m+".length > "+i.length+") { for (var "+w+" = "+i.length+"; "+w+" < "+m+".length; "+w+"++) { ",b.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var j=m+"["+w+"]";b.dataPathArr[C]=w;var L=e.validate(b);b.baseId=O,e.util.varOccurences(L,I)<2?a+=" "+e.util.varReplace(L,I,j)+" ":a+=" var "+I+" = "+j+"; "+L+" ",d&&(a+=" if (!"+_+") break; "),a+=" } } ",d&&(a+=" if ("+_+") { ",y+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){b.schema=i,b.schemaPath=c,b.errSchemaPath=l,a+=" for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",b.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var j=m+"["+w+"]";b.dataPathArr[C]=w;var L=e.validate(b);b.baseId=O,e.util.varOccurences(L,I)<2?a+=" "+e.util.varReplace(L,I,j)+" ":a+=" var "+I+" = "+j+"; "+L+" ",d&&(a+=" if (!"+_+") break; "),a+=" }"}return d&&(a+=" "+y+" if ("+p+" == errors) {"),a}});var ti=D((dx,ou)=>{"use strict";ou.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,O,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i;var b=t=="maximum",y=b?"exclusiveMaximum":"exclusiveMinimum",_=e.schema[y],w=e.opts.$data&&_&&_.$data,C=b?"<":">",I=b?">":"<",O=void 0;if(!(v||typeof i=="number"||i===void 0))throw new Error(t+" must be number");if(!(w||_===void 0||typeof _=="number"||typeof _=="boolean"))throw new Error(y+" must be number or boolean");if(w){var k=e.util.getData(_.$data,o,e.dataPathArr),A="exclusive"+n,K="exclType"+n,J="exclIsNumber"+n,M="op"+n,W="' + "+M+" + '";a+=" var schemaExcl"+n+" = "+k+"; ",k="schemaExcl"+n,a+=" var "+A+"; var "+K+" = typeof "+k+"; if ("+K+" != 'boolean' && "+K+" != 'undefined' && "+K+" != 'number') { ";var O=y,B=B||[];B.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+y+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var V=a;a=B.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),a+=" "+K+" == 'number' ? ( ("+A+" = "+p+" === undefined || "+k+" "+C+"= "+p+") ? "+m+" "+I+"= "+k+" : "+m+" "+I+" "+p+" ) : ( ("+A+" = "+k+" === true) ? "+m+" "+I+"= "+p+" : "+m+" "+I+" "+p+" ) || "+m+" !== "+m+") { var op"+n+" = "+A+" ? '"+C+"' : '"+C+"='; ",i===void 0&&(O=y,l=e.errSchemaPath+"/"+y,p=k,v=w)}else{var J=typeof _=="number",W=C;if(J&&v){var M="'"+W+"'";a+=" if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),a+=" ( "+p+" === undefined || "+_+" "+C+"= "+p+" ? "+m+" "+I+"= "+_+" : "+m+" "+I+" "+p+" ) || "+m+" !== "+m+") { "}else{J&&i===void 0?(A=!0,O=y,l=e.errSchemaPath+"/"+y,p=_,I+="="):(J&&(p=Math[b?"min":"max"](_,i)),_===(J?p:!0)?(A=!0,O=y,l=e.errSchemaPath+"/"+y,I+="="):(A=!1,W+="="));var M="'"+W+"'";a+=" if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),a+=" "+m+" "+I+" "+p+" || "+m+" !== "+m+") { "}}O=O||t;var B=B||[];B.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+M+", limit: "+p+", exclusive: "+A+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+W+" ",v?a+="' + "+p:a+=""+p+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var V=a;return a=B.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d&&(a+=" else { "),a}});var ri=D((hx,iu)=>{"use strict";iu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,y,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i,!(v||typeof i=="number"))throw new Error(t+" must be number");var b=t=="maxItems"?">":"<";a+="if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),a+=" "+m+".length "+b+" "+p+") { ";var y=t,_=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",t=="maxItems"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+p+" + '":a+=""+i,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var w=a;return a=_.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",d&&(a+=" else { "),a}});var ai=D((fx,lu)=>{"use strict";lu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,y,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i,!(v||typeof i=="number"))throw new Error(t+" must be number");var b=t=="maxLength"?">":"<";a+="if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),e.opts.unicode===!1?a+=" "+m+".length ":a+=" ucs2length("+m+") ",a+=" "+b+" "+p+") { ";var y=t,_=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",t=="maxLength"?a+="longer":a+="shorter",a+=" than ",v?a+="' + "+p+" + '":a+=""+i,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var w=a;return a=_.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",d&&(a+=" else { "),a}});var si=D((px,cu)=>{"use strict";cu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,y,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i,!(v||typeof i=="number"))throw new Error(t+" must be number");var b=t=="maxProperties"?">":"<";a+="if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),a+=" Object.keys("+m+").length "+b+" "+p+") { ";var y=t,_=_||[];_.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",t=="maxProperties"?a+="more":a+="fewer",a+=" than ",v?a+="' + "+p+" + '":a+=""+i,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var w=a;return a=_.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",d&&(a+=" else { "),a}});var du=D((mx,uu)=>{"use strict";uu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i,!(v||typeof i=="number"))throw new Error(t+" must be number");a+="var division"+n+";if (",v&&(a+=" "+p+" !== undefined && ( typeof "+p+" != 'number' || "),a+=" (division"+n+" = "+m+" / "+p+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+n+" !== parseInt(division"+n+") ",a+=" ) ",v&&(a+=" ) "),a+=" ) { ";var b=b||[];b.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+p+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",v?a+="' + "+p:a+=""+p+"'"),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var y=a;return a=b.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",d&&(a+=" else { "),a}});var fu=D((vx,hu)=>{"use strict";hu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="errs__"+n,p=e.util.copy(e);p.level++;var b="valid"+p.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){p.schema=i,p.schemaPath=c,p.errSchemaPath=l,a+=" var "+v+" = errors; ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.createErrors=!1;var _;p.opts.allErrors&&(_=p.opts.allErrors,p.opts.allErrors=!1),a+=" "+e.validate(p)+" ",p.createErrors=!0,_&&(p.opts.allErrors=_),e.compositeRule=p.compositeRule=y,a+=" if ("+b+") { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var C=a;a=w.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+C+"]); ":a+=" validate.errors = ["+C+"]; return false; ":a+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(a+=" if (false) { ");return a}});var mu=D((gx,pu)=>{"use strict";pu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p="errs__"+n,b=e.util.copy(e),y="";b.level++;var _="valid"+b.level,w=b.baseId,C="prevValid"+n,I="passingSchemas"+n;a+="var "+p+" = errors , "+C+" = false , "+v+" = false , "+I+" = null; ";var O=e.compositeRule;e.compositeRule=b.compositeRule=!0;var k=i;if(k)for(var A,K=-1,J=k.length-1;K<J;)A=k[K+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(b.schema=A,b.schemaPath=c+"["+K+"]",b.errSchemaPath=l+"/"+K,a+=" "+e.validate(b)+" ",b.baseId=w):a+=" var "+_+" = true; ",K&&(a+=" if ("+_+" && "+C+") { "+v+" = false; "+I+" = ["+I+", "+K+"]; } else { ",y+="}"),a+=" if ("+_+") { "+v+" = "+C+" = true; "+I+" = "+K+"; }";return e.compositeRule=b.compositeRule=O,a+=""+y+"if (!"+v+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+I+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}});var gu=D((_x,vu)=>{"use strict";vu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;v?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+n):p=i;var b=v?"(new RegExp("+p+"))":e.usePattern(i);a+="if ( ",v&&(a+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),a+=" !"+b+".test("+m+") ) { ";var y=y||[];y.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { pattern: ",v?a+=""+p:a+=""+e.util.toQuotedString(i),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,v?a+="' + "+p+" + '":a+=""+e.util.escapeQuotes(i),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",v?a+="validate.schema"+c:a+=""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var _=a;return a=y.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+_+"]); ":a+=" validate.errors = ["+_+"]; return false; ":a+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",d&&(a+=" else { "),a}});var yu=D((yx,_u)=>{"use strict";_u.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="errs__"+n,p=e.util.copy(e),b="";p.level++;var y="valid"+p.level,_="key"+n,w="idx"+n,C=p.dataLevel=e.dataLevel+1,I="data"+C,O="dataProperties"+n,k=Object.keys(i||{}).filter(he),A=e.schema.patternProperties||{},K=Object.keys(A).filter(he),J=e.schema.additionalProperties,M=k.length||K.length,W=J===!1,B=typeof J=="object"&&Object.keys(J).length,V=e.opts.removeAdditional,j=W||B||V,L=e.opts.ownProperties,H=e.baseId,ye=e.schema.required;if(ye&&!(e.opts.$data&&ye.$data)&&ye.length<e.opts.loopRequired)var le=e.util.toHash(ye);function he(Rt){return Rt!=="__proto__"}if(a+="var "+v+" = errors;var "+y+" = true;",L&&(a+=" var "+O+" = undefined;"),j){if(L?a+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+O+".length; "+w+"++) { var "+_+" = "+O+"["+w+"]; ":a+=" for (var "+_+" in "+m+") { ",M){if(a+=" var isAdditional"+n+" = !(false ",k.length)if(k.length>8)a+=" || validate.schema"+c+".hasOwnProperty("+_+") ";else{var ie=k;if(ie)for(var Y,Ie=-1,Ve=ie.length-1;Ie<Ve;)Y=ie[Ie+=1],a+=" || "+_+" == "+e.util.toQuotedString(Y)+" "}if(K.length){var Ge=K;if(Ge)for(var me,Ne=-1,Le=Ge.length-1;Ne<Le;)me=Ge[Ne+=1],a+=" || "+e.usePattern(me)+".test("+_+") "}a+=" ); if (isAdditional"+n+") { "}if(V=="all")a+=" delete "+m+"["+_+"]; ";else{var Qe=e.errorPath,ir="' + "+_+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers)),W)if(V)a+=" delete "+m+"["+_+"]; ";else{a+=" "+y+" = false; ";var Ht=l;l=e.errSchemaPath+"/additionalProperties";var $e=$e||[];$e.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+ir+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var Oe=a;a=$e.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+Oe+"]); ":a+=" validate.errors = ["+Oe+"]; return false; ":a+=" var err = "+Oe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=Ht,d&&(a+=" break; ")}else if(B)if(V=="failing"){a+=" var "+v+" = errors; ";var Tr=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=J,p.schemaPath=e.schemaPath+".additionalProperties",p.errSchemaPath=e.errSchemaPath+"/additionalProperties",p.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers);var He=m+"["+_+"]";p.dataPathArr[C]=_;var ge=e.validate(p);p.baseId=H,e.util.varOccurences(ge,I)<2?a+=" "+e.util.varReplace(ge,I,He)+" ":a+=" var "+I+" = "+He+"; "+ge+" ",a+=" if (!"+y+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+_+"]; } ",e.compositeRule=p.compositeRule=Tr}else{p.schema=J,p.schemaPath=e.schemaPath+".additionalProperties",p.errSchemaPath=e.errSchemaPath+"/additionalProperties",p.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers);var He=m+"["+_+"]";p.dataPathArr[C]=_;var ge=e.validate(p);p.baseId=H,e.util.varOccurences(ge,I)<2?a+=" "+e.util.varReplace(ge,I,He)+" ":a+=" var "+I+" = "+He+"; "+ge+" ",d&&(a+=" if (!"+y+") break; ")}e.errorPath=Qe}M&&(a+=" } "),a+=" } ",d&&(a+=" if ("+y+") { ",b+="}")}var lr=e.opts.useDefaults&&!e.compositeRule;if(k.length){var Bt=k;if(Bt)for(var Y,Cr=-1,Ir=Bt.length-1;Cr<Ir;){Y=Bt[Cr+=1];var Ze=i[Y];if(e.opts.strictKeywords?typeof Ze=="object"&&Object.keys(Ze).length>0||Ze===!1:e.util.schemaHasRules(Ze,e.RULES.all)){var pt=e.util.getProperty(Y),He=m+pt,et=lr&&Ze.default!==void 0;p.schema=Ze,p.schemaPath=c+pt,p.errSchemaPath=l+"/"+e.util.escapeFragment(Y),p.errorPath=e.util.getPath(e.errorPath,Y,e.opts.jsonPointers),p.dataPathArr[C]=e.util.toQuotedString(Y);var ge=e.validate(p);if(p.baseId=H,e.util.varOccurences(ge,I)<2){ge=e.util.varReplace(ge,I,He);var Ke=He}else{var Ke=I;a+=" var "+I+" = "+He+"; "}if(et)a+=" "+ge+" ";else{if(le&&le[Y]){a+=" if ( "+Ke+" === undefined ",L&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Y)+"') "),a+=") { "+y+" = false; ";var Qe=e.errorPath,Ht=l,$t=e.util.escapeQuotes(Y);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Qe,Y,e.opts.jsonPointers)),l=e.errSchemaPath+"/required";var $e=$e||[];$e.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+$t+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+$t+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var Oe=a;a=$e.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+Oe+"]); ":a+=" validate.errors = ["+Oe+"]; return false; ":a+=" var err = "+Oe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=Ht,e.errorPath=Qe,a+=" } else { "}else d?(a+=" if ( "+Ke+" === undefined ",L&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Y)+"') "),a+=") { "+y+" = true; } else { "):(a+=" if ("+Ke+" !== undefined ",L&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Y)+"') "),a+=" ) { ");a+=" "+ge+" } "}}d&&(a+=" if ("+y+") { ",b+="}")}}if(K.length){var lt=K;if(lt)for(var me,Ws=-1,fo=lt.length-1;Ws<fo;){me=lt[Ws+=1];var Ze=A[me];if(e.opts.strictKeywords?typeof Ze=="object"&&Object.keys(Ze).length>0||Ze===!1:e.util.schemaHasRules(Ze,e.RULES.all)){p.schema=Ze,p.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(me),p.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(me),L?a+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+O+".length; "+w+"++) { var "+_+" = "+O+"["+w+"]; ":a+=" for (var "+_+" in "+m+") { ",a+=" if ("+e.usePattern(me)+".test("+_+")) { ",p.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers);var He=m+"["+_+"]";p.dataPathArr[C]=_;var ge=e.validate(p);p.baseId=H,e.util.varOccurences(ge,I)<2?a+=" "+e.util.varReplace(ge,I,He)+" ":a+=" var "+I+" = "+He+"; "+ge+" ",d&&(a+=" if (!"+y+") break; "),a+=" } ",d&&(a+=" else "+y+" = true; "),a+=" } ",d&&(a+=" if ("+y+") { ",b+="}")}}}return d&&(a+=" "+b+" if ("+v+" == errors) {"),a}});var Su=D((bx,bu)=>{"use strict";bu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="errs__"+n,p=e.util.copy(e),b="";p.level++;var y="valid"+p.level;if(a+="var "+v+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){p.schema=i,p.schemaPath=c,p.errSchemaPath=l;var _="key"+n,w="idx"+n,C="i"+n,I="' + "+_+" + '",O=p.dataLevel=e.dataLevel+1,k="data"+O,A="dataProperties"+n,K=e.opts.ownProperties,J=e.baseId;K&&(a+=" var "+A+" = undefined; "),K?a+=" "+A+" = "+A+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+A+".length; "+w+"++) { var "+_+" = "+A+"["+w+"]; ":a+=" for (var "+_+" in "+m+") { ",a+=" var startErrs"+n+" = errors; ";var M=_,W=e.compositeRule;e.compositeRule=p.compositeRule=!0;var B=e.validate(p);p.baseId=J,e.util.varOccurences(B,k)<2?a+=" "+e.util.varReplace(B,k,M)+" ":a+=" var "+k+" = "+M+"; "+B+" ",e.compositeRule=p.compositeRule=W,a+=" if (!"+y+") { for (var "+C+"=startErrs"+n+"; "+C+"<errors; "+C+"++) { vErrors["+C+"].propertyName = "+_+"; } var err = ",e.createErrors!==!1?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { propertyName: '"+I+"' } ",e.opts.messages!==!1&&(a+=" , message: 'property name \\'"+I+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),d&&(a+=" break; "),a+=" } }"}return d&&(a+=" "+b+" if ("+v+" == errors) {"),a}});var wu=D((Sx,xu)=>{"use strict";xu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p=e.opts.$data&&i&&i.$data,b;p?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",b="schema"+n):b=i;var y="schema"+n;if(!p)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var _=[],w=i;if(w)for(var C,I=-1,O=w.length-1;I<O;){C=w[I+=1];var k=e.schema.properties[C];k&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))||(_[_.length]=C)}}else var _=i;if(p||_.length){var A=e.errorPath,K=p||_.length>=e.opts.loopRequired,J=e.opts.ownProperties;if(d)if(a+=" var missing"+n+"; ",K){p||(a+=" var "+y+" = validate.schema"+c+"; ");var M="i"+n,W="schema"+n+"["+M+"]",B="' + "+W+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,W,e.opts.jsonPointers)),a+=" var "+v+" = true; ",p&&(a+=" if (schema"+n+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+n+")) "+v+" = false; else {"),a+=" for (var "+M+" = 0; "+M+" < "+y+".length; "+M+"++) { "+v+" = "+m+"["+y+"["+M+"]] !== undefined ",J&&(a+=" && Object.prototype.hasOwnProperty.call("+m+", "+y+"["+M+"]) "),a+="; if (!"+v+") break; } ",p&&(a+=" } "),a+=" if (!"+v+") { ";var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+B+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var j=a;a=V.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+j+"]); ":a+=" validate.errors = ["+j+"]; return false; ":a+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var L=_;if(L)for(var H,M=-1,ye=L.length-1;M<ye;){H=L[M+=1],M&&(a+=" || ");var le=e.util.getProperty(H),he=m+le;a+=" ( ( "+he+" === undefined ",J&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),a+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?H:le)+") ) "}a+=") { ";var W="missing"+n,B="' + "+W+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,W,!0):A+" + "+W);var V=V||[];V.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+B+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var j=a;a=V.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+j+"]); ":a+=" validate.errors = ["+j+"]; return false; ":a+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(K){p||(a+=" var "+y+" = validate.schema"+c+"; ");var M="i"+n,W="schema"+n+"["+M+"]",B="' + "+W+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,W,e.opts.jsonPointers)),p&&(a+=" if ("+y+" && !Array.isArray("+y+")) { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+B+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+y+" !== undefined) { "),a+=" for (var "+M+" = 0; "+M+" < "+y+".length; "+M+"++) { if ("+m+"["+y+"["+M+"]] === undefined ",J&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+y+"["+M+"]) "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+B+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",p&&(a+=" } ")}else{var ie=_;if(ie)for(var H,Y=-1,Ie=ie.length-1;Y<Ie;){H=ie[Y+=1];var le=e.util.getProperty(H),B=e.util.escapeQuotes(H),he=m+le;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,H,e.opts.jsonPointers)),a+=" if ( "+he+" === undefined ",J&&(a+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+B+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=A}else d&&(a+=" if (true) {");return a}});var Pu=D((xx,Eu)=>{"use strict";Eu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m="data"+(o||""),v="valid"+n,p=e.opts.$data&&i&&i.$data,b;if(p?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",b="schema"+n):b=i,(i||p)&&e.opts.uniqueItems!==!1){p&&(a+=" var "+v+"; if ("+b+" === false || "+b+" === undefined) "+v+" = true; else if (typeof "+b+" != 'boolean') "+v+" = false; else { "),a+=" var i = "+m+".length , "+v+" = true , j; if (i > 1) { ";var y=e.schema.items&&e.schema.items.type,_=Array.isArray(y);if(!y||y=="object"||y=="array"||_&&(y.indexOf("object")>=0||y.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+v+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var w="checkDataType"+(_?"s":"");a+=" if ("+e.util[w](y,"item",e.opts.strictNumbers,!0)+") continue; ",_&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",p&&(a+=" } "),a+=" if (!"+v+") { ";var C=C||[];C.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),a+=" } "):a+=" {} ";var I=a;a=C.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+I+"]); ":a+=" validate.errors = ["+I+"]; return false; ":a+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d&&(a+=" else { ")}else d&&(a+=" if (true) { ");return a}});var Tu=D((wx,Ru)=>{"use strict";Ru.exports={$ref:Lc(),allOf:Zc(),anyOf:Fc(),$comment:Hc(),const:Jc(),contains:Gc(),dependencies:Kc(),enum:Xc(),format:tu(),if:au(),items:nu(),maximum:ti(),minimum:ti(),maxItems:ri(),minItems:ri(),maxLength:ai(),minLength:ai(),maxProperties:si(),minProperties:si(),multipleOf:du(),not:fu(),oneOf:mu(),pattern:gu(),properties:yu(),propertyNames:Su(),required:wu(),uniqueItems:Pu(),validate:Xo()}});var Ou=D((Ex,Iu)=>{"use strict";var Cu=Tu(),ni=Kr().toHash;Iu.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"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],a=["number","integer","string","array","object","boolean","null"];return e.all=ni(t),e.types=ni(a),e.forEach(function(n){n.rules=n.rules.map(function(o){var i;if(typeof o=="object"){var c=Object.keys(o)[0];i=o[c],o=c,i.forEach(function(d){t.push(d),e.all[d]=!0})}t.push(o);var l=e.all[o]={keyword:o,code:Cu[o],implements:i};return l}),e.all.$comment={keyword:"$comment",code:Cu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ni(t.concat(s)),e.custom={},e}});var Nu=D((Px,Au)=>{"use strict";var ku=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Au.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var s=e[t].split("/"),a=r,n;for(n=1;n<s.length;n++)a=a[s[n]];for(n=0;n<ku.length;n++){var o=ku[n],i=a[o];i&&(a[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var Du=D((Rx,ju)=>{"use strict";var cg=wn().MissingRef;ju.exports=$u;function $u(r,e,t){var s=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 a=n(r).then(function(){var i=s._addSchema(r,void 0,e);return i.validate||o(i)});return t&&a.then(function(i){t(null,i)},t),a;function n(i){var c=i.$schema;return c&&!s.getSchema(c)?$u.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(l){if(l instanceof cg)return c(l);throw l}function c(l){var d=l.missingSchema;if(p(d))throw new Error("Schema "+d+" is loaded but "+l.missingRef+" cannot be resolved");var m=s._loadingSchemas[d];return m||(m=s._loadingSchemas[d]=s._opts.loadSchema(d),m.then(v,v)),m.then(function(b){if(!p(d))return n(b).then(function(){p(d)||s.addSchema(b,d,void 0,e)})}).then(function(){return o(i)});function v(){delete s._loadingSchemas[d]}function p(b){return s._refs[b]||s._schemas[b]}}}}});var Mu=D((Tx,zu)=>{"use strict";zu.exports=function(e,t,s){var a=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,m,v="data"+(o||""),p="valid"+n,b="errs__"+n,y=e.opts.$data&&i&&i.$data,_;y?(a+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",_="schema"+n):_=i;var w=this,C="definition"+n,I=w.definition,O="",k,A,K,J,M;if(y&&I.$data){M="keywordValidate"+n;var W=I.validateSchema;a+=" var "+C+" = RULES.custom['"+t+"'].definition; var "+M+" = "+C+".validate;"}else{if(J=e.useCustomRule(w,i,e.schema,e),!J)return;_="validate.schema"+c,M=J.code,k=I.compile,A=I.inline,K=I.macro}var B=M+".errors",V="i"+n,j="ruleErr"+n,L=I.async;if(L&&!e.async)throw new Error("async keyword in sync schema");if(A||K||(a+=""+B+" = null;"),a+="var "+b+" = errors;var "+p+";",y&&I.$data&&(O+="}",a+=" if ("+_+" === undefined) { "+p+" = true; } else { ",W&&(O+="}",a+=" "+p+" = "+C+".validateSchema("+_+"); if ("+p+") { ")),A)I.statements?a+=" "+J.validate+" ":a+=" "+p+" = "+J.validate+"; ";else if(K){var H=e.util.copy(e),O="";H.level++;var ye="valid"+H.level;H.schema=J.validate,H.schemaPath="";var le=e.compositeRule;e.compositeRule=H.compositeRule=!0;var he=e.validate(H).replace(/validate\.schema/g,M);e.compositeRule=H.compositeRule=le,a+=" "+he}else{var ie=ie||[];ie.push(a),a="",a+=" "+M+".call( ",e.opts.passContext?a+="this":a+="self",k||I.schema===!1?a+=" , "+v+" ":a+=" , "+_+" , "+v+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var Y=o?"data"+(o-1||""):"parentData",Ie=o?e.dataPathArr[o]:"parentDataProperty";a+=" , "+Y+" , "+Ie+" , rootData ) ";var Ve=a;a=ie.pop(),I.errors===!1?(a+=" "+p+" = ",L&&(a+="await "),a+=""+Ve+"; "):L?(B="customErrors"+n,a+=" var "+B+" = null; try { "+p+" = await "+Ve+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+B+" = e.errors; else throw e; } "):a+=" "+B+" = null; "+p+" = "+Ve+"; "}if(I.modifying&&(a+=" if ("+Y+") "+v+" = "+Y+"["+Ie+"];"),a+=""+O,I.valid)d&&(a+=" if (true) { ");else{a+=" if ( ",I.valid===void 0?(a+=" !",K?a+=""+ye:a+=""+p):a+=" "+!I.valid+" ",a+=") { ",m=w.keyword;var ie=ie||[];ie.push(a),a="";var ie=ie||[];ie.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+w.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ";var Ge=a;a=ie.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+Ge+"]); ":a+=" validate.errors = ["+Ge+"]; return false; ":a+=" var err = "+Ge+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var me=a;a=ie.pop(),A?I.errors?I.errors!="full"&&(a+=" for (var "+V+"="+b+"; "+V+"<errors; "+V+"++) { var "+j+" = vErrors["+V+"]; if ("+j+".dataPath === undefined) "+j+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+j+".schemaPath === undefined) { "+j+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(a+=" "+j+".schema = "+_+"; "+j+".data = "+v+"; "),a+=" } "):I.errors===!1?a+=" "+me+" ":(a+=" if ("+b+" == errors) { "+me+" } else { for (var "+V+"="+b+"; "+V+"<errors; "+V+"++) { var "+j+" = vErrors["+V+"]; if ("+j+".dataPath === undefined) "+j+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+j+".schemaPath === undefined) { "+j+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(a+=" "+j+".schema = "+_+"; "+j+".data = "+v+"; "),a+=" } } "):K?(a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+w.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; ")):I.errors===!1?a+=" "+me+" ":(a+=" if (Array.isArray("+B+")) { if (vErrors === null) vErrors = "+B+"; else vErrors = vErrors.concat("+B+"); errors = vErrors.length; for (var "+V+"="+b+"; "+V+"<errors; "+V+"++) { var "+j+" = vErrors["+V+"]; if ("+j+".dataPath === undefined) "+j+".dataPath = (dataPath || '') + "+e.errorPath+"; "+j+'.schemaPath = "'+l+'"; ',e.opts.verbose&&(a+=" "+j+".schema = "+_+"; "+j+".data = "+v+"; "),a+=" } } else { "+me+" } "),a+=" } ",d&&(a+=" else { ")}return a}});var oi=D((Cx,ug)=>{ug.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 Zu=D((Ix,qu)=>{"use strict";var Lu=oi();qu.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Lu.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Lu.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 Fu=D((Ox,Uu)=>{"use strict";var dg=/^[a-z_$][a-z0-9_$-]*$/i,hg=Mu(),fg=Zu();Uu.exports={add:pg,get:mg,remove:vg,validate:ii};function pg(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!dg.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var a=0;a<s.length;a++)o(r,s[a],e);else o(r,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[r]=t.all[r]=!0;function o(i,c,l){for(var d,m=0;m<t.length;m++){var v=t[m];if(v.type==c){d=v;break}}d||(d={type:c,rules:[]},t.push(d));var p={keyword:i,definition:l,custom:!0,code:hg,implements:l.implements};d.rules.push(p),t.custom[i]=p}return this}function mg(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function vg(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 s=e[t].rules,a=0;a<s.length;a++)if(s[a].keyword==r){s.splice(a,1);break}return this}function ii(r,e){ii.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(fg,!0);if(t(r))return!0;if(ii.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var Vu=D((kx,gg)=>{gg.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 An=D((Ax,Xu)=>{"use strict";var Bu=wc(),Yr=xn(),_g=Pc(),Ju=Bo(),yg=Yo(),bg=zc(),Sg=Ou(),Wu=Nu(),Gu=Kr();Xu.exports=ke;ke.prototype.validate=wg;ke.prototype.compile=Eg;ke.prototype.addSchema=Pg;ke.prototype.addMetaSchema=Rg;ke.prototype.validateSchema=Tg;ke.prototype.getSchema=Ig;ke.prototype.removeSchema=kg;ke.prototype.addFormat=Lg;ke.prototype.errorsText=Mg;ke.prototype._addSchema=Ag;ke.prototype._compile=Ng;ke.prototype.compileAsync=Du();var kn=Fu();ke.prototype.addKeyword=kn.add;ke.prototype.getKeyword=kn.get;ke.prototype.removeKeyword=kn.remove;ke.prototype.validateKeyword=kn.validate;var Qu=wn();ke.ValidationError=Qu.Validation;ke.MissingRefError=Qu.MissingRef;ke.$dataMetaSchema=Wu;var On="http://json-schema.org/draft-07/schema",Hu=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],xg=["/properties"];function ke(r){if(!(this instanceof ke))return new ke(r);r=this._opts=Gu.copy(r)||{},Hg(this),this._schemas={},this._refs={},this._fragments={},this._formats=bg(r.format),this._cache=r.cache||new _g,this._loadingSchemas={},this._compilations=[],this.RULES=Sg(),this._getId=$g(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=yg),this._metaOpts=Vg(this),r.formats&&Ug(this),r.keywords&&Fg(this),qg(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Zg(this)}function wg(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 s=this._addSchema(r);t=s.validate||this._compile(s)}var a=t(e);return t.$async!==!0&&(this.errors=t.errors),a}function Eg(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function Pg(r,e,t,s){if(Array.isArray(r)){for(var a=0;a<r.length;a++)this.addSchema(r[a],void 0,t,s);return this}var n=this._getId(r);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=Yr.normalizeId(e||n),Yu(this,e),this._schemas[e]=this._addSchema(r,t,s,!0),this}function Rg(r,e,t){return this.addSchema(r,e,t,!0),this}function Tg(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||Cg(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,r);if(!s&&e){var a="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(a);else throw new Error(a)}return s}function Cg(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema(On)?On:void 0,r._opts.defaultMeta}function Ig(r){var e=Ku(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Og(this,r)}}function Og(r,e){var t=Yr.schema.call(r,{schema:{}},e);if(t){var s=t.schema,a=t.root,n=t.baseId,o=Bu.call(r,s,a,void 0,n);return r._fragments[e]=new Ju({ref:e,fragment:!0,schema:s,root:a,baseId:n,validate:o}),o}}function Ku(r,e){return e=Yr.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function kg(r){if(r instanceof RegExp)return In(this,this._schemas,r),In(this,this._refs,r),this;switch(typeof r){case"undefined":return In(this,this._schemas),In(this,this._refs),this._cache.clear(),this;case"string":var e=Ku(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,s=t?t(r):r;this._cache.del(s);var a=this._getId(r);a&&(a=Yr.normalizeId(a),delete this._schemas[a],delete this._refs[a])}return this}function In(r,e,t){for(var s in e){var a=e[s];!a.meta&&(!t||t.test(s))&&(r._cache.del(a.cacheKey),delete e[s])}}function Ag(r,e,t,s){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var a=this._opts.serialize,n=a?a(r):r,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=Yr.normalizeId(this._getId(r));i&&s&&Yu(this,i);var c=this._opts.validateSchema!==!1&&!e,l;c&&!(l=i&&i==Yr.normalizeId(r.$schema))&&this.validateSchema(r,!0);var d=Yr.ids.call(this,r),m=new Ju({id:i,schema:r,localRefs:d,cacheKey:n,meta:t});return i[0]!="#"&&s&&(this._refs[i]=m),this._cache.put(n,m),c&&l&&this.validateSchema(r,!0),m}function Ng(r,e){if(r.compiling)return r.validate=a,a.schema=r.schema,a.errors=null,a.root=e||a,r.schema.$async===!0&&(a.$async=!0),a;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=Bu.call(this,r.schema,e,r.localRefs)}catch(n){throw delete r.validate,n}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=s,r.refs=s.refs,r.refVal=s.refVal,r.root=s.root,s;function a(){var n=r.validate,o=n.apply(this,arguments);return a.errors=n.errors,o}}function $g(r){switch(r.schemaId){case"auto":return zg;case"id":return jg;default:return Dg}}function jg(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function Dg(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function zg(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 Mg(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,a="",n=0;n<r.length;n++){var o=r[n];o&&(a+=s+o.dataPath+" "+o.message+t)}return a.slice(0,-t.length)}function Lg(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function qg(r){var e;if(r._opts.$data&&(e=Vu(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=oi();r._opts.$data&&(t=Wu(t,xg)),r.addMetaSchema(t,On,!0),r._refs["http://json-schema.org/schema"]=On}}function Zg(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 Ug(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function Fg(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function Yu(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Vg(r){for(var e=Gu.copy(r._opts),t=0;t<Hu.length;t++)delete e[Hu[t]];return e}function Hg(r){var e=r._opts.logger;if(e===!1)r.logger={log:li,warn:li,error:li};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 li(){}});var bd=D((ow,Zn)=>{"use strict";Zn.exports=y_;Zn.exports.format=_d;Zn.exports.parse=yd;var v_=/\B(?=(\d{3})+(?!\d))/g,g_=/(?:\.0*|(\.[^0]+)0+)$/,yr={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},__=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function y_(r,e){return typeof r=="string"?yd(r):typeof r=="number"?_d(r,e):null}function _d(r,e){if(!Number.isFinite(r))return null;var t=Math.abs(r),s=e&&e.thousandsSeparator||"",a=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=!!(e&&e.fixedDecimals),i=e&&e.unit||"";(!i||!yr[i.toLowerCase()])&&(t>=yr.pb?i="PB":t>=yr.tb?i="TB":t>=yr.gb?i="GB":t>=yr.mb?i="MB":t>=yr.kb?i="KB":i="B");var c=r/yr[i.toLowerCase()],l=c.toFixed(n);return o||(l=l.replace(g_,"$1")),s&&(l=l.split(".").map(function(d,m){return m===0?d.replace(v_,s):d}).join(".")),l+a+i}function yd(r){if(typeof r=="number"&&!isNaN(r))return r;if(typeof r!="string")return null;var e=__.exec(r),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(r,10),s="b"),isNaN(t)?null:Math.floor(yr[s]*t)}});var Ci=D(Ti=>{"use strict";var xd=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,b_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,wd=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,S_=/\\([\u000b\u0020-\u00ff])/g,x_=/([\\"])/g,Ed=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Ti.format=w_;Ti.parse=E_;function w_(r){if(!r||typeof r!="object")throw new TypeError("argument obj is required");var e=r.parameters,t=r.type;if(!t||!Ed.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var a,n=Object.keys(e).sort(),o=0;o<n.length;o++){if(a=n[o],!wd.test(a))throw new TypeError("invalid parameter name");s+="; "+a+"="+R_(e[a])}return s}function E_(r){if(!r)throw new TypeError("argument string is required");var e=typeof r=="object"?P_(r):r;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var t=e.indexOf(";"),s=t!==-1?e.slice(0,t).trim():e.trim();if(!Ed.test(s))throw new TypeError("invalid media type");var a=new T_(s.toLowerCase());if(t!==-1){var n,o,i;for(xd.lastIndex=t;o=xd.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,n=o[1].toLowerCase(),i=o[2],i.charCodeAt(0)===34&&(i=i.slice(1,-1),i.indexOf("\\")!==-1&&(i=i.replace(S_,"$1"))),a.parameters[n]=i}if(t!==e.length)throw new TypeError("invalid parameter format")}return a}function P_(r){var e;if(typeof r.getHeader=="function"?e=r.getHeader("content-type"):typeof r.headers=="object"&&(e=r.headers&&r.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function R_(r){var e=String(r);if(wd.test(e))return e;if(e.length>0&&!b_.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(x_,"\\$1")+'"'}function T_(r){this.parameters=Object.create(null),this.type=r}});var Ad=D((hw,kd)=>{kd.exports=Od;Od.sync=O_;var Cd=require("fs");function I_(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s<t.length;s++){var a=t[s].toLowerCase();if(a&&r.substr(-a.length).toLowerCase()===a)return!0}return!1}function Id(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:I_(e,t)}function Od(r,e,t){Cd.stat(r,function(s,a){t(s,s?!1:Id(a,r,e))})}function O_(r,e){return Id(Cd.statSync(r),r,e)}});var zd=D((fw,Dd)=>{Dd.exports=$d;$d.sync=k_;var Nd=require("fs");function $d(r,e,t){Nd.stat(r,function(s,a){t(s,s?!1:jd(a,e))})}function k_(r,e){return jd(Nd.statSync(r),e)}function jd(r,e){return r.isFile()&&A_(r,e)}function A_(r,e){var t=r.mode,s=r.uid,a=r.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),i=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),d=i|c,m=t&l||t&c&&a===o||t&i&&s===n||t&d&&n===0;return m}});var Ld=D((mw,Md)=>{var pw=require("fs"),Fn;process.platform==="win32"||global.TESTING_WINDOWS?Fn=Ad():Fn=zd();Md.exports=Ii;Ii.sync=N_;function Ii(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,a){Ii(r,e||{},function(n,o){n?a(n):s(o)})})}Fn(r,e||{},function(s,a){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,a=!1),t(s,a)})}function N_(r,e){try{return Fn.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Bd=D((vw,Hd)=>{var Ba=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qd=require("path"),$_=Ba?";":":",Zd=Ld(),Ud=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),Fd=(r,e)=>{let t=e.colon||$_,s=r.match(/\//)||Ba&&r.match(/\\/)?[""]:[...Ba?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],a=Ba?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Ba?a.split(t):[""];return Ba&&r.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:a}},Vd=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:s,pathExt:a,pathExtExe:n}=Fd(r,e),o=[],i=l=>new Promise((d,m)=>{if(l===s.length)return e.all&&o.length?d(o):m(Ud(r));let v=s[l],p=/^".*"$/.test(v)?v.slice(1,-1):v,b=qd.join(p,r),y=!p&&/^\.[\\\/]/.test(r)?r.slice(0,2)+b:b;d(c(y,l,0))}),c=(l,d,m)=>new Promise((v,p)=>{if(m===a.length)return v(i(d+1));let b=a[m];Zd(l+b,{pathExt:n},(y,_)=>{if(!y&&_)if(e.all)o.push(l+b);else return v(l+b);return v(c(l,d,m+1))})});return t?i(0).then(l=>t(null,l),t):i(0)},j_=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:s,pathExtExe:a}=Fd(r,e),n=[];for(let o=0;o<t.length;o++){let i=t[o],c=/^".*"$/.test(i)?i.slice(1,-1):i,l=qd.join(c,r),d=!c&&/^\.[\\\/]/.test(r)?r.slice(0,2)+l:l;for(let m=0;m<s.length;m++){let v=d+s[m];try{if(Zd.sync(v,{pathExt:a}))if(e.all)n.push(v);else return v}catch{}}}if(e.all&&n.length)return n;if(e.nothrow)return null;throw Ud(r)};Hd.exports=Vd;Vd.sync=j_});var Wd=D((gw,Oi)=>{"use strict";var Jd=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};Oi.exports=Jd;Oi.exports.default=Jd});var Yd=D((_w,Kd)=>{"use strict";var Gd=require("path"),D_=Bd(),z_=Wd();function Qd(r,e){let t=r.options.env||process.env,s=process.cwd(),a=r.options.cwd!=null,n=a&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(r.options.cwd)}catch{}let o;try{o=D_.sync(r.command,{path:t[z_({env:t})],pathExt:e?Gd.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return o&&(o=Gd.resolve(a?r.options.cwd:"",o)),o}function M_(r){return Qd(r)||Qd(r,!0)}Kd.exports=M_});var Xd=D((yw,Ai)=>{"use strict";var ki=/([()\][%!^"`<>&|;, *?])/g;function L_(r){return r=r.replace(ki,"^$1"),r}function q_(r,e){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(ki,"^$1"),e&&(r=r.replace(ki,"^$1")),r}Ai.exports.command=L_;Ai.exports.argument=q_});var th=D((bw,eh)=>{"use strict";eh.exports=/^#!(.*)/});var ah=D((Sw,rh)=>{"use strict";var Z_=th();rh.exports=(r="")=>{let e=r.match(Z_);if(!e)return null;let[t,s]=e[0].replace(/#! ?/,"").split(" "),a=t.split("/").pop();return a==="env"?s:s?`${a} ${s}`:a}});var nh=D((xw,sh)=>{"use strict";var Ni=require("fs"),U_=ah();function F_(r){let t=Buffer.alloc(150),s;try{s=Ni.openSync(r,"r"),Ni.readSync(s,t,0,150,0),Ni.closeSync(s)}catch{}return U_(t.toString())}sh.exports=F_});var ch=D((ww,lh)=>{"use strict";var V_=require("path"),oh=Yd(),ih=Xd(),H_=nh(),B_=process.platform==="win32",J_=/\.(?:com|exe)$/i,W_=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function G_(r){r.file=oh(r);let e=r.file&&H_(r.file);return e?(r.args.unshift(r.file),r.command=e,oh(r)):r.file}function Q_(r){if(!B_)return r;let e=G_(r),t=!J_.test(e);if(r.options.forceShell||t){let s=W_.test(e);r.command=V_.normalize(r.command),r.command=ih.command(r.command),r.args=r.args.map(n=>ih.argument(n,s));let a=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${a}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function K_(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let s={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?s:Q_(s)}lh.exports=K_});var hh=D((Ew,dh)=>{"use strict";var $i=process.platform==="win32";function ji(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function Y_(r,e){if(!$i)return;let t=r.emit;r.emit=function(s,a){if(s==="exit"){let n=uh(a,e);if(n)return t.call(r,"error",n)}return t.apply(r,arguments)}}function uh(r,e){return $i&&r===1&&!e.file?ji(e.original,"spawn"):null}function X_(r,e){return $i&&r===1&&!e.file?ji(e.original,"spawnSync"):null}dh.exports={hookChildProcess:Y_,verifyENOENT:uh,verifyENOENTSync:X_,notFoundError:ji}});var Mi=D((Pw,Ja)=>{"use strict";var fh=require("child_process"),Di=ch(),zi=hh();function ph(r,e,t){let s=Di(r,e,t),a=fh.spawn(s.command,s.args,s.options);return zi.hookChildProcess(a,s),a}function ey(r,e,t){let s=Di(r,e,t),a=fh.spawnSync(s.command,s.args,s.options);return a.error=a.error||zi.verifyENOENTSync(a.status,s),a}Ja.exports=ph;Ja.exports.spawn=ph;Ja.exports.sync=ey;Ja.exports._parse=Di;Ja.exports._enoent=zi});var yh=D(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.OpenAI=void 0;var qi=class{constructor(){dt(this,"name","openai")}async complete(e,t){var c,l,d,m;let s=e.messages.map(cy).flat(),a=e.tools.map(uy),n=await iy({model:t.model,temperature:t.temperature,input:s,instructions:fy(e.systemPrompt),tools:a.length>0?a:void 0,tool_choice:e.tools.length>0?"auto":void 0,parallel_tool_calls:!1},t),o={role:"assistant",content:[]};for(let v of n.output)if(v.type==="message"&&v.role==="assistant"){o.openaiId=v.id,o.openaiStatus=v.status;for(let p of v.content)p.type==="output_text"&&o.content.push({type:"text",text:p.text})}else v.type==="function_call"&&o.content.push(hy(v));let i={input:(l=(c=n.usage)==null?void 0:c.input_tokens)!=null?l:0,output:(m=(d=n.usage)==null?void 0:d.output_tokens)!=null?m:0};return{result:o,usage:i}}};Qn.OpenAI=qi;async function iy(r,e){var i,c,l,d,m;let s={"Content-Type":"application/json",Authorization:`Bearer ${process.env.OPENAI_API_KEY}`,"Copilot-Vision-Request":"true"},a={...r,tools:`${(c=(i=r.tools)==null?void 0:i.length)!=null?c:0} tools`};(l=e.debug)==null||l.call(e,"lowire:openai-responses")("Request:",JSON.stringify(a,null,2));let n=await fetch("https://api.openai.com/v1/responses",{method:"POST",headers:s,body:JSON.stringify(r)});if(!n.ok)throw(d=e.debug)==null||d.call(e,"lowire:openai-responses")("Response:",n.status),new Error(`API error: ${n.status} ${n.statusText} ${await n.text()}`);let o=await n.json();return(m=e.debug)==null||m.call(e,"lowire:openai-responses")("Response:",JSON.stringify(o,null,2)),o}function ly(r){if(r.type==="text")return{type:"input_text",text:r.text};if(r.type==="image")return{type:"input_image",image_url:`data:${r.mimeType};base64,${r.data}`,detail:"auto"};throw new Error(`Cannot convert content part of type ${r.type} to response content part`)}function cy(r){if(r.role==="user")return[{type:"message",role:"user",content:r.content}];if(r.role==="assistant"){let e=r.content.filter(a=>a.type==="text"),t=r.content.filter(a=>a.type==="tool_call"),s=[];if(e.length>0){let a={id:r.openaiId,status:r.openaiStatus,type:"message",role:"assistant",content:e.map(n=>({type:"output_text",text:n.text,annotations:[],logprobs:[]}))};s.push(a)}return r.toolError&&s.push({type:"message",role:"user",content:r.toolError}),s.push(...t.map(dy).flat()),s}throw new Error(`Unsupported message role: ${r.role}`)}function uy(r){var e;return{type:"function",name:r.name,description:(e=r.description)!=null?e:null,parameters:r.inputSchema,strict:null}}function dy(r){let e=[{type:"function_call",call_id:r.id,name:r.name,arguments:JSON.stringify(r.arguments),id:r.openaiId,status:r.openaiStatus}];return r.result&&e.push({type:"function_call_output",call_id:r.id,output:r.result.content.map(ly)}),e}function hy(r){return{type:"tool_call",name:r.name,arguments:JSON.parse(r.arguments),id:r.call_id,openaiId:r.id,openaiStatus:r.status}}var fy=r=>`
|
|
1
|
+
"use strict";var m0=Object.create;var to=Object.defineProperty;var _0=Object.getOwnPropertyDescriptor;var g0=Object.getOwnPropertyNames;var v0=Object.getPrototypeOf,y0=Object.prototype.hasOwnProperty;var w0=(t,e,r)=>e in t?to(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ro=(t,e)=>{for(var r in e)to(t,r,{get:e[r],enumerable:!0})},$s=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g0(e))!y0.call(t,o)&&o!==r&&to(t,o,{get:()=>e[o],enumerable:!(n=_0(e,o))||n.enumerable});return t},bd=(t,e,r)=>($s(t,e,"default"),r&&$s(r,e,"default")),xt=(t,e,r)=>(r=t!=null?m0(v0(t)):{},$s(e||!t||!t.__esModule?to(r,"default",{value:t,enumerable:!0}):r,t)),b0=t=>$s(to({},"__esModule",{value:!0}),t);var Ye=(t,e,r)=>w0(t,typeof e!="symbol"?e+"":e,r);var Po=$(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Eo=class{};te._CodeOrName=Eo;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Dr=class extends Eo{constructor(e){if(super(),!te.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}}};te.Name=Dr;var st=class extends Eo{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 Dr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};te._Code=st;te.nil=new st("");function Jm(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Fc(r,e[n]),r.push(t[++n]);return new st(r)}te._=Jm;var Vc=new st("+");function Km(t,...e){let r=[To(t[0])],n=0;for(;n<e.length;)r.push(Vc),Fc(r,e[n]),r.push(Vc,To(t[++n]));return N$(r),new st(r)}te.str=Km;function Fc(t,e){e instanceof st?t.push(...e._items):e instanceof Dr?t.push(e):t.push(M$(e))}te.addCodeArg=Fc;function N$(t){let e=1;for(;e<t.length-1;){if(t[e]===Vc){let r=j$(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function j$(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Dr||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 Dr))return`"${t}${e.slice(1)}`}function A$(t,e){return e.emptyStr()?t:t.emptyStr()?e:Km`${t}${e}`}te.strConcat=A$;function M$(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:To(Array.isArray(t)?t.join(","):t)}function Z$(t){return new st(To(t))}te.stringify=Z$;function To(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=To;function q$(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new st(`.${t}`):Jm`[${t}]`}te.getProperty=q$;function D$(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new st(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=D$;function L$(t){return new st(t.toString())}te.regexpCode=L$});var Wc=$(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.ValueScope=We.ValueScopeName=We.Scope=We.varKinds=We.UsedValueState=void 0;var Be=Po(),Hc=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ai;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ai||(We.UsedValueState=ai={}));We.varKinds={const:new Be.Name("const"),let:new Be.Name("let"),var:new Be.Name("var")};var ci=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Be.Name?e:this.name(e)}name(e){return new Be.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}}};We.Scope=ci;var ui=class extends Be.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Be._)`.${new Be.Name(r)}[${n}]`}};We.ValueScopeName=ui;var U$=(0,Be._)`\n`,Bc=class extends ci{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?U$:Be.nil}}get(){return this._scope}name(e){return new ui(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 o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}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,Be._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Be.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ai.Started);let l=r(u);if(l){let d=this.opts.es5?We.varKinds.var:We.varKinds.const;s=(0,Be._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o==null?void 0:o(u))s=(0,Be._)`${s}${l}${this.opts._n}`;else throw new Hc(u);c.set(u,ai.Completed)})}return s}};We.ValueScope=Bc});var F=$(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.or=H.and=H.not=H.CodeGen=H.operators=H.varKinds=H.ValueScopeName=H.ValueScope=H.Scope=H.Name=H.regexpCode=H.stringify=H.getProperty=H.nil=H.strConcat=H.str=H._=void 0;var Y=Po(),_t=Wc(),ar=Po();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return ar._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return ar.str}});Object.defineProperty(H,"strConcat",{enumerable:!0,get:function(){return ar.strConcat}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return ar.nil}});Object.defineProperty(H,"getProperty",{enumerable:!0,get:function(){return ar.getProperty}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return ar.stringify}});Object.defineProperty(H,"regexpCode",{enumerable:!0,get:function(){return ar.regexpCode}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return ar.Name}});var fi=Wc();Object.defineProperty(H,"Scope",{enumerable:!0,get:function(){return fi.Scope}});Object.defineProperty(H,"ValueScope",{enumerable:!0,get:function(){return fi.ValueScope}});Object.defineProperty(H,"ValueScopeName",{enumerable:!0,get:function(){return fi.ValueScopeName}});Object.defineProperty(H,"varKinds",{enumerable:!0,get:function(){return fi.varKinds}});H.operators={GT:new Y._Code(">"),GTE:new Y._Code(">="),LT:new Y._Code("<"),LTE:new Y._Code("<="),EQ:new Y._Code("==="),NEQ:new Y._Code("!=="),NOT:new Y._Code("!"),OR:new Y._Code("||"),AND:new Y._Code("&&"),ADD:new Y._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Jc=class extends Ft{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?_t.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Tn(this.rhs,e,r)),this}get names(){return this.rhs instanceof Y._CodeOrName?this.rhs.names:{}}},li=class extends Ft{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 Y.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Tn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Y.Name?{}:{...this.lhs.names};return pi(e,this.rhs)}},Kc=class extends li{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Gc=class extends Ft{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Yc=class extends Ft{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Xc=class extends Ft{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Qc=class extends Ft{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=Tn(this.code,e,r),this}get names(){return this.code instanceof Y._CodeOrName?this.code.names:{}}},Ro=class extends Ft{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,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(V$(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Vr(e,r.names),{})}},Ht=class extends Ro{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},eu=class extends Ro{},En=class extends Ht{};En.kind="else";var Lr=class t extends Ht{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 En(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Gm(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=Tn(this.condition,e,r),this}get names(){let e=super.names;return pi(e,this.condition),this.else&&Vr(e,this.else.names),e}};Lr.kind="if";var Ur=class extends Ht{};Ur.kind="for";var tu=class extends Ur{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=Tn(this.iteration,e,r),this}get names(){return Vr(super.names,this.iteration.names)}},ru=class extends Ur{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?_t.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=pi(super.names,this.from);return pi(e,this.to)}},di=class extends Ur{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}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=Tn(this.iterable,e,r),this}get names(){return Vr(super.names,this.iterable.names)}},Io=class extends Ht{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)}};Io.kind="func";var Oo=class extends Ro{render(e){return"return "+super.render(e)}};Oo.kind="return";var nu=class extends Ht{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,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Vr(e,this.catch.names),this.finally&&Vr(e,this.finally.names),e}},Co=class extends Ht{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Co.kind="catch";var No=class extends Ht{render(e){return"finally"+super.render(e)}};No.kind="finally";var ou=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=e,this._scope=new _t.Scope({parent:e}),this._nodes=[new eu]}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,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Jc(e,s,n)),s}const(e,r,n){return this._def(_t.varKinds.const,e,r,n)}let(e,r,n){return this._def(_t.varKinds.let,e,r,n)}var(e,r,n){return this._def(_t.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new li(e,r,n))}add(e,r){return this._leafNode(new Kc(e,H.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Y.nil&&this._leafNode(new Qc(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Y.addCodeArg)(r,o));return r.push("}"),new Y._Code(r)}if(e,r,n){if(this._blockNode(new Lr(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 Lr(e))}else(){return this._elseNode(new En)}endIf(){return this._endBlockNode(Lr,En)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new tu(e),r)}forRange(e,r,n,o,s=this.opts.es5?_t.varKinds.var:_t.varKinds.let){let i=this._scope.toName(e);return this._for(new ru(s,i,r,n),()=>o(i))}forOf(e,r,n,o=_t.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Y.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Y._)`${i}.length`,a=>{this.var(s,(0,Y._)`${i}[${a}]`),n(s)})}return this._for(new di("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?_t.varKinds.var:_t.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Y._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new di("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Ur)}label(e){return this._leafNode(new Gc(e))}break(e){return this._leafNode(new Yc(e))}return(e){let r=new Oo;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Oo)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new nu;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Co(s),r(s)}return n&&(this._currNode=o.finally=new No,this.code(n)),this._endBlockNode(Co,No)}throw(e){return this._leafNode(new Xc(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=Y.nil,n,o){return this._blockNode(new Io(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Io)}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 Lr))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}};H.CodeGen=ou;function Vr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function pi(t,e){return e instanceof Y._CodeOrName?Vr(t,e.names):t}function Tn(t,e,r){if(t instanceof Y.Name)return n(t);if(!o(t))return t;return new Y._Code(t._items.reduce((s,i)=>(i instanceof Y.Name&&(i=n(i)),i instanceof Y._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof Y._Code&&s._items.some(i=>i instanceof Y.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function V$(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Gm(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Y._)`!${su(t)}`}H.not=Gm;var F$=Ym(H.operators.AND);function H$(...t){return t.reduce(F$)}H.and=H$;var B$=Ym(H.operators.OR);function W$(...t){return t.reduce(B$)}H.or=W$;function Ym(t){return(e,r)=>e===Y.nil?r:r===Y.nil?e:(0,Y._)`${su(e)} ${t} ${su(r)}`}function su(t){return t instanceof Y.Name?t:(0,Y._)`(${t})`}});var re=$(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var ie=F(),J$=Po();function K$(t){let e={};for(let r of t)e[r]=!0;return e}B.toHash=K$;function G$(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(e_(t,e),!t_(e,t.self.RULES.all))}B.alwaysValidSchema=G$;function e_(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||o_(t,`unknown keyword: "${s}"`)}B.checkUnknownRules=e_;function t_(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}B.schemaHasRules=t_;function Y$(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}B.schemaHasRulesButRef=Y$;function X$({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ie._)`${r}`}return(0,ie._)`${t}${e}${(0,ie.getProperty)(n)}`}B.schemaRefOrVal=X$;function Q$(t){return r_(decodeURIComponent(t))}B.unescapeFragment=Q$;function ek(t){return encodeURIComponent(au(t))}B.escapeFragment=ek;function au(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=au;function r_(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=r_;function tk(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}B.eachItem=tk;function Xm({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof ie.Name?(s instanceof ie.Name?t(o,s,i):e(o,s,i),i):s instanceof ie.Name?(e(o,i,s),s):r(s,i);return a===ie.Name&&!(c instanceof ie.Name)?n(o,c):c}}B.mergeEvaluated={props:Xm({mergeNames:(t,e,r)=>t.if((0,ie._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ie._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ie._)`${r} || {}`).code((0,ie._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ie._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ie._)`${r} || {}`),cu(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:n_}),items:Xm({mergeNames:(t,e,r)=>t.if((0,ie._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ie._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ie._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ie._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function n_(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ie._)`{}`);return e!==void 0&&cu(t,r,e),r}B.evaluatedPropsToName=n_;function cu(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ie._)`${e}${(0,ie.getProperty)(n)}`,!0))}B.setEvaluated=cu;var Qm={};function rk(t,e){return t.scopeValue("func",{ref:e,code:Qm[e.code]||(Qm[e.code]=new J$._Code(e.code))})}B.useFunc=rk;var iu;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(iu||(B.Type=iu={}));function nk(t,e,r){if(t instanceof ie.Name){let n=e===iu.Num;return r?n?(0,ie._)`"[" + ${t} + "]"`:(0,ie._)`"['" + ${t} + "']"`:n?(0,ie._)`"/" + ${t}`:(0,ie._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ie.getProperty)(t).toString():"/"+au(t)}B.getErrorPath=nk;function o_(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}B.checkStrictMode=o_});var Bt=$(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});var Ne=F(),ok={data:new Ne.Name("data"),valCxt:new Ne.Name("valCxt"),instancePath:new Ne.Name("instancePath"),parentData:new Ne.Name("parentData"),parentDataProperty:new Ne.Name("parentDataProperty"),rootData:new Ne.Name("rootData"),dynamicAnchors:new Ne.Name("dynamicAnchors"),vErrors:new Ne.Name("vErrors"),errors:new Ne.Name("errors"),this:new Ne.Name("this"),self:new Ne.Name("self"),scope:new Ne.Name("scope"),json:new Ne.Name("json"),jsonPos:new Ne.Name("jsonPos"),jsonLen:new Ne.Name("jsonLen"),jsonPart:new Ne.Name("jsonPart")};uu.default=ok});var jo=$(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.extendErrors=je.resetErrorsCount=je.reportExtraError=je.reportError=je.keyword$DataError=je.keywordError=void 0;var Q=F(),hi=re(),qe=Bt();je.keywordError={message:({keyword:t})=>(0,Q.str)`must pass "${t}" keyword validation`};je.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Q.str)`"${t}" keyword must be ${e} ($data)`:(0,Q.str)`"${t}" keyword is invalid ($data)`};function sk(t,e=je.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=a_(t,e,r);(n!=null?n:i||a)?s_(s,c):i_(o,(0,Q._)`[${c}]`)}je.reportError=sk;function ik(t,e=je.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=a_(t,e,r);s_(o,a),s||i||i_(n,qe.default.vErrors)}je.reportExtraError=ik;function ak(t,e){t.assign(qe.default.errors,e),t.if((0,Q._)`${qe.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Q._)`${qe.default.vErrors}.length`,e),()=>t.assign(qe.default.vErrors,null)))}je.resetErrorsCount=ak;function ck({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,qe.default.errors,a=>{t.const(i,(0,Q._)`${qe.default.vErrors}[${a}]`),t.if((0,Q._)`${i}.instancePath === undefined`,()=>t.assign((0,Q._)`${i}.instancePath`,(0,Q.strConcat)(qe.default.instancePath,s.errorPath))),t.assign((0,Q._)`${i}.schemaPath`,(0,Q.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,Q._)`${i}.schema`,r),t.assign((0,Q._)`${i}.data`,n))})}je.extendErrors=ck;function s_(t,e){let r=t.const("err",e);t.if((0,Q._)`${qe.default.vErrors} === null`,()=>t.assign(qe.default.vErrors,(0,Q._)`[${r}]`),(0,Q._)`${qe.default.vErrors}.push(${r})`),t.code((0,Q._)`${qe.default.errors}++`)}function i_(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Q._)`new ${t.ValidationError}(${e})`):(r.assign((0,Q._)`${n}.errors`,e),r.return(!1))}var Fr={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function a_(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Q._)`{}`:uk(t,e,r)}function uk(t,e,r={}){let{gen:n,it:o}=t,s=[lk(o,r),dk(t,r)];return pk(t,e,s),n.object(...s)}function lk({errorPath:t},{instancePath:e}){let r=e?(0,Q.str)`${t}${(0,hi.getErrorPath)(e,hi.Type.Str)}`:t;return[qe.default.instancePath,(0,Q.strConcat)(qe.default.instancePath,r)]}function dk({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Q.str)`${e}/${t}`;return r&&(o=(0,Q.str)`${o}${(0,hi.getErrorPath)(r,hi.Type.Str)}`),[Fr.schemaPath,o]}function pk(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Fr.keyword,o],[Fr.params,typeof e=="function"?e(t):e||(0,Q._)`{}`]),c.messages&&n.push([Fr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Fr.schema,i],[Fr.parentSchema,(0,Q._)`${l}${d}`],[qe.default.data,s]),u&&n.push([Fr.propertyName,u])}});var u_=$(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.boolOrEmptySchema=Pn.topBoolOrEmptySchema=void 0;var fk=jo(),hk=F(),mk=Bt(),_k={message:"boolean schema is false"};function gk(t){let{gen:e,schema:r,validateName:n}=t;r===!1?c_(t,!1):typeof r=="object"&&r.$async===!0?e.return(mk.default.data):(e.assign((0,hk._)`${n}.errors`,null),e.return(!0))}Pn.topBoolOrEmptySchema=gk;function vk(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),c_(t)):r.var(e,!0)}Pn.boolOrEmptySchema=vk;function c_(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,fk.reportError)(o,_k,void 0,e)}});var lu=$(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.getRules=Rn.isJSONType=void 0;var yk=["string","number","integer","boolean","null","object","array"],wk=new Set(yk);function bk(t){return typeof t=="string"&&wk.has(t)}Rn.isJSONType=bk;function xk(){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:{}}}Rn.getRules=xk});var du=$(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.shouldUseRule=cr.shouldUseGroup=cr.schemaHasRulesForType=void 0;function $k({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&l_(t,n)}cr.schemaHasRulesForType=$k;function l_(t,e){return e.rules.some(r=>d_(t,r))}cr.shouldUseGroup=l_;function d_(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))}cr.shouldUseRule=d_});var Ao=$(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.reportTypeError=Ae.checkDataTypes=Ae.checkDataType=Ae.coerceAndCheckDataType=Ae.getJSONTypes=Ae.getSchemaTypes=Ae.DataType=void 0;var kk=lu(),Sk=du(),zk=jo(),U=F(),p_=re(),In;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(In||(Ae.DataType=In={}));function Ek(t){let e=f_(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}Ae.getSchemaTypes=Ek;function f_(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(kk.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ae.getJSONTypes=f_;function Tk(t,e){let{gen:r,data:n,opts:o}=t,s=Pk(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,Sk.schemaHasRulesForType)(t,e[0]));if(i){let a=fu(e,n,o.strictNumbers,In.Wrong);r.if(a,()=>{s.length?Rk(t,e,s):hu(t)})}return i}Ae.coerceAndCheckDataType=Tk;var h_=new Set(["string","number","integer","boolean","null"]);function Pk(t,e){return e?t.filter(r=>h_.has(r)||e==="array"&&r==="array"):[]}function Rk(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,U._)`typeof ${o}`),a=n.let("coerced",(0,U._)`undefined`);s.coerceTypes==="array"&&n.if((0,U._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,U._)`${o}[0]`).assign(i,(0,U._)`typeof ${o}`).if(fu(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,U._)`${a} !== undefined`);for(let u of r)(h_.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),hu(t),n.endIf(),n.if((0,U._)`${a} !== undefined`,()=>{n.assign(o,a),Ik(t,a)});function c(u){switch(u){case"string":n.elseIf((0,U._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,U._)`"" + ${o}`).elseIf((0,U._)`${o} === null`).assign(a,(0,U._)`""`);return;case"number":n.elseIf((0,U._)`${i} == "boolean" || ${o} === null
|
|
3
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,U._)`+${o}`);return;case"integer":n.elseIf((0,U._)`${i} === "boolean" || ${o} === null
|
|
4
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,U._)`+${o}`);return;case"boolean":n.elseIf((0,U._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,U._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,U._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,U._)`${i} === "string" || ${i} === "number"
|
|
5
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,U._)`[${o}]`)}}}function Ik({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,U._)`${e} !== undefined`,()=>t.assign((0,U._)`${e}[${r}]`,n))}function pu(t,e,r,n=In.Correct){let o=n===In.Correct?U.operators.EQ:U.operators.NEQ,s;switch(t){case"null":return(0,U._)`${e} ${o} null`;case"array":s=(0,U._)`Array.isArray(${e})`;break;case"object":s=(0,U._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,U._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,U._)`typeof ${e} ${o} ${t}`}return n===In.Correct?s:(0,U.not)(s);function i(a=U.nil){return(0,U.and)((0,U._)`typeof ${e} == "number"`,a,r?(0,U._)`isFinite(${e})`:U.nil)}}Ae.checkDataType=pu;function fu(t,e,r,n){if(t.length===1)return pu(t[0],e,r,n);let o,s=(0,p_.toHash)(t);if(s.array&&s.object){let i=(0,U._)`typeof ${e} != "object"`;o=s.null?i:(0,U._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=U.nil;s.number&&delete s.integer;for(let i in s)o=(0,U.and)(o,pu(i,e,r,n));return o}Ae.checkDataTypes=fu;var Ok={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,U._)`{type: ${t}}`:(0,U._)`{type: ${e}}`};function hu(t){let e=Ck(t);(0,zk.reportError)(e,Ok)}Ae.reportTypeError=hu;function Ck(t){let{gen:e,data:r,schema:n}=t,o=(0,p_.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var __=$(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.assignDefaults=void 0;var On=F(),Nk=re();function jk(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)m_(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>m_(t,s,o.default))}mi.assignDefaults=jk;function m_(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,On._)`${s}${(0,On.getProperty)(e)}`;if(o){(0,Nk.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,On._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,On._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,On._)`${a} = ${(0,On.stringify)(r)}`)}});var it=$(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.validateUnion=se.validateArray=se.usePattern=se.callValidateCode=se.schemaProperties=se.allSchemaProperties=se.noPropertyInData=se.propertyInData=se.isOwnProperty=se.hasPropFunc=se.reportMissingProp=se.checkMissingProp=se.checkReportMissingProp=void 0;var pe=F(),mu=re(),ur=Bt(),Ak=re();function Mk(t,e){let{gen:r,data:n,it:o}=t;r.if(gu(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,pe._)`${e}`},!0),t.error()})}se.checkReportMissingProp=Mk;function Zk({gen:t,data:e,it:{opts:r}},n,o){return(0,pe.or)(...n.map(s=>(0,pe.and)(gu(t,e,s,r.ownProperties),(0,pe._)`${o} = ${s}`)))}se.checkMissingProp=Zk;function qk(t,e){t.setParams({missingProperty:e},!0),t.error()}se.reportMissingProp=qk;function g_(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,pe._)`Object.prototype.hasOwnProperty`})}se.hasPropFunc=g_;function _u(t,e,r){return(0,pe._)`${g_(t)}.call(${e}, ${r})`}se.isOwnProperty=_u;function Dk(t,e,r,n){let o=(0,pe._)`${e}${(0,pe.getProperty)(r)} !== undefined`;return n?(0,pe._)`${o} && ${_u(t,e,r)}`:o}se.propertyInData=Dk;function gu(t,e,r,n){let o=(0,pe._)`${e}${(0,pe.getProperty)(r)} === undefined`;return n?(0,pe.or)(o,(0,pe.not)(_u(t,e,r))):o}se.noPropertyInData=gu;function v_(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}se.allSchemaProperties=v_;function Lk(t,e){return v_(e).filter(r=>!(0,mu.alwaysValidSchema)(t,e[r]))}se.schemaProperties=Lk;function Uk({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,pe._)`${t}, ${e}, ${n}${o}`:e,d=[[ur.default.instancePath,(0,pe.strConcat)(ur.default.instancePath,s)],[ur.default.parentData,i.parentData],[ur.default.parentDataProperty,i.parentDataProperty],[ur.default.rootData,ur.default.rootData]];i.opts.dynamicRef&&d.push([ur.default.dynamicAnchors,ur.default.dynamicAnchors]);let p=(0,pe._)`${l}, ${r.object(...d)}`;return c!==pe.nil?(0,pe._)`${a}.call(${c}, ${p})`:(0,pe._)`${a}(${p})`}se.callValidateCode=Uk;var Vk=(0,pe._)`new RegExp`;function Fk({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,pe._)`${o.code==="new RegExp"?Vk:(0,Ak.useFunc)(t,o)}(${r}, ${n})`})}se.usePattern=Fk;function Hk(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,pe._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:mu.Type.Num},s),e.if((0,pe.not)(s),a)})}}se.validateArray=Hk;function Bk(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,mu.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,pe._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,pe.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}se.validateUnion=Bk});var b_=$(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.validateKeywordUsage=Pt.validSchemaType=Pt.funcKeywordCode=Pt.macroKeywordCode=void 0;var De=F(),Hr=Bt(),Wk=it(),Jk=jo();function Kk(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=w_(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Pt.macroKeywordCode=Kk;function Gk(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;Xk(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=w_(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)v(),e.modifying&&y_(t),m(()=>t.error());else{let _=e.async?f():g();e.modifying&&y_(t),m(()=>Yk(t,_))}}function f(){let _=n.let("ruleErrs",null);return n.try(()=>v((0,De._)`await `),w=>n.assign(d,!1).if((0,De._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,De._)`${w}.errors`),()=>n.throw(w))),_}function g(){let _=(0,De._)`${l}.errors`;return n.assign(_,null),v(De.nil),_}function v(_=e.async?(0,De._)`await `:De.nil){let w=c.opts.passContext?Hr.default.this:Hr.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,De._)`${_}${(0,Wk.callValidateCode)(t,l,w,b)}`,e.modifying)}function m(_){var w;n.if((0,De.not)((w=e.valid)!==null&&w!==void 0?w:d),_)}}Pt.funcKeywordCode=Gk;function y_(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,De._)`${n.parentData}[${n.parentDataProperty}]`))}function Yk(t,e){let{gen:r}=t;r.if((0,De._)`Array.isArray(${e})`,()=>{r.assign(Hr.default.vErrors,(0,De._)`${Hr.default.vErrors} === null ? ${e} : ${Hr.default.vErrors}.concat(${e})`).assign(Hr.default.errors,(0,De._)`${Hr.default.vErrors}.length`),(0,Jk.extendErrors)(t)},()=>t.error())}function Xk({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function w_(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,De.stringify)(r)})}function Qk(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=="undefined")}Pt.validSchemaType=Qk;function eS({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i!=null&&i.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Pt.validateKeywordUsage=eS});var $_=$(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendSubschemaMode=lr.extendSubschemaData=lr.getSubschema=void 0;var Rt=F(),x_=re();function tS(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Rt._)`${t.schemaPath}${(0,Rt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Rt._)`${t.schemaPath}${(0,Rt.getProperty)(e)}${(0,Rt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,x_.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}lr.getSubschema=tS;function rS(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Rt._)`${e.data}${(0,Rt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Rt.str)`${u}${(0,x_.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Rt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Rt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}lr.extendSubschemaData=rS;function nS(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}lr.extendSubschemaMode=nS});var vu=$((hA,k_)=>{"use strict";k_.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,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))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(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var z_=$((mA,S_)=>{"use strict";var dr=S_.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};_i(e,n,o,t,"",t)};dr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};dr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};dr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};dr.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 _i(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in dr.arrayKeywords)for(var p=0;p<d.length;p++)_i(t,e,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in dr.propsKeywords){if(d&&typeof d=="object")for(var f in d)_i(t,e,r,d[f],o+"/"+l+"/"+oS(f),s,o,l,n,f)}else(l in dr.keywords||t.allKeys&&!(l in dr.skipKeywords))&&_i(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function oS(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Mo=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.getSchemaRefs=Je.resolveUrl=Je.normalizeId=Je._getFullPath=Je.getFullPath=Je.inlineRef=void 0;var sS=re(),iS=vu(),aS=z_(),cS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function uS(t,e=!0){return typeof t=="boolean"?!0:e===!0?!yu(t):e?E_(t)<=e:!1}Je.inlineRef=uS;var lS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function yu(t){for(let e in t){if(lS.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(yu)||typeof r=="object"&&yu(r))return!0}return!1}function E_(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!cS.has(r)&&(typeof t[r]=="object"&&(0,sS.eachItem)(t[r],n=>e+=E_(n)),e===1/0))return 1/0}return e}function T_(t,e="",r){r!==!1&&(e=Cn(e));let n=t.parse(e);return P_(t,n)}Je.getFullPath=T_;function P_(t,e){return t.serialize(e).split("#")[0]+"#"}Je._getFullPath=P_;var dS=/#\/?$/;function Cn(t){return t?t.replace(dS,""):""}Je.normalizeId=Cn;function pS(t,e,r){return r=Cn(r),t.resolve(e,r)}Je.resolveUrl=pS;var fS=/^[a-z_][-a-z0-9._]*$/i;function hS(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Cn(t[r]||e),s={"":o},i=T_(n,o,!1),a={},c=new Set;return aS(t,{allKeys:!0},(d,p,f,g)=>{if(g===void 0)return;let v=i+p,m=s[g];typeof d[r]=="string"&&(m=_.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=m;function _(b){let E=this.opts.uriResolver.resolve;if(b=Cn(m?E(m,b):b),c.has(b))throw l(b);c.add(b);let P=this.refs[b];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,b):b!==Cn(v)&&(b[0]==="#"?(u(d,a[b],b),a[b]=d):this.refs[b]=v),b}function w(b){if(typeof b=="string"){if(!fS.test(b))throw new Error(`invalid anchor "${b}"`);_.call(this,`#${b}`)}}}),a;function u(d,p,f){if(p!==void 0&&!iS(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Je.getSchemaRefs=hS});var Do=$(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.getData=pr.KeywordCxt=pr.validateFunctionCode=void 0;var N_=u_(),R_=Ao(),bu=du(),gi=Ao(),mS=__(),qo=b_(),wu=$_(),j=F(),D=Bt(),_S=Mo(),Wt=re(),Zo=jo();function gS(t){if(M_(t)&&(Z_(t),A_(t))){wS(t);return}j_(t,()=>(0,N_.topBoolOrEmptySchema)(t))}pr.validateFunctionCode=gS;function j_({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,j._)`${D.default.data}, ${D.default.valCxt}`,n.$async,()=>{t.code((0,j._)`"use strict"; ${I_(r,o)}`),yS(t,o),t.code(s)}):t.func(e,(0,j._)`${D.default.data}, ${vS(o)}`,n.$async,()=>t.code(I_(r,o)).code(s))}function vS(t){return(0,j._)`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${t.dynamicRef?(0,j._)`, ${D.default.dynamicAnchors}={}`:j.nil}}={}`}function yS(t,e){t.if(D.default.valCxt,()=>{t.var(D.default.instancePath,(0,j._)`${D.default.valCxt}.${D.default.instancePath}`),t.var(D.default.parentData,(0,j._)`${D.default.valCxt}.${D.default.parentData}`),t.var(D.default.parentDataProperty,(0,j._)`${D.default.valCxt}.${D.default.parentDataProperty}`),t.var(D.default.rootData,(0,j._)`${D.default.valCxt}.${D.default.rootData}`),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,j._)`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{t.var(D.default.instancePath,(0,j._)`""`),t.var(D.default.parentData,(0,j._)`undefined`),t.var(D.default.parentDataProperty,(0,j._)`undefined`),t.var(D.default.rootData,D.default.data),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,j._)`{}`)})}function wS(t){let{schema:e,opts:r,gen:n}=t;j_(t,()=>{r.$comment&&e.$comment&&D_(t),SS(t),n.let(D.default.vErrors,null),n.let(D.default.errors,0),r.unevaluated&&bS(t),q_(t),TS(t)})}function bS(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,j._)`${r}.evaluated`),e.if((0,j._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,j._)`${t.evaluated}.props`,(0,j._)`undefined`)),e.if((0,j._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,j._)`${t.evaluated}.items`,(0,j._)`undefined`))}function I_(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,j._)`/*# sourceURL=${r} */`:j.nil}function xS(t,e){if(M_(t)&&(Z_(t),A_(t))){$S(t,e);return}(0,N_.boolOrEmptySchema)(t,e)}function A_({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 M_(t){return typeof t.schema!="boolean"}function $S(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&D_(t),zS(t),ES(t);let s=n.const("_errs",D.default.errors);q_(t,s),n.var(e,(0,j._)`${s} === ${D.default.errors}`)}function Z_(t){(0,Wt.checkUnknownRules)(t),kS(t)}function q_(t,e){if(t.opts.jtd)return O_(t,[],!1,e);let r=(0,R_.getSchemaTypes)(t.schema),n=(0,R_.coerceAndCheckDataType)(t,r);O_(t,r,!n,e)}function kS(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Wt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function SS(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Wt.checkStrictMode)(t,"default is ignored in the schema root")}function zS(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,_S.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function ES(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function D_({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,j._)`${D.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,j.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,j._)`${D.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function TS(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,j._)`${D.default.errors} === 0`,()=>e.return(D.default.data),()=>e.throw((0,j._)`new ${o}(${D.default.vErrors})`)):(e.assign((0,j._)`${n}.errors`,D.default.vErrors),s.unevaluated&&PS(t),e.return((0,j._)`${D.default.errors} === 0`))}function PS({gen:t,evaluated:e,props:r,items:n}){r instanceof j.Name&&t.assign((0,j._)`${e}.props`,r),n instanceof j.Name&&t.assign((0,j._)`${e}.items`,n)}function O_(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Wt.schemaHasRulesButRef)(s,l))){o.block(()=>U_(t,"$ref",l.all.$ref.definition));return}c.jtd||RS(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,bu.shouldUseGroup)(s,p)&&(p.type?(o.if((0,gi.checkDataType)(p.type,i,c.strictNumbers)),C_(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,gi.reportTypeError)(t)),o.endIf()):C_(t,p),a||o.if((0,j._)`${D.default.errors} === ${n||0}`))}}function C_(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,mS.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,bu.shouldUseRule)(n,s)&&U_(t,s.keyword,s.definition,e.type)})}function RS(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IS(t,e),t.opts.allowUnionTypes||OS(t,e),CS(t,t.dataTypes))}function IS(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{L_(t.dataTypes,r)||xu(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),jS(t,e)}}function OS(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&xu(t,"use allowUnionTypes to allow union type keyword")}function CS(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,bu.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>NS(e,i))&&xu(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function NS(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function L_(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function jS(t,e){let r=[];for(let n of t.dataTypes)L_(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function xu(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Wt.checkStrictMode)(t,e,t.opts.strictTypes)}var vi=class{constructor(e,r,n){if((0,qo.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,Wt.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",V_(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qo.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",D.default.errors))}result(e,r,n){this.failResult((0,j.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,j.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,j._)`${r} !== undefined && (${(0,j.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?Zo.reportExtraError:Zo.reportError)(this,this.def.error,r)}$dataError(){(0,Zo.reportError)(this,this.def.$dataError||Zo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Zo.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=j.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=j.nil,r=j.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,j.or)((0,j._)`${o} === undefined`,r)),e!==j.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==j.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,j.or)(i(),a());function i(){if(n.length){if(!(r instanceof j.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,j._)`${(0,gi.checkDataTypes)(c,r,s.opts.strictNumbers,gi.DataType.Wrong)}`}return j.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,j._)`!${c}(${r})`}return j.nil}}subschema(e,r){let n=(0,wu.getSubschema)(this.it,e);(0,wu.extendSubschemaData)(n,this.it,e),(0,wu.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return xS(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Wt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Wt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,j.Name)),!0}};pr.KeywordCxt=vi;function U_(t,e,r,n){let o=new vi(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,qo.funcKeywordCode)(o,r):"macro"in r?(0,qo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,qo.funcKeywordCode)(o,r)}var AS=/^\/(?:[^~]|~0|~1)*$/,MS=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function V_(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return D.default.rootData;if(t[0]==="/"){if(!AS.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=D.default.rootData}else{let u=MS.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,j._)`${s}${(0,j.getProperty)((0,Wt.unescapeJsonPointer)(u))}`,i=(0,j._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}pr.getData=V_});var yi=$(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});var $u=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ku.default=$u});var Lo=$(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});var Su=Mo(),zu=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Su.resolveUrl)(e,r,n),this.missingSchema=(0,Su.normalizeId)((0,Su.getFullPath)(e,this.missingRef))}};Eu.default=zu});var bi=$(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.resolveSchema=at.getCompilingSchema=at.resolveRef=at.compileSchema=at.SchemaEnv=void 0;var gt=F(),ZS=yi(),Br=Bt(),vt=Mo(),F_=re(),qS=Do(),Nn=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,vt.normalizeId)(n==null?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n==null?void 0:n.$async,this.refs={}}};at.SchemaEnv=Nn;function Pu(t){let e=H_.call(this,t);if(e)return e;let r=(0,vt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new gt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:ZS.default,code:(0,gt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Br.default.data,parentData:Br.default.parentData,parentDataProperty:Br.default.parentDataProperty,dataNames:[Br.default.data],dataPathArr:[gt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,gt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:gt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,gt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,qS.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Br.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Br.default.self}`,`${Br.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:v}=u;f.evaluated={props:g instanceof gt.Name?void 0:g,items:v instanceof gt.Name?void 0:v,dynamicProps:g instanceof gt.Name,dynamicItems:v instanceof gt.Name},f.source&&(f.source.evaluated=(0,gt.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}at.compileSchema=Pu;function DS(t,e,r){var n;r=(0,vt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=VS.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new Nn({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=LS.call(this,s)}at.resolveRef=DS;function LS(t){return(0,vt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Pu.call(this,t)}function H_(t){for(let e of this._compilations)if(US(e,t))return e}at.getCompilingSchema=H_;function US(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function VS(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||wi.call(this,t,e)}function wi(t,e){let r=this.opts.uriResolver.parse(e),n=(0,vt._getFullPath)(this.opts.uriResolver,r),o=(0,vt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Tu.call(this,r,t);let s=(0,vt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=wi.call(this,t,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:Tu.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||Pu.call(this,i),s===(0,vt.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,vt.resolveUrl)(this.opts.uriResolver,o,u)),new Nn({schema:a,schemaId:c,root:t,baseId:o})}return Tu.call(this,r,i)}}at.resolveSchema=wi;var FS=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Tu(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,F_.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!FS.has(a)&&u&&(e=(0,vt.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,F_.schemaHasRulesButRef)(r,this.RULES)){let a=(0,vt.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=wi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Nn({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var B_=$((bA,HS)=>{HS.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 Iu=$((xA,G_)=>{"use strict";var BS=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),J_=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 Ru(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 WS=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function W_(t){return t.length=0,!0}function JS(t,e,r){if(t.length){let n=Ru(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function KS(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=JS;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=W_}else{o.push(u);continue}}return o.length&&(a===W_?r.zone=o.join(""):i?n.push(o.join("")):n.push(Ru(o))),r.address=n.join(""),r}function K_(t){if(GS(t,":")<2)return{host:t,isIPV6:!1};let e=KS(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 GS(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function YS(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===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(o===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 XS(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 QS(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!J_(r)){let n=K_(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}G_.exports={nonSimpleDomain:WS,recomposeAuthority:QS,normalizeComponentEncoding:XS,removeDotSegments:YS,isIPv4:J_,isUUID:BS,normalizeIPv6:K_,stringArrayToHexStripped:Ru}});var tg=$(($A,eg)=>{"use strict";var{isUUID:ez}=Iu(),tz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,rz=["http","https","ws","wss","urn","urn:uuid"];function nz(t){return rz.indexOf(t)!==-1}function Ou(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 Y_(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function X_(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 oz(t){return t.secure=Ou(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function sz(t){if((t.port===(Ou(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 iz(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(tz);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=Cu(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function az(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(),o=`${r}:${e.nid||n}`,s=Cu(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function cz(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!ez(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uz(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Q_={scheme:"http",domainHost:!0,parse:Y_,serialize:X_},lz={scheme:"https",domainHost:Q_.domainHost,parse:Y_,serialize:X_},xi={scheme:"ws",domainHost:!0,parse:oz,serialize:sz},dz={scheme:"wss",domainHost:xi.domainHost,parse:xi.parse,serialize:xi.serialize},pz={scheme:"urn",parse:iz,serialize:az,skipNormalize:!0},fz={scheme:"urn:uuid",parse:cz,serialize:uz,skipNormalize:!0},$i={http:Q_,https:lz,ws:xi,wss:dz,urn:pz,"urn:uuid":fz};Object.setPrototypeOf($i,null);function Cu(t){return t&&($i[t]||$i[t.toLowerCase()])||void 0}eg.exports={wsIsSecure:Ou,SCHEMES:$i,isValidSchemeName:nz,getSchemeHandler:Cu}});var og=$((kA,Si)=>{"use strict";var{normalizeIPv6:hz,removeDotSegments:Uo,recomposeAuthority:mz,normalizeComponentEncoding:ki,isIPv4:_z,nonSimpleDomain:gz}=Iu(),{SCHEMES:vz,getSchemeHandler:rg}=tg();function yz(t,e){return typeof t=="string"?t=It(Jt(t,e),e):typeof t=="object"&&(t=Jt(It(t,e),e)),t}function wz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=ng(Jt(t,n),Jt(e,n),n,!0);return n.skipEscape=!0,It(o,n)}function ng(t,e,r,n){let o={};return n||(t=Jt(It(t,r),r),e=Jt(It(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Uo(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Uo(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Uo(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Uo(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function bz(t,e,r){return typeof t=="string"?(t=unescape(t),t=It(ki(Jt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=It(ki(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=It(ki(Jt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=It(ki(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function It(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),o=[],s=rg(n.scheme||r.scheme);s&&s.serialize&&s.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&&o.push(r.scheme,":");let i=mz(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Uo(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var xz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Jt(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},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(xz);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(_z(n.host)===!1){let c=hz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!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 i=rg(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===!1&&gz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.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)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Nu={SCHEMES:vz,normalize:yz,resolve:wz,resolveComponent:ng,equal:bz,serialize:It,parse:Jt};Si.exports=Nu;Si.exports.default=Nu;Si.exports.fastUri=Nu});var ig=$(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});var sg=og();sg.code='require("ajv/dist/runtime/uri").default';ju.default=sg});var hg=$(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var $z=Do();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return $z.KeywordCxt}});var jn=F();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return jn._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return jn.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return jn.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return jn.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return jn.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return jn.CodeGen}});var kz=yi(),dg=Lo(),Sz=lu(),Vo=bi(),zz=F(),Fo=Mo(),zi=Ao(),Mu=re(),ag=B_(),Ez=ig(),pg=(t,e)=>new RegExp(t,e);pg.code="new RegExp";var Tz=["removeAdditional","useDefaults","coerceTypes"],Pz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Rz={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."},Iz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},cg=200;function Oz(t){var e,r,n,o,s,i,a,c,u,l,d,p,f,g,v,m,_,w,b,E,P,X,be,et,K;let xe=t.strict,Ue=(e=t.code)===null||e===void 0?void 0:e.optimize,xs=Ue===!0||Ue===void 0?1:Ue||0,wd=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:pg,h0=(o=t.uriResolver)!==null&&o!==void 0?o:Ez.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:xe)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:xe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:xe)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:xe)!==null&&p!==void 0?p:"log",strictRequired:(g=(f=t.strictRequired)!==null&&f!==void 0?f:xe)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:xs,regExp:wd}:{optimize:xs,regExp:wd},loopRequired:(v=t.loopRequired)!==null&&v!==void 0?v:cg,loopEnum:(m=t.loopEnum)!==null&&m!==void 0?m:cg,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(E=t.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(X=t.validateSchema)!==null&&X!==void 0?X:!0,validateFormats:(be=t.validateFormats)!==null&&be!==void 0?be:!0,unicodeRegExp:(et=t.unicodeRegExp)!==null&&et!==void 0?et:!0,int32range:(K=t.int32range)!==null&&K!==void 0?K:!0,uriResolver:h0}}var Ho=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Oz(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new zz.ValueScope({scope:{},prefixes:Pz,es5:r,lines:n}),this.logger=Zz(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Sz.getRules)(),ug.call(this,Rz,e,"NOT SUPPORTED"),ug.call(this,Iz,e,"DEPRECATED","warn"),this._metaOpts=Az.call(this),e.formats&&Nz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&jz.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Cz.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=ag;n==="id"&&(o={...ag},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[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 o=n(r);return"$async"in n||(this.errors=n.errors),o}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 o.call(this,e,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof dg.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Fo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!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 o=this.validate(n,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=lg.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Vo.SchemaEnv({schema:{},schemaId:n});if(r=Vo.resolveSchema.call(this,o,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=lg.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,Fo.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(Dz.call(this,n,r),!r)return(0,Mu.eachItem)(n,s=>Au.call(this,s)),this;Uz.call(this,r);let o={...r,type:(0,zi.getJSONTypes)(r.type),schemaType:(0,zi.getJSONTypes)(r.schemaType)};return(0,Mu.eachItem)(n,o.type.length===0?s=>Au.call(this,s,o):s=>o.type.forEach(i=>Au.call(this,s,o,i))),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 o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,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(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=fg(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];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 c=this._cache.get(e);if(c!==void 0)return c;n=(0,Fo.normalizeId)(i||n);let u=Fo.getSchemaRefs.call(this,e,n);return c=new Vo.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_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):Vo.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{Vo.compileSchema.call(this,e)}finally{this.opts=r}}};Ho.ValidationError=kz.default;Ho.MissingRefError=dg.default;Ee.default=Ho;function ug(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function lg(t){return t=(0,Fo.normalizeId)(t),this.schemas[t]||this.refs[t]}function Cz(){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 Nz(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function jz(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 Az(){let t={...this.opts};for(let e of Tz)delete t[e];return t}var Mz={log(){},warn(){},error(){}};function Zz(t){if(t===!1)return Mz;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 qz=/^[a-z_$][a-z0-9_$:-]*$/i;function Dz(t,e){let{RULES:r}=this;if((0,Mu.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!qz.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 Au(t,e,r){var n;let o=e==null?void 0:e.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,zi.getJSONTypes)(e.type),schemaType:(0,zi.getJSONTypes)(e.schemaType)}};e.before?Lz.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Lz(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Uz(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=fg(e)),t.validateSchema=this.compile(e,!0))}var Vz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fg(t){return{anyOf:[t,Vz]}}});var mg=$(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});var Fz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zu.default=Fz});var yg=$(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.callRef=Wr.getValidate=void 0;var Hz=Lo(),_g=it(),Ke=F(),An=Bt(),gg=bi(),Ei=re(),Bz={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=gg.resolveRef.call(c,u,o,r);if(l===void 0)throw new Hz.default(n.opts.uriResolver,o,r);if(l instanceof gg.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Ti(t,i,s,s.$async);let g=e.scopeValue("root",{ref:u});return Ti(t,(0,Ke._)`${g}.validate`,u,u.$async)}function p(g){let v=vg(t,g);Ti(t,v,g,g.$async)}function f(g){let v=e.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Ke.stringify)(g)}:{ref:g}),m=e.name("valid"),_=t.subschema({schema:g,dataTypes:[],schemaPath:Ke.nil,topSchemaRef:v,errSchemaPath:r},m);t.mergeEvaluated(_),t.ok(m)}}};function vg(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ke._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Wr.getValidate=vg;function Ti(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?An.default.this:Ke.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Ke._)`await ${(0,_g.callValidateCode)(t,e,u)}`),f(e),i||o.assign(g,!0)},v=>{o.if((0,Ke._)`!(${v} instanceof ${s.ValidationError})`,()=>o.throw(v)),p(v),i||o.assign(g,!1)}),t.ok(g)}function d(){t.result((0,_g.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(g){let v=(0,Ke._)`${g}.errors`;o.assign(An.default.vErrors,(0,Ke._)`${An.default.vErrors} === null ? ${v} : ${An.default.vErrors}.concat(${v})`),o.assign(An.default.errors,(0,Ke._)`${An.default.vErrors}.length`)}function f(g){var v;if(!s.opts.unevaluated)return;let m=(v=r==null?void 0:r.validate)===null||v===void 0?void 0:v.evaluated;if(s.props!==!0)if(m&&!m.dynamicProps)m.props!==void 0&&(s.props=Ei.mergeEvaluated.props(o,m.props,s.props));else{let _=o.var("props",(0,Ke._)`${g}.evaluated.props`);s.props=Ei.mergeEvaluated.props(o,_,s.props,Ke.Name)}if(s.items!==!0)if(m&&!m.dynamicItems)m.items!==void 0&&(s.items=Ei.mergeEvaluated.items(o,m.items,s.items));else{let _=o.var("items",(0,Ke._)`${g}.evaluated.items`);s.items=Ei.mergeEvaluated.items(o,_,s.items,Ke.Name)}}}Wr.callRef=Ti;Wr.default=Bz});var wg=$(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});var Wz=mg(),Jz=yg(),Kz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Wz.default,Jz.default];qu.default=Kz});var bg=$(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});var Pi=F(),fr=Pi.operators,Ri={maximum:{okStr:"<=",ok:fr.LTE,fail:fr.GT},minimum:{okStr:">=",ok:fr.GTE,fail:fr.LT},exclusiveMaximum:{okStr:"<",ok:fr.LT,fail:fr.GTE},exclusiveMinimum:{okStr:">",ok:fr.GT,fail:fr.LTE}},Gz={message:({keyword:t,schemaCode:e})=>(0,Pi.str)`must be ${Ri[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Pi._)`{comparison: ${Ri[t].okStr}, limit: ${e}}`},Yz={keyword:Object.keys(Ri),type:"number",schemaType:"number",$data:!0,error:Gz,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Pi._)`${r} ${Ri[e].fail} ${n} || isNaN(${r})`)}};Du.default=Yz});var xg=$(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});var Bo=F(),Xz={message:({schemaCode:t})=>(0,Bo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Bo._)`{multipleOf: ${t}}`},Qz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Xz,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Bo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Bo._)`${i} !== parseInt(${i})`;t.fail$data((0,Bo._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Lu.default=Qz});var kg=$(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});function $g(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Uu.default=$g;$g.code='require("ajv/dist/runtime/ucs2length").default'});var Sg=$(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});var Jr=F(),eE=re(),tE=kg(),rE={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Jr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Jr._)`{limit: ${t}}`},nE={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rE,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Jr.operators.GT:Jr.operators.LT,i=o.opts.unicode===!1?(0,Jr._)`${r}.length`:(0,Jr._)`${(0,eE.useFunc)(t.gen,tE.default)}(${r})`;t.fail$data((0,Jr._)`${i} ${s} ${n}`)}};Vu.default=nE});var zg=$(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});var oE=it(),Ii=F(),sE={message:({schemaCode:t})=>(0,Ii.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ii._)`{pattern: ${t}}`},iE={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sE,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:s}=t,i=s.opts.unicodeRegExp?"u":"",a=r?(0,Ii._)`(new RegExp(${o}, ${i}))`:(0,oE.usePattern)(t,n);t.fail$data((0,Ii._)`!${a}.test(${e})`)}};Fu.default=iE});var Eg=$(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});var Wo=F(),aE={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Wo.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Wo._)`{limit: ${t}}`},cE={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:aE,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Wo.operators.GT:Wo.operators.LT;t.fail$data((0,Wo._)`Object.keys(${r}).length ${o} ${n}`)}};Hu.default=cE});var Tg=$(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});var Jo=it(),Ko=F(),uE=re(),lE={message:({params:{missingProperty:t}})=>(0,Ko.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ko._)`{missingProperty: ${t}}`},dE={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lE,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:g}=t.it;for(let v of r)if((f==null?void 0:f[v])===void 0&&!g.has(v)){let m=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${v}" is not defined at "${m}" (strictRequired)`;(0,uE.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Ko.nil,d);else for(let f of r)(0,Jo.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let g=e.let("valid",!0);t.block$data(g,()=>p(f,g)),t.ok(g)}else e.if((0,Jo.checkMissingProp)(t,r,f)),(0,Jo.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Jo.noPropertyInData)(e,o,f,a.ownProperties),()=>t.error())})}function p(f,g){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(g,(0,Jo.propertyInData)(e,o,f,a.ownProperties)),e.if((0,Ko.not)(g),()=>{t.error(),e.break()})},Ko.nil)}}};Bu.default=dE});var Pg=$(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});var Go=F(),pE={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Go.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Go._)`{limit: ${t}}`},fE={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:pE,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Go.operators.GT:Go.operators.LT;t.fail$data((0,Go._)`${r}.length ${o} ${n}`)}};Wu.default=fE});var Oi=$(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});var Rg=vu();Rg.code='require("ajv/dist/runtime/equal").default';Ju.default=Rg});var Ig=$(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var Ku=Ao(),Te=F(),hE=re(),mE=Oi(),_E={message:({params:{i:t,j:e}})=>(0,Te.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Te._)`{i: ${t}, j: ${e}}`},gE={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:_E,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,Ku.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,Te._)`${i} === false`),t.ok(c);function l(){let g=e.let("i",(0,Te._)`${r}.length`),v=e.let("j");t.setParams({i:g,j:v}),e.assign(c,!0),e.if((0,Te._)`${g} > 1`,()=>(d()?p:f)(g,v))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,v){let m=e.name("item"),_=(0,Ku.checkDataTypes)(u,m,a.opts.strictNumbers,Ku.DataType.Wrong),w=e.const("indices",(0,Te._)`{}`);e.for((0,Te._)`;${g}--;`,()=>{e.let(m,(0,Te._)`${r}[${g}]`),e.if(_,(0,Te._)`continue`),u.length>1&&e.if((0,Te._)`typeof ${m} == "string"`,(0,Te._)`${m} += "_"`),e.if((0,Te._)`typeof ${w}[${m}] == "number"`,()=>{e.assign(v,(0,Te._)`${w}[${m}]`),t.error(),e.assign(c,!1).break()}).code((0,Te._)`${w}[${m}] = ${g}`)})}function f(g,v){let m=(0,hE.useFunc)(e,mE.default),_=e.name("outer");e.label(_).for((0,Te._)`;${g}--;`,()=>e.for((0,Te._)`${v} = ${g}; ${v}--;`,()=>e.if((0,Te._)`${m}(${r}[${g}], ${r}[${v}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};Gu.default=gE});var Og=$(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});var Yu=F(),vE=re(),yE=Oi(),wE={message:"must be equal to constant",params:({schemaCode:t})=>(0,Yu._)`{allowedValue: ${t}}`},bE={keyword:"const",$data:!0,error:wE,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Yu._)`!${(0,vE.useFunc)(e,yE.default)}(${r}, ${o})`):t.fail((0,Yu._)`${s} !== ${r}`)}};Xu.default=bE});var Cg=$(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});var Yo=F(),xE=re(),$E=Oi(),kE={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Yo._)`{allowedValues: ${t}}`},SE={keyword:"enum",schemaType:"array",$data:!0,error:kE,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!=null?c:c=(0,xE.useFunc)(e,$E.default),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,Yo.or)(...o.map((g,v)=>p(f,v)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,Yo._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,g){let v=o[g];return typeof v=="object"&&v!==null?(0,Yo._)`${u()}(${r}, ${f}[${g}])`:(0,Yo._)`${r} === ${v}`}}};Qu.default=SE});var Ng=$(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});var zE=bg(),EE=xg(),TE=Sg(),PE=zg(),RE=Eg(),IE=Tg(),OE=Pg(),CE=Ig(),NE=Og(),jE=Cg(),AE=[zE.default,EE.default,TE.default,PE.default,RE.default,IE.default,OE.default,CE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},NE.default,jE.default];el.default=AE});var rl=$(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.validateAdditionalItems=void 0;var Kr=F(),tl=re(),ME={message:({params:{len:t}})=>(0,Kr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Kr._)`{limit: ${t}}`},ZE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ME,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,tl.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}jg(t,n)}};function jg(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Kr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Kr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,tl.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Kr._)`${a} <= ${e.length}`);r.if((0,Kr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:tl.Type.Num},u),i.allErrors||r.if((0,Kr.not)(u),()=>r.break())})}}Xo.validateAdditionalItems=jg;Xo.default=ZE});var nl=$(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.validateTuple=void 0;var Ag=F(),Ci=re(),qE=it(),DE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Mg(t,"additionalItems",e);r.items=!0,!(0,Ci.alwaysValidSchema)(r,e)&&t.ok((0,qE.validateArray)(t))}};function Mg(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ci.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Ag._)`${s}.length`);r.forEach((d,p)=>{(0,Ci.alwaysValidSchema)(a,d)||(n.if((0,Ag._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,g=r.length,v=g===d.minItems&&(g===d.maxItems||d[e]===!1);if(p.strictTuples&&!v){let m=`"${i}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Ci.checkStrictMode)(a,m,p.strictTuples)}}}Qo.validateTuple=Mg;Qo.default=DE});var Zg=$(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});var LE=nl(),UE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,LE.validateTuple)(t,"items")};ol.default=UE});var Dg=$(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});var qg=F(),VE=re(),FE=it(),HE=rl(),BE={message:({params:{len:t}})=>(0,qg.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,qg._)`{limit: ${t}}`},WE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:BE,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,VE.alwaysValidSchema)(n,e)&&(o?(0,HE.validateAdditionalItems)(t,o):t.ok((0,FE.validateArray)(t)))}};sl.default=WE});var Lg=$(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});var ct=F(),Ni=re(),JE={message:({params:{min:t,max:e}})=>e===void 0?(0,ct.str)`must contain at least ${t} valid item(s)`:(0,ct.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ct._)`{minContains: ${t}}`:(0,ct._)`{minContains: ${t}, maxContains: ${e}}`},KE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:JE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,ct._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Ni.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ni.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ni.alwaysValidSchema)(s,r)){let v=(0,ct._)`${l} >= ${i}`;a!==void 0&&(v=(0,ct._)`${v} && ${l} <= ${a}`),t.pass(v);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,ct._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let v=e.name("_valid"),m=e.let("count",0);f(v,()=>e.if(v,()=>g(m)))}function f(v,m){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:Ni.Type.Num,compositeRule:!0},v),m()})}function g(v){e.code((0,ct._)`${v}++`),a===void 0?e.if((0,ct._)`${v} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,ct._)`${v} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,ct._)`${v} >= ${i}`,()=>e.assign(d,!0)))}}};il.default=KE});var Fg=$(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateSchemaDeps=Ot.validatePropertyDeps=Ot.error=void 0;var al=F(),GE=re(),es=it();Ot.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,al.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,al._)`{property: ${t},
|
|
6
|
+
missingProperty: ${n},
|
|
7
|
+
depsCount: ${e},
|
|
8
|
+
deps: ${r}}`};var YE={keyword:"dependencies",type:"object",schemaType:"object",error:Ot.error,code(t){let[e,r]=XE(t);Ug(t,e),Vg(t,r)}};function XE({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Ug(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,es.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,es.checkReportMissingProp)(t,u)}):(r.if((0,al._)`${c} && (${(0,es.checkMissingProp)(t,a,s)})`),(0,es.reportMissingProp)(t,s),r.else())}}Ot.validatePropertyDeps=Ug;function Vg(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,GE.alwaysValidSchema)(s,e[a])||(r.if((0,es.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ot.validateSchemaDeps=Vg;Ot.default=YE});var Bg=$(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});var Hg=F(),QE=re(),eT={message:"property name must be valid",params:({params:t})=>(0,Hg._)`{propertyName: ${t.propertyName}}`},tT={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:eT,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,QE.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Hg.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};cl.default=tT});var ll=$(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});var ji=it(),yt=F(),rT=Bt(),Ai=re(),nT={message:"must NOT have additional properties",params:({params:t})=>(0,yt._)`{additionalProperty: ${t.additionalProperty}}`},oT={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:nT,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ai.alwaysValidSchema)(i,r))return;let u=(0,ji.allSchemaProperties)(n.properties),l=(0,ji.allSchemaProperties)(n.patternProperties);d(),t.ok((0,yt._)`${s} === ${rT.default.errors}`);function d(){e.forIn("key",o,m=>{!u.length&&!l.length?g(m):e.if(p(m),()=>g(m))})}function p(m){let _;if(u.length>8){let w=(0,Ai.schemaRefOrVal)(i,n.properties,"properties");_=(0,ji.isOwnProperty)(e,w,m)}else u.length?_=(0,yt.or)(...u.map(w=>(0,yt._)`${m} === ${w}`)):_=yt.nil;return l.length&&(_=(0,yt.or)(_,...l.map(w=>(0,yt._)`${(0,ji.usePattern)(t,w)}.test(${m})`))),(0,yt.not)(_)}function f(m){e.code((0,yt._)`delete ${o}[${m}]`)}function g(m){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(m);return}if(r===!1){t.setParams({additionalProperty:m}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Ai.alwaysValidSchema)(i,r)){let _=e.name("valid");c.removeAdditional==="failing"?(v(m,_,!1),e.if((0,yt.not)(_),()=>{t.reset(),f(m)})):(v(m,_),a||e.if((0,yt.not)(_),()=>e.break()))}}function v(m,_,w){let b={keyword:"additionalProperties",dataProp:m,dataPropType:Ai.Type.Str};w===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(b,_)}}};ul.default=oT});var Kg=$(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});var sT=Do(),Wg=it(),dl=re(),Jg=ll(),iT={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Jg.default.code(new sT.KeywordCxt(s,Jg.default,"additionalProperties"));let i=(0,Wg.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=dl.mergeEvaluated.props(e,(0,dl.toHash)(i),s.props));let a=i.filter(d=>!(0,dl.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Wg.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};pl.default=iT});var Qg=$(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});var Gg=it(),Mi=F(),Yg=re(),Xg=re(),aT={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,Gg.allSchemaProperties)(r),c=a.filter(v=>(0,Yg.alwaysValidSchema)(s,r[v]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof Mi.Name)&&(s.props=(0,Xg.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let v of a)u&&f(v),s.allErrors?g(v):(e.var(l,!0),g(v),e.if(l))}function f(v){for(let m in u)new RegExp(v).test(m)&&(0,Yg.checkStrictMode)(s,`property ${m} matches pattern ${v} (use allowMatchingProperties)`)}function g(v){e.forIn("key",n,m=>{e.if((0,Mi._)`${(0,Gg.usePattern)(t,v)}.test(${m})`,()=>{let _=c.includes(v);_||t.subschema({keyword:"patternProperties",schemaProp:v,dataProp:m,dataPropType:Xg.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,Mi._)`${d}[${m}]`,!0):!_&&!s.allErrors&&e.if((0,Mi.not)(l),()=>e.break())})})}}};fl.default=aT});var ev=$(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var cT=re(),uT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,cT.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};hl.default=uT});var tv=$(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});var lT=it(),dT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lT.validateUnion,error:{message:"must match a schema in anyOf"}};ml.default=dT});var rv=$(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});var Zi=F(),pT=re(),fT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Zi._)`{passingSchemas: ${t.passing}}`},hT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:fT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,pT.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Zi._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Zi._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Zi.Name)})})}}};_l.default=hT});var nv=$(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});var mT=re(),_T={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 o=e.name("valid");r.forEach((s,i)=>{if((0,mT.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};gl.default=_T});var iv=$(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var qi=F(),sv=re(),gT={message:({params:t})=>(0,qi.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,qi._)`{failingKeyword: ${t.ifClause}}`},vT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:gT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,sv.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=ov(n,"then"),s=ov(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,qi.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,qi._)`${l}`):t.setParams({ifClause:l})}}}};function ov(t,e){let r=t.schema[e];return r!==void 0&&!(0,sv.alwaysValidSchema)(t,r)}vl.default=vT});var av=$(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var yT=re(),wT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,yT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};yl.default=wT});var cv=$(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var bT=rl(),xT=Zg(),$T=nl(),kT=Dg(),ST=Lg(),zT=Fg(),ET=Bg(),TT=ll(),PT=Kg(),RT=Qg(),IT=ev(),OT=tv(),CT=rv(),NT=nv(),jT=iv(),AT=av();function MT(t=!1){let e=[IT.default,OT.default,CT.default,NT.default,jT.default,AT.default,ET.default,TT.default,zT.default,PT.default,RT.default];return t?e.push(xT.default,kT.default):e.push(bT.default,$T.default),e.push(ST.default),e}wl.default=MT});var uv=$(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});var ge=F(),ZT={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},qT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ZT,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),v=r.const("fDef",(0,ge._)`${g}[${i}]`),m=r.let("fType"),_=r.let("format");r.if((0,ge._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(m,(0,ge._)`${v}.type || "string"`).assign(_,(0,ge._)`${v}.validate`),()=>r.assign(m,(0,ge._)`"string"`).assign(_,v)),t.fail$data((0,ge.or)(w(),b()));function w(){return c.strictSchema===!1?ge.nil:(0,ge._)`${i} && !${_}`}function b(){let E=l.$async?(0,ge._)`(${v}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,ge._)`${_}(${n})`,P=(0,ge._)`(typeof ${_} == "function" ? ${E} : ${_}.test(${n}))`;return(0,ge._)`${_} && ${_} !== true && ${m} === ${e} && !${P}`}}function f(){let g=d.formats[s];if(!g){w();return}if(g===!0)return;let[v,m,_]=b(g);v===e&&t.pass(E());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function b(P){let X=P instanceof RegExp?(0,ge.regexpCode)(P):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(s)}`:void 0,be=r.scopeValue("formats",{key:s,ref:P,code:X});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,ge._)`${be}.validate`]:["string",P,be]}function E(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${_}(${n})`}return typeof m=="function"?(0,ge._)`${_}(${n})`:(0,ge._)`${_}.test(${n})`}}}};bl.default=qT});var lv=$(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var DT=uv(),LT=[DT.default];xl.default=LT});var dv=$(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.contentVocabulary=Mn.metadataVocabulary=void 0;Mn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Mn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var fv=$($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var UT=wg(),VT=Ng(),FT=cv(),HT=lv(),pv=dv(),BT=[UT.default,VT.default,(0,FT.default)(),HT.default,pv.metadataVocabulary,pv.contentVocabulary];$l.default=BT});var mv=$(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.DiscrError=void 0;var hv;(function(t){t.Tag="tag",t.Mapping="mapping"})(hv||(Di.DiscrError=hv={}))});var gv=$(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var Zn=F(),kl=mv(),_v=bi(),WT=Lo(),JT=re(),KT={message:({params:{discrError:t,tagName:e}})=>t===kl.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Zn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},GT={keyword:"discriminator",type:"object",schemaType:"object",error:KT,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Zn._)`${r}${(0,Zn.getProperty)(a)}`);e.if((0,Zn._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:kl.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let g in f)e.elseIf((0,Zn._)`${u} === ${g}`),e.assign(c,d(f[g]));e.else(),t.error(!1,{discrError:kl.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let g=e.name("valid"),v=t.subschema({keyword:"oneOf",schemaProp:f},g);return t.mergeEvaluated(v,Zn.Name),g}function p(){var f;let g={},v=_(o),m=!0;for(let E=0;E<i.length;E++){let P=i[E];if(P!=null&&P.$ref&&!(0,JT.schemaHasRulesButRef)(P,s.self.RULES)){let be=P.$ref;if(P=_v.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,be),P instanceof _v.SchemaEnv&&(P=P.schema),P===void 0)throw new WT.default(s.opts.uriResolver,s.baseId,be)}let X=(f=P==null?void 0:P.properties)===null||f===void 0?void 0:f[a];if(typeof X!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);m=m&&(v||_(P)),w(X,E)}if(!m)throw new Error(`discriminator: "${a}" must be required`);return g;function _({required:E}){return Array.isArray(E)&&E.includes(a)}function w(E,P){if(E.const)b(E.const,P);else if(E.enum)for(let X of E.enum)b(X,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(E,P){if(typeof E!="string"||E in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[E]=P}}}};Sl.default=GT});var vv=$((pM,YT)=>{YT.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 El=$((fe,zl)=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.MissingRefError=fe.ValidationError=fe.CodeGen=fe.Name=fe.nil=fe.stringify=fe.str=fe._=fe.KeywordCxt=fe.Ajv=void 0;var XT=hg(),QT=fv(),eP=gv(),yv=vv(),tP=["/properties"],Li="http://json-schema.org/draft-07/schema",qn=class extends XT.default{_addVocabularies(){super._addVocabularies(),QT.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(eP.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(yv,tP):yv;this.addMetaSchema(e,Li,!1),this.refs["http://json-schema.org/schema"]=Li}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Li)?Li:void 0)}};fe.Ajv=qn;zl.exports=fe=qn;zl.exports.Ajv=qn;Object.defineProperty(fe,"__esModule",{value:!0});fe.default=qn;var rP=Do();Object.defineProperty(fe,"KeywordCxt",{enumerable:!0,get:function(){return rP.KeywordCxt}});var Dn=F();Object.defineProperty(fe,"_",{enumerable:!0,get:function(){return Dn._}});Object.defineProperty(fe,"str",{enumerable:!0,get:function(){return Dn.str}});Object.defineProperty(fe,"stringify",{enumerable:!0,get:function(){return Dn.stringify}});Object.defineProperty(fe,"nil",{enumerable:!0,get:function(){return Dn.nil}});Object.defineProperty(fe,"Name",{enumerable:!0,get:function(){return Dn.Name}});Object.defineProperty(fe,"CodeGen",{enumerable:!0,get:function(){return Dn.CodeGen}});var nP=yi();Object.defineProperty(fe,"ValidationError",{enumerable:!0,get:function(){return nP.default}});var oP=Lo();Object.defineProperty(fe,"MissingRefError",{enumerable:!0,get:function(){return oP.default}})});var Ev=$(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.formatNames=Nt.fastFormats=Nt.fullFormats=void 0;function Ct(t,e){return{validate:t,compare:e}}Nt.fullFormats={date:Ct($v,Il),time:Ct(Pl(!0),Ol),"date-time":Ct(wv(!0),Sv),"iso-time":Ct(Pl(),kv),"iso-date-time":Ct(wv(),zv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:lP,"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:gP,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:dP,int32:{type:"number",validate:hP},int64:{type:"number",validate:mP},float:{type:"number",validate:xv},double:{type:"number",validate:xv},password:!0,binary:!0};Nt.fastFormats={...Nt.fullFormats,date:Ct(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Il),time:Ct(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ol),"date-time":Ct(/^\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,Sv),"iso-time":Ct(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kv),"iso-date-time":Ct(/^\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,zv),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};Nt.formatNames=Object.keys(Nt.fullFormats);function sP(t){return t%4===0&&(t%100!==0||t%400===0)}var iP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,aP=[0,31,28,31,30,31,30,31,31,30,31,30,31];function $v(t){let e=iP.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&sP(r)?29:aP[n])}function Il(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Tl=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Pl(t){return function(r){let n=Tl.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ol(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 kv(t,e){if(!(t&&e))return;let r=Tl.exec(t),n=Tl.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 Rl=/t|\s/i;function wv(t){let e=Pl(t);return function(n){let o=n.split(Rl);return o.length===2&&$v(o[0])&&e(o[1])}}function Sv(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function zv(t,e){if(!(t&&e))return;let[r,n]=t.split(Rl),[o,s]=e.split(Rl),i=Il(r,o);if(i!==void 0)return i||Ol(n,s)}var cP=/\/|:/,uP=/^(?:[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 lP(t){return cP.test(t)&&uP.test(t)}var bv=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function dP(t){return bv.lastIndex=0,bv.test(t)}var pP=-(2**31),fP=2**31-1;function hP(t){return Number.isInteger(t)&&t<=fP&&t>=pP}function mP(t){return Number.isInteger(t)}function xv(){return!0}var _P=/[^\\]\\Z/;function gP(t){if(_P.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Tv=$(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.formatLimitDefinition=void 0;var vP=El(),wt=F(),hr=wt.operators,Ui={formatMaximum:{okStr:"<=",ok:hr.LTE,fail:hr.GT},formatMinimum:{okStr:">=",ok:hr.GTE,fail:hr.LT},formatExclusiveMaximum:{okStr:"<",ok:hr.LT,fail:hr.GTE},formatExclusiveMinimum:{okStr:">",ok:hr.GT,fail:hr.LTE}},yP={message:({keyword:t,schemaCode:e})=>(0,wt.str)`should be ${Ui[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,wt._)`{comparison: ${Ui[t].okStr}, limit: ${e}}`};Ln.formatLimitDefinition={keyword:Object.keys(Ui),type:"string",schemaType:"string",$data:!0,error:yP,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new vP.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,wt._)`${p}[${c.schemaCode}]`);t.fail$data((0,wt.or)((0,wt._)`typeof ${f} != "object"`,(0,wt._)`${f} instanceof RegExp`,(0,wt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,wt._)`${i.code.formats}${(0,wt.getProperty)(p)}`:void 0});t.fail$data(d(g))}function d(p){return(0,wt._)`${p}.compare(${r}, ${n}) ${Ui[o].fail} 0`}},dependencies:["format"]};var wP=t=>(t.addKeyword(Ln.formatLimitDefinition),t);Ln.default=wP});var Ov=$((ts,Iv)=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});var Un=Ev(),bP=Tv(),Cl=F(),Pv=new Cl.Name("fullFormats"),xP=new Cl.Name("fastFormats"),Nl=(t,e={keywords:!0})=>{if(Array.isArray(e))return Rv(t,e,Un.fullFormats,Pv),t;let[r,n]=e.mode==="fast"?[Un.fastFormats,xP]:[Un.fullFormats,Pv],o=e.formats||Un.formatNames;return Rv(t,o,r,n),e.keywords&&(0,bP.default)(t),t};Nl.get=(t,e="full")=>{let n=(e==="fast"?Un.fastFormats:Un.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function Rv(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Cl._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}Iv.exports=ts=Nl;Object.defineProperty(ts,"__esModule",{value:!0});ts.default=Nl});var ty=$((rZ,na)=>{"use strict";na.exports=nR;na.exports.format=Qv;na.exports.parse=ey;var eR=/\B(?=(\d{3})+(?!\d))/g,tR=/(?:\.0*|(\.[^0]+)0+)$/,_r={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},rR=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function nR(t,e){return typeof t=="string"?ey(t):typeof t=="number"?Qv(t,e):null}function Qv(t,e){if(!Number.isFinite(t))return null;var r=Math.abs(t),n=e&&e.thousandsSeparator||"",o=e&&e.unitSeparator||"",s=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,i=!!(e&&e.fixedDecimals),a=e&&e.unit||"";(!a||!_r[a.toLowerCase()])&&(r>=_r.pb?a="PB":r>=_r.tb?a="TB":r>=_r.gb?a="GB":r>=_r.mb?a="MB":r>=_r.kb?a="KB":a="B");var c=t/_r[a.toLowerCase()],u=c.toFixed(s);return i||(u=u.replace(tR,"$1")),n&&(u=u.split(".").map(function(l,d){return d===0?l.replace(eR,n):l}).join(".")),u+o+a}function ey(t){if(typeof t=="number"&&!isNaN(t))return t;if(typeof t!="string")return null;var e=rR.exec(t),r,n="b";return e?(r=parseFloat(e[1]),n=e[4].toLowerCase()):(r=parseInt(t,10),n="b"),isNaN(r)?null:Math.floor(_r[n]*r)}});var td=$(ed=>{"use strict";var ny=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,oR=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,oy=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,sR=/\\([\u000b\u0020-\u00ff])/g,iR=/([\\"])/g,sy=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;ed.format=aR;ed.parse=cR;function aR(t){if(!t||typeof t!="object")throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!sy.test(r))throw new TypeError("invalid type");var n=r;if(e&&typeof e=="object")for(var o,s=Object.keys(e).sort(),i=0;i<s.length;i++){if(o=s[i],!oy.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+lR(e[o])}return n}function cR(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?uR(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=r!==-1?e.slice(0,r).trim():e.trim();if(!sy.test(n))throw new TypeError("invalid media type");var o=new dR(n.toLowerCase());if(r!==-1){var s,i,a;for(ny.lastIndex=r;i=ny.exec(e);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(sR,"$1"))),o.parameters[s]=a}if(r!==e.length)throw new TypeError("invalid parameter format")}return o}function uR(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function lR(t){var e=String(t);if(oy.test(e))return e;if(e.length>0&&!oR.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(iR,"\\$1")+'"'}function dR(t){this.parameters=Object.create(null),this.type=t}});var fy=$((cZ,py)=>{py.exports=dy;dy.sync=hR;var uy=require("fs");function fR(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&t.substr(-o.length).toLowerCase()===o)return!0}return!1}function ly(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:fR(e,r)}function dy(t,e,r){uy.stat(t,function(n,o){r(n,n?!1:ly(o,t,e))})}function hR(t,e){return ly(uy.statSync(t),t,e)}});var vy=$((uZ,gy)=>{gy.exports=my;my.sync=mR;var hy=require("fs");function my(t,e,r){hy.stat(t,function(n,o){r(n,n?!1:_y(o,e))})}function mR(t,e){return _y(hy.statSync(t),e)}function _y(t,e){return t.isFile()&&_R(t,e)}function _R(t,e){var r=t.mode,n=t.uid,o=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&o===i||r&a&&n===s||r&l&&s===0;return d}});var wy=$((dZ,yy)=>{var lZ=require("fs"),sa;process.platform==="win32"||global.TESTING_WINDOWS?sa=fy():sa=vy();yy.exports=rd;rd.sync=gR;function rd(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){rd(t,e||{},function(s,i){s?o(s):n(i)})})}sa(t,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function gR(t,e){try{return sa.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ey=$((pZ,zy)=>{var Yn=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",by=require("path"),vR=Yn?";":":",xy=wy(),$y=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),ky=(t,e)=>{let r=e.colon||vR,n=t.match(/\//)||Yn&&t.match(/\\/)?[""]:[...Yn?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=Yn?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Yn?o.split(r):[""];return Yn&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:o}},Sy=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:s}=ky(t,e),i=[],a=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&i.length?l(i):d($y(t));let p=n[u],f=/^".*"$/.test(p)?p.slice(1,-1):p,g=by.join(f,t),v=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(v,u,0))}),c=(u,l,d)=>new Promise((p,f)=>{if(d===o.length)return p(a(l+1));let g=o[d];xy(u+g,{pathExt:s},(v,m)=>{if(!v&&m)if(e.all)i.push(u+g);else return p(u+g);return p(c(u,l,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},yR=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=ky(t,e),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=by.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let p=l+n[d];try{if(xy.sync(p,{pathExt:o}))if(e.all)s.push(p);else return p}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw $y(t)};zy.exports=Sy;Sy.sync=yR});var Py=$((fZ,nd)=>{"use strict";var Ty=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};nd.exports=Ty;nd.exports.default=Ty});var Cy=$((hZ,Oy)=>{"use strict";var Ry=require("path"),wR=Ey(),bR=Py();function Iy(t,e){let r=t.options.env||process.env,n=process.cwd(),o=t.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=wR.sync(t.command,{path:r[bR({env:r})],pathExt:e?Ry.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=Ry.resolve(o?t.options.cwd:"",i)),i}function xR(t){return Iy(t)||Iy(t,!0)}Oy.exports=xR});var Ny=$((mZ,sd)=>{"use strict";var od=/([()\][%!^"`<>&|;, *?])/g;function $R(t){return t=t.replace(od,"^$1"),t}function kR(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(od,"^$1"),e&&(t=t.replace(od,"^$1")),t}sd.exports.command=$R;sd.exports.argument=kR});var Ay=$((_Z,jy)=>{"use strict";jy.exports=/^#!(.*)/});var Zy=$((gZ,My)=>{"use strict";var SR=Ay();My.exports=(t="")=>{let e=t.match(SR);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Dy=$((vZ,qy)=>{"use strict";var id=require("fs"),zR=Zy();function ER(t){let r=Buffer.alloc(150),n;try{n=id.openSync(t,"r"),id.readSync(n,r,0,150,0),id.closeSync(n)}catch{}return zR(r.toString())}qy.exports=ER});var Fy=$((yZ,Vy)=>{"use strict";var TR=require("path"),Ly=Cy(),Uy=Ny(),PR=Dy(),RR=process.platform==="win32",IR=/\.(?:com|exe)$/i,OR=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function CR(t){t.file=Ly(t);let e=t.file&&PR(t.file);return e?(t.args.unshift(t.file),t.command=e,Ly(t)):t.file}function NR(t){if(!RR)return t;let e=CR(t),r=!IR.test(e);if(t.options.forceShell||r){let n=OR.test(e);t.command=TR.normalize(t.command),t.command=Uy.command(t.command),t.args=t.args.map(s=>Uy.argument(s,n));let o=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${o}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function jR(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:NR(n)}Vy.exports=jR});var Wy=$((wZ,By)=>{"use strict";var ad=process.platform==="win32";function cd(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function AR(t,e){if(!ad)return;let r=t.emit;t.emit=function(n,o){if(n==="exit"){let s=Hy(o,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Hy(t,e){return ad&&t===1&&!e.file?cd(e.original,"spawn"):null}function MR(t,e){return ad&&t===1&&!e.file?cd(e.original,"spawnSync"):null}By.exports={hookChildProcess:AR,verifyENOENT:Hy,verifyENOENTSync:MR,notFoundError:cd}});var Gy=$((bZ,Xn)=>{"use strict";var Jy=require("child_process"),ud=Fy(),ld=Wy();function Ky(t,e,r){let n=ud(t,e,r),o=Jy.spawn(n.command,n.args,n.options);return ld.hookChildProcess(o,n),o}function ZR(t,e,r){let n=ud(t,e,r),o=Jy.spawnSync(n.command,n.args,n.options);return o.error=o.error||ld.verifyENOENTSync(o.status,n),o}Xn.exports=Ky;Xn.exports.spawn=Ky;Xn.exports.sync=ZR;Xn.exports._parse=ud;Xn.exports._enoent=ld});var t0=$(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.OpenAI=void 0;var pd=class{constructor(){Ye(this,"name","openai")}async complete(e,r){var c,u,l,d;let n=e.messages.map(WR).flat(),o=e.tools.map(JR),s=await HR({model:r.model,temperature:r.temperature,input:n,instructions:YR(e.systemPrompt),tools:o.length>0?o:void 0,tool_choice:e.tools.length>0?"auto":void 0,parallel_tool_calls:!1},r),i={role:"assistant",content:[]};for(let p of s.output)if(p.type==="message"&&p.role==="assistant"){i.openaiId=p.id,i.openaiStatus=p.status;for(let f of p.content)f.type==="output_text"&&i.content.push({type:"text",text:f.text})}else p.type==="function_call"&&i.content.push(GR(p));let a={input:(u=(c=s.usage)==null?void 0:c.input_tokens)!=null?u:0,output:(d=(l=s.usage)==null?void 0:l.output_tokens)!=null?d:0};return{result:i,usage:a}}};pa.OpenAI=pd;async function HR(t,e){var a,c,u,l,d;let n={"Content-Type":"application/json",Authorization:`Bearer ${process.env.OPENAI_API_KEY}`,"Copilot-Vision-Request":"true"},o={...t,tools:`${(c=(a=t.tools)==null?void 0:a.length)!=null?c:0} tools`};(u=e.debug)==null||u.call(e,"lowire:openai-responses")("Request:",JSON.stringify(o,null,2));let s=await fetch("https://api.openai.com/v1/responses",{method:"POST",headers:n,body:JSON.stringify(t)});if(!s.ok)throw(l=e.debug)==null||l.call(e,"lowire:openai-responses")("Response:",s.status),new Error(`API error: ${s.status} ${s.statusText} ${await s.text()}`);let i=await s.json();return(d=e.debug)==null||d.call(e,"lowire:openai-responses")("Response:",JSON.stringify(i,null,2)),i}function BR(t){if(t.type==="text")return{type:"input_text",text:t.text};if(t.type==="image")return{type:"input_image",image_url:`data:${t.mimeType};base64,${t.data}`,detail:"auto"};throw new Error(`Cannot convert content part of type ${t.type} to response content part`)}function WR(t){if(t.role==="user")return[{type:"message",role:"user",content:t.content}];if(t.role==="assistant"){let e=t.content.filter(o=>o.type==="text"),r=t.content.filter(o=>o.type==="tool_call"),n=[];if(e.length>0){let o={id:t.openaiId,status:t.openaiStatus,type:"message",role:"assistant",content:e.map(s=>({type:"output_text",text:s.text,annotations:[],logprobs:[]}))};n.push(o)}return t.toolError&&n.push({type:"message",role:"user",content:t.toolError}),n.push(...r.map(KR).flat()),n}throw new Error(`Unsupported message role: ${t.role}`)}function JR(t){var e;return{type:"function",name:t.name,description:(e=t.description)!=null?e:null,parameters:t.inputSchema,strict:null}}function KR(t){let e=[{type:"function_call",call_id:t.id,name:t.name,arguments:JSON.stringify(t.arguments),id:t.openaiId,status:t.openaiStatus}];return t.result&&e.push({type:"function_call_output",call_id:t.id,output:t.result.content.map(BR)}),e}function GR(t){return{type:"tool_call",name:t.name,arguments:JSON.parse(t.arguments),id:t.call_id,openaiId:t.id,openaiStatus:t.status}}var YR=t=>`
|
|
2
9
|
### System instructions
|
|
3
10
|
|
|
4
|
-
${
|
|
11
|
+
${t}
|
|
5
12
|
|
|
6
13
|
### Tool calling instructions
|
|
7
14
|
- Make sure every message contains a tool call.
|
|
8
15
|
- When you use a tool, you may provide a brief thought or explanation in the content field
|
|
9
16
|
immediately before the tool_call. Do not split this into separate messages.
|
|
10
17
|
- Every reply must include a tool call.
|
|
11
|
-
`});var
|
|
18
|
+
`});var r0=$(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.kEditorHeaders=vr.Github=void 0;var fd=class{constructor(){Ye(this,"name","github");Ye(this,"_apiKey")}async _bearer(){return this._apiKey||(this._apiKey=await oI()),this._apiKey}async complete(e,r){var d,p,f,g;let o=[{role:"system",content:nI(e.systemPrompt)},...e.messages.map(eI).flat()],s=e.tools.map(v=>tI(v)),i=await this._bearer(),a;for(let v=0;v<3&&(a=await XR({model:r.model,max_tokens:r.maxTokens,temperature:r.temperature,messages:o,tools:s,tool_choice:e.tools.length>0?"auto":void 0,reasoning_effort:r.reasoning?"medium":void 0,parallel_tool_calls:!1},i,r),!a.choices.length);++v);if(!a||!a.choices.length)throw new Error("Failed to get response from GitHub Copilot");let c={role:"assistant",content:[]},u=a.choices[0].message;u.content&&c.content.push({type:"text",text:u.content});for(let v of u.tool_calls||[]){if(v.type!=="function")continue;let{toolCall:m,intent:_}=rI(v);_&&c.content.push({type:"text",text:_,copilotToolCallId:m.id}),c.content.push(m)}let l={input:(p=(d=a.usage)==null?void 0:d.prompt_tokens)!=null?p:0,output:(g=(f=a.usage)==null?void 0:f.completion_tokens)!=null?g:0};return{result:c,usage:l}}};vr.Github=fd;async function XR(t,e,r){var a,c,u,l,d;let n={Authorization:`Bearer ${e}`,...vr.kEditorHeaders},o={...t,tools:`${(c=(a=t.tools)==null?void 0:a.length)!=null?c:0} tools`};(u=r.debug)==null||u.call(r,"lowire:github")("Request:",JSON.stringify(o,null,2));let s=await fetch("https://api.githubcopilot.com/chat/completions",{method:"POST",headers:n,body:JSON.stringify(t)});if(!s.ok)throw(l=r.debug)==null||l.call(r,"lowire:github")("Response:",s.status),new Error(`API error: ${s.status} ${s.statusText} ${await s.text()}`);let i=await s.json();return(d=r.debug)==null||d.call(r,"lowire:github")("Response:",JSON.stringify(i,null,2)),i}function QR(t){if(t.type==="text")return{type:"text",text:t.text};if(t.type==="image")return{type:"image_url",image_url:{url:`data:${t.mimeType};base64,${t.data}`}};throw new Error(`Cannot convert content part of type ${t.type} to text content part`)}function eI(t){if(t.role==="user")return[{role:"user",content:t.content}];if(t.role==="assistant"){let e={role:"assistant"},r=new Map;for(let a of t.content)a.type==="text"&&a.copilotToolCallId&&r.set(a.copilotToolCallId,a.text);let n=t.content.filter(a=>a.type==="text"&&!a.copilotToolCallId),o=t.content.filter(a=>a.type==="tool_call");n.length===1?e.content=n[0].text:e.content=n;let s=[],i=[];for(let a of o){let c={...a.arguments};r.has(a.id)&&(c._intent=r.get(a.id)),s.push({id:a.id,type:"function",function:{name:a.name,arguments:JSON.stringify(c)}}),a.result&&i.push({role:"tool",tool_call_id:a.id,content:a.result.content.map(QR)})}return s.length>0&&(e.tool_calls=s),t.toolError&&i.push({role:"user",content:[{type:"text",text:t.toolError}]}),[e,...i]}throw new Error(`Unsupported message role: ${t.role}`)}function tI(t){let e={...t.inputSchema};return e.properties={_intent:{type:"string",description:"Describe the intent of this tool call"},...e.properties||{}},{type:"function",function:{name:t.name,description:t.description,parameters:e}}}function rI(t){let e={type:"tool_call",name:t.type==="function"?t.function.name:t.custom.name,arguments:JSON.parse(t.type==="function"?t.function.arguments:t.custom.input),id:t.id},r=e.arguments._intent;return delete e.arguments._intent,{toolCall:e,intent:r}}var nI=t=>`
|
|
12
19
|
### System instructions
|
|
13
20
|
|
|
14
|
-
${
|
|
21
|
+
${t}
|
|
15
22
|
|
|
16
23
|
### Tool calling instructions
|
|
17
24
|
- Your reply MUST be a tool call and nothing but the tool call.
|
|
18
25
|
- NEVER respond with text content, only tool calls.
|
|
19
26
|
- Do NOT describe your plan, do NOT explain what you are doing, do NOT describe what you see, call tools.
|
|
20
27
|
- Provide thoughts in the '_intent' property of the tool calls instead.
|
|
21
|
-
`;
|
|
28
|
+
`;vr.kEditorHeaders={"Editor-Version":"vscode/1.96.0","Editor-Plugin-Version":"copilot-chat/0.24.0","User-Agent":"GitHubCopilotChat/0.24.0",Accept:"application/json","Content-Type":"application/json","Copilot-Vision-Request":"true"};async function oI(){let e=await(await fetch("https://api.github.com/copilot_internal/v2/token",{method:"GET",headers:{Authorization:`token ${process.env.COPILOT_API_KEY}`,...vr.kEditorHeaders}})).json();if(e.token)return e.token;throw new Error("Failed to get Copilot token")}});var n0=$(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.Anthropic=void 0;var hd=class{constructor(){Ye(this,"name","anthropic")}async complete(e,r){var i;let n=await sI({model:r.model,max_tokens:(i=r.maxTokens)!=null?i:32768,temperature:r.temperature,system:fI(e.systemPrompt),messages:e.messages.map(pI).flat(),tools:e.tools.map(uI),thinking:r.reasoning?{type:"enabled",budget_tokens:r.maxTokens?Math.round(r.maxTokens/10):1024}:void 0},r),o=cI(n),s={input:n.usage.input_tokens,output:n.usage.output_tokens};return{result:o,usage:s}}};fa.Anthropic=hd;async function sI(t,e){var i,a,c,u,l;let r={"Content-Type":"application/json","x-api-key":process.env.ANTHROPIC_API_KEY,"anthropic-version":"2023-06-01"},n={...t,tools:`${(a=(i=t.tools)==null?void 0:i.length)!=null?a:0} tools`};(c=e.debug)==null||c.call(e,"lowire:anthropic")("Request:",JSON.stringify(n,null,2));let o=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:r,body:JSON.stringify(t)});if(!o.ok)throw(u=e.debug)==null||u.call(e,"lowire:anthropic")("Response:",o.status),new Error(`API error: ${o.status} ${o.statusText} ${await o.text()}`);let s=await o.json();return(l=e.debug)==null||l.call(e,"lowire:anthropic")("Response:",JSON.stringify(s,null,2)),s}function iI(t){return t.type==="text"?{type:"text",text:t.text}:t.type==="tool_use"?{type:"tool_call",name:t.name,arguments:t.input,id:t.id}:t.type==="thinking"?{type:"thinking",thinking:t.thinking,signature:t.signature}:null}function aI(t){if(t.type==="text")return{type:"text",text:t.text};if(t.type==="image")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mimeType}};throw new Error(`Unsupported content part type: ${t.type}`)}function cI(t){return{role:"assistant",content:t.content.map(iI).filter(Boolean)}}function uI(t){return{name:t.name,description:t.description,input_schema:t.inputSchema}}function lI(t){let e=[],r=[];for(let n of t.content){if(n.type==="text"){e.push({...n,citations:[]});continue}if(n.type==="tool_call"){e.push({type:"tool_use",id:n.id,name:n.name,input:n.arguments}),n.result&&r.push(dI(n,n.result));continue}if(n.type==="thinking"){e.push({type:"thinking",thinking:n.thinking,signature:n.signature});continue}}return t.toolError&&r.push({role:"user",content:[{type:"text",text:t.toolError}]}),[{role:"assistant",content:e},...r]}function dI(t,e){return{role:"user",content:[{type:"tool_result",tool_use_id:t.id,content:e.content.map(aI),is_error:e.isError}]}}function pI(t){if(t.role==="user")return[{role:"user",content:t.content}];if(t.role==="assistant")return lI(t);throw new Error(`Unsupported message role: ${t.role}`)}var fI=t=>`
|
|
22
29
|
### System instructions
|
|
23
30
|
|
|
24
|
-
${
|
|
31
|
+
${t}
|
|
25
32
|
|
|
26
33
|
### Tool calling instructions
|
|
27
34
|
- Make sure every message contains a tool call.
|
|
28
35
|
- When you use a tool, you may provide a brief thought or explanation in the content field
|
|
29
36
|
immediately before the tool_call. Do not split this into separate messages.
|
|
30
37
|
- Every reply must include a tool call.
|
|
31
|
-
`});var
|
|
32
|
-
`));let
|
|
38
|
+
`});var s0=$(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.Google=void 0;var md=class{constructor(){Ye(this,"name","google")}async complete(e,r){var c,u,l,d,p,f;let n=e.messages.map(vI).flat(),o=await hI((c=r.model)!=null?c:"gemini-2.5-pro",{systemInstruction:{role:"system",parts:[{text:wI(e.systemPrompt)}]},contents:n,tools:e.tools.length>0?[{functionDeclarations:e.tools.map(mI)}]:void 0,generationConfig:{temperature:r.temperature}},r),[s]=(u=o.candidates)!=null?u:[];if(!s)throw new Error("No candidates in response");let i={input:(d=(l=o.usageMetadata)==null?void 0:l.promptTokenCount)!=null?d:0,output:(f=(p=o.usageMetadata)==null?void 0:p.candidatesTokenCount)!=null?f:0};return{result:_I(s),usage:i}}};ha.Google=md;async function hI(t,e,r){var a,c,u,l,d,p;let n=(a=process.env.GEMINI_API_KEY)!=null?a:process.env.GOOGLE_API_KEY;if(!n)throw new Error("GEMINI_API_KEY or GOOGLE_API_KEY environment variable is required");let o={...e,tools:`${(u=(c=e.tools)==null?void 0:c.length)!=null?u:0} tools`};(l=r.debug)==null||l.call(r,"lowire:google")("Request:",JSON.stringify(o,null,2));let s=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${t}:generateContent`,{method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":n},body:JSON.stringify(e)});if(!s.ok)throw(d=r.debug)==null||d.call(r,"lowire:google")("Response:",s.status),new Error(`API error: ${s.status} ${s.statusText} ${await s.text()}`);let i=await s.json();return(p=r.debug)==null||p.call(r,"lowire:google")("Response:",JSON.stringify(i,null,2)),i}function mI(t){return{name:t.name,description:t.description,parameters:o0(t.inputSchema)}}function o0(t){if(!t||typeof t!="object")return t;let e=Array.isArray(t)?[...t]:{...t};delete e.additionalProperties,delete e.$schema;for(let r in e)e[r]&&typeof e[r]=="object"&&(e[r]=o0(e[r]));return e}function _I(t){return{role:"assistant",content:t.content.parts.map(gI).filter(Boolean)}}function gI(t){return t.text?{type:"text",text:t.text,googleThoughtSignature:t.thoughtSignature}:t.functionCall?{type:"tool_call",name:t.functionCall.name,arguments:t.functionCall.args,id:`call_${Math.random().toString(36).substring(2,15)}`,googleThoughtSignature:t.thoughtSignature}:null}function vI(t){if(t.role==="user")return[{role:"user",parts:[{text:t.content}]}];if(t.role==="assistant"){let e=[],r=[];for(let n of t.content){if(n.type==="text"){e.push({text:n.text,thoughtSignature:n.googleThoughtSignature});continue}n.type==="tool_call"&&(e.push({functionCall:{name:n.name,args:n.arguments},thoughtSignature:n.googleThoughtSignature}),n.result&&r.push(...yI(n,n.result)))}return t.toolError&&r.push({role:"user",parts:[{text:t.toolError}]}),[{role:"model",parts:e},...r]}throw new Error(`Unsupported message role: ${t.role}`)}function yI(t,e){let r={},n=[],o=[];for(let i of e.content)i.type==="text"?n.push(i.text):i.type==="image"&&o.push({inline_data:{mime_type:i.mimeType,data:i.data}});n.length>0&&(r.result=n.join(`
|
|
39
|
+
`));let s=[{role:"function",parts:[{functionResponse:{name:t.name,response:r}}]}];return o.length>0&&s.push({role:"user",parts:o}),s}var wI=t=>`
|
|
33
40
|
### System instructions
|
|
34
41
|
|
|
35
|
-
${
|
|
42
|
+
${t}
|
|
36
43
|
|
|
37
44
|
### Tool calling instructions
|
|
38
45
|
- Make sure every message contains a tool call.
|
|
39
46
|
- When you use a tool, you may provide a brief thought or explanation in the content field
|
|
40
47
|
immediately before the tool_call. Do not split this into separate messages.
|
|
41
48
|
- Every reply must include a tool call.
|
|
42
|
-
`});var
|
|
43
|
-
`).map(
|
|
44
|
-
`);
|
|
45
|
-
`)}
|
|
46
|
-
`),
|
|
47
|
-
`)),(
|
|
48
|
-
`),lastMessage:
|
|
49
|
-
`);
|
|
50
|
-
`);
|
|
51
|
-
|
|
52
|
-
Please try to recover and complete the task.`;
|
|
49
|
+
`});var i0=$(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.getProvider=SI;var bI=t0(),xI=r0(),$I=n0(),kI=s0();function SI(t){if(t==="openai")return new bI.OpenAI;if(t==="github")return new xI.Github;if(t==="anthropic")return new $I.Anthropic;if(t==="google")return new kI.Google;throw new Error(`Unknown loop LLM: ${t}`)}});var u0=$(ws=>{"use strict";var zI=ws&&ws.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ws,"__esModule",{value:!0});ws.cachedComplete=TI;var EI=zI(require("crypto"));async function TI(t,e,r,n){var c;if(!r)return await t.complete(e,n);let o=r.secrets||{},s=a0(e,o),i=PI(JSON.stringify(s));if(!process.env.LOWIRE_NO_CACHE&&r.input[i])return r.output[i]=r.input[i],c0((c=r.input[i])!=null?c:r.output[i],o);if(!process.env.LOWIRE_NO_CACHE&&r.output[i])return c0(r.output[i],o);if(process.env.LOWIRE_FORCE_CACHE)throw new Error("Cache missing but TL_FORCE_CACHE is set"+JSON.stringify(e,null,2));let a=await t.complete(e,n);return r.output[i]=a0(a,o),a}function a0(t,e){let r=JSON.stringify(t);for(let[n,o]of Object.entries(e))r=r.replaceAll(o,`<${n}>`);return JSON.parse(r)}function c0(t,e){let r=JSON.stringify(t);for(let[n,o]of Object.entries(e))r=r.replaceAll(`<${n}>`,o);return JSON.parse(r)}function PI(t){let e=EI.default.createHash("sha1");return e.update(t),e.digest("hex")}});var gd=$(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.jsxs=void 0;bs.jsx=l0;function l0(t,e){let{children:r,...n}=e||{},o=Object.entries(n),s=(Array.isArray(r)?r.flat():r?[r]:[]).filter(a=>a&&!!a.trim()),i=[`${t}:`];for(let[a,c]of o)i.push(` ${a}: ${c}`);for(let a of s){let c=a.split(`
|
|
50
|
+
`).map(u=>` ${u}`).join(`
|
|
51
|
+
`);i.push(c)}return i.join(`
|
|
52
|
+
`)}bs.jsxs=l0});var p0=$(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.summarizeConversation=RI;var rn=gd(),d0=gd();function RI(t,e,r){var a,c,u,l,d;let n=["## Task",t],o={},s=e.messages.filter(p=>p.role==="assistant");for(let p=0;p<s.length-1;++p){p===0&&(n.push(""),n.push("## History")),n.push("");let f=s[p].content.filter(m=>m.type==="text").map(m=>m.text).join(`
|
|
53
|
+
`),g=s[p].content.filter(m=>m.type==="tool_call");for(let m of g)if(m.result)for(let[_,w]of Object.entries(((a=m.result._meta)==null?void 0:a["dev.lowire/state"])||{}))o[_]=w;let v=s[p];n.push((0,rn.jsxs)("step",{turn:p+1,children:[(0,rn.jsx)("title",{children:f}),g.map(m=>(0,rn.jsxs)("tool-call",{children:[(0,rn.jsx)("name",{children:m.name}),Object.keys(m.arguments).length>0&&(0,rn.jsx)("arguments",{children:Object.entries(m.arguments).map(([_,w])=>(0,d0.jsx)(_,{children:[JSON.stringify(w)]}))})]})),g.map(m=>{var _,w;return((w=(_=m.result)==null?void 0:_._meta)==null?void 0:w["dev.lowire/history"])||[]}).flat().map(m=>(0,d0.jsx)(m.category,{children:[m.content]})),v.toolError&&(0,rn.jsx)("error",{children:v.toolError})]}))}let i=s[s.length-1];if(i)for(let p of i.content.filter(f=>f.type==="tool_call"))for(let f of Object.keys(((u=(c=p.result)==null?void 0:c._meta)==null?void 0:u["dev.lowire/state"])||{}))delete o[f];for(let[p,f]of Object.entries(o))n.push(""),n.push((0,rn.jsx)("state",{name:p,children:f}));return(l=r.debug)==null||l.call(r,"lowire:summary")(n.join(`
|
|
54
|
+
`)),(d=r.debug)==null||d.call(r,"lowire:summary")(JSON.stringify(i,null,2)),{summary:n.join(`
|
|
55
|
+
`),lastMessage:i}}});var f0=$(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.Loop=void 0;var II=i0(),OI=u0(),CI=p0(),yd=class{constructor(e,r){Ye(this,"_provider");Ye(this,"_loopOptions");Ye(this,"_cacheOutput",{});this._provider=(0,II.getProvider)(e),this._loopOptions=r}async run(e,r={}){var u;let n={...this._loopOptions,...r},o=[...n.tools||[]];o.push({name:"report_result",description:"Report the result of the task.",inputSchema:(u=n.resultSchema)!=null?u:NI});let s={systemPrompt:jI,messages:[{role:"user",content:e}],tools:o},i=n.debug,a={input:0,output:0};i==null||i("lowire:loop")(`Starting ${this._provider.name} loop`,e);let c=n.maxTurns||100;for(let l=0;l<c;++l){i==null||i("lowire:loop")(`Turn ${l+1} of (max ${c})`);let d=n.cache?{input:n.cache.messages,output:this._cacheOutput,secrets:n.cache.secrets}:void 0,p=n.summarize?this._summarizeConversation(e,s,n):s;i==null||i("lowire:loop")("Request",JSON.stringify({...p,tools:`${p.tools.length} tools`},null,2));let{result:f,usage:g}=await(0,OI.cachedComplete)(this._provider,p,d,n),v=f.content.filter(_=>_.type==="text").map(_=>_.text).join(`
|
|
56
|
+
`);i==null||i("lowire:loop")("Usage",`input: ${g.input}, output: ${g.output}`),i==null||i("lowire:loop")("Assistant",v,JSON.stringify(f.content,null,2)),a.input+=g.input,a.output+=g.output,s.messages.push(f);let m=f.content.filter(_=>_.type==="tool_call");if(m.length===0){f.toolError='Error: tool call is expected in every assistant message. Call the "report_result" tool when the task is complete.';continue}for(let _ of m){let{name:w,arguments:b}=_;if(i==null||i("lowire:loop")("Call tool",w,JSON.stringify(b,null,2)),w==="report_result")return b;try{let E=await n.callTool({name:w,arguments:{...b,_meta:{"dev.lowire/history":!0,"dev.lowire/state":!0}}}),P=E.content.filter(X=>X.type==="text").map(X=>X.text).join(`
|
|
57
|
+
`);i==null||i("lowire:loop")("Tool result",P,JSON.stringify(E,null,2)),_.result=E}catch(E){let P=`Error while executing tool "${w}": ${E instanceof Error?E.message:String(E)}
|
|
58
|
+
|
|
59
|
+
Please try to recover and complete the task.`;i==null||i("lowire:loop")("Tool error",P,String(E)),_.result={content:[{type:"text",text:P}],isError:!0};for(let X of m.slice(m.indexOf(_)+1))X.result={content:[{type:"text",text:"This tool call is skipped due to previous error."}],isError:!0};break}}}if(n.summarize)return this._summarizeConversation(e,s,n);throw new Error("Failed to perform step, max attempts reached")}_summarizeConversation(e,r,n){let{summary:o,lastMessage:s}=(0,CI.summarizeConversation)(e,r,n);return{...r,messages:[{role:"user",content:o},...s?[s]:[]]}}cache(){return this._cacheOutput}};ma.Loop=yd;var NI={type:"object",properties:{result:{type:"string"}},required:["result"]},jI=`
|
|
53
60
|
You are an autonomous agent designed to complete tasks by interacting with tools. Perform the user task.
|
|
54
|
-
`});var Zs=D(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getParsedType=we.ZodParsedType=we.objectUtil=we.util=void 0;var Wi;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{let n={};for(let o of a)n[o]=o;return n},r.getValidEnumValues=a=>{let n=r.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),o={};for(let i of n)o[i]=a[i];return r.objectValues(o)},r.objectValues=a=>r.objectKeys(a).map(function(n){return a[n]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let n=[];for(let o in a)Object.prototype.hasOwnProperty.call(a,o)&&n.push(o);return n},r.find=(a,n)=>{for(let o of a)if(n(o))return o},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}r.joinValues=s,r.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(Wi||(we.util=Wi={}));var Ah;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ah||(we.objectUtil=Ah={}));we.ZodParsedType=Wi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Yy=r=>{switch(typeof r){case"undefined":return we.ZodParsedType.undefined;case"string":return we.ZodParsedType.string;case"number":return Number.isNaN(r)?we.ZodParsedType.nan:we.ZodParsedType.number;case"boolean":return we.ZodParsedType.boolean;case"function":return we.ZodParsedType.function;case"bigint":return we.ZodParsedType.bigint;case"symbol":return we.ZodParsedType.symbol;case"object":return Array.isArray(r)?we.ZodParsedType.array:r===null?we.ZodParsedType.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?we.ZodParsedType.promise:typeof Map!="undefined"&&r instanceof Map?we.ZodParsedType.map:typeof Set!="undefined"&&r instanceof Set?we.ZodParsedType.set:typeof Date!="undefined"&&r instanceof Date?we.ZodParsedType.date:we.ZodParsedType.object;default:return we.ZodParsedType.unknown}};we.getParsedType=Yy});var eo=D(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.ZodError=Sr.quotelessJson=Sr.ZodIssueCode=void 0;var Nh=Zs();Sr.ZodIssueCode=Nh.util.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 Xy=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");Sr.quotelessJson=Xy;var Us=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(n){return n.message},s={_errors:[]},a=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],c++}}};return a(this),s}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,Nh.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let a of this.issues)if(a.path.length>0){let n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Sr.ZodError=Us;Us.create=r=>new Us(r)});var Qi=D(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});var We=eo(),na=Zs(),e0=(r,e)=>{let t;switch(r.code){case We.ZodIssueCode.invalid_type:r.received===na.ZodParsedType.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case We.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,na.util.jsonStringifyReplacer)}`;break;case We.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${na.util.joinValues(r.keys,", ")}`;break;case We.ZodIssueCode.invalid_union:t="Invalid input";break;case We.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${na.util.joinValues(r.options)}`;break;case We.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${na.util.joinValues(r.options)}, received '${r.received}'`;break;case We.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case We.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case We.ZodIssueCode.invalid_date:t="Invalid date";break;case We.ZodIssueCode.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}"`:na.util.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case We.ZodIssueCode.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==="bigint"?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 We.ZodIssueCode.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 We.ZodIssueCode.custom:t="Invalid input";break;case We.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case We.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case We.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,na.util.assertNever(r)}return{message:t}};Gi.default=e0});var to=D(xr=>{"use strict";var t0=xr&&xr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xr,"__esModule",{value:!0});xr.defaultErrorMap=void 0;xr.setErrorMap=r0;xr.getErrorMap=a0;var $h=t0(Qi());xr.defaultErrorMap=$h.default;var jh=$h.default;function r0(r){jh=r}function a0(){return jh}});var Yi=D(be=>{"use strict";var s0=be&&be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(be,"__esModule",{value:!0});be.isAsync=be.isValid=be.isDirty=be.isAborted=be.OK=be.DIRTY=be.INVALID=be.ParseStatus=be.EMPTY_PATH=be.makeIssue=void 0;be.addIssueToContext=i0;var n0=to(),Dh=s0(Qi()),o0=r=>{let{data:e,path:t,errorMaps:s,issueData:a}=r,n=[...t,...a.path||[]],o={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let i="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)i=l(o,{data:e,defaultError:i}).message;return{...a,path:n,message:i}};be.makeIssue=o0;be.EMPTY_PATH=[];function i0(r,e){let t=(0,n0.getErrorMap)(),s=(0,be.makeIssue)({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Dh.default?void 0:Dh.default].filter(a=>!!a)});r.common.issues.push(s)}var Ki=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 s=[];for(let a of t){if(a.status==="aborted")return be.INVALID;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let a of t){let n=await a.key,o=await a.value;s.push({key:n,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let a of t){let{key:n,value:o}=a;if(n.status==="aborted"||o.status==="aborted")return be.INVALID;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||a.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}};be.ParseStatus=Ki;be.INVALID=Object.freeze({status:"aborted"});var l0=r=>({status:"dirty",value:r});be.DIRTY=l0;var c0=r=>({status:"valid",value:r});be.OK=c0;var u0=r=>r.status==="aborted";be.isAborted=u0;var d0=r=>r.status==="dirty";be.isDirty=d0;var h0=r=>r.status==="valid";be.isValid=h0;var f0=r=>typeof Promise!="undefined"&&r instanceof Promise;be.isAsync=f0});var Mh=D(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0})});var qh=D(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.errorUtil=void 0;var Lh;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Lh||(ro.errorUtil=Lh={}))});var Yh=D(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.discriminatedUnion=E.date=E.boolean=E.bigint=E.array=E.any=E.coerce=E.ZodFirstPartyTypeKind=E.late=E.ZodSchema=E.Schema=E.ZodReadonly=E.ZodPipeline=E.ZodBranded=E.BRAND=E.ZodNaN=E.ZodCatch=E.ZodDefault=E.ZodNullable=E.ZodOptional=E.ZodTransformer=E.ZodEffects=E.ZodPromise=E.ZodNativeEnum=E.ZodEnum=E.ZodLiteral=E.ZodLazy=E.ZodFunction=E.ZodSet=E.ZodMap=E.ZodRecord=E.ZodTuple=E.ZodIntersection=E.ZodDiscriminatedUnion=E.ZodUnion=E.ZodObject=E.ZodArray=E.ZodVoid=E.ZodNever=E.ZodUnknown=E.ZodAny=E.ZodNull=E.ZodUndefined=E.ZodSymbol=E.ZodDate=E.ZodBoolean=E.ZodBigInt=E.ZodNumber=E.ZodString=E.ZodType=void 0;E.NEVER=E.void=E.unknown=E.union=E.undefined=E.tuple=E.transformer=E.symbol=E.string=E.strictObject=E.set=E.record=E.promise=E.preprocess=E.pipeline=E.ostring=E.optional=E.onumber=E.oboolean=E.object=E.number=E.nullable=E.null=E.never=E.nativeEnum=E.nan=E.map=E.literal=E.lazy=E.intersection=E.instanceof=E.function=E.enum=E.effect=void 0;E.datetimeRegex=Hh;E.custom=Jh;var z=eo(),ao=to(),Q=qh(),P=Yi(),q=Zs(),wt=class{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}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}},Zh=(r,e)=>{if((0,P.isValid)(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 z.ZodError(r.common.issues);return this._error=t,this._error}}};function ae(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,i)=>{var l,d;let{message:c}=r;return o.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(l=c!=null?c:s)!=null?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(d=c!=null?c:t)!=null?d:i.defaultError}},description:a}}var se=class{get description(){return this._def.description}_getType(e){return(0,q.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,q.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,q.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,P.isAsync)(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t==null?void 0:t.async)!=null?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,q.getParsedType)(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Zh(s,a)}"~validate"(e){var s,a;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,q.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return(0,P.isValid)(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>(0,P.isValid)(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,q.getParsedType)(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await((0,P.isAsync)(a)?a:Promise.resolve(a));return Zh(s,n)}refine(e,t){let s=a=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{let o=e(a),i=()=>n.addIssue({code:z.ZodIssueCode.custom,...s(a)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new ft({schema:this,typeName:te.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 xt.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return or.create(this)}promise(){return Pr.create(this,this._def)}or(e){return ha.create([this,e],this._def)}and(e){return fa.create(this,e,this._def)}transform(e){return new ft({...ae(this._def),schema:this,typeName:te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new _a({...ae(this._def),innerType:this,defaultValue:t,typeName:te.ZodDefault})}brand(){return new Fs({typeName:te.ZodBranded,type:this,...ae(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ya({...ae(this._def),innerType:this,catchValue:t,typeName:te.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vs.create(this,e)}readonly(){return ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};E.ZodType=se;E.Schema=se;E.ZodSchema=se;var p0=/^c[^\s-]{8,}$/i,m0=/^[0-9a-z]+$/,v0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g0=/^[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,_0=/^[a-z0-9_-]{21}$/i,y0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,b0=/^[-+]?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)?)??$/,S0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,x0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Xi,w0=/^(?:(?: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])$/,E0=/^(?:(?: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])$/,P0=/^(([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]))$/,R0=/^(([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])$/,T0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,C0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fh="((\\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])))",I0=new RegExp(`^${Fh}$`);function Vh(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 O0(r){return new RegExp(`^${Vh(r)}$`)}function Hh(r){let e=`${Fh}T${Vh(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 k0(r,e){return!!((e==="v4"||!e)&&w0.test(r)||(e==="v6"||!e)&&P0.test(r))}function A0(r,e){if(!y0.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function N0(r,e){return!!((e==="v4"||!e)&&E0.test(r)||(e==="v6"||!e)&&R0.test(r))}var wr=class r extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.ZodParsedType.string){let n=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(n,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.string,received:n.parsedType}),P.INVALID}let s=new P.ParseStatus,a;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(a=this._getOrReturnCtx(e,a),o?(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")S0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"email",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Xi||(Xi=new RegExp(x0,"u")),Xi.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"emoji",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")g0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"uuid",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")_0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"nanoid",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")p0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"cuid",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")m0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"cuid2",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")v0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"ulid",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"url",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"regex",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Hh(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?I0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?O0(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?b0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"duration",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?k0(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"ip",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?A0(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"jwt",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?N0(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"cidr",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?T0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"base64",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?C0.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{validation:"base64url",code:z.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):q.util.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:z.ZodIssueCode.invalid_string,...Q.errorUtil.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errorUtil.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1,...Q.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...Q.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Q.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Q.errorUtil.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Q.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Q.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Q.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Q.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Q.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,Q.errorUtil.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}};E.ZodString=wr;wr.create=r=>{var e;return new wr({checks:[],typeName:te.ZodString,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1,...ae(r)})};function $0(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return n%o/10**a}var oa=class r extends se{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.ZodParsedType.number){let n=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(n,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.number,received:n.parsedType}),P.INVALID}let s,a=new P.ParseStatus;for(let n of this._def.checks)n.kind==="int"?q.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?$0(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.not_finite,message:n.message}),a.dirty()):q.util.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Q.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Q.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Q.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Q.errorUtil.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Q.errorUtil.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Q.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Q.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.errorUtil.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"&&q.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};E.ZodNumber=oa;oa.create=r=>new oa({checks:[],typeName:te.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ae(r)});var ia=class r extends se{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.ZodParsedType.bigint)return this._getInvalidInput(e);let s,a=new P.ParseStatus;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):q.util.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.bigint,received:t.parsedType}),P.INVALID}gte(e,t){return this.setLimit("min",e,!0,Q.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Q.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Q.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Q.errorUtil.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Q.errorUtil.toString(a)}]})}_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:Q.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Q.errorUtil.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}};E.ZodBigInt=ia;ia.create=r=>{var e;return new ia({checks:[],typeName:te.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1,...ae(r)})};var la=class extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.ZodParsedType.boolean){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.boolean,received:s.parsedType}),P.INVALID}return(0,P.OK)(e.data)}};E.ZodBoolean=la;la.create=r=>new la({typeName:te.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ae(r)});var ca=class r extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.ZodParsedType.date){let n=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(n,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.date,received:n.parsedType}),P.INVALID}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(n,{code:z.ZodIssueCode.invalid_date}),P.INVALID}let s=new P.ParseStatus,a;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),(0,P.addIssueToContext)(a,{code:z.ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):q.util.assertNever(n);return{status:s.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:Q.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Q.errorUtil.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}};E.ZodDate=ca;ca.create=r=>new ca({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:te.ZodDate,...ae(r)});var Qa=class extends se{_parse(e){if(this._getType(e)!==q.ZodParsedType.symbol){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.symbol,received:s.parsedType}),P.INVALID}return(0,P.OK)(e.data)}};E.ZodSymbol=Qa;Qa.create=r=>new Qa({typeName:te.ZodSymbol,...ae(r)});var ua=class extends se{_parse(e){if(this._getType(e)!==q.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.undefined,received:s.parsedType}),P.INVALID}return(0,P.OK)(e.data)}};E.ZodUndefined=ua;ua.create=r=>new ua({typeName:te.ZodUndefined,...ae(r)});var da=class extends se{_parse(e){if(this._getType(e)!==q.ZodParsedType.null){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.null,received:s.parsedType}),P.INVALID}return(0,P.OK)(e.data)}};E.ZodNull=da;da.create=r=>new da({typeName:te.ZodNull,...ae(r)});var Er=class extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,P.OK)(e.data)}};E.ZodAny=Er;Er.create=r=>new Er({typeName:te.ZodAny,...ae(r)});var nr=class extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,P.OK)(e.data)}};E.ZodUnknown=nr;nr.create=r=>new nr({typeName:te.ZodUnknown,...ae(r)});var Ot=class extends se{_parse(e){let t=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.never,received:t.parsedType}),P.INVALID}};E.ZodNever=Ot;Ot.create=r=>new Ot({typeName:te.ZodNever,...ae(r)});var Ka=class extends se{_parse(e){if(this._getType(e)!==q.ZodParsedType.undefined){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.void,received:s.parsedType}),P.INVALID}return(0,P.OK)(e.data)}};E.ZodVoid=Ka;Ka.create=r=>new Ka({typeName:te.ZodVoid,...ae(r)});var or=class r extends se{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==q.ZodParsedType.array)return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.array,received:t.parsedType}),P.INVALID;if(a.exactLength!==null){let o=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(o||i)&&((0,P.addIssueToContext)(t,{code:o?z.ZodIssueCode.too_big:z.ZodIssueCode.too_small,minimum:i?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,P.addIssueToContext)(t,{code:z.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,P.addIssueToContext)(t,{code:z.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>a.type._parseAsync(new wt(t,o,t.path,i)))).then(o=>P.ParseStatus.mergeArray(s,o));let n=[...t.data].map((o,i)=>a.type._parseSync(new wt(t,o,t.path,i)));return P.ParseStatus.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Q.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Q.errorUtil.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Q.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};E.ZodArray=or;or.create=(r,e)=>new or({type:r,minLength:null,maxLength:null,exactLength:null,typeName:te.ZodArray,...ae(e)});function Ga(r){if(r instanceof ot){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=xt.create(Ga(s))}return new ot({...r._def,shape:()=>e})}else return r instanceof or?new or({...r._def,type:Ga(r.element)}):r instanceof xt?xt.create(Ga(r.unwrap())):r instanceof Ut?Ut.create(Ga(r.unwrap())):r instanceof Zt?Zt.create(r.items.map(e=>Ga(e))):r}var ot=class r extends se{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=q.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(l,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.object,received:l.parsedType}),P.INVALID}let{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ot&&this._def.unknownKeys==="strip"))for(let l in a.data)o.includes(l)||i.push(l);let c=[];for(let l of o){let d=n[l],m=a.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new wt(a,m,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof Ot){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of i)c.push({key:{status:"valid",value:d},value:{status:"valid",value:a.data[d]}});else if(l==="strict")i.length>0&&((0,P.addIssueToContext)(a,{code:z.ZodIssueCode.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of i){let m=a.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new wt(a,m,a.path,d)),alwaysSet:d in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of c){let m=await d.key,v=await d.value;l.push({key:m,value:v,alwaysSet:d.alwaysSet})}return l}).then(l=>P.ParseStatus.mergeObjectSync(s,l)):P.ParseStatus.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return Q.errorUtil.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,i,c;let a=(i=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(c=Q.errorUtil.errToObj(e).message)!=null?c:a}:{message:a}}}:{}})}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:te.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of q.util.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of q.util.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return Ga(this)}partial(e){let t={};for(let s of q.util.objectKeys(this.shape)){let a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of q.util.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof xt;)n=n._def.innerType;t[s]=n}return new r({...this._def,shape:()=>t})}keyof(){return Bh(q.util.objectKeys(this.shape))}};E.ZodObject=ot;ot.create=(r,e)=>new ot({shape:()=>r,unknownKeys:"strip",catchall:Ot.create(),typeName:te.ZodObject,...ae(e)});ot.strictCreate=(r,e)=>new ot({shape:()=>r,unknownKeys:"strict",catchall:Ot.create(),typeName:te.ZodObject,...ae(e)});ot.lazycreate=(r,e)=>new ot({shape:r,unknownKeys:"strip",catchall:Ot.create(),typeName:te.ZodObject,...ae(e)});var ha=class extends se{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new z.ZodError(i.ctx.common.issues));return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_union,unionErrors:o}),P.INVALID}if(t.common.async)return Promise.all(s.map(async n=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(a);{let n,o=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},d=c._parseSync({data:t.data,path:t.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(c=>new z.ZodError(c));return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_union,unionErrors:i}),P.INVALID}}get options(){return this._def.options}};E.ZodUnion=ha;ha.create=(r,e)=>new ha({options:r,typeName:te.ZodUnion,...ae(e)});var sr=r=>r instanceof pa?sr(r.schema):r instanceof ft?sr(r.innerType()):r instanceof ma?[r.value]:r instanceof va?r.options:r instanceof ga?q.util.objectValues(r.enum):r instanceof _a?sr(r._def.innerType):r instanceof ua?[void 0]:r instanceof da?[null]:r instanceof xt?[void 0,...sr(r.unwrap())]:r instanceof Ut?[null,...sr(r.unwrap())]:r instanceof Fs||r instanceof ba?sr(r.unwrap()):r instanceof ya?sr(r._def.innerType):[],so=class r extends se{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.ZodParsedType.object)return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.object,received:t.parsedType}),P.INVALID;let s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):((0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),P.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let a=new Map;for(let n of t){let o=sr(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new r({typeName:te.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...ae(s)})}};E.ZodDiscriminatedUnion=so;function el(r,e){let t=(0,q.getParsedType)(r),s=(0,q.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===q.ZodParsedType.object&&s===q.ZodParsedType.object){let a=q.util.objectKeys(e),n=q.util.objectKeys(r).filter(i=>a.indexOf(i)!==-1),o={...r,...e};for(let i of n){let c=el(r[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(t===q.ZodParsedType.array&&s===q.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};let a=[];for(let n=0;n<r.length;n++){let o=r[n],i=e[n],c=el(o,i);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return t===q.ZodParsedType.date&&s===q.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var fa=class extends se{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=(n,o)=>{if((0,P.isAborted)(n)||(0,P.isAborted)(o))return P.INVALID;let i=el(n.value,o.value);return i.valid?(((0,P.isDirty)(n)||(0,P.isDirty)(o))&&t.dirty(),{status:t.value,value:i.data}):((0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_intersection_types}),P.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>a(n,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};E.ZodIntersection=fa;fa.create=(r,e,t)=>new fa({left:r,right:e,typeName:te.ZodIntersection,...ae(t)});var Zt=class r extends se{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==q.ZodParsedType.array)return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.array,received:s.parsedType}),P.INVALID;if(s.data.length<this._def.items.length)return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new wt(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>P.ParseStatus.mergeArray(t,o)):P.ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};E.ZodTuple=Zt;Zt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zt({items:r,typeName:te.ZodTuple,rest:null,...ae(e)})};var no=class r extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==q.ZodParsedType.object)return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.object,received:s.parsedType}),P.INVALID;let a=[],n=this._def.keyType,o=this._def.valueType;for(let i in s.data)a.push({key:n._parse(new wt(s,i,s.path,i)),value:o._parse(new wt(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?P.ParseStatus.mergeObjectAsync(t,a):P.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof se?new r({keyType:e,valueType:t,typeName:te.ZodRecord,...ae(s)}):new r({keyType:wr.create(),valueType:e,typeName:te.ZodRecord,...ae(t)})}};E.ZodRecord=no;var Ya=class extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==q.ZodParsedType.map)return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.map,received:s.parsedType}),P.INVALID;let a=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,c],l)=>({key:a._parse(new wt(s,i,s.path,[l,"key"])),value:n._parse(new wt(s,c,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return P.INVALID;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),i.set(l.value,d.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let c of o){let l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return P.INVALID;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),i.set(l.value,d.value)}return{status:t.value,value:i}}}};E.ZodMap=Ya;Ya.create=(r,e,t)=>new Ya({valueType:e,keyType:r,typeName:te.ZodMap,...ae(t)});var Xa=class r extends se{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==q.ZodParsedType.set)return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.set,received:s.parsedType}),P.INVALID;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&((0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&((0,P.addIssueToContext)(s,{code:z.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let n=this._def.valueType;function o(c){let l=new Set;for(let d of c){if(d.status==="aborted")return P.INVALID;d.status==="dirty"&&t.dirty(),l.add(d.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((c,l)=>n._parse(new wt(s,c,s.path,l)));return s.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:Q.errorUtil.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Q.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};E.ZodSet=Xa;Xa.create=(r,e)=>new Xa({valueType:r,minSize:null,maxSize:null,typeName:te.ZodSet,...ae(e)});var oo=class r extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.ZodParsedType.function)return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.function,received:t.parsedType}),P.INVALID;function s(i,c){return(0,P.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ao.getErrorMap)(),ao.defaultErrorMap].filter(l=>!!l),issueData:{code:z.ZodIssueCode.invalid_arguments,argumentsError:c}})}function a(i,c){return(0,P.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ao.getErrorMap)(),ao.defaultErrorMap].filter(l=>!!l),issueData:{code:z.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Pr){let i=this;return(0,P.OK)(async function(...c){let l=new z.ZodError([]),d=await i._def.args.parseAsync(c,n).catch(p=>{throw l.addIssue(s(c,p)),l}),m=await Reflect.apply(o,this,d);return await i._def.returns._def.type.parseAsync(m,n).catch(p=>{throw l.addIssue(a(m,p)),l})})}else{let i=this;return(0,P.OK)(function(...c){let l=i._def.args.safeParse(c,n);if(!l.success)throw new z.ZodError([s(c,l.error)]);let d=Reflect.apply(o,this,l.data),m=i._def.returns.safeParse(d,n);if(!m.success)throw new z.ZodError([a(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Zt.create(e).rest(nr.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,s){return new r({args:e||Zt.create([]).rest(nr.create()),returns:t||nr.create(),typeName:te.ZodFunction,...ae(s)})}};E.ZodFunction=oo;var pa=class extends se{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})}};E.ZodLazy=pa;pa.create=(r,e)=>new pa({getter:r,typeName:te.ZodLazy,...ae(e)});var ma=class extends se{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(t,{received:t.data,code:z.ZodIssueCode.invalid_literal,expected:this._def.value}),P.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};E.ZodLiteral=ma;ma.create=(r,e)=>new ma({value:r,typeName:te.ZodLiteral,...ae(e)});function Bh(r,e){return new va({values:r,typeName:te.ZodEnum,...ae(e)})}var va=class r extends se{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return(0,P.addIssueToContext)(t,{expected:q.util.joinValues(s),received:t.parsedType,code:z.ZodIssueCode.invalid_type}),P.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return(0,P.addIssueToContext)(t,{received:t.data,code:z.ZodIssueCode.invalid_enum_value,options:s}),P.INVALID}return(0,P.OK)(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(s=>!e.includes(s)),{...this._def,...t})}};E.ZodEnum=va;va.create=Bh;var ga=class extends se{_parse(e){let t=q.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==q.ZodParsedType.string&&s.parsedType!==q.ZodParsedType.number){let a=q.util.objectValues(t);return(0,P.addIssueToContext)(s,{expected:q.util.joinValues(a),received:s.parsedType,code:z.ZodIssueCode.invalid_type}),P.INVALID}if(this._cache||(this._cache=new Set(q.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=q.util.objectValues(t);return(0,P.addIssueToContext)(s,{received:s.data,code:z.ZodIssueCode.invalid_enum_value,options:a}),P.INVALID}return(0,P.OK)(e.data)}get enum(){return this._def.values}};E.ZodNativeEnum=ga;ga.create=(r,e)=>new ga({values:r,typeName:te.ZodNativeEnum,...ae(e)});var Pr=class extends se{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.ZodParsedType.promise&&t.common.async===!1)return(0,P.addIssueToContext)(t,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.promise,received:t.parsedType}),P.INVALID;let s=t.parsedType===q.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,P.OK)(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};E.ZodPromise=Pr;Pr.create=(r,e)=>new Pr({type:r,typeName:te.ZodPromise,...ae(e)});var ft=class extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:o=>{(0,P.addIssueToContext)(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){let o=a.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return P.INVALID;let c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?P.INVALID:c.status==="dirty"||t.value==="dirty"?(0,P.DIRTY)(c.value):c});{if(t.value==="aborted")return P.INVALID;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?P.INVALID:i.status==="dirty"||t.value==="dirty"?(0,P.DIRTY)(i.value):i}}if(a.type==="refinement"){let o=i=>{let c=a.refinement(i,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?P.INVALID:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?P.INVALID:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,P.isValid)(o))return P.INVALID;let i=a.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>(0,P.isValid)(o)?Promise.resolve(a.transform(o.value,n)).then(i=>({status:t.value,value:i})):P.INVALID);q.util.assertNever(a)}};E.ZodEffects=ft;E.ZodTransformer=ft;ft.create=(r,e,t)=>new ft({schema:r,typeName:te.ZodEffects,effect:e,...ae(t)});ft.createWithPreprocess=(r,e,t)=>new ft({schema:e,effect:{type:"preprocess",transform:r},typeName:te.ZodEffects,...ae(t)});var xt=class extends se{_parse(e){return this._getType(e)===q.ZodParsedType.undefined?(0,P.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.ZodOptional=xt;xt.create=(r,e)=>new xt({innerType:r,typeName:te.ZodOptional,...ae(e)});var Ut=class extends se{_parse(e){return this._getType(e)===q.ZodParsedType.null?(0,P.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.ZodNullable=Ut;Ut.create=(r,e)=>new Ut({innerType:r,typeName:te.ZodNullable,...ae(e)});var _a=class extends se{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===q.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};E.ZodDefault=_a;_a.create=(r,e)=>new _a({innerType:r,typeName:te.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var ya=class extends se{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,P.isAsync)(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new z.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new z.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};E.ZodCatch=ya;ya.create=(r,e)=>new ya({innerType:r,typeName:te.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var es=class extends se{_parse(e){if(this._getType(e)!==q.ZodParsedType.nan){let s=this._getOrReturnCtx(e);return(0,P.addIssueToContext)(s,{code:z.ZodIssueCode.invalid_type,expected:q.ZodParsedType.nan,received:s.parsedType}),P.INVALID}return{status:"valid",value:e.data}}};E.ZodNaN=es;es.create=r=>new es({typeName:te.ZodNaN,...ae(r)});E.BRAND=Symbol("zod_brand");var Fs=class extends se{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};E.ZodBranded=Fs;var Vs=class r extends se{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?P.INVALID:n.status==="dirty"?(t.dirty(),(0,P.DIRTY)(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?P.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:te.ZodPipeline})}};E.ZodPipeline=Vs;var ba=class extends se{_parse(e){let t=this._def.innerType._parse(e),s=a=>((0,P.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,P.isAsync)(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}};E.ZodReadonly=ba;ba.create=(r,e)=>new ba({innerType:r,typeName:te.ZodReadonly,...ae(e)});function Uh(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Jh(r,e={},t){return r?Er.create().superRefine((s,a)=>{var o,i;let n=r(s);if(n instanceof Promise)return n.then(c=>{var l,d;if(!c){let m=Uh(e,s),v=(d=(l=m.fatal)!=null?l:t)!=null?d:!0;a.addIssue({code:"custom",...m,fatal:v})}});if(!n){let c=Uh(e,s),l=(i=(o=c.fatal)!=null?o:t)!=null?i:!0;a.addIssue({code:"custom",...c,fatal:l})}}):Er.create()}E.late={object:ot.lazycreate};var te;(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"})(te||(E.ZodFirstPartyTypeKind=te={}));var j0=(r,e={message:`Input not instance of ${r.name}`})=>Jh(t=>t instanceof r,e);E.instanceof=j0;var Wh=wr.create;E.string=Wh;var Gh=oa.create;E.number=Gh;var D0=es.create;E.nan=D0;var z0=ia.create;E.bigint=z0;var Qh=la.create;E.boolean=Qh;var M0=ca.create;E.date=M0;var L0=Qa.create;E.symbol=L0;var q0=ua.create;E.undefined=q0;var Z0=da.create;E.null=Z0;var U0=Er.create;E.any=U0;var F0=nr.create;E.unknown=F0;var V0=Ot.create;E.never=V0;var H0=Ka.create;E.void=H0;var B0=or.create;E.array=B0;var J0=ot.create;E.object=J0;var W0=ot.strictCreate;E.strictObject=W0;var G0=ha.create;E.union=G0;var Q0=so.create;E.discriminatedUnion=Q0;var K0=fa.create;E.intersection=K0;var Y0=Zt.create;E.tuple=Y0;var X0=no.create;E.record=X0;var eb=Ya.create;E.map=eb;var tb=Xa.create;E.set=tb;var rb=oo.create;E.function=rb;var ab=pa.create;E.lazy=ab;var sb=ma.create;E.literal=sb;var nb=va.create;E.enum=nb;var ob=ga.create;E.nativeEnum=ob;var ib=Pr.create;E.promise=ib;var Kh=ft.create;E.effect=Kh;E.transformer=Kh;var lb=xt.create;E.optional=lb;var cb=Ut.create;E.nullable=cb;var ub=ft.createWithPreprocess;E.preprocess=ub;var db=Vs.create;E.pipeline=db;var hb=()=>Wh().optional();E.ostring=hb;var fb=()=>Gh().optional();E.onumber=fb;var pb=()=>Qh().optional();E.oboolean=pb;E.coerce={string:(r=>wr.create({...r,coerce:!0})),number:(r=>oa.create({...r,coerce:!0})),boolean:(r=>la.create({...r,coerce:!0})),bigint:(r=>ia.create({...r,coerce:!0})),date:(r=>ca.create({...r,coerce:!0}))};E.NEVER=P.INVALID});var tl=D(Et=>{"use strict";var mb=Et&&Et.__createBinding||(Object.create?(function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}):(function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]})),ts=Et&&Et.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&mb(e,r,t)};Object.defineProperty(Et,"__esModule",{value:!0});ts(to(),Et);ts(Yi(),Et);ts(Mh(),Et);ts(Zs(),Et);ts(Yh(),Et);ts(eo(),Et)});var tf=D(it=>{"use strict";var Xh=it&&it.__createBinding||(Object.create?(function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}):(function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]})),vb=it&&it.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),gb=it&&it.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Xh(e,r,t);return vb(e,r),e},_b=it&&it.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xh(e,r,t)};Object.defineProperty(it,"__esModule",{value:!0});it.z=void 0;var ef=gb(tl());it.z=ef;_b(tl(),it);it.default=ef});var Bs=D(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.UnsubscribeRequestSchema=h.SubscribeRequestSchema=h.ResourceListChangedNotificationSchema=h.ReadResourceResultSchema=h.ReadResourceRequestSchema=h.ListResourceTemplatesResultSchema=h.ListResourceTemplatesRequestSchema=h.ListResourcesResultSchema=h.ListResourcesRequestSchema=h.ResourceTemplateSchema=h.ResourceSchema=h.BlobResourceContentsSchema=h.TextResourceContentsSchema=h.ResourceContentsSchema=h.PaginatedResultSchema=h.PaginatedRequestSchema=h.ProgressNotificationSchema=h.ProgressSchema=h.PingRequestSchema=h.isInitializedNotification=h.InitializedNotificationSchema=h.InitializeResultSchema=h.ServerCapabilitiesSchema=h.isInitializeRequest=h.InitializeRequestSchema=h.ClientCapabilitiesSchema=h.ImplementationSchema=h.BaseMetadataSchema=h.CancelledNotificationSchema=h.EmptyResultSchema=h.JSONRPCMessageSchema=h.isJSONRPCError=h.JSONRPCErrorSchema=h.ErrorCode=h.isJSONRPCResponse=h.JSONRPCResponseSchema=h.isJSONRPCNotification=h.JSONRPCNotificationSchema=h.isJSONRPCRequest=h.JSONRPCRequestSchema=h.RequestIdSchema=h.ResultSchema=h.NotificationSchema=h.RequestSchema=h.CursorSchema=h.ProgressTokenSchema=h.JSONRPC_VERSION=h.SUPPORTED_PROTOCOL_VERSIONS=h.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=h.LATEST_PROTOCOL_VERSION=void 0;h.ClientResultSchema=h.ClientNotificationSchema=h.ClientRequestSchema=h.RootsListChangedNotificationSchema=h.ListRootsResultSchema=h.ListRootsRequestSchema=h.RootSchema=h.CompleteResultSchema=h.CompleteRequestSchema=h.PromptReferenceSchema=h.ResourceReferenceSchema=h.ResourceTemplateReferenceSchema=h.ElicitResultSchema=h.ElicitRequestSchema=h.PrimitiveSchemaDefinitionSchema=h.EnumSchemaSchema=h.NumberSchemaSchema=h.StringSchemaSchema=h.BooleanSchemaSchema=h.CreateMessageResultSchema=h.CreateMessageRequestSchema=h.SamplingMessageSchema=h.ModelPreferencesSchema=h.ModelHintSchema=h.LoggingMessageNotificationSchema=h.SetLevelRequestSchema=h.LoggingLevelSchema=h.ToolListChangedNotificationSchema=h.CallToolRequestSchema=h.CompatibilityCallToolResultSchema=h.CallToolResultSchema=h.ListToolsResultSchema=h.ListToolsRequestSchema=h.ToolSchema=h.ToolAnnotationsSchema=h.PromptListChangedNotificationSchema=h.GetPromptResultSchema=h.PromptMessageSchema=h.ContentBlockSchema=h.ResourceLinkSchema=h.EmbeddedResourceSchema=h.AudioContentSchema=h.ImageContentSchema=h.TextContentSchema=h.GetPromptRequestSchema=h.ListPromptsResultSchema=h.ListPromptsRequestSchema=h.PromptSchema=h.PromptArgumentSchema=h.ResourceUpdatedNotificationSchema=void 0;h.McpError=h.ServerResultSchema=h.ServerNotificationSchema=h.ServerRequestSchema=void 0;var f=tf();h.LATEST_PROTOCOL_VERSION="2025-06-18";h.DEFAULT_NEGOTIATED_PROTOCOL_VERSION="2025-03-26";h.SUPPORTED_PROTOCOL_VERSIONS=[h.LATEST_PROTOCOL_VERSION,"2025-03-26","2024-11-05","2024-10-07"];h.JSONRPC_VERSION="2.0";h.ProgressTokenSchema=f.z.union([f.z.string(),f.z.number().int()]);h.CursorSchema=f.z.string();var yb=f.z.object({progressToken:f.z.optional(h.ProgressTokenSchema)}).passthrough(),Pt=f.z.object({_meta:f.z.optional(yb)}).passthrough();h.RequestSchema=f.z.object({method:f.z.string(),params:f.z.optional(Pt)});var Hs=f.z.object({_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.NotificationSchema=f.z.object({method:f.z.string(),params:f.z.optional(Hs)});h.ResultSchema=f.z.object({_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.RequestIdSchema=f.z.union([f.z.string(),f.z.number().int()]);h.JSONRPCRequestSchema=f.z.object({jsonrpc:f.z.literal(h.JSONRPC_VERSION),id:h.RequestIdSchema}).merge(h.RequestSchema).strict();var bb=r=>h.JSONRPCRequestSchema.safeParse(r).success;h.isJSONRPCRequest=bb;h.JSONRPCNotificationSchema=f.z.object({jsonrpc:f.z.literal(h.JSONRPC_VERSION)}).merge(h.NotificationSchema).strict();var Sb=r=>h.JSONRPCNotificationSchema.safeParse(r).success;h.isJSONRPCNotification=Sb;h.JSONRPCResponseSchema=f.z.object({jsonrpc:f.z.literal(h.JSONRPC_VERSION),id:h.RequestIdSchema,result:h.ResultSchema}).strict();var xb=r=>h.JSONRPCResponseSchema.safeParse(r).success;h.isJSONRPCResponse=xb;var rf;(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"})(rf||(h.ErrorCode=rf={}));h.JSONRPCErrorSchema=f.z.object({jsonrpc:f.z.literal(h.JSONRPC_VERSION),id:h.RequestIdSchema,error:f.z.object({code:f.z.number().int(),message:f.z.string(),data:f.z.optional(f.z.unknown())})}).strict();var wb=r=>h.JSONRPCErrorSchema.safeParse(r).success;h.isJSONRPCError=wb;h.JSONRPCMessageSchema=f.z.union([h.JSONRPCRequestSchema,h.JSONRPCNotificationSchema,h.JSONRPCResponseSchema,h.JSONRPCErrorSchema]);h.EmptyResultSchema=h.ResultSchema.strict();h.CancelledNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/cancelled"),params:Hs.extend({requestId:h.RequestIdSchema,reason:f.z.string().optional()})});h.BaseMetadataSchema=f.z.object({name:f.z.string(),title:f.z.optional(f.z.string())}).passthrough();h.ImplementationSchema=h.BaseMetadataSchema.extend({version:f.z.string()});h.ClientCapabilitiesSchema=f.z.object({experimental:f.z.optional(f.z.object({}).passthrough()),sampling:f.z.optional(f.z.object({}).passthrough()),elicitation:f.z.optional(f.z.object({}).passthrough()),roots:f.z.optional(f.z.object({listChanged:f.z.optional(f.z.boolean())}).passthrough())}).passthrough();h.InitializeRequestSchema=h.RequestSchema.extend({method:f.z.literal("initialize"),params:Pt.extend({protocolVersion:f.z.string(),capabilities:h.ClientCapabilitiesSchema,clientInfo:h.ImplementationSchema})});var Eb=r=>h.InitializeRequestSchema.safeParse(r).success;h.isInitializeRequest=Eb;h.ServerCapabilitiesSchema=f.z.object({experimental:f.z.optional(f.z.object({}).passthrough()),logging:f.z.optional(f.z.object({}).passthrough()),completions:f.z.optional(f.z.object({}).passthrough()),prompts:f.z.optional(f.z.object({listChanged:f.z.optional(f.z.boolean())}).passthrough()),resources:f.z.optional(f.z.object({subscribe:f.z.optional(f.z.boolean()),listChanged:f.z.optional(f.z.boolean())}).passthrough()),tools:f.z.optional(f.z.object({listChanged:f.z.optional(f.z.boolean())}).passthrough())}).passthrough();h.InitializeResultSchema=h.ResultSchema.extend({protocolVersion:f.z.string(),capabilities:h.ServerCapabilitiesSchema,serverInfo:h.ImplementationSchema,instructions:f.z.optional(f.z.string())});h.InitializedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/initialized")});var Pb=r=>h.InitializedNotificationSchema.safeParse(r).success;h.isInitializedNotification=Pb;h.PingRequestSchema=h.RequestSchema.extend({method:f.z.literal("ping")});h.ProgressSchema=f.z.object({progress:f.z.number(),total:f.z.optional(f.z.number()),message:f.z.optional(f.z.string())}).passthrough();h.ProgressNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/progress"),params:Hs.merge(h.ProgressSchema).extend({progressToken:h.ProgressTokenSchema})});h.PaginatedRequestSchema=h.RequestSchema.extend({params:Pt.extend({cursor:f.z.optional(h.CursorSchema)}).optional()});h.PaginatedResultSchema=h.ResultSchema.extend({nextCursor:f.z.optional(h.CursorSchema)});h.ResourceContentsSchema=f.z.object({uri:f.z.string(),mimeType:f.z.optional(f.z.string()),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.TextResourceContentsSchema=h.ResourceContentsSchema.extend({text:f.z.string()});var al=f.z.string().refine(r=>{try{return atob(r),!0}catch{return!1}},{message:"Invalid Base64 string"});h.BlobResourceContentsSchema=h.ResourceContentsSchema.extend({blob:al});h.ResourceSchema=h.BaseMetadataSchema.extend({uri:f.z.string(),description:f.z.optional(f.z.string()),mimeType:f.z.optional(f.z.string()),_meta:f.z.optional(f.z.object({}).passthrough())});h.ResourceTemplateSchema=h.BaseMetadataSchema.extend({uriTemplate:f.z.string(),description:f.z.optional(f.z.string()),mimeType:f.z.optional(f.z.string()),_meta:f.z.optional(f.z.object({}).passthrough())});h.ListResourcesRequestSchema=h.PaginatedRequestSchema.extend({method:f.z.literal("resources/list")});h.ListResourcesResultSchema=h.PaginatedResultSchema.extend({resources:f.z.array(h.ResourceSchema)});h.ListResourceTemplatesRequestSchema=h.PaginatedRequestSchema.extend({method:f.z.literal("resources/templates/list")});h.ListResourceTemplatesResultSchema=h.PaginatedResultSchema.extend({resourceTemplates:f.z.array(h.ResourceTemplateSchema)});h.ReadResourceRequestSchema=h.RequestSchema.extend({method:f.z.literal("resources/read"),params:Pt.extend({uri:f.z.string()})});h.ReadResourceResultSchema=h.ResultSchema.extend({contents:f.z.array(f.z.union([h.TextResourceContentsSchema,h.BlobResourceContentsSchema]))});h.ResourceListChangedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/resources/list_changed")});h.SubscribeRequestSchema=h.RequestSchema.extend({method:f.z.literal("resources/subscribe"),params:Pt.extend({uri:f.z.string()})});h.UnsubscribeRequestSchema=h.RequestSchema.extend({method:f.z.literal("resources/unsubscribe"),params:Pt.extend({uri:f.z.string()})});h.ResourceUpdatedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/resources/updated"),params:Hs.extend({uri:f.z.string()})});h.PromptArgumentSchema=f.z.object({name:f.z.string(),description:f.z.optional(f.z.string()),required:f.z.optional(f.z.boolean())}).passthrough();h.PromptSchema=h.BaseMetadataSchema.extend({description:f.z.optional(f.z.string()),arguments:f.z.optional(f.z.array(h.PromptArgumentSchema)),_meta:f.z.optional(f.z.object({}).passthrough())});h.ListPromptsRequestSchema=h.PaginatedRequestSchema.extend({method:f.z.literal("prompts/list")});h.ListPromptsResultSchema=h.PaginatedResultSchema.extend({prompts:f.z.array(h.PromptSchema)});h.GetPromptRequestSchema=h.RequestSchema.extend({method:f.z.literal("prompts/get"),params:Pt.extend({name:f.z.string(),arguments:f.z.optional(f.z.record(f.z.string()))})});h.TextContentSchema=f.z.object({type:f.z.literal("text"),text:f.z.string(),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.ImageContentSchema=f.z.object({type:f.z.literal("image"),data:al,mimeType:f.z.string(),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.AudioContentSchema=f.z.object({type:f.z.literal("audio"),data:al,mimeType:f.z.string(),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.EmbeddedResourceSchema=f.z.object({type:f.z.literal("resource"),resource:f.z.union([h.TextResourceContentsSchema,h.BlobResourceContentsSchema]),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.ResourceLinkSchema=h.ResourceSchema.extend({type:f.z.literal("resource_link")});h.ContentBlockSchema=f.z.union([h.TextContentSchema,h.ImageContentSchema,h.AudioContentSchema,h.ResourceLinkSchema,h.EmbeddedResourceSchema]);h.PromptMessageSchema=f.z.object({role:f.z.enum(["user","assistant"]),content:h.ContentBlockSchema}).passthrough();h.GetPromptResultSchema=h.ResultSchema.extend({description:f.z.optional(f.z.string()),messages:f.z.array(h.PromptMessageSchema)});h.PromptListChangedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/prompts/list_changed")});h.ToolAnnotationsSchema=f.z.object({title:f.z.optional(f.z.string()),readOnlyHint:f.z.optional(f.z.boolean()),destructiveHint:f.z.optional(f.z.boolean()),idempotentHint:f.z.optional(f.z.boolean()),openWorldHint:f.z.optional(f.z.boolean())}).passthrough();h.ToolSchema=h.BaseMetadataSchema.extend({description:f.z.optional(f.z.string()),inputSchema:f.z.object({type:f.z.literal("object"),properties:f.z.optional(f.z.object({}).passthrough()),required:f.z.optional(f.z.array(f.z.string()))}).passthrough(),outputSchema:f.z.optional(f.z.object({type:f.z.literal("object"),properties:f.z.optional(f.z.object({}).passthrough()),required:f.z.optional(f.z.array(f.z.string()))}).passthrough()),annotations:f.z.optional(h.ToolAnnotationsSchema),_meta:f.z.optional(f.z.object({}).passthrough())});h.ListToolsRequestSchema=h.PaginatedRequestSchema.extend({method:f.z.literal("tools/list")});h.ListToolsResultSchema=h.PaginatedResultSchema.extend({tools:f.z.array(h.ToolSchema)});h.CallToolResultSchema=h.ResultSchema.extend({content:f.z.array(h.ContentBlockSchema).default([]),structuredContent:f.z.object({}).passthrough().optional(),isError:f.z.optional(f.z.boolean())});h.CompatibilityCallToolResultSchema=h.CallToolResultSchema.or(h.ResultSchema.extend({toolResult:f.z.unknown()}));h.CallToolRequestSchema=h.RequestSchema.extend({method:f.z.literal("tools/call"),params:Pt.extend({name:f.z.string(),arguments:f.z.optional(f.z.record(f.z.unknown()))})});h.ToolListChangedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/tools/list_changed")});h.LoggingLevelSchema=f.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]);h.SetLevelRequestSchema=h.RequestSchema.extend({method:f.z.literal("logging/setLevel"),params:Pt.extend({level:h.LoggingLevelSchema})});h.LoggingMessageNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/message"),params:Hs.extend({level:h.LoggingLevelSchema,logger:f.z.optional(f.z.string()),data:f.z.unknown()})});h.ModelHintSchema=f.z.object({name:f.z.string().optional()}).passthrough();h.ModelPreferencesSchema=f.z.object({hints:f.z.optional(f.z.array(h.ModelHintSchema)),costPriority:f.z.optional(f.z.number().min(0).max(1)),speedPriority:f.z.optional(f.z.number().min(0).max(1)),intelligencePriority:f.z.optional(f.z.number().min(0).max(1))}).passthrough();h.SamplingMessageSchema=f.z.object({role:f.z.enum(["user","assistant"]),content:f.z.union([h.TextContentSchema,h.ImageContentSchema,h.AudioContentSchema])}).passthrough();h.CreateMessageRequestSchema=h.RequestSchema.extend({method:f.z.literal("sampling/createMessage"),params:Pt.extend({messages:f.z.array(h.SamplingMessageSchema),systemPrompt:f.z.optional(f.z.string()),includeContext:f.z.optional(f.z.enum(["none","thisServer","allServers"])),temperature:f.z.optional(f.z.number()),maxTokens:f.z.number().int(),stopSequences:f.z.optional(f.z.array(f.z.string())),metadata:f.z.optional(f.z.object({}).passthrough()),modelPreferences:f.z.optional(h.ModelPreferencesSchema)})});h.CreateMessageResultSchema=h.ResultSchema.extend({model:f.z.string(),stopReason:f.z.optional(f.z.enum(["endTurn","stopSequence","maxTokens"]).or(f.z.string())),role:f.z.enum(["user","assistant"]),content:f.z.discriminatedUnion("type",[h.TextContentSchema,h.ImageContentSchema,h.AudioContentSchema])});h.BooleanSchemaSchema=f.z.object({type:f.z.literal("boolean"),title:f.z.optional(f.z.string()),description:f.z.optional(f.z.string()),default:f.z.optional(f.z.boolean())}).passthrough();h.StringSchemaSchema=f.z.object({type:f.z.literal("string"),title:f.z.optional(f.z.string()),description:f.z.optional(f.z.string()),minLength:f.z.optional(f.z.number()),maxLength:f.z.optional(f.z.number()),format:f.z.optional(f.z.enum(["email","uri","date","date-time"]))}).passthrough();h.NumberSchemaSchema=f.z.object({type:f.z.enum(["number","integer"]),title:f.z.optional(f.z.string()),description:f.z.optional(f.z.string()),minimum:f.z.optional(f.z.number()),maximum:f.z.optional(f.z.number())}).passthrough();h.EnumSchemaSchema=f.z.object({type:f.z.literal("string"),title:f.z.optional(f.z.string()),description:f.z.optional(f.z.string()),enum:f.z.array(f.z.string()),enumNames:f.z.optional(f.z.array(f.z.string()))}).passthrough();h.PrimitiveSchemaDefinitionSchema=f.z.union([h.BooleanSchemaSchema,h.StringSchemaSchema,h.NumberSchemaSchema,h.EnumSchemaSchema]);h.ElicitRequestSchema=h.RequestSchema.extend({method:f.z.literal("elicitation/create"),params:Pt.extend({message:f.z.string(),requestedSchema:f.z.object({type:f.z.literal("object"),properties:f.z.record(f.z.string(),h.PrimitiveSchemaDefinitionSchema),required:f.z.optional(f.z.array(f.z.string()))}).passthrough()})});h.ElicitResultSchema=h.ResultSchema.extend({action:f.z.enum(["accept","decline","cancel"]),content:f.z.optional(f.z.record(f.z.string(),f.z.unknown()))});h.ResourceTemplateReferenceSchema=f.z.object({type:f.z.literal("ref/resource"),uri:f.z.string()}).passthrough();h.ResourceReferenceSchema=h.ResourceTemplateReferenceSchema;h.PromptReferenceSchema=f.z.object({type:f.z.literal("ref/prompt"),name:f.z.string()}).passthrough();h.CompleteRequestSchema=h.RequestSchema.extend({method:f.z.literal("completion/complete"),params:Pt.extend({ref:f.z.union([h.PromptReferenceSchema,h.ResourceTemplateReferenceSchema]),argument:f.z.object({name:f.z.string(),value:f.z.string()}).passthrough(),context:f.z.optional(f.z.object({arguments:f.z.optional(f.z.record(f.z.string(),f.z.string()))}))})});h.CompleteResultSchema=h.ResultSchema.extend({completion:f.z.object({values:f.z.array(f.z.string()).max(100),total:f.z.optional(f.z.number().int()),hasMore:f.z.optional(f.z.boolean())}).passthrough()});h.RootSchema=f.z.object({uri:f.z.string().startsWith("file://"),name:f.z.optional(f.z.string()),_meta:f.z.optional(f.z.object({}).passthrough())}).passthrough();h.ListRootsRequestSchema=h.RequestSchema.extend({method:f.z.literal("roots/list")});h.ListRootsResultSchema=h.ResultSchema.extend({roots:f.z.array(h.RootSchema)});h.RootsListChangedNotificationSchema=h.NotificationSchema.extend({method:f.z.literal("notifications/roots/list_changed")});h.ClientRequestSchema=f.z.union([h.PingRequestSchema,h.InitializeRequestSchema,h.CompleteRequestSchema,h.SetLevelRequestSchema,h.GetPromptRequestSchema,h.ListPromptsRequestSchema,h.ListResourcesRequestSchema,h.ListResourceTemplatesRequestSchema,h.ReadResourceRequestSchema,h.SubscribeRequestSchema,h.UnsubscribeRequestSchema,h.CallToolRequestSchema,h.ListToolsRequestSchema]);h.ClientNotificationSchema=f.z.union([h.CancelledNotificationSchema,h.ProgressNotificationSchema,h.InitializedNotificationSchema,h.RootsListChangedNotificationSchema]);h.ClientResultSchema=f.z.union([h.EmptyResultSchema,h.CreateMessageResultSchema,h.ElicitResultSchema,h.ListRootsResultSchema]);h.ServerRequestSchema=f.z.union([h.PingRequestSchema,h.CreateMessageRequestSchema,h.ElicitRequestSchema,h.ListRootsRequestSchema]);h.ServerNotificationSchema=f.z.union([h.CancelledNotificationSchema,h.ProgressNotificationSchema,h.LoggingMessageNotificationSchema,h.ResourceUpdatedNotificationSchema,h.ResourceListChangedNotificationSchema,h.ToolListChangedNotificationSchema,h.PromptListChangedNotificationSchema]);h.ServerResultSchema=f.z.union([h.EmptyResultSchema,h.InitializeResultSchema,h.CompleteResultSchema,h.GetPromptResultSchema,h.ListPromptsResultSchema,h.ListResourcesResultSchema,h.ListResourceTemplatesResultSchema,h.ReadResourceResultSchema,h.CallToolResultSchema,h.ListToolsResultSchema]);var rl=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};h.McpError=rl});var af=D(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Protocol=Rr.DEFAULT_REQUEST_TIMEOUT_MSEC=void 0;Rr.mergeCapabilities=Rb;var Fe=Bs();Rr.DEFAULT_REQUEST_TIMEOUT_MSEC=6e4;var sl=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.setNotificationHandler(Fe.CancelledNotificationSchema,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(Fe.ProgressNotificationSchema,t=>{this._onprogress(t)}),this.setRequestHandler(Fe.PingRequestSchema,t=>({}))}_setupTimeout(e,t,s,a,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Fe.McpError(Fe.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});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){var t,s,a;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};let o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};let i=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(c,l)=>{i==null||i(c,l),(0,Fe.isJSONRPCResponse)(c)||(0,Fe.isJSONRPCError)(c)?this._onresponse(c):(0,Fe.isJSONRPCRequest)(c)?this._onrequest(c,l):(0,Fe.isJSONRPCNotification)(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Fe.McpError(Fe.ErrorCode.ConnectionClosed,"Connection closed");for(let a of t.values())a(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){var s,a;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(n===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:Fe.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let c={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,d,m)=>this.request(l,d,{...m,relatedRequestId:e.id}),authInfo:t==null?void 0:t.authInfo,requestId:e.id,requestInfo:t==null?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,c)).then(l=>{if(!i.signal.aborted)return o==null?void 0:o.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var d;if(!i.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Fe.ErrorCode.InternalError,message:(d=l.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,a=Number(t),n=this._progressHandlers.get(a);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(a),i=this._timeoutInfo.get(a);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(c){o(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===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),(0,Fe.isJSONRPCResponse)(e))s(e);else{let a=new Fe.McpError(e.error.code,e.error.message,e.error.data);s(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((i,c)=>{var l,d,m,v,p,b;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=s==null?void 0:s.signal)===null||d===void 0||d.throwIfAborted();let y=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:y};s!=null&&s.onprogress&&(this._progressHandlers.set(y,s.onprogress),_.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:y}});let w=O=>{var k;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(O)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),c(O)};this._responseHandlers.set(y,O=>{var k;if(!(!((k=s==null?void 0:s.signal)===null||k===void 0)&&k.aborted)){if(O instanceof Error)return c(O);try{let A=t.parse(O.result);i(A)}catch(A){c(A)}}}),(v=s==null?void 0:s.signal)===null||v===void 0||v.addEventListener("abort",()=>{var O;w((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let C=(p=s==null?void 0:s.timeout)!==null&&p!==void 0?p:Rr.DEFAULT_REQUEST_TIMEOUT_MSEC,I=()=>w(new Fe.McpError(Fe.ErrorCode.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(y,C,s==null?void 0:s.maxTotalTimeout,I,(b=s==null?void 0:s.resetTimeoutOnProgress)!==null&&b!==void 0?b:!1),this._transport.send(_,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(y),c(O)})})}async notification(e,t){var s,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!(t!=null&&t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,t).catch(d=>this._onerror(d))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>Promise.resolve(t(e.parse(a),n)))}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,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};Rr.Protocol=sl;function Rb(r,e){return Object.entries(e).reduce((t,[s,a])=>(a&&typeof a=="object"?t[s]=t[s]?{...t[s],...a}:a:t[s]=a,t),{...r})}});var nf=D(rs=>{"use strict";var Tb=rs&&rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rs,"__esModule",{value:!0});rs.Client=void 0;var sf=af(),Ae=Bs(),Cb=Tb(An()),nl=class extends sf.Protocol{constructor(e,t){var s;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._ajv=new Cb.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=(0,sf.mergeCapabilities)(this._capabilities,e)}assertCapability(e,t){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[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 s=await this.request({method:"initialize",params:{protocolVersion:Ae.LATEST_PROTOCOL_VERSION,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ae.InitializeResultSchema,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ae.SUPPORTED_PROTOCOL_VERSIONS.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,s,a,n,o;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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.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(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.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 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"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"ping":break}}async ping(e){return this.request({method:"ping"},Ae.EmptyResultSchema,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Ae.CompleteResultSchema,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},Ae.EmptyResultSchema,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ae.GetPromptResultSchema,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ae.ListPromptsResultSchema,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Ae.ListResourcesResultSchema,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ae.ListResourceTemplatesResultSchema,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ae.ReadResourceResultSchema,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},Ae.EmptyResultSchema,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},Ae.EmptyResultSchema,t)}async callTool(e,t=Ae.CallToolResultSchema,s){let a=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!a.structuredContent&&!a.isError)throw new Ae.McpError(Ae.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!n(a.structuredContent))throw new Ae.McpError(Ae.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof Ae.McpError?o:new Ae.McpError(Ae.ErrorCode.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let s=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let s=await this.request({method:"tools/list",params:e},Ae.ListToolsResultSchema,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};rs.Client=nl});var lf=D(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.ReadBuffer=void 0;as.deserializeMessage=of;as.serializeMessage=Ob;var Ib=Bs(),ol=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
55
|
-
`)
|
|
56
|
-
`}});var hf=D(Ft=>{"use strict";var uf=Ft&&Ft.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.StdioClientTransport=Ft.DEFAULT_INHERITED_ENV_VARS=void 0;Ft.getDefaultEnvironment=df;var kb=uf(Mi()),io=uf(require("node:process")),Ab=require("node:stream"),cf=lf();Ft.DEFAULT_INHERITED_ENV_VARS=io.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function df(){let r={};for(let e of Ft.DEFAULT_INHERITED_ENV_VARS){let t=io.default.env[e];t!==void 0&&(t.startsWith("()")||(r[e]=t))}return r}var il=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new cf.ReadBuffer,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new Ab.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{var s,a,n,o,i;this._process=(0,kb.default)(this._serverParams.command,(s=this._serverParams.args)!==null&&s!==void 0?s:[],{env:{...df(),...this._serverParams.env},stdio:["pipe","pipe",(a=this._serverParams.stderr)!==null&&a!==void 0?a:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:io.default.platform==="win32"&&Nb(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var l,d;if(c.name==="AbortError"){(l=this.onclose)===null||l===void 0||l.call(this);return}t(c),(d=this.onerror)===null||d===void 0||d.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var l;this._process=void 0,(l=this.onclose)===null||l===void 0||l.call(this)}),(n=this._process.stdin)===null||n===void 0||n.on("error",c=>{var l;(l=this.onerror)===null||l===void 0||l.call(this,c)}),(o=this._process.stdout)===null||o===void 0||o.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(i=this._process.stdout)===null||i===void 0||i.on("error",c=>{var l;(l=this.onerror)===null||l===void 0||l.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,t;return this._stderrStream?this._stderrStream:(t=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&t!==void 0?t:null}get pid(){var e,t;return(t=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&t!==void 0?t:null}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(t=>{var s;if(!(!((s=this._process)===null||s===void 0)&&s.stdin))throw new Error("Not connected");let a=(0,cf.serializeMessage)(e);this._process.stdin.write(a)?t():this._process.stdin.once("drain",t)})}};Ft.StdioClientTransport=il;function Nb(){return"type"in io.default}});var ff=D(kt=>{"use strict";var $b=kt&&kt.__createBinding||(Object.create?(function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}):(function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]})),jb=kt&&kt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ll=kt&&kt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var s=[];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[s.length]=a);return s},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var s=r(e),a=0;a<s.length;a++)s[a]!=="default"&&$b(t,e,s[a]);return jb(t,e),t}})(),Db=kt&&kt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(kt,"__esModule",{value:!0});kt.createMcpTools=qb;var zb=Db(require("url"));async function Mb(r,e){let{Client:t}=await Promise.resolve().then(()=>ll(nf())),{StdioClientTransport:s}=await Promise.resolve().then(()=>ll(hf())),{ListRootsRequestSchema:a}=await Promise.resolve().then(()=>ll(Bs())),n=new s(r),o={};e!=null&&e.rootDir&&(o.roots={});let i=new t({name:"test",version:"1.0.0"},{capabilities:o});return e!=null&&e.rootDir&&i.setRequestHandler(a,async()=>({roots:[{name:"workspace",uri:zb.default.pathToFileURL(e.rootDir).toString()}]})),await i.connect(n),i}async function Lb(r,e){let t=await Mb(r,e),{tools:s}=await t.listTools();return{tools:e!=null&&e.toolFilter?s.filter(o=>e.toolFilter.some(i=>typeof i=="string"?o.name===i:i.test(o.name))):s,callTool:async o=>await t.callTool({name:o.name,arguments:o.arguments}),close:()=>t.close()}}async function qb(r,e){let t=[],s=new Map,a=[];for(let[n,o]of Object.entries(r)){let{tools:i,callTool:c,close:l}=await Lb(o,e);for(let d of i){let m=`${n}__${d.name}`;t.push({...d,name:m}),s.set(m,v=>c({name:d.name,arguments:v.arguments}))}a.push(l)}return{close:async()=>{await Promise.all(a.map(n=>n()))},tools:t,callTool:async n=>{let o=s.get(n.name);if(!o)throw new Error(`Tool not found: ${n.name}`);return o(n)}}}});var Gb={};Rl(Gb,{CallToolRequestSchema:()=>Ao,Client:()=>Nn,ListRootsRequestSchema:()=>zo,ListToolsRequestSchema:()=>Oo,Loop:()=>Vt.Loop,PingRequestSchema:()=>Ma,ProgressNotificationSchema:()=>La,SSEClientTransport:()=>qn,SSEServerTransport:()=>Un,Server:()=>$n,StdioClientTransport:()=>Hn,StdioServerTransport:()=>Bn,StreamableHTTPClientTransport:()=>Gn,StreamableHTTPServerTransport:()=>Jn,z:()=>u,zodToJsonSchema:()=>fl});module.exports=gp(Gb);var u={};Rl(u,{BRAND:()=>Fp,DIRTY:()=>Nr,EMPTY_PATH:()=>Sp,INVALID:()=>X,NEVER:()=>Tm,OK:()=>Be,ParseStatus:()=>Ue,Schema:()=>oe,ZodAny:()=>dr,ZodArray:()=>Xt,ZodBigInt:()=>jr,ZodBoolean:()=>Dr,ZodBranded:()=>fs,ZodCatch:()=>Jr,ZodDate:()=>zr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>tn,ZodEffects:()=>yt,ZodEnum:()=>Vr,ZodError:()=>tt,ZodFirstPartyTypeKind:()=>$,ZodFunction:()=>an,ZodIntersection:()=>Zr,ZodIssueCode:()=>N,ZodLazy:()=>Ur,ZodLiteral:()=>Fr,ZodMap:()=>$a,ZodNaN:()=>Da,ZodNativeEnum:()=>Hr,ZodNever:()=>Ct,ZodNull:()=>Lr,ZodNullable:()=>Lt,ZodNumber:()=>$r,ZodObject:()=>rt,ZodOptional:()=>gt,ZodParsedType:()=>U,ZodPipeline:()=>ps,ZodPromise:()=>hr,ZodReadonly:()=>Wr,ZodRecord:()=>rn,ZodSchema:()=>oe,ZodSet:()=>ja,ZodString:()=>ur,ZodSymbol:()=>Aa,ZodTransformer:()=>yt,ZodTuple:()=>Mt,ZodType:()=>oe,ZodUndefined:()=>Mr,ZodUnion:()=>qr,ZodUnknown:()=>Yt,ZodVoid:()=>Na,addIssueToContext:()=>Z,any:()=>Yp,array:()=>rm,bigint:()=>Jp,boolean:()=>zl,coerce:()=>Rm,custom:()=>$l,date:()=>Wp,datetimeRegex:()=>Al,defaultErrorMap:()=>Qt,discriminatedUnion:()=>om,effect:()=>_m,enum:()=>mm,function:()=>hm,getErrorMap:()=>Ia,getParsedType:()=>zt,instanceof:()=>Hp,intersection:()=>im,isAborted:()=>Xs,isAsync:()=>Oa,isDirty:()=>en,isValid:()=>cr,late:()=>Vp,lazy:()=>fm,literal:()=>pm,makeIssue:()=>hs,map:()=>um,nan:()=>Bp,nativeEnum:()=>vm,never:()=>em,null:()=>Kp,nullable:()=>bm,number:()=>Dl,object:()=>am,objectUtil:()=>go,oboolean:()=>Pm,onumber:()=>Em,optional:()=>ym,ostring:()=>wm,pipeline:()=>xm,preprocess:()=>Sm,promise:()=>gm,quotelessJson:()=>_p,record:()=>cm,set:()=>dm,setErrorMap:()=>bp,strictObject:()=>sm,string:()=>jl,symbol:()=>Gp,transformer:()=>_m,tuple:()=>lm,undefined:()=>Qp,union:()=>nm,unknown:()=>Xp,util:()=>ce,void:()=>tm});var ce;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{let n={};for(let o of a)n[o]=o;return n},r.getValidEnumValues=a=>{let n=r.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),o={};for(let i of n)o[i]=a[i];return r.objectValues(o)},r.objectValues=a=>r.objectKeys(a).map(function(n){return a[n]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let n=[];for(let o in a)Object.prototype.hasOwnProperty.call(a,o)&&n.push(o);return n},r.find=(a,n)=>{for(let o of a)if(n(o))return o},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}r.joinValues=s,r.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(ce||(ce={}));var go;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(go||(go={}));var U=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zt=r=>{switch(typeof r){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(r)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(r)?U.array:r===null?U.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?U.promise:typeof Map!="undefined"&&r instanceof Map?U.map:typeof Set!="undefined"&&r instanceof Set?U.set:typeof Date!="undefined"&&r instanceof Date?U.date:U.object;default:return U.unknown}};var N=ce.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"]),_p=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),tt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(n){return n.message},s={_errors:[]},a=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],c++}}};return a(this),s}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,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let a of this.issues)if(a.path.length>0){let n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};tt.create=r=>new tt(r);var yp=(r,e)=>{let t;switch(r.code){case N.invalid_type:r.received===U.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case N.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ce.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:t=`Unrecognized key(s) in object: ${ce.joinValues(r.keys,", ")}`;break;case N.invalid_union:t="Invalid input";break;case N.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ce.joinValues(r.options)}`;break;case N.invalid_enum_value:t=`Invalid enum value. Expected ${ce.joinValues(r.options)}, received '${r.received}'`;break;case N.invalid_arguments:t="Invalid function arguments";break;case N.invalid_return_type:t="Invalid function return type";break;case N.invalid_date:t="Invalid date";break;case N.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}"`:ce.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case N.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==="bigint"?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 N.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 N.custom:t="Invalid input";break;case N.invalid_intersection_types:t="Intersection results could not be merged";break;case N.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case N.not_finite:t="Number must be finite";break;default:t=e.defaultError,ce.assertNever(r)}return{message:t}},Qt=yp;var Tl=Qt;function bp(r){Tl=r}function Ia(){return Tl}var hs=r=>{let{data:e,path:t,errorMaps:s,issueData:a}=r,n=[...t,...a.path||[]],o={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let i="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)i=l(o,{data:e,defaultError:i}).message;return{...a,path:n,message:i}},Sp=[];function Z(r,e){let t=Ia(),s=hs({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Qt?void 0:Qt].filter(a=>!!a)});r.common.issues.push(s)}var Ue=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 s=[];for(let a of t){if(a.status==="aborted")return X;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let a of t){let n=await a.key,o=await a.value;s.push({key:n,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let a of t){let{key:n,value:o}=a;if(n.status==="aborted"||o.status==="aborted")return X;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||a.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},X=Object.freeze({status:"aborted"}),Nr=r=>({status:"dirty",value:r}),Be=r=>({status:"valid",value:r}),Xs=r=>r.status==="aborted",en=r=>r.status==="dirty",cr=r=>r.status==="valid",Oa=r=>typeof Promise!="undefined"&&r instanceof Promise;var G;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(G||(G={}));var _t=class{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}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}},Cl=(r,e)=>{if(cr(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 tt(r.common.issues);return this._error=t,this._error}}};function re(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,i)=>{var l,d;let{message:c}=r;return o.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(l=c!=null?c:s)!=null?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(d=c!=null?c:t)!=null?d:i.defaultError}},description:a}}var oe=class{get description(){return this._def.description}_getType(e){return zt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:zt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ue,ctx:{common:e.parent.common,data:e.data,parsedType:zt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Oa(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t==null?void 0:t.async)!=null?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Cl(s,a)}"~validate"(e){var s,a;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return cr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>cr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(Oa(a)?a:Promise.resolve(a));return Cl(s,n)}refine(e,t){let s=a=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{let o=e(a),i=()=>n.addIssue({code:N.custom,...s(a)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new yt({schema:this,typeName:$.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 gt.create(this,this._def)}nullable(){return Lt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xt.create(this)}promise(){return hr.create(this,this._def)}or(e){return qr.create([this,e],this._def)}and(e){return Zr.create(this,e,this._def)}transform(e){return new yt({...re(this._def),schema:this,typeName:$.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...re(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new fs({typeName:$.ZodBranded,type:this,...re(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Jr({...re(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ps.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},xp=/^c[^\s-]{8,}$/i,wp=/^[0-9a-z]+$/,Ep=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Pp=/^[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,Rp=/^[a-z0-9_-]{21}$/i,Tp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Cp=/^[-+]?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)?)??$/,Ip=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Op="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_o,kp=/^(?:(?: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])$/,Ap=/^(?:(?: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])$/,Np=/^(([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]))$/,$p=/^(([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])$/,jp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ol="((\\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])))",zp=new RegExp(`^${Ol}$`);function kl(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 Mp(r){return new RegExp(`^${kl(r)}$`)}function Al(r){let e=`${Ol}T${kl(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 Lp(r,e){return!!((e==="v4"||!e)&&kp.test(r)||(e==="v6"||!e)&&Np.test(r))}function qp(r,e){if(!Tp.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Zp(r,e){return!!((e==="v4"||!e)&&Ap.test(r)||(e==="v6"||!e)&&$p.test(r))}var ur=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let n=this._getOrReturnCtx(e);return Z(n,{code:N.invalid_type,expected:U.string,received:n.parsedType}),X}let s=new Ue,a;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:N.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:N.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(a=this._getOrReturnCtx(e,a),o?Z(a,{code:N.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&Z(a,{code:N.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Ip.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"email",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")_o||(_o=new RegExp(Op,"u")),_o.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"emoji",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Pp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"uuid",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Rp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"nanoid",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")xp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cuid",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")wp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cuid2",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ep.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"ulid",code:N.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),Z(a,{validation:"url",code:N.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"regex",code:N.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Al(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?zp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Mp(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:N.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Cp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"duration",code:N.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Lp(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"ip",code:N.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?qp(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"jwt",code:N.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Zp(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cidr",code:N.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?jp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"base64",code:N.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Dp.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"base64url",code:N.invalid_string,message:n.message}),s.dirty()):ce.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:N.invalid_string,...G.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1,...G.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...G.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...G.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...G.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...G.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...G.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...G.errToObj(t)})}nonempty(e){return this.min(1,G.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}};ur.create=r=>{var e;return new ur({checks:[],typeName:$.ZodString,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1,...re(r)})};function Up(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return n%o/10**a}var $r=class r extends oe{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)!==U.number){let n=this._getOrReturnCtx(e);return Z(n,{code:N.invalid_type,expected:U.number,received:n.parsedType}),X}let s,a=new Ue;for(let n of this._def.checks)n.kind==="int"?ce.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{code:N.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Up(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{code:N.not_finite,message:n.message}),a.dirty()):ce.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,G.toString(t))}gt(e,t){return this.setLimit("min",e,!1,G.toString(t))}lte(e,t){return this.setLimit("max",e,!0,G.toString(t))}lt(e,t){return this.setLimit("max",e,!1,G.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:G.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.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"&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};$r.create=r=>new $r({checks:[],typeName:$.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...re(r)});var jr=class r extends oe{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)!==U.bigint)return this._getInvalidInput(e);let s,a=new Ue;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),Z(s,{code:N.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):ce.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Z(t,{code:N.invalid_type,expected:U.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit("min",e,!0,G.toString(t))}gt(e,t){return this.setLimit("min",e,!1,G.toString(t))}lte(e,t){return this.setLimit("max",e,!0,G.toString(t))}lt(e,t){return this.setLimit("max",e,!1,G.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:G.toString(a)}]})}_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:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:G.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}};jr.create=r=>{var e;return new jr({checks:[],typeName:$.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1,...re(r)})};var Dr=class extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.boolean,received:s.parsedType}),X}return Be(e.data)}};Dr.create=r=>new Dr({typeName:$.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...re(r)});var zr=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let n=this._getOrReturnCtx(e);return Z(n,{code:N.invalid_type,expected:U.date,received:n.parsedType}),X}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Z(n,{code:N.invalid_date}),X}let s=new Ue,a;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:N.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:N.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):ce.assertNever(n);return{status:s.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:G.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:G.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}};zr.create=r=>new zr({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:$.ZodDate,...re(r)});var Aa=class extends oe{_parse(e){if(this._getType(e)!==U.symbol){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.symbol,received:s.parsedType}),X}return Be(e.data)}};Aa.create=r=>new Aa({typeName:$.ZodSymbol,...re(r)});var Mr=class extends oe{_parse(e){if(this._getType(e)!==U.undefined){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.undefined,received:s.parsedType}),X}return Be(e.data)}};Mr.create=r=>new Mr({typeName:$.ZodUndefined,...re(r)});var Lr=class extends oe{_parse(e){if(this._getType(e)!==U.null){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.null,received:s.parsedType}),X}return Be(e.data)}};Lr.create=r=>new Lr({typeName:$.ZodNull,...re(r)});var dr=class extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Be(e.data)}};dr.create=r=>new dr({typeName:$.ZodAny,...re(r)});var Yt=class extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Be(e.data)}};Yt.create=r=>new Yt({typeName:$.ZodUnknown,...re(r)});var Ct=class extends oe{_parse(e){let t=this._getOrReturnCtx(e);return Z(t,{code:N.invalid_type,expected:U.never,received:t.parsedType}),X}};Ct.create=r=>new Ct({typeName:$.ZodNever,...re(r)});var Na=class extends oe{_parse(e){if(this._getType(e)!==U.undefined){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.void,received:s.parsedType}),X}return Be(e.data)}};Na.create=r=>new Na({typeName:$.ZodVoid,...re(r)});var Xt=class r extends oe{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==U.array)return Z(t,{code:N.invalid_type,expected:U.array,received:t.parsedType}),X;if(a.exactLength!==null){let o=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(o||i)&&(Z(t,{code:o?N.too_big:N.too_small,minimum:i?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(Z(t,{code:N.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(Z(t,{code:N.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>a.type._parseAsync(new _t(t,o,t.path,i)))).then(o=>Ue.mergeArray(s,o));let n=[...t.data].map((o,i)=>a.type._parseSync(new _t(t,o,t.path,i)));return Ue.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:G.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:G.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:G.toString(t)}})}nonempty(e){return this.min(1,e)}};Xt.create=(r,e)=>new Xt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...re(e)});function ka(r){if(r instanceof rt){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=gt.create(ka(s))}return new rt({...r._def,shape:()=>e})}else return r instanceof Xt?new Xt({...r._def,type:ka(r.element)}):r instanceof gt?gt.create(ka(r.unwrap())):r instanceof Lt?Lt.create(ka(r.unwrap())):r instanceof Mt?Mt.create(r.items.map(e=>ka(e))):r}var rt=class r extends oe{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=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==U.object){let l=this._getOrReturnCtx(e);return Z(l,{code:N.invalid_type,expected:U.object,received:l.parsedType}),X}let{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ct&&this._def.unknownKeys==="strip"))for(let l in a.data)o.includes(l)||i.push(l);let c=[];for(let l of o){let d=n[l],m=a.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new _t(a,m,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof Ct){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of i)c.push({key:{status:"valid",value:d},value:{status:"valid",value:a.data[d]}});else if(l==="strict")i.length>0&&(Z(a,{code:N.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of i){let m=a.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new _t(a,m,a.path,d)),alwaysSet:d in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of c){let m=await d.key,v=await d.value;l.push({key:m,value:v,alwaysSet:d.alwaysSet})}return l}).then(l=>Ue.mergeObjectSync(s,l)):Ue.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,i,c;let a=(i=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(c=G.errToObj(e).message)!=null?c:a}:{message:a}}}:{}})}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:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of ce.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of ce.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return ka(this)}partial(e){let t={};for(let s of ce.objectKeys(this.shape)){let a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of ce.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof gt;)n=n._def.innerType;t[s]=n}return new r({...this._def,shape:()=>t})}keyof(){return Nl(ce.objectKeys(this.shape))}};rt.create=(r,e)=>new rt({shape:()=>r,unknownKeys:"strip",catchall:Ct.create(),typeName:$.ZodObject,...re(e)});rt.strictCreate=(r,e)=>new rt({shape:()=>r,unknownKeys:"strict",catchall:Ct.create(),typeName:$.ZodObject,...re(e)});rt.lazycreate=(r,e)=>new rt({shape:r,unknownKeys:"strip",catchall:Ct.create(),typeName:$.ZodObject,...re(e)});var qr=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new tt(i.ctx.common.issues));return Z(t,{code:N.invalid_union,unionErrors:o}),X}if(t.common.async)return Promise.all(s.map(async n=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(a);{let n,o=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},d=c._parseSync({data:t.data,path:t.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(c=>new tt(c));return Z(t,{code:N.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};qr.create=(r,e)=>new qr({options:r,typeName:$.ZodUnion,...re(e)});var Kt=r=>r instanceof Ur?Kt(r.schema):r instanceof yt?Kt(r.innerType()):r instanceof Fr?[r.value]:r instanceof Vr?r.options:r instanceof Hr?ce.objectValues(r.enum):r instanceof Br?Kt(r._def.innerType):r instanceof Mr?[void 0]:r instanceof Lr?[null]:r instanceof gt?[void 0,...Kt(r.unwrap())]:r instanceof Lt?[null,...Kt(r.unwrap())]:r instanceof fs||r instanceof Wr?Kt(r.unwrap()):r instanceof Jr?Kt(r._def.innerType):[],tn=class r extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.object)return Z(t,{code:N.invalid_type,expected:U.object,received:t.parsedType}),X;let s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(Z(t,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let a=new Map;for(let n of t){let o=Kt(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new r({typeName:$.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...re(s)})}};function yo(r,e){let t=zt(r),s=zt(e);if(r===e)return{valid:!0,data:r};if(t===U.object&&s===U.object){let a=ce.objectKeys(e),n=ce.objectKeys(r).filter(i=>a.indexOf(i)!==-1),o={...r,...e};for(let i of n){let c=yo(r[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.data}return{valid:!0,data:o}}else if(t===U.array&&s===U.array){if(r.length!==e.length)return{valid:!1};let a=[];for(let n=0;n<r.length;n++){let o=r[n],i=e[n],c=yo(o,i);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return t===U.date&&s===U.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Zr=class extends oe{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=(n,o)=>{if(Xs(n)||Xs(o))return X;let i=yo(n.value,o.value);return i.valid?((en(n)||en(o))&&t.dirty(),{status:t.value,value:i.data}):(Z(s,{code:N.invalid_intersection_types}),X)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>a(n,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Zr.create=(r,e,t)=>new Zr({left:r,right:e,typeName:$.ZodIntersection,...re(t)});var Mt=class r extends oe{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.array)return Z(s,{code:N.invalid_type,expected:U.array,received:s.parsedType}),X;if(s.data.length<this._def.items.length)return Z(s,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&s.data.length>this._def.items.length&&(Z(s,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new _t(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Ue.mergeArray(t,o)):Ue.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Mt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mt({items:r,typeName:$.ZodTuple,rest:null,...re(e)})};var rn=class r extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.object)return Z(s,{code:N.invalid_type,expected:U.object,received:s.parsedType}),X;let a=[],n=this._def.keyType,o=this._def.valueType;for(let i in s.data)a.push({key:n._parse(new _t(s,i,s.path,i)),value:o._parse(new _t(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?Ue.mergeObjectAsync(t,a):Ue.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof oe?new r({keyType:e,valueType:t,typeName:$.ZodRecord,...re(s)}):new r({keyType:ur.create(),valueType:e,typeName:$.ZodRecord,...re(t)})}},$a=class extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.map)return Z(s,{code:N.invalid_type,expected:U.map,received:s.parsedType}),X;let a=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,c],l)=>({key:a._parse(new _t(s,i,s.path,[l,"key"])),value:n._parse(new _t(s,c,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return X;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),i.set(l.value,d.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let c of o){let l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return X;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),i.set(l.value,d.value)}return{status:t.value,value:i}}}};$a.create=(r,e,t)=>new $a({valueType:e,keyType:r,typeName:$.ZodMap,...re(t)});var ja=class r extends oe{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.set)return Z(s,{code:N.invalid_type,expected:U.set,received:s.parsedType}),X;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(Z(s,{code:N.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(Z(s,{code:N.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let n=this._def.valueType;function o(c){let l=new Set;for(let d of c){if(d.status==="aborted")return X;d.status==="dirty"&&t.dirty(),l.add(d.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((c,l)=>n._parse(new _t(s,c,s.path,l)));return s.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,t){return new r({...this._def,minSize:{value:e,message:G.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:G.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ja.create=(r,e)=>new ja({valueType:r,minSize:null,maxSize:null,typeName:$.ZodSet,...re(e)});var an=class r extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.function)return Z(t,{code:N.invalid_type,expected:U.function,received:t.parsedType}),X;function s(i,c){return hs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ia(),Qt].filter(l=>!!l),issueData:{code:N.invalid_arguments,argumentsError:c}})}function a(i,c){return hs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ia(),Qt].filter(l=>!!l),issueData:{code:N.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof hr){let i=this;return Be(async function(...c){let l=new tt([]),d=await i._def.args.parseAsync(c,n).catch(p=>{throw l.addIssue(s(c,p)),l}),m=await Reflect.apply(o,this,d);return await i._def.returns._def.type.parseAsync(m,n).catch(p=>{throw l.addIssue(a(m,p)),l})})}else{let i=this;return Be(function(...c){let l=i._def.args.safeParse(c,n);if(!l.success)throw new tt([s(c,l.error)]);let d=Reflect.apply(o,this,l.data),m=i._def.returns.safeParse(d,n);if(!m.success)throw new tt([a(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Mt.create(e).rest(Yt.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,s){return new r({args:e||Mt.create([]).rest(Yt.create()),returns:t||Yt.create(),typeName:$.ZodFunction,...re(s)})}},Ur=class extends oe{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})}};Ur.create=(r,e)=>new Ur({getter:r,typeName:$.ZodLazy,...re(e)});var Fr=class extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:N.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}};Fr.create=(r,e)=>new Fr({value:r,typeName:$.ZodLiteral,...re(e)});function Nl(r,e){return new Vr({values:r,typeName:$.ZodEnum,...re(e)})}var Vr=class r extends oe{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return Z(t,{expected:ce.joinValues(s),received:t.parsedType,code:N.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return Z(t,{received:t.data,code:N.invalid_enum_value,options:s}),X}return Be(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(s=>!e.includes(s)),{...this._def,...t})}};Vr.create=Nl;var Hr=class extends oe{_parse(e){let t=ce.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==U.string&&s.parsedType!==U.number){let a=ce.objectValues(t);return Z(s,{expected:ce.joinValues(a),received:s.parsedType,code:N.invalid_type}),X}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=ce.objectValues(t);return Z(s,{received:s.data,code:N.invalid_enum_value,options:a}),X}return Be(e.data)}get enum(){return this._def.values}};Hr.create=(r,e)=>new Hr({values:r,typeName:$.ZodNativeEnum,...re(e)});var hr=class extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.promise&&t.common.async===!1)return Z(t,{code:N.invalid_type,expected:U.promise,received:t.parsedType}),X;let s=t.parsedType===U.promise?t.data:Promise.resolve(t.data);return Be(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};hr.create=(r,e)=>new hr({type:r,typeName:$.ZodPromise,...re(e)});var yt=class extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:o=>{Z(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){let o=a.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return X;let c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?X:c.status==="dirty"?Nr(c.value):t.value==="dirty"?Nr(c.value):c});{if(t.value==="aborted")return X;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?X:i.status==="dirty"?Nr(i.value):t.value==="dirty"?Nr(i.value):i}}if(a.type==="refinement"){let o=i=>{let c=a.refinement(i,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?X:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?X:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!cr(o))return X;let i=a.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>cr(o)?Promise.resolve(a.transform(o.value,n)).then(i=>({status:t.value,value:i})):X);ce.assertNever(a)}};yt.create=(r,e,t)=>new yt({schema:r,typeName:$.ZodEffects,effect:e,...re(t)});yt.createWithPreprocess=(r,e,t)=>new yt({schema:e,effect:{type:"preprocess",transform:r},typeName:$.ZodEffects,...re(t)});var gt=class extends oe{_parse(e){return this._getType(e)===U.undefined?Be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:$.ZodOptional,...re(e)});var Lt=class extends oe{_parse(e){return this._getType(e)===U.null?Be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Lt.create=(r,e)=>new Lt({innerType:r,typeName:$.ZodNullable,...re(e)});var Br=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===U.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(r,e)=>new Br({innerType:r,typeName:$.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});var Jr=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Oa(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new tt(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new tt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Jr.create=(r,e)=>new Jr({innerType:r,typeName:$.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});var Da=class extends oe{_parse(e){if(this._getType(e)!==U.nan){let s=this._getOrReturnCtx(e);return Z(s,{code:N.invalid_type,expected:U.nan,received:s.parsedType}),X}return{status:"valid",value:e.data}}};Da.create=r=>new Da({typeName:$.ZodNaN,...re(r)});var Fp=Symbol("zod_brand"),fs=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},ps=class r extends oe{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?X:n.status==="dirty"?(t.dirty(),Nr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?X:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:$.ZodPipeline})}},Wr=class extends oe{_parse(e){let t=this._def.innerType._parse(e),s=a=>(cr(a)&&(a.value=Object.freeze(a.value)),a);return Oa(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}};Wr.create=(r,e)=>new Wr({innerType:r,typeName:$.ZodReadonly,...re(e)});function Il(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function $l(r,e={},t){return r?dr.create().superRefine((s,a)=>{var o,i;let n=r(s);if(n instanceof Promise)return n.then(c=>{var l,d;if(!c){let m=Il(e,s),v=(d=(l=m.fatal)!=null?l:t)!=null?d:!0;a.addIssue({code:"custom",...m,fatal:v})}});if(!n){let c=Il(e,s),l=(i=(o=c.fatal)!=null?o:t)!=null?i:!0;a.addIssue({code:"custom",...c,fatal:l})}}):dr.create()}var Vp={object:rt.lazycreate},$;(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"})($||($={}));var Hp=(r,e={message:`Input not instance of ${r.name}`})=>$l(t=>t instanceof r,e),jl=ur.create,Dl=$r.create,Bp=Da.create,Jp=jr.create,zl=Dr.create,Wp=zr.create,Gp=Aa.create,Qp=Mr.create,Kp=Lr.create,Yp=dr.create,Xp=Yt.create,em=Ct.create,tm=Na.create,rm=Xt.create,am=rt.create,sm=rt.strictCreate,nm=qr.create,om=tn.create,im=Zr.create,lm=Mt.create,cm=rn.create,um=$a.create,dm=ja.create,hm=an.create,fm=Ur.create,pm=Fr.create,mm=Vr.create,vm=Hr.create,gm=hr.create,_m=yt.create,ym=gt.create,bm=Lt.create,Sm=yt.createWithPreprocess,xm=ps.create,wm=()=>jl().optional(),Em=()=>Dl().optional(),Pm=()=>zl().optional(),Rm={string:(r=>ur.create({...r,coerce:!0})),number:(r=>$r.create({...r,coerce:!0})),boolean:(r=>Dr.create({...r,coerce:!0})),bigint:(r=>jr.create({...r,coerce:!0})),date:(r=>zr.create({...r,coerce:!0}))};var Tm=X;var fr="2025-06-18",Ml="2025-03-26",Gr=[fr,"2025-03-26","2024-11-05","2024-10-07"],sn="2.0",Ll=u.union([u.string(),u.number().int()]),ql=u.string(),Cm=u.object({progressToken:u.optional(Ll)}).passthrough(),bt=u.object({_meta:u.optional(Cm)}).passthrough(),at=u.object({method:u.string(),params:u.optional(bt)}),ms=u.object({_meta:u.optional(u.object({}).passthrough())}).passthrough(),qt=u.object({method:u.string(),params:u.optional(ms)}),St=u.object({_meta:u.optional(u.object({}).passthrough())}).passthrough(),nn=u.union([u.string(),u.number().int()]),Zl=u.object({jsonrpc:u.literal(sn),id:nn}).merge(at).strict(),Qr=r=>Zl.safeParse(r).success,Ul=u.object({jsonrpc:u.literal(sn)}).merge(qt).strict(),Fl=r=>Ul.safeParse(r).success,Vl=u.object({jsonrpc:u.literal(sn),id:nn,result:St}).strict(),er=r=>Vl.safeParse(r).success,Ye;(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"})(Ye||(Ye={}));var Hl=u.object({jsonrpc:u.literal(sn),id:nn,error:u.object({code:u.number().int(),message:u.string(),data:u.optional(u.unknown())})}).strict(),za=r=>Hl.safeParse(r).success,ht=u.union([Zl,Ul,Vl,Hl]),tr=St.strict(),on=qt.extend({method:u.literal("notifications/cancelled"),params:ms.extend({requestId:nn,reason:u.string().optional()})}),vs=u.object({name:u.string(),title:u.optional(u.string())}).passthrough(),Bl=vs.extend({version:u.string()}),Im=u.object({experimental:u.optional(u.object({}).passthrough()),sampling:u.optional(u.object({}).passthrough()),elicitation:u.optional(u.object({}).passthrough()),roots:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough())}).passthrough(),ln=at.extend({method:u.literal("initialize"),params:bt.extend({protocolVersion:u.string(),capabilities:Im,clientInfo:Bl})}),Jl=r=>ln.safeParse(r).success,Om=u.object({experimental:u.optional(u.object({}).passthrough()),logging:u.optional(u.object({}).passthrough()),completions:u.optional(u.object({}).passthrough()),prompts:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough()),resources:u.optional(u.object({subscribe:u.optional(u.boolean()),listChanged:u.optional(u.boolean())}).passthrough()),tools:u.optional(u.object({listChanged:u.optional(u.boolean())}).passthrough())}).passthrough(),bo=St.extend({protocolVersion:u.string(),capabilities:Om,serverInfo:Bl,instructions:u.optional(u.string())}),cn=qt.extend({method:u.literal("notifications/initialized")}),Wl=r=>cn.safeParse(r).success,Ma=at.extend({method:u.literal("ping")}),km=u.object({progress:u.number(),total:u.optional(u.number()),message:u.optional(u.string())}).passthrough(),La=qt.extend({method:u.literal("notifications/progress"),params:ms.merge(km).extend({progressToken:Ll})}),un=at.extend({params:bt.extend({cursor:u.optional(ql)}).optional()}),dn=St.extend({nextCursor:u.optional(ql)}),Gl=u.object({uri:u.string(),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Ql=Gl.extend({text:u.string()}),So=u.string().refine(r=>{try{return atob(r),!0}catch{return!1}},{message:"Invalid Base64 string"}),Kl=Gl.extend({blob:So}),Yl=vs.extend({uri:u.string(),description:u.optional(u.string()),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}),Am=vs.extend({uriTemplate:u.string(),description:u.optional(u.string()),mimeType:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}),Nm=un.extend({method:u.literal("resources/list")}),xo=dn.extend({resources:u.array(Yl)}),$m=un.extend({method:u.literal("resources/templates/list")}),wo=dn.extend({resourceTemplates:u.array(Am)}),jm=at.extend({method:u.literal("resources/read"),params:bt.extend({uri:u.string()})}),Eo=St.extend({contents:u.array(u.union([Ql,Kl]))}),Dm=qt.extend({method:u.literal("notifications/resources/list_changed")}),zm=at.extend({method:u.literal("resources/subscribe"),params:bt.extend({uri:u.string()})}),Mm=at.extend({method:u.literal("resources/unsubscribe"),params:bt.extend({uri:u.string()})}),Lm=qt.extend({method:u.literal("notifications/resources/updated"),params:ms.extend({uri:u.string()})}),qm=u.object({name:u.string(),description:u.optional(u.string()),required:u.optional(u.boolean())}).passthrough(),Zm=vs.extend({description:u.optional(u.string()),arguments:u.optional(u.array(qm)),_meta:u.optional(u.object({}).passthrough())}),Um=un.extend({method:u.literal("prompts/list")}),Po=dn.extend({prompts:u.array(Zm)}),Fm=at.extend({method:u.literal("prompts/get"),params:bt.extend({name:u.string(),arguments:u.optional(u.record(u.string()))})}),Ro=u.object({type:u.literal("text"),text:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),To=u.object({type:u.literal("image"),data:So,mimeType:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Co=u.object({type:u.literal("audio"),data:So,mimeType:u.string(),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Vm=u.object({type:u.literal("resource"),resource:u.union([Ql,Kl]),_meta:u.optional(u.object({}).passthrough())}).passthrough(),Hm=Yl.extend({type:u.literal("resource_link")}),Xl=u.union([Ro,To,Co,Hm,Vm]),Bm=u.object({role:u.enum(["user","assistant"]),content:Xl}).passthrough(),Io=St.extend({description:u.optional(u.string()),messages:u.array(Bm)}),Jm=qt.extend({method:u.literal("notifications/prompts/list_changed")}),Wm=u.object({title:u.optional(u.string()),readOnlyHint:u.optional(u.boolean()),destructiveHint:u.optional(u.boolean()),idempotentHint:u.optional(u.boolean()),openWorldHint:u.optional(u.boolean())}).passthrough(),Gm=vs.extend({description:u.optional(u.string()),inputSchema:u.object({type:u.literal("object"),properties:u.optional(u.object({}).passthrough()),required:u.optional(u.array(u.string()))}).passthrough(),outputSchema:u.optional(u.object({type:u.literal("object"),properties:u.optional(u.object({}).passthrough()),required:u.optional(u.array(u.string()))}).passthrough()),annotations:u.optional(Wm),_meta:u.optional(u.object({}).passthrough())}),Oo=un.extend({method:u.literal("tools/list")}),ko=dn.extend({tools:u.array(Gm)}),hn=St.extend({content:u.array(Xl).default([]),structuredContent:u.object({}).passthrough().optional(),isError:u.optional(u.boolean())}),AS=hn.or(St.extend({toolResult:u.unknown()})),Ao=at.extend({method:u.literal("tools/call"),params:bt.extend({name:u.string(),arguments:u.optional(u.record(u.unknown()))})}),Qm=qt.extend({method:u.literal("notifications/tools/list_changed")}),gs=u.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),No=at.extend({method:u.literal("logging/setLevel"),params:bt.extend({level:gs})}),Km=qt.extend({method:u.literal("notifications/message"),params:ms.extend({level:gs,logger:u.optional(u.string()),data:u.unknown()})}),Ym=u.object({name:u.string().optional()}).passthrough(),Xm=u.object({hints:u.optional(u.array(Ym)),costPriority:u.optional(u.number().min(0).max(1)),speedPriority:u.optional(u.number().min(0).max(1)),intelligencePriority:u.optional(u.number().min(0).max(1))}).passthrough(),ev=u.object({role:u.enum(["user","assistant"]),content:u.union([Ro,To,Co])}).passthrough(),tv=at.extend({method:u.literal("sampling/createMessage"),params:bt.extend({messages:u.array(ev),systemPrompt:u.optional(u.string()),includeContext:u.optional(u.enum(["none","thisServer","allServers"])),temperature:u.optional(u.number()),maxTokens:u.number().int(),stopSequences:u.optional(u.array(u.string())),metadata:u.optional(u.object({}).passthrough()),modelPreferences:u.optional(Xm)})}),$o=St.extend({model:u.string(),stopReason:u.optional(u.enum(["endTurn","stopSequence","maxTokens"]).or(u.string())),role:u.enum(["user","assistant"]),content:u.discriminatedUnion("type",[Ro,To,Co])}),rv=u.object({type:u.literal("boolean"),title:u.optional(u.string()),description:u.optional(u.string()),default:u.optional(u.boolean())}).passthrough(),av=u.object({type:u.literal("string"),title:u.optional(u.string()),description:u.optional(u.string()),minLength:u.optional(u.number()),maxLength:u.optional(u.number()),format:u.optional(u.enum(["email","uri","date","date-time"]))}).passthrough(),sv=u.object({type:u.enum(["number","integer"]),title:u.optional(u.string()),description:u.optional(u.string()),minimum:u.optional(u.number()),maximum:u.optional(u.number())}).passthrough(),nv=u.object({type:u.literal("string"),title:u.optional(u.string()),description:u.optional(u.string()),enum:u.array(u.string()),enumNames:u.optional(u.array(u.string()))}).passthrough(),ov=u.union([rv,av,sv,nv]),iv=at.extend({method:u.literal("elicitation/create"),params:bt.extend({message:u.string(),requestedSchema:u.object({type:u.literal("object"),properties:u.record(u.string(),ov),required:u.optional(u.array(u.string()))}).passthrough()})}),jo=St.extend({action:u.enum(["accept","decline","cancel"]),content:u.optional(u.record(u.string(),u.unknown()))}),lv=u.object({type:u.literal("ref/resource"),uri:u.string()}).passthrough();var cv=u.object({type:u.literal("ref/prompt"),name:u.string()}).passthrough(),uv=at.extend({method:u.literal("completion/complete"),params:bt.extend({ref:u.union([cv,lv]),argument:u.object({name:u.string(),value:u.string()}).passthrough(),context:u.optional(u.object({arguments:u.optional(u.record(u.string(),u.string()))}))})}),Do=St.extend({completion:u.object({values:u.array(u.string()).max(100),total:u.optional(u.number().int()),hasMore:u.optional(u.boolean())}).passthrough()}),dv=u.object({uri:u.string().startsWith("file://"),name:u.optional(u.string()),_meta:u.optional(u.object({}).passthrough())}).passthrough(),zo=at.extend({method:u.literal("roots/list")}),Mo=St.extend({roots:u.array(dv)}),hv=qt.extend({method:u.literal("notifications/roots/list_changed")}),NS=u.union([Ma,ln,uv,No,Fm,Um,Nm,$m,jm,zm,Mm,Ao,Oo]),$S=u.union([on,La,cn,hv]),jS=u.union([tr,$o,jo,Mo]),DS=u.union([Ma,tv,iv,zo]),zS=u.union([on,La,Km,Lm,Dm,Qm,Jm]),MS=u.union([tr,bo,Do,Io,Po,xo,wo,Eo,hn,ko]),Je=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var fv=6e4,qa=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.setNotificationHandler(on,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(La,t=>{this._onprogress(t)}),this.setRequestHandler(Ma,t=>({}))}_setupTimeout(e,t,s,a,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Je(Ye.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});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){var t,s,a;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};let o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};let i=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(c,l)=>{i==null||i(c,l),er(c)||za(c)?this._onresponse(c):Qr(c)?this._onrequest(c,l):Fl(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Je(Ye.ConnectionClosed,"Connection closed");for(let a of t.values())a(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){var s,a;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(n===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:Ye.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let c={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,d,m)=>this.request(l,d,{...m,relatedRequestId:e.id}),authInfo:t==null?void 0:t.authInfo,requestId:e.id,requestInfo:t==null?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,c)).then(l=>{if(!i.signal.aborted)return o==null?void 0:o.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var d;if(!i.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Ye.InternalError,message:(d=l.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,a=Number(t),n=this._progressHandlers.get(a);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(a),i=this._timeoutInfo.get(a);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(c){o(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===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),er(e))s(e);else{let a=new Je(e.error.code,e.error.message,e.error.data);s(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((i,c)=>{var l,d,m,v,p,b;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=s==null?void 0:s.signal)===null||d===void 0||d.throwIfAborted();let y=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:y};s!=null&&s.onprogress&&(this._progressHandlers.set(y,s.onprogress),_.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:y}});let w=O=>{var k;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(O)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),c(O)};this._responseHandlers.set(y,O=>{var k;if(!(!((k=s==null?void 0:s.signal)===null||k===void 0)&&k.aborted)){if(O instanceof Error)return c(O);try{let A=t.parse(O.result);i(A)}catch(A){c(A)}}}),(v=s==null?void 0:s.signal)===null||v===void 0||v.addEventListener("abort",()=>{var O;w((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let C=(p=s==null?void 0:s.timeout)!==null&&p!==void 0?p:fv,I=()=>w(new Je(Ye.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(y,C,s==null?void 0:s.maxTotalTimeout,I,(b=s==null?void 0:s.resetTimeoutOnProgress)!==null&&b!==void 0?b:!1),this._transport.send(_,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(y),c(O)})})}async notification(e,t){var s,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!(t!=null&&t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,t).catch(d=>this._onerror(d))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>Promise.resolve(t(e.parse(a),n)))}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,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function fn(r,e){return Object.entries(e).reduce((t,[s,a])=>(a&&typeof a=="object"?t[s]=t[s]?{...t[s],...a}:a:t[s]=a,t),{...r})}var ed=Tt(An(),1),Nn=class extends qa{constructor(e,t){var s;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._ajv=new ed.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=fn(this._capabilities,e)}assertCapability(e,t){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[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 s=await this.request({method:"initialize",params:{protocolVersion:fr,capabilities:this._capabilities,clientInfo:this._clientInfo}},bo,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Gr.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,s,a,n,o;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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.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(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.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 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"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"ping":break}}async ping(e){return this.request({method:"ping"},tr,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Do,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},tr,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Io,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Po,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xo,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},wo,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Eo,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},tr,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},tr,t)}async callTool(e,t=hn,s){let a=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!a.structuredContent&&!a.isError)throw new Je(Ye.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!n(a.structuredContent))throw new Je(Ye.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof Je?o:new Je(Ye.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let s=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let s=await this.request({method:"tools/list",params:e},ko,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var td=Tt(An(),1),$n=class extends qa{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(gs.options.map((a,n)=>[a,n])),this.isMessageIgnored=(a,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(a)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(ln,a=>this._oninitialize(a)),this.setNotificationHandler(cn,()=>{var a;return(a=this.oninitialized)===null||a===void 0?void 0:a.call(this)}),this._capabilities.logging&&this.setRequestHandler(No,async(a,n)=>{var o;let i=n.sessionId||((o=n.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:c}=a.params,l=gs.safeParse(c);return i&&l.success&&this._loggingLevels.set(i,l.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=fn(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,a;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Gr.includes(t)?t:fr,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},tr)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},$o,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},jo,t);if(s.action==="accept"&&s.content)try{let a=new td.default,n=a.compile(e.requestedSchema);if(!n(s.content))throw new Je(Ye.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorsText(n.errors)}`)}catch(a){throw a instanceof Je?a:new Je(Ye.InternalError,`Error validating elicitation response: ${a}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Mo,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&(!t||!this.isMessageIgnored(e.level,t)))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var jn=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 ci(r){}function Dn(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=ci,onError:t=ci,onRetry:s=ci,onComment:a}=r,n="",o=!0,i,c="",l="";function d(y){let _=o?y.replace(/^\xEF\xBB\xBF/,""):y,[w,C]=Bg(`${n}${_}`);for(let I of w)m(I);n=C,o=!1}function m(y){if(y===""){p();return}if(y.startsWith(":")){a&&a(y.slice(y.startsWith(": ")?2:1));return}let _=y.indexOf(":");if(_!==-1){let w=y.slice(0,_),C=y[_+1]===" "?2:1,I=y.slice(_+C);v(w,I,y);return}v(y,"",y)}function v(y,_,w){switch(y){case"event":l=_;break;case"data":c=`${c}${_}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`&&s++}}return[e,t]}var Mn=class extends Event{constructor(e,t){var s,a;super(e),this.code=(s=t==null?void 0:t.code)!=null?s:void 0,this.message=(a=t==null?void 0:t.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,s){return s(rd(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(rd(this),t)}};function Jg(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function ui(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(ui).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${ui(r.cause)}`:r.message:`${r}`}function rd(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var sd=r=>{throw TypeError(r)},_i=(r,e,t)=>e.has(r)||sd("Cannot "+t),ue=(r,e,t)=>(_i(r,e,"read from private field"),t?t.call(r):e.get(r)),Me=(r,e,t)=>e.has(r)?sd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Pe=(r,e,t,s)=>(_i(r,e,"write to private field"),e.set(r,t),t),rr=(r,e,t)=>(_i(r,e,"access private method"),t),st,Xr,Za,zn,Ln,Ss,Va,xs,gr,Ua,Ha,Fa,ys,It,di,hi,fi,ad,pi,mi,bs,vi,gi,ea=class extends EventTarget{constructor(e,t){var s,a;super(),Me(this,It),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Me(this,st),Me(this,Xr),Me(this,Za),Me(this,zn),Me(this,Ln),Me(this,Ss),Me(this,Va),Me(this,xs,null),Me(this,gr),Me(this,Ua),Me(this,Ha,null),Me(this,Fa,null),Me(this,ys,null),Me(this,hi,async n=>{var o;ue(this,Ua).reset();let{body:i,redirected:c,status:l,headers:d}=n;if(l===204){rr(this,It,bs).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Pe(this,Za,new URL(n.url)):Pe(this,Za,void 0),l!==200){rr(this,It,bs).call(this,`Non-200 status code (${l})`,l);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){rr(this,It,bs).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(ue(this,st)===this.CLOSED)return;Pe(this,st,this.OPEN);let m=new Event("open");if((o=ue(this,ys))==null||o.call(this,m),this.dispatchEvent(m),typeof i!="object"||!i||!("getReader"in i)){rr(this,It,bs).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let v=new TextDecoder,p=i.getReader(),b=!0;do{let{done:y,value:_}=await p.read();_&&ue(this,Ua).feed(v.decode(_,{stream:!y})),y&&(b=!1,ue(this,Ua).reset(),rr(this,It,vi).call(this))}while(b)}),Me(this,fi,n=>{Pe(this,gr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&rr(this,It,vi).call(this,ui(n))}),Me(this,pi,n=>{typeof n.id=="string"&&Pe(this,xs,n.id);let o=new MessageEvent(n.event||"message",{data:n.data,origin:ue(this,Za)?ue(this,Za).origin:ue(this,Xr).origin,lastEventId:n.id||""});ue(this,Fa)&&(!n.event||n.event==="message")&&ue(this,Fa).call(this,o),this.dispatchEvent(o)}),Me(this,mi,n=>{Pe(this,Ss,n)}),Me(this,gi,()=>{Pe(this,Va,void 0),ue(this,st)===this.CONNECTING&&rr(this,It,di).call(this)});try{if(e instanceof URL)Pe(this,Xr,e);else if(typeof e=="string")Pe(this,Xr,new URL(e,Wg()));else throw new Error("Invalid URL")}catch{throw Jg("An invalid or illegal string was specified")}Pe(this,Ua,Dn({onEvent:ue(this,pi),onRetry:ue(this,mi)})),Pe(this,st,this.CONNECTING),Pe(this,Ss,3e3),Pe(this,Ln,(s=t==null?void 0:t.fetch)!=null?s:globalThis.fetch),Pe(this,zn,(a=t==null?void 0:t.withCredentials)!=null?a:!1),rr(this,It,di).call(this)}get readyState(){return ue(this,st)}get url(){return ue(this,Xr).href}get withCredentials(){return ue(this,zn)}get onerror(){return ue(this,Ha)}set onerror(e){Pe(this,Ha,e)}get onmessage(){return ue(this,Fa)}set onmessage(e){Pe(this,Fa,e)}get onopen(){return ue(this,ys)}set onopen(e){Pe(this,ys,e)}addEventListener(e,t,s){let a=t;super.addEventListener(e,a,s)}removeEventListener(e,t,s){let a=t;super.removeEventListener(e,a,s)}close(){ue(this,Va)&&clearTimeout(ue(this,Va)),ue(this,st)!==this.CLOSED&&(ue(this,gr)&&ue(this,gr).abort(),Pe(this,st,this.CLOSED),Pe(this,gr,void 0))}};st=new WeakMap,Xr=new WeakMap,Za=new WeakMap,zn=new WeakMap,Ln=new WeakMap,Ss=new WeakMap,Va=new WeakMap,xs=new WeakMap,gr=new WeakMap,Ua=new WeakMap,Ha=new WeakMap,Fa=new WeakMap,ys=new WeakMap,It=new WeakSet,di=function(){Pe(this,st,this.CONNECTING),Pe(this,gr,new AbortController),ue(this,Ln)(ue(this,Xr),rr(this,It,ad).call(this)).then(ue(this,hi)).catch(ue(this,fi))},hi=new WeakMap,fi=new WeakMap,ad=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ue(this,xs)?{"Last-Event-ID":ue(this,xs)}:void 0},cache:"no-store",signal:(r=ue(this,gr))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},pi=new WeakMap,mi=new WeakMap,bs=function(r,e){var t;ue(this,st)!==this.CLOSED&&Pe(this,st,this.CLOSED);let s=new Mn("error",{code:e,message:r});(t=ue(this,Ha))==null||t.call(this,s),this.dispatchEvent(s)},vi=function(r,e){var t;if(ue(this,st)===this.CLOSED)return;Pe(this,st,this.CONNECTING);let s=new Mn("error",{code:e,message:r});(t=ue(this,Ha))==null||t.call(this,s),this.dispatchEvent(s),Pe(this,Va,setTimeout(ue(this,gi),ue(this,Ss)))},gi=new WeakMap,ea.CONNECTING=0,ea.OPEN=1,ea.CLOSED=2;function Wg(){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 yi,nd,od,id;yi=(id=(od=(nd=globalThis.crypto)==null?void 0:nd.webcrypto)!=null?od:globalThis.crypto)!=null?id:import("node:crypto").then(r=>r.webcrypto);async function Gg(r){return(await yi).getRandomValues(new Uint8Array(r))}async function Qg(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await Gg(r);for(let a=0;a<r;a++){let n=s[a]%e.length;t+=e[n]}return t}async function Kg(r){return await Qg(r)}async function Yg(r){let e=await(await yi).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function bi(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await Kg(r),t=await Yg(e);return{code_verifier:e,code_challenge:t}}var qe=u.string().url().superRefine((r,e)=>{if(!URL.canParse(r))return e.addIssue({code:u.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),u.NEVER}).refine(r=>{let e=new URL(r);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ld=u.object({resource:u.string().url(),authorization_servers:u.array(qe).optional(),jwks_uri:u.string().url().optional(),scopes_supported:u.array(u.string()).optional(),bearer_methods_supported:u.array(u.string()).optional(),resource_signing_alg_values_supported:u.array(u.string()).optional(),resource_name:u.string().optional(),resource_documentation:u.string().optional(),resource_policy_uri:u.string().url().optional(),resource_tos_uri:u.string().url().optional(),tls_client_certificate_bound_access_tokens:u.boolean().optional(),authorization_details_types_supported:u.array(u.string()).optional(),dpop_signing_alg_values_supported:u.array(u.string()).optional(),dpop_bound_access_tokens_required:u.boolean().optional()}).passthrough(),Si=u.object({issuer:u.string(),authorization_endpoint:qe,token_endpoint:qe,registration_endpoint:qe.optional(),scopes_supported:u.array(u.string()).optional(),response_types_supported:u.array(u.string()),response_modes_supported:u.array(u.string()).optional(),grant_types_supported:u.array(u.string()).optional(),token_endpoint_auth_methods_supported:u.array(u.string()).optional(),token_endpoint_auth_signing_alg_values_supported:u.array(u.string()).optional(),service_documentation:qe.optional(),revocation_endpoint:qe.optional(),revocation_endpoint_auth_methods_supported:u.array(u.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:u.array(u.string()).optional(),introspection_endpoint:u.string().optional(),introspection_endpoint_auth_methods_supported:u.array(u.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:u.array(u.string()).optional(),code_challenge_methods_supported:u.array(u.string()).optional()}).passthrough(),Xg=u.object({issuer:u.string(),authorization_endpoint:qe,token_endpoint:qe,userinfo_endpoint:qe.optional(),jwks_uri:qe,registration_endpoint:qe.optional(),scopes_supported:u.array(u.string()).optional(),response_types_supported:u.array(u.string()),response_modes_supported:u.array(u.string()).optional(),grant_types_supported:u.array(u.string()).optional(),acr_values_supported:u.array(u.string()).optional(),subject_types_supported:u.array(u.string()),id_token_signing_alg_values_supported:u.array(u.string()),id_token_encryption_alg_values_supported:u.array(u.string()).optional(),id_token_encryption_enc_values_supported:u.array(u.string()).optional(),userinfo_signing_alg_values_supported:u.array(u.string()).optional(),userinfo_encryption_alg_values_supported:u.array(u.string()).optional(),userinfo_encryption_enc_values_supported:u.array(u.string()).optional(),request_object_signing_alg_values_supported:u.array(u.string()).optional(),request_object_encryption_alg_values_supported:u.array(u.string()).optional(),request_object_encryption_enc_values_supported:u.array(u.string()).optional(),token_endpoint_auth_methods_supported:u.array(u.string()).optional(),token_endpoint_auth_signing_alg_values_supported:u.array(u.string()).optional(),display_values_supported:u.array(u.string()).optional(),claim_types_supported:u.array(u.string()).optional(),claims_supported:u.array(u.string()).optional(),service_documentation:u.string().optional(),claims_locales_supported:u.array(u.string()).optional(),ui_locales_supported:u.array(u.string()).optional(),claims_parameter_supported:u.boolean().optional(),request_parameter_supported:u.boolean().optional(),request_uri_parameter_supported:u.boolean().optional(),require_request_uri_registration:u.boolean().optional(),op_policy_uri:qe.optional(),op_tos_uri:qe.optional()}).passthrough(),cd=Xg.merge(Si.pick({code_challenge_methods_supported:!0})),xi=u.object({access_token:u.string(),id_token:u.string().optional(),token_type:u.string(),expires_in:u.number().optional(),scope:u.string().optional(),refresh_token:u.string().optional()}).strip(),ud=u.object({error:u.string(),error_description:u.string().optional(),error_uri:u.string().optional()}),e_=u.object({redirect_uris:u.array(qe),token_endpoint_auth_method:u.string().optional(),grant_types:u.array(u.string()).optional(),response_types:u.array(u.string()).optional(),client_name:u.string().optional(),client_uri:qe.optional(),logo_uri:qe.optional(),scope:u.string().optional(),contacts:u.array(u.string()).optional(),tos_uri:qe.optional(),policy_uri:u.string().optional(),jwks_uri:qe.optional(),jwks:u.any().optional(),software_id:u.string().optional(),software_version:u.string().optional(),software_statement:u.string().optional()}).strip(),t_=u.object({client_id:u.string(),client_secret:u.string().optional(),client_id_issued_at:u.number().optional(),client_secret_expires_at:u.number().optional()}).strip(),dd=e_.merge(t_),Vx=u.object({error:u.string(),error_description:u.string().optional()}).strip(),Hx=u.object({token:u.string(),token_type_hint:u.string().optional()}).strip();function hd(r){let e=typeof r=="string"?new URL(r):new URL(r.href);return e.hash="",e}function fd({requestedResource:r,configuredResource:e}){let t=typeof r=="string"?new URL(r):new URL(r.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(t.origin!==s.origin||t.pathname.length<s.pathname.length)return!1;let a=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return a.startsWith(n)}var ze=class extends Error{constructor(e,t){super(e),this.errorUri=t,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}},ws=class extends ze{};ws.errorCode="invalid_request";var ta=class extends ze{};ta.errorCode="invalid_client";var ra=class extends ze{};ra.errorCode="invalid_grant";var aa=class extends ze{};aa.errorCode="unauthorized_client";var Es=class extends ze{};Es.errorCode="unsupported_grant_type";var Ps=class extends ze{};Ps.errorCode="invalid_scope";var Rs=class extends ze{};Rs.errorCode="access_denied";var ar=class extends ze{};ar.errorCode="server_error";var Ts=class extends ze{};Ts.errorCode="temporarily_unavailable";var Cs=class extends ze{};Cs.errorCode="unsupported_response_type";var Is=class extends ze{};Is.errorCode="unsupported_token_type";var Os=class extends ze{};Os.errorCode="invalid_token";var ks=class extends ze{};ks.errorCode="method_not_allowed";var As=class extends ze{};As.errorCode="too_many_requests";var Ns=class extends ze{};Ns.errorCode="invalid_client_metadata";var $s=class extends ze{};$s.errorCode="insufficient_scope";var pd={[ws.errorCode]:ws,[ta.errorCode]:ta,[ra.errorCode]:ra,[aa.errorCode]:aa,[Es.errorCode]:Es,[Ps.errorCode]:Ps,[Rs.errorCode]:Rs,[ar.errorCode]:ar,[Ts.errorCode]:Ts,[Cs.errorCode]:Cs,[Is.errorCode]:Is,[Os.errorCode]:Os,[ks.errorCode]:ks,[As.errorCode]:As,[Ns.errorCode]:Ns,[$s.errorCode]:$s};var nt=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function vd(r,e){let t=r.client_secret!==void 0;return e.length===0?t?"client_secret_post":"none":t&&e.includes("client_secret_basic")?"client_secret_basic":t&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":t?"client_secret_post":"none"}function gd(r,e,t,s){let{client_id:a,client_secret:n}=e;switch(r){case"client_secret_basic":r_(a,n,t);return;case"client_secret_post":a_(a,n,s);return;case"none":s_(a,s);return;default:throw new Error(`Unsupported client authentication method: ${r}`)}}function r_(r,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${r}:${e}`);t.set("Authorization",`Basic ${s}`)}function a_(r,e,t){t.set("client_id",r),e&&t.set("client_secret",e)}function s_(r,e){e.set("client_id",r)}async function Ei(r){let e=r instanceof Response?r.status:void 0,t=r instanceof Response?await r.text():r;try{let s=ud.parse(JSON.parse(t)),{error:a,error_description:n,error_uri:o}=s,i=pd[a]||ar;return new i(n||"",o)}catch(s){let a=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new ar(a)}}async function _r(r,e){var t,s;try{return await wi(r,e)}catch(a){if(a instanceof ta||a instanceof aa)return await((t=r.invalidateCredentials)===null||t===void 0?void 0:t.call(r,"all")),await wi(r,e);if(a instanceof ra)return await((s=r.invalidateCredentials)===null||s===void 0?void 0:s.call(r,"tokens")),await wi(r,e);throw a}}async function wi(r,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:a,fetchFn:n}){let o,i;try{o=await o_(e,{resourceMetadataUrl:a},n),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);let c=await n_(e,r,o),l=await d_(i,{fetchFn:n}),d=await Promise.resolve(r.clientInformation());if(!d){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 y=await m_(i,{metadata:l,clientMetadata:r.clientMetadata,fetchFn:n});await r.saveClientInformation(y),d=y}if(t!==void 0){let y=await r.codeVerifier(),_=await f_(i,{metadata:l,clientInformation:d,authorizationCode:t,codeVerifier:y,redirectUri:r.redirectUrl,resource:c,addClientAuthentication:r.addClientAuthentication,fetchFn:n});return await r.saveTokens(_),"AUTHORIZED"}let m=await r.tokens();if(m!=null&&m.refresh_token)try{let y=await p_(i,{metadata:l,clientInformation:d,refreshToken:m.refresh_token,resource:c,addClientAuthentication:r.addClientAuthentication,fetchFn:n});return await r.saveTokens(y),"AUTHORIZED"}catch(y){if(!(!(y instanceof ze)||y instanceof ar))throw y}let v=r.state?await r.state():void 0,{authorizationUrl:p,codeVerifier:b}=await h_(i,{metadata:l,clientInformation:d,state:v,redirectUrl:r.redirectUrl,scope:s||r.clientMetadata.scope,resource:c});return await r.saveCodeVerifier(b),await r.redirectToAuthorization(p),"REDIRECT"}async function n_(r,e,t){let s=hd(r);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!fd({requestedResource:s,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${s} (or origin)`);return new URL(t.resource)}}function js(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,s]=e.split(" ");if(t.toLowerCase()!=="bearer"||!s)return;let n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function o_(r,e,t=fetch){let s=await c_(r,"oauth-protected-resource",t,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return ld.parse(await s.json())}async function Pi(r,e,t=fetch){try{return await t(r,{headers:e})}catch(s){if(s instanceof TypeError)return e?Pi(r,void 0,t):void 0;throw s}}function i_(r,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${r}`:`/.well-known/${r}${e}`}async function md(r,e,t=fetch){return await Pi(r,{"MCP-Protocol-Version":e},t)}function l_(r,e){return!r||r.status>=400&&r.status<500&&e!=="/"}async function c_(r,e,t,s){var a,n;let o=new URL(r),i=(a=s==null?void 0:s.protocolVersion)!==null&&a!==void 0?a:fr,c;if(s!=null&&s.metadataUrl)c=new URL(s.metadataUrl);else{let d=i_(e,o.pathname);c=new URL(d,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),c.search=o.search}let l=await md(c,i,t);if(!(s!=null&&s.metadataUrl)&&l_(l,o.pathname)){let d=new URL(`/.well-known/${e}`,o);l=await md(d,i,t)}return l}function u_(r){let e=typeof r=="string"?new URL(r):r,t=e.pathname!=="/",s=[];if(!t)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let a=e.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${a}`,e.origin),type:"oidc"}),s.push({url:new URL(`${a}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function d_(r,{fetchFn:e=fetch,protocolVersion:t=fr}={}){var s;let a={"MCP-Protocol-Version":t},n=u_(r);for(let{url:o,type:i}of n){let c=await Pi(o,a,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return Si.parse(await c.json());{let l=cd.parse(await c.json());if(!(!((s=l.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return l}}}}async function h_(r,{metadata:e,clientInformation:t,redirectUrl:s,scope:a,state:n,resource:o}){let i="code",c="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else l=new URL("/authorize",r);let d=await bi(),m=d.code_verifier,v=d.code_challenge;return l.searchParams.set("response_type",i),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",v),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(s)),n&&l.searchParams.set("state",n),a&&l.searchParams.set("scope",a),a!=null&&a.includes("offline_access")&&l.searchParams.append("prompt","consent"),o&&l.searchParams.set("resource",o.href),{authorizationUrl:l,codeVerifier:m}}async function f_(r,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:a,redirectUri:n,resource:o,addClientAuthentication:i,fetchFn:c}){var l;let d="authorization_code",m=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",r);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let v=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),p=new URLSearchParams({grant_type:d,code:s,code_verifier:a,redirect_uri:String(n)});if(i)i(v,p,r,e);else{let y=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],_=vd(t,y);gd(_,t,v,p)}o&&p.set("resource",o.href);let b=await(c!=null?c:fetch)(m,{method:"POST",headers:v,body:p});if(!b.ok)throw await Ei(b);return xi.parse(await b.json())}async function p_(r,{metadata:e,clientInformation:t,refreshToken:s,resource:a,addClientAuthentication:n,fetchFn:o}){var i;let c="refresh_token",l;if(e){if(l=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else l=new URL("/token",r);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),m=new URLSearchParams({grant_type:c,refresh_token:s});if(n)n(d,m,r,e);else{let p=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],b=vd(t,p);gd(b,t,d,m)}a&&m.set("resource",a.href);let v=await(o!=null?o:fetch)(l,{method:"POST",headers:d,body:m});if(!v.ok)throw await Ei(v);return xi.parse({refresh_token:s,...await v.json()})}async function m_(r,{metadata:e,clientMetadata:t,fetchFn:s}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",r);let n=await(s!=null?s:fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await Ei(n);return dd.parse(await n.json())}var Ri=class extends Error{constructor(e,t,s){super(`SSE error: ${t}`),this.code=e,this.event=s}},qn=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t==null?void 0:t.eventSourceInit,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new nt("No auth provider");let t;try{t=await _r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new nt;return await this._startOrAuth()}async _commonHeaders(){var e;let t={};if(this._authProvider){let s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,t,s;let a=(s=(t=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&t!==void 0?t:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((n,o)=>{this._eventSource=new ea(this._url.href,{...this._eventSourceInit,fetch:async(i,c)=>{let l=await this._commonHeaders();l.set("Accept","text/event-stream");let d=await a(i,{...c,headers:l});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=js(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var c;if(i.code===401&&this._authProvider){this._authThenStart().then(n,o);return}let l=new Ri(i.code,i.message,i);o(l),(c=this.onerror)===null||c===void 0||c.call(this,l)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var c;let l=i;try{if(this._endpoint=new URL(l.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){o(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}n()}),this._eventSource.onmessage=i=>{var c,l;let d=i,m;try{m=ht.parse(JSON.parse(d.data))}catch(v){(c=this.onerror)===null||c===void 0||c.call(this,v);return}(l=this.onmessage)===null||l===void 0||l.call(this,m)}})}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 nt("No auth provider");if(await _r(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new nt("Failed to authorize")}async close(){var e,t,s;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var t,s,a;if(!this._endpoint)throw new Error("Not connected");try{let n=await this._commonHeaders();n.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(t=this._abortController)===null||t===void 0?void 0:t.signal},i=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,o);if(!i.ok){if(i.status===401&&this._authProvider){if(this._resourceMetadataUrl=js(i),await _r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new nt;return this.send(e)}let c=await i.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${c}`)}}catch(n){throw(a=this.onerror)===null||a===void 0||a.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}};var Pd=require("node:crypto");var Sd=Tt(bd());function Ds(r,{limit:e,encoding:t}){let s=Sd.default.parse(e);return new Promise((a,n)=>{let o=0,i=[];r.on("data",c=>{if(o+=c.length,o>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));i.push(c)}),r.on("end",()=>{try{a(Buffer.concat(i).toString(t))}catch(c){n(c)}}),r.on("error",c=>{n(c)})})}var Rd=Tt(Ci(),1),Td=require("url"),C_="4mb",Un=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,Pd.randomUUID)(),this._options=s||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let t=e.headers.host;if(!t||!this._options.allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._options.allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",t=new Td.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
`});var AI={};ro(AI,{CallToolRequestSchema:()=>$o,Client:()=>Wi,ListRootsRequestSchema:()=>jc,ListToolsRequestSchema:()=>Tc,Loop:()=>eo.Loop,PingRequestSchema:()=>xn,ProgressNotificationSchema:()=>$n,SSEClientTransport:()=>ra,SSEServerTransport:()=>oa,Server:()=>Ki,StdioClientTransport:()=>aa,StdioServerTransport:()=>ca,StreamableHTTPClientTransport:()=>da,StreamableHTTPServerTransport:()=>ua,z:()=>Ps,zodToJsonSchema:()=>si});module.exports=b0(AI);var Ps={};ro(Ps,{BRAND:()=>W0,DIRTY:()=>yr,EMPTY_PATH:()=>S0,INVALID:()=>Z,NEVER:()=>Iw,OK:()=>Re,ParseStatus:()=>ke,Schema:()=>V,ZodAny:()=>er,ZodArray:()=>Zt,ZodBigInt:()=>br,ZodBoolean:()=>xr,ZodBranded:()=>oo,ZodCatch:()=>Cr,ZodDate:()=>$r,ZodDefault:()=>Or,ZodDiscriminatedUnion:()=>zs,ZodEffects:()=>nt,ZodEnum:()=>Rr,ZodError:()=>Ve,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Ts,ZodIntersection:()=>Er,ZodIssueCode:()=>x,ZodLazy:()=>Tr,ZodLiteral:()=>Pr,ZodMap:()=>un,ZodNaN:()=>dn,ZodNativeEnum:()=>Ir,ZodNever:()=>ut,ZodNull:()=>Sr,ZodNullable:()=>St,ZodNumber:()=>wr,ZodObject:()=>Fe,ZodOptional:()=>tt,ZodParsedType:()=>R,ZodPipeline:()=>so,ZodPromise:()=>tr,ZodReadonly:()=>Nr,ZodRecord:()=>Es,ZodSchema:()=>V,ZodSet:()=>ln,ZodString:()=>Qt,ZodSymbol:()=>an,ZodTransformer:()=>nt,ZodTuple:()=>kt,ZodType:()=>V,ZodUndefined:()=>kr,ZodUnion:()=>zr,ZodUnknown:()=>Mt,ZodVoid:()=>cn,addIssueToContext:()=>T,any:()=>rw,array:()=>iw,bigint:()=>Y0,boolean:()=>Od,coerce:()=>Rw,custom:()=>Pd,date:()=>X0,datetimeRegex:()=>Ed,defaultErrorMap:()=>jt,discriminatedUnion:()=>lw,effect:()=>xw,enum:()=>yw,function:()=>_w,getErrorMap:()=>nn,getParsedType:()=>$t,instanceof:()=>K0,intersection:()=>dw,isAborted:()=>ks,isAsync:()=>on,isDirty:()=>Ss,isValid:()=>Xt,late:()=>J0,lazy:()=>gw,literal:()=>vw,makeIssue:()=>no,map:()=>hw,nan:()=>G0,nativeEnum:()=>ww,never:()=>ow,null:()=>tw,nullable:()=>kw,number:()=>Id,object:()=>aw,objectUtil:()=>_a,oboolean:()=>Pw,onumber:()=>Tw,optional:()=>$w,ostring:()=>Ew,pipeline:()=>zw,preprocess:()=>Sw,promise:()=>bw,quotelessJson:()=>x0,record:()=>fw,set:()=>mw,setErrorMap:()=>k0,strictObject:()=>cw,string:()=>Rd,symbol:()=>Q0,transformer:()=>xw,tuple:()=>pw,undefined:()=>ew,union:()=>uw,unknown:()=>nw,util:()=>W,void:()=>sw});var W;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(W||(W={}));var _a;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(_a||(_a={}));var R=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$t=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map!="undefined"&&t instanceof Map?R.map:typeof Set!="undefined"&&t instanceof Set?R.set:typeof Date!="undefined"&&t instanceof Date?R.date:R.object;default:return R.unknown}};var x=W.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"]),x0=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ve=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(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(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,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ve.create=t=>new Ve(t);var $0=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.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}"`:W.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.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 x.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 x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,W.assertNever(t)}return{message:r}},jt=$0;var xd=jt;function k0(t){xd=t}function nn(){return xd}var no=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},S0=[];function T(t,e){let r=nn(),n=no({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jt?void 0:jt].filter(o=>!!o)});t.common.issues.push(n)}var ke=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 o of r){if(o.status==="aborted")return Z;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value!="undefined"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},Z=Object.freeze({status:"aborted"}),yr=t=>({status:"dirty",value:t}),Re=t=>({status:"valid",value:t}),ks=t=>t.status==="aborted",Ss=t=>t.status==="dirty",Xt=t=>t.status==="valid",on=t=>typeof Promise!="undefined"&&t instanceof Promise;var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(I||(I={}));var rt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},$d=(t,e)=>{if(Xt(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 Ve(t.common.issues);return this._error=r,this._error}}};function L(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(i,a)=>{var u,l;let{message:c}=t;return i.code==="invalid_enum_value"?{message:c!=null?c:a.defaultError}:typeof a.data=="undefined"?{message:(u=c!=null?c:n)!=null?u:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(l=c!=null?c:r)!=null?l:a.defaultError}},description:o}}var V=class{get description(){return this._def.description}_getType(e){return $t(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:$t(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ke,ctx:{common:e.parent.common,data:e.data,parsedType:$t(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(on(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){var s;let n={common:{issues:[],async:(s=r==null?void 0:r.async)!=null?s:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$t(e)},o=this._parseSync({data:e,path:n.path,parent:n});return $d(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$t(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return Xt(s)?{value:s.value}:{issues:r.common.issues}}catch(s){(o=(n=s==null?void 0:s.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>Xt(s)?{value:s.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==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$t(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(on(o)?o:Promise.resolve(o));return $d(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:x.custom,...n(o)});return typeof Promise!="undefined"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new nt({schema:this,typeName:k.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 tt.create(this,this._def)}nullable(){return St.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zt.create(this)}promise(){return tr.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Er.create(this,e,this._def)}transform(e){return new nt({...L(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Or({...L(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new oo({typeName:k.ZodBranded,type:this,...L(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Cr({...L(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return so.create(this,e)}readonly(){return Nr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},z0=/^c[^\s-]{8,}$/i,E0=/^[0-9a-z]+$/,T0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P0=/^[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,R0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O0=/^[-+]?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)?)??$/,C0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,N0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ga,j0=/^(?:(?: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])$/,A0=/^(?:(?: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])$/,M0=/^(([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]))$/,Z0=/^(([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])$/,q0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sd="((\\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])))",L0=new RegExp(`^${Sd}$`);function zd(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 U0(t){return new RegExp(`^${zd(t)}$`)}function Ed(t){let e=`${Sd}T${zd(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 V0(t,e){return!!((e==="v4"||!e)&&j0.test(t)||(e==="v6"||!e)&&M0.test(t))}function F0(t,e){if(!I0.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function H0(t,e){return!!((e==="v4"||!e)&&A0.test(t)||(e==="v6"||!e)&&Z0.test(t))}var Qt=class t extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return T(s,{code:x.invalid_type,expected:R.string,received:s.parsedType}),Z}let n=new ke,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),T(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),T(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?T(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&T(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")C0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"email",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ga||(ga=new RegExp(N0,"u")),ga.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"emoji",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")P0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"uuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")R0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"nanoid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")z0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"cuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")E0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"cuid2",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")T0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"ulid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),T(o,{validation:"url",code:x.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"regex",code:x.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ed(s).test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?L0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?U0(s).test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{code:x.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?O0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"duration",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?V0(e.data,s.version)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"ip",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?F0(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"jwt",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?H0(e.data,s.version)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"cidr",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?q0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"base64",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?D0.test(e.data)||(o=this._getOrReturnCtx(e,o),T(o,{validation:"base64url",code:x.invalid_string,message:s.message}),n.dirty()):W.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:x.invalid_string,...I.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...I.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...I.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...I.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...I.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...I.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...I.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...I.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...I.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...I.errToObj(r)})}nonempty(e){return this.min(1,I.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}};Qt.create=t=>{var e;return new Qt({checks:[],typeName:k.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...L(t)})};function B0(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var wr=class t extends V{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)!==R.number){let s=this._getOrReturnCtx(e);return T(s,{code:x.invalid_type,expected:R.number,received:s.parsedType}),Z}let n,o=new ke;for(let s of this._def.checks)s.kind==="int"?W.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:x.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?B0(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_finite,message:s.message}),o.dirty()):W.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.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"&&W.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)}};wr.create=t=>new wr({checks:[],typeName:k.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...L(t)});var br=class t extends V{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)!==R.bigint)return this._getInvalidInput(e);let n,o=new ke;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):W.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_type,expected:R.bigint,received:r.parsedType}),Z}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(o)}]})}_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:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.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}};br.create=t=>{var e;return new br({checks:[],typeName:k.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...L(t)})};var xr=class extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.boolean,received:n.parsedType}),Z}return Re(e.data)}};xr.create=t=>new xr({typeName:k.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...L(t)});var $r=class t extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return T(s,{code:x.invalid_type,expected:R.date,received:s.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return T(s,{code:x.invalid_date}),Z}let n=new ke,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),T(o,{code:x.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),T(o,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):W.assertNever(s);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:I.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:I.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}};$r.create=t=>new $r({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:k.ZodDate,...L(t)});var an=class extends V{_parse(e){if(this._getType(e)!==R.symbol){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.symbol,received:n.parsedType}),Z}return Re(e.data)}};an.create=t=>new an({typeName:k.ZodSymbol,...L(t)});var kr=class extends V{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.undefined,received:n.parsedType}),Z}return Re(e.data)}};kr.create=t=>new kr({typeName:k.ZodUndefined,...L(t)});var Sr=class extends V{_parse(e){if(this._getType(e)!==R.null){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.null,received:n.parsedType}),Z}return Re(e.data)}};Sr.create=t=>new Sr({typeName:k.ZodNull,...L(t)});var er=class extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};er.create=t=>new er({typeName:k.ZodAny,...L(t)});var Mt=class extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};Mt.create=t=>new Mt({typeName:k.ZodUnknown,...L(t)});var ut=class extends V{_parse(e){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_type,expected:R.never,received:r.parsedType}),Z}};ut.create=t=>new ut({typeName:k.ZodNever,...L(t)});var cn=class extends V{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.void,received:n.parsedType}),Z}return Re(e.data)}};cn.create=t=>new cn({typeName:k.ZodVoid,...L(t)});var Zt=class t extends V{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==R.array)return T(r,{code:x.invalid_type,expected:R.array,received:r.parsedType}),Z;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(T(r,{code:i?x.too_big:x.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(T(r,{code:x.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(T(r,{code:x.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new rt(r,i,r.path,a)))).then(i=>ke.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new rt(r,i,r.path,a)));return ke.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:I.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:I.toString(r)}})}nonempty(e){return this.min(1,e)}};Zt.create=(t,e)=>new Zt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...L(e)});function sn(t){if(t instanceof Fe){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=tt.create(sn(n))}return new Fe({...t._def,shape:()=>e})}else return t instanceof Zt?new Zt({...t._def,type:sn(t.element)}):t instanceof tt?tt.create(sn(t.unwrap())):t instanceof St?St.create(sn(t.unwrap())):t instanceof kt?kt.create(t.items.map(e=>sn(e))):t}var Fe=class t extends V{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=W.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){let u=this._getOrReturnCtx(e);return T(u,{code:x.invalid_type,expected:R.object,received:u.parsedType}),Z}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ut&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new rt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof ut){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(T(o,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new rt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>ke.mergeObjectSync(n,u)):ke.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var s,i,a,c;let o=(a=(i=(s=this._def).errorMap)==null?void 0:i.call(s,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=I.errToObj(e).message)!=null?c:o}:{message:o}}}:{}})}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:k.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 W.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 W.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return sn(this)}partial(e){let r={};for(let n of W.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of W.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof tt;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Td(W.objectKeys(this.shape))}};Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:ut.create(),typeName:k.ZodObject,...L(e)});Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:ut.create(),typeName:k.ZodObject,...L(e)});Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:ut.create(),typeName:k.ZodObject,...L(e)});var zr=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Ve(a.ctx.common.issues));return T(r,{code:x.invalid_union,unionErrors:i}),Z}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Ve(c));return T(r,{code:x.invalid_union,unionErrors:a}),Z}}get options(){return this._def.options}};zr.create=(t,e)=>new zr({options:t,typeName:k.ZodUnion,...L(e)});var At=t=>t instanceof Tr?At(t.schema):t instanceof nt?At(t.innerType()):t instanceof Pr?[t.value]:t instanceof Rr?t.options:t instanceof Ir?W.objectValues(t.enum):t instanceof Or?At(t._def.innerType):t instanceof kr?[void 0]:t instanceof Sr?[null]:t instanceof tt?[void 0,...At(t.unwrap())]:t instanceof St?[null,...At(t.unwrap())]:t instanceof oo||t instanceof Nr?At(t.unwrap()):t instanceof Cr?At(t._def.innerType):[],zs=class t extends V{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return T(r,{code:x.invalid_type,expected:R.object,received:r.parsedType}),Z;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(T(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=At(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...L(n)})}};function va(t,e){let r=$t(t),n=$t(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){let o=W.objectKeys(e),s=W.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=va(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=va(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Er=class extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(ks(s)||ks(i))return Z;let a=va(s.value,i.value);return a.valid?((Ss(s)||Ss(i))&&r.dirty(),{status:r.value,value:a.data}):(T(n,{code:x.invalid_intersection_types}),Z)};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(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Er.create=(t,e,r)=>new Er({left:t,right:e,typeName:k.ZodIntersection,...L(r)});var kt=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return T(n,{code:x.invalid_type,expected:R.array,received:n.parsedType}),Z;if(n.data.length<this._def.items.length)return T(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&n.data.length>this._def.items.length&&(T(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new rt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>ke.mergeArray(r,i)):ke.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};kt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kt({items:t,typeName:k.ZodTuple,rest:null,...L(e)})};var Es=class t extends V{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!==R.object)return T(n,{code:x.invalid_type,expected:R.object,received:n.parsedType}),Z;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new rt(n,a,n.path,a)),value:i._parse(new rt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ke.mergeObjectAsync(r,o):ke.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof V?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...L(n)}):new t({keyType:Qt.create(),valueType:e,typeName:k.ZodRecord,...L(r)})}},un=class extends V{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!==R.map)return T(n,{code:x.invalid_type,expected:R.map,received:n.parsedType}),Z;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new rt(n,a,n.path,[u,"key"])),value:s._parse(new rt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Z;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Z;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};un.create=(t,e,r)=>new un({valueType:e,keyType:t,typeName:k.ZodMap,...L(r)});var ln=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return T(n,{code:x.invalid_type,expected:R.set,received:n.parsedType}),Z;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(T(n,{code:x.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(T(n,{code:x.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Z;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new rt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:I.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ln.create=(t,e)=>new ln({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...L(e)});var Ts=class t extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.function)return T(r,{code:x.invalid_type,expected:R.function,received:r.parsedType}),Z;function n(a,c){return no({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nn(),jt].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function o(a,c){return no({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nn(),jt].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof tr){let a=this;return Re(async function(...c){let u=new Ve([]),l=await a._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let a=this;return Re(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new Ve([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Ve([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:kt.create(e).rest(Mt.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||kt.create([]).rest(Mt.create()),returns:r||Mt.create(),typeName:k.ZodFunction,...L(n)})}},Tr=class extends V{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})}};Tr.create=(t,e)=>new Tr({getter:t,typeName:k.ZodLazy,...L(e)});var Pr=class extends V{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return T(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Pr.create=(t,e)=>new Pr({value:t,typeName:k.ZodLiteral,...L(e)});function Td(t,e){return new Rr({values:t,typeName:k.ZodEnum,...L(e)})}var Rr=class t extends V{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return T(r,{expected:W.joinValues(n),received:r.parsedType,code:x.invalid_type}),Z}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 T(r,{received:r.data,code:x.invalid_enum_value,options:n}),Z}return Re(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})}};Rr.create=Td;var Ir=class extends V{_parse(e){let r=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){let o=W.objectValues(r);return T(n,{expected:W.joinValues(o),received:n.parsedType,code:x.invalid_type}),Z}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=W.objectValues(r);return T(n,{received:n.data,code:x.invalid_enum_value,options:o}),Z}return Re(e.data)}get enum(){return this._def.values}};Ir.create=(t,e)=>new Ir({values:t,typeName:k.ZodNativeEnum,...L(e)});var tr=class extends V{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return T(r,{code:x.invalid_type,expected:R.promise,received:r.parsedType}),Z;let n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Re(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};tr.create=(t,e)=>new tr({type:t,typeName:k.ZodPromise,...L(e)});var nt=class extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{T(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Z;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Z:c.status==="dirty"?yr(c.value):r.value==="dirty"?yr(c.value):c});{if(r.value==="aborted")return Z;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Z:a.status==="dirty"?yr(a.value):r.value==="dirty"?yr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Z:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Z:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(i))return Z;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Xt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):Z);W.assertNever(o)}};nt.create=(t,e,r)=>new nt({schema:t,typeName:k.ZodEffects,effect:e,...L(r)});nt.createWithPreprocess=(t,e,r)=>new nt({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...L(r)});var tt=class extends V{_parse(e){return this._getType(e)===R.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tt.create=(t,e)=>new tt({innerType:t,typeName:k.ZodOptional,...L(e)});var St=class extends V{_parse(e){return this._getType(e)===R.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};St.create=(t,e)=>new St({innerType:t,typeName:k.ZodNullable,...L(e)});var Or=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Or.create=(t,e)=>new Or({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var Cr=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return on(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Cr.create=(t,e)=>new Cr({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var dn=class extends V{_parse(e){if(this._getType(e)!==R.nan){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.nan,received:n.parsedType}),Z}return{status:"valid",value:e.data}}};dn.create=t=>new dn({typeName:k.ZodNaN,...L(t)});var W0=Symbol("zod_brand"),oo=class extends V{_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}},so=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Z:s.status==="dirty"?(r.dirty(),yr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Z:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},Nr=class extends V{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Xt(o)&&(o.value=Object.freeze(o.value)),o);return on(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Nr.create=(t,e)=>new Nr({innerType:t,typeName:k.ZodReadonly,...L(e)});function kd(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Pd(t,e={},r){return t?er.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(c=>{var u,l;if(!c){let d=kd(e,n),p=(l=(u=d.fatal)!=null?u:r)!=null?l:!0;o.addIssue({code:"custom",...d,fatal:p})}});if(!s){let c=kd(e,n),u=(a=(i=c.fatal)!=null?i:r)!=null?a:!0;o.addIssue({code:"custom",...c,fatal:u})}}):er.create()}var J0={object:Fe.lazycreate},k;(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"})(k||(k={}));var K0=(t,e={message:`Input not instance of ${t.name}`})=>Pd(r=>r instanceof t,e),Rd=Qt.create,Id=wr.create,G0=dn.create,Y0=br.create,Od=xr.create,X0=$r.create,Q0=an.create,ew=kr.create,tw=Sr.create,rw=er.create,nw=Mt.create,ow=ut.create,sw=cn.create,iw=Zt.create,aw=Fe.create,cw=Fe.strictCreate,uw=zr.create,lw=zs.create,dw=Er.create,pw=kt.create,fw=Es.create,hw=un.create,mw=ln.create,_w=Ts.create,gw=Tr.create,vw=Pr.create,yw=Rr.create,ww=Ir.create,bw=tr.create,xw=nt.create,$w=tt.create,kw=St.create,Sw=nt.createWithPreprocess,zw=so.create,Ew=()=>Rd().optional(),Tw=()=>Id().optional(),Pw=()=>Od().optional(),Rw={string:(t=>Qt.create({...t,coerce:!0})),number:(t=>wr.create({...t,coerce:!0})),boolean:(t=>xr.create({...t,coerce:!0})),bigint:(t=>br.create({...t,coerce:!0})),date:(t=>$r.create({...t,coerce:!0}))};var Iw=Z;var ya=Object.freeze({status:"aborted"});function y(t,e,r){var a;function n(c,u){var d,p;var l;Object.defineProperty(c,"_zod",{value:(d=c._zod)!=null?d:{},enumerable:!1}),(p=(l=c._zod).traits)!=null||(l.traits=new Set),c._zod.traits.add(t),e(c,u);for(let f in i.prototype)f in c||Object.defineProperty(c,f,{value:i.prototype[f].bind(c)});c._zod.constr=i,c._zod.def=u}let o=(a=r==null?void 0:r.Parent)!=null?a:Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(c){var d;var u;let l=r!=null&&r.Parent?new s:this;n(l,c),(d=(u=l._zod).deferred)!=null||(u.deferred=[]);for(let p of l._zod.deferred)p();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>{var u,l;return r!=null&&r.Parent&&c instanceof r.Parent?!0:(l=(u=c==null?void 0:c._zod)==null?void 0:u.traits)==null?void 0:l.has(t)}}),Object.defineProperty(i,"name",{value:t}),i}var Ow=Symbol("zod_brand"),qt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Rs={};function Xe(t){return t&&Object.assign(Rs,t),Rs}var ee={};ro(ee,{BIGINT_FORMAT_RANGES:()=>Nd,Class:()=>ba,NUMBER_FORMAT_RANGES:()=>Pa,aborted:()=>Ar,allowsEval:()=>za,assert:()=>Mw,assertEqual:()=>Cw,assertIs:()=>jw,assertNever:()=>Aw,assertNotEqual:()=>Nw,assignProp:()=>Sa,cached:()=>ao,captureStackTrace:()=>Os,cleanEnum:()=>Gw,cleanRegex:()=>uo,clone:()=>lt,createTransparentProxy:()=>Vw,defineLazy:()=>ae,esc:()=>jr,escapeRegex:()=>rr,extend:()=>Bw,finalizeIssue:()=>dt,floatSafeRemainder:()=>ka,getElementAtPath:()=>Zw,getEnumValues:()=>xa,getLengthableOrigin:()=>lo,getParsedType:()=>Uw,getSizableOrigin:()=>jd,isObject:()=>pn,isPlainObject:()=>fn,issue:()=>Ra,joinValues:()=>Is,jsonStringifyReplacer:()=>$a,merge:()=>Ww,normalizeParams:()=>A,nullish:()=>co,numKeys:()=>Lw,omit:()=>Hw,optionalKeys:()=>Ta,partial:()=>Jw,pick:()=>Fw,prefixIssues:()=>zt,primitiveTypes:()=>Cd,promiseAllObject:()=>qw,propertyKeyTypes:()=>Ea,randomString:()=>Dw,required:()=>Kw,stringifyPrimitive:()=>Cs,unwrapMessage:()=>io});function Cw(t){return t}function Nw(t){return t}function jw(t){}function Aw(t){throw new Error}function Mw(t){}function xa(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function Is(t,e="|"){return t.map(r=>Cs(r)).join(e)}function $a(t,e){return typeof e=="bigint"?e.toString():e}function ao(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function co(t){return t==null}function uo(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function ka(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function ae(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Sa(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Zw(t,e){return e?e.reduce((r,n)=>r==null?void 0:r[n],t):t}function qw(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function Dw(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function jr(t){return JSON.stringify(t)}var Os=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function pn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var za=ao(()=>{var t;if(typeof navigator!="undefined"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function fn(t){if(pn(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(pn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Lw(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Uw=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!="undefined"&&t instanceof Map?"map":typeof Set!="undefined"&&t instanceof Set?"set":typeof Date!="undefined"&&t instanceof Date?"date":typeof File!="undefined"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Ea=new Set(["string","number","symbol"]),Cd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lt(t,e,r){let n=new t._zod.constr(e!=null?e:t._zod.def);return(!e||r!=null&&r.parent)&&(n._zod.parent=t),n}function A(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0: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 Vw(t){let e;return new Proxy({},{get(r,n,o){return e!=null||(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e!=null||(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e!=null||(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e!=null||(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e!=null||(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e!=null||(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e!=null||(e=t()),Reflect.defineProperty(e,n,o)}})}function Cs(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ta(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Pa={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]},Nd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Fw(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return lt(t,{...t._zod.def,shape:r,checks:[]})}function Hw(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return lt(t,{...t._zod.def,shape:r,checks:[]})}function Bw(t,e){if(!fn(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Sa(this,"shape",n),n},checks:[]};return lt(t,r)}function Ww(t,e){return lt(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Sa(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Jw(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return lt(e,{...e._zod.def,shape:o,checks:[]})}function Kw(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return lt(e,{...e._zod.def,shape:o,checks:[]})}function Ar(t,e=0){var r;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function zt(t,e){return e.map(r=>{var o;var n;return(o=(n=r).path)!=null||(n.path=[]),r.path.unshift(t),r})}function io(t){return typeof t=="string"?t:t==null?void 0:t.message}function dt(t,e,r){var o,s,i,a,c,u,l,d,p,f,g;let n={...t,path:(o=t.path)!=null?o:[]};if(!t.message){let v=(g=(f=(d=(u=io((a=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:a.call(i,t)))!=null?u:io((c=e==null?void 0:e.error)==null?void 0:c.call(e,t)))!=null?d:io((l=r.customError)==null?void 0:l.call(r,t)))!=null?f:io((p=r.localeError)==null?void 0:p.call(r,t)))!=null?g:"Invalid input";n.message=v}return delete n.inst,delete n.continue,e!=null&&e.reportInput||delete n.input,n}function jd(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function lo(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ra(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Gw(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var ba=class{constructor(...e){}};var Ad=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,$a,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Ns=y("$ZodError",Ad),Ia=y("$ZodError",Ad,{Parent:Error});function Oa(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Ca(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var Md=t=>(e,r,n,o)=>{var a;let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new qt;if(i.issues.length){let c=new((a=o==null?void 0:o.Err)!=null?a:t)(i.issues.map(u=>dt(u,s,Xe())));throw Os(c,o==null?void 0:o.callee),c}return i.value};var Zd=t=>async(e,r,n,o)=>{var a;let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new((a=o==null?void 0:o.Err)!=null?a:t)(i.issues.map(u=>dt(u,s,Xe())));throw Os(c,o==null?void 0:o.callee),c}return i.value};var Na=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new qt;return s.issues.length?{success:!1,error:new(t!=null?t:Ns)(s.issues.map(i=>dt(i,o,Xe())))}:{success:!0,data:s.value}},po=Na(Ia),ja=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>dt(i,o,Xe())))}:{success:!0,data:s.value}},js=ja(Ia);var qd=/^[cC][^\s-]{8,}$/,Dd=/^[0-9a-z]+$/,Ld=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ud=/^[0-9a-vA-V]{20}$/,Vd=/^[A-Za-z0-9]{27}$/,Fd=/^[a-zA-Z0-9_-]{21}$/,Hd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Bd=/^([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})$/,Aa=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)$/;var Wd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Xw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Jd(){return new RegExp(Xw,"u")}var Kd=/^(?:(?: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])$/,Gd=/^(([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})$/,Yd=/^((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])$/,Xd=/^(([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])$/,Qd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ma=/^[A-Za-z0-9_-]*$/,ep=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var tp=/^\+(?:[0-9]){6,14}[0-9]$/,rp="(?:(?:\\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])))",np=new RegExp(`^${rp}$`);function op(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 sp(t){return new RegExp(`^${op(t)}$`)}function ip(t){let e=op({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${rp}T(?:${n})$`)}var ap=t=>{var r,n;let e=t?`[\\s\\S]{${(r=t==null?void 0:t.minimum)!=null?r:0},${(n=t==null?void 0:t.maximum)!=null?n:""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},cp=/^\d+n?$/,up=/^\d+$/,lp=/^-?\d+(?:\.\d+)?/i,dp=/true|false/i,pp=/null/i;var fp=/^[^A-Z]*$/,hp=/^[^a-z]*$/;var Ie=y("$ZodCheck",(t,e)=>{var n,o;var r;(n=t._zod)!=null||(t._zod={}),t._zod.def=e,(o=(r=t._zod).onattach)!=null||(r.onattach=[])}),mp={number:"number",bigint:"bigint",object:"date"},qa=y("$ZodCheckLessThan",(t,e)=>{Ie.init(t,e);let r=mp[typeof e.value];t._zod.onattach.push(n=>{var i;let o=n._zod.bag,s=(i=e.inclusive?o.maximum:o.exclusiveMaximum)!=null?i:Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.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})}}),Da=y("$ZodCheckGreaterThan",(t,e)=>{Ie.init(t,e);let r=mp[typeof e.value];t._zod.onattach.push(n=>{var i;let o=n._zod.bag,s=(i=e.inclusive?o.minimum:o.exclusiveMinimum)!=null?i:Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.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})}}),_p=y("$ZodCheckMultipleOf",(t,e)=>{Ie.init(t,e),t._zod.onattach.push(r=>{var o;var n;(o=(n=r._zod.bag).multipleOf)!=null||(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):ka(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})}}),gp=y("$ZodCheckNumberFormat",(t,e)=>{var i;Ie.init(t,e),e.format=e.format||"float64";let r=(i=e.format)==null?void 0:i.includes("int"),n=r?"int":"number",[o,s]=Pa[e.format];t._zod.onattach.push(a=>{let c=a._zod.bag;c.format=e.format,c.minimum=o,c.maximum=s,r&&(c.pattern=up)}),t._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:c,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}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:t})}});var vp=y("$ZodCheckMaxLength",(t,e)=>{var n;var r;Ie.init(t,e),(n=(r=t._zod.def).when)!=null||(r.when=o=>{let s=o.value;return!co(s)&&s.length!==void 0}),t._zod.onattach.push(o=>{var i;let s=(i=o._zod.bag.maximum)!=null?i:Number.POSITIVE_INFINITY;e.maximum<s&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let s=o.value;if(s.length<=e.maximum)return;let a=lo(s);o.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),yp=y("$ZodCheckMinLength",(t,e)=>{var n;var r;Ie.init(t,e),(n=(r=t._zod.def).when)!=null||(r.when=o=>{let s=o.value;return!co(s)&&s.length!==void 0}),t._zod.onattach.push(o=>{var i;let s=(i=o._zod.bag.minimum)!=null?i:Number.NEGATIVE_INFINITY;e.minimum>s&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let s=o.value;if(s.length>=e.minimum)return;let a=lo(s);o.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),wp=y("$ZodCheckLengthEquals",(t,e)=>{var n;var r;Ie.init(t,e),(n=(r=t._zod.def).when)!=null||(r.when=o=>{let s=o.value;return!co(s)&&s.length!==void 0}),t._zod.onattach.push(o=>{let s=o._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=o=>{let s=o.value,i=s.length;if(i===e.length)return;let a=lo(s),c=i>e.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),fo=y("$ZodCheckStringFormat",(t,e)=>{var o,s;var r,n;Ie.init(t,e),t._zod.onattach.push(i=>{var c;let a=i._zod.bag;a.format=e.format,e.pattern&&((c=a.patterns)!=null||(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(o=(r=t._zod).check)!=null||(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})}):(s=(n=t._zod).check)!=null||(n.check=()=>{})}),bp=y("$ZodCheckRegex",(t,e)=>{fo.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})}}),xp=y("$ZodCheckLowerCase",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=fp),fo.init(t,e)}),$p=y("$ZodCheckUpperCase",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=hp),fo.init(t,e)}),kp=y("$ZodCheckIncludes",(t,e)=>{Ie.init(t,e);let r=rr(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{var i;let s=o._zod.bag;(i=s.patterns)!=null||(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Sp=y("$ZodCheckStartsWith",(t,e)=>{var n;Ie.init(t,e);let r=new RegExp(`^${rr(e.prefix)}.*`);(n=e.pattern)!=null||(e.pattern=r),t._zod.onattach.push(o=>{var i;let s=o._zod.bag;(i=s.patterns)!=null||(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),zp=y("$ZodCheckEndsWith",(t,e)=>{var n;Ie.init(t,e);let r=new RegExp(`.*${rr(e.suffix)}$`);(n=e.pattern)!=null||(e.pattern=r),t._zod.onattach.push(o=>{var i;let s=o._zod.bag;(i=s.patterns)!=null||(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var Ep=y("$ZodCheckOverwrite",(t,e)=>{Ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var As=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(`
|
|
62
|
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){var s;let e=Function,r=this==null?void 0:this.args,o=[...((s=this==null?void 0:this.content)!=null?s:[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
|
|
63
|
+
`))}};var Pp={major:4,minor:0,patch:0};var oe=y("$ZodType",(t,e)=>{var o,s,i;var r;t!=null||(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Pp;let n=[...(o=t._zod.def.checks)!=null?o:[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let a of n)for(let c of a._zod.onattach)c(t);if(n.length===0)(s=(r=t._zod).deferred)!=null||(r.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{let a=(c,u,l)=>{let d=Ar(c),p;for(let f of u){if(f._zod.def.when){if(!f._zod.def.when(c))continue}else if(d)continue;let g=c.issues.length,v=f._zod.check(c);if(v instanceof Promise&&(l==null?void 0:l.async)===!1)throw new qt;if(p||v instanceof Promise)p=(p!=null?p:Promise.resolve()).then(async()=>{await v,c.issues.length!==g&&(d||(d=Ar(c,g)))});else{if(c.issues.length===g)continue;d||(d=Ar(c,g))}}return p?p.then(()=>c):c};t._zod.run=(c,u)=>{let l=t._zod.parse(c,u);if(l instanceof Promise){if(u.async===!1)throw new qt;return l.then(d=>a(d,n,u))}return a(l,n,u)}}t["~standard"]={validate:a=>{var c;try{let u=po(t,a);return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}}catch{return js(t,a).then(l=>{var d;return l.success?{value:l.data}:{issues:(d=l.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}}),Zs=y("$ZodString",(t,e)=>{var r,n,o;oe.init(t,e),t._zod.pattern=(o=[...(n=(r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)!=null?n:[]].pop())!=null?o:ap(t._zod.bag),t._zod.parse=(s,i)=>{if(e.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:t}),s}}),le=y("$ZodStringFormat",(t,e)=>{fo.init(t,e),Zs.init(t,e)}),qp=y("$ZodGUID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Bd),le.init(t,e)}),Dp=y("$ZodUUID",(t,e)=>{var r,n;if(e.version){let s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(s===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);(r=e.pattern)!=null||(e.pattern=Aa(s))}else(n=e.pattern)!=null||(e.pattern=Aa());le.init(t,e)}),Lp=y("$ZodEmail",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Wd),le.init(t,e)}),Up=y("$ZodURL",(t,e)=>{le.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ep.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Vp=y("$ZodEmoji",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Jd()),le.init(t,e)}),Fp=y("$ZodNanoID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Fd),le.init(t,e)}),Hp=y("$ZodCUID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=qd),le.init(t,e)}),Bp=y("$ZodCUID2",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Dd),le.init(t,e)}),Wp=y("$ZodULID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Ld),le.init(t,e)}),Jp=y("$ZodXID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Ud),le.init(t,e)}),Kp=y("$ZodKSUID",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Vd),le.init(t,e)}),Gp=y("$ZodISODateTime",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=ip(e)),le.init(t,e)}),Yp=y("$ZodISODate",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=np),le.init(t,e)}),Xp=y("$ZodISOTime",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=sp(e)),le.init(t,e)}),Qp=y("$ZodISODuration",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Hd),le.init(t,e)}),ef=y("$ZodIPv4",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Kd),le.init(t,e),t._zod.onattach.push(n=>{let o=n._zod.bag;o.format="ipv4"})}),tf=y("$ZodIPv6",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Gd),le.init(t,e),t._zod.onattach.push(n=>{let o=n._zod.bag;o.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),rf=y("$ZodCIDRv4",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Yd),le.init(t,e)}),nf=y("$ZodCIDRv6",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Xd),le.init(t,e),t._zod.check=n=>{let[o,s]=n.value.split("/");try{if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function of(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var sf=y("$ZodBase64",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Qd),le.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{of(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Qw(t){if(!Ma.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return of(r)}var af=y("$ZodBase64URL",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=Ma),le.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{Qw(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),cf=y("$ZodE164",(t,e)=>{var r;(r=e.pattern)!=null||(e.pattern=tp),le.init(t,e)});function eb(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var uf=y("$ZodJWT",(t,e)=>{le.init(t,e),t._zod.check=r=>{eb(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var Ua=y("$ZodNumber",(t,e)=>{var r;oe.init(t,e),t._zod.pattern=(r=t._zod.bag.pattern)!=null?r:lp,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}let s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;let i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),n}}),lf=y("$ZodNumber",(t,e)=>{gp.init(t,e),Ua.init(t,e)}),df=y("$ZodBoolean",(t,e)=>{oe.init(t,e),t._zod.pattern=dp,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),pf=y("$ZodBigInt",(t,e)=>{oe.init(t,e),t._zod.pattern=cp,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 ff=y("$ZodNull",(t,e)=>{oe.init(t,e),t._zod.pattern=pp,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),hf=y("$ZodAny",(t,e)=>{oe.init(t,e),t._zod.parse=r=>r}),mf=y("$ZodUnknown",(t,e)=>{oe.init(t,e),t._zod.parse=r=>r}),_f=y("$ZodNever",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var gf=y("$ZodDate",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:t}),r}});function Rp(t,e,r){t.issues.length&&e.issues.push(...zt(r,t.issues)),e.value[r]=t.value}var vf=y("$ZodArray",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Rp(u,r,i))):Rp(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Ms(t,e,r){t.issues.length&&e.issues.push(...zt(r,t.issues)),e.value[r]=t.value}function Ip(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...zt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var yf=y("$ZodObject",(t,e)=>{oe.init(t,e);let r=ao(()=>{let d=Object.keys(e.shape);for(let f of d)if(!(e.shape[f]instanceof oe))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let p=Ta(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});ae(t._zod,"propValues",()=>{var f;let d=e.shape,p={};for(let g in d){let v=d[g]._zod;if(v.values){(f=p[g])!=null||(p[g]=new Set);for(let m of v.values)p[g].add(m)}}return p});let n=d=>{let p=new As(["shape","payload","ctx"]),f=r.value,g=w=>{let b=jr(w);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};p.write("const input = payload.value;");let v=Object.create(null),m=0;for(let w of f.keys)v[w]=`key_${m++}`;p.write("const newResult = {}");for(let w of f.keys)if(f.optionalKeys.has(w)){let b=v[w];p.write(`const ${b} = ${g(w)};`);let E=jr(w);p.write(`
|
|
64
|
+
if (${b}.issues.length) {
|
|
65
|
+
if (input[${E}] === undefined) {
|
|
66
|
+
if (${E} in input) {
|
|
67
|
+
newResult[${E}] = undefined;
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
payload.issues = payload.issues.concat(
|
|
71
|
+
${b}.issues.map((iss) => ({
|
|
72
|
+
...iss,
|
|
73
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}],
|
|
74
|
+
}))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
} else if (${b}.value === undefined) {
|
|
78
|
+
if (${E} in input) newResult[${E}] = undefined;
|
|
79
|
+
} else {
|
|
80
|
+
newResult[${E}] = ${b}.value;
|
|
81
|
+
}
|
|
82
|
+
`)}else{let b=v[w];p.write(`const ${b} = ${g(w)};`),p.write(`
|
|
83
|
+
if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
84
|
+
...iss,
|
|
85
|
+
path: iss.path ? [${jr(w)}, ...iss.path] : [${jr(w)}]
|
|
86
|
+
})));`),p.write(`newResult[${jr(w)}] = ${b}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");let _=p.compile();return(w,b)=>_(d,w,b)},o,s=pn,i=!Rs.jitless,c=i&&za.value,u=e.catchall,l;t._zod.parse=(d,p)=>{l!=null||(l=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),d;let g=[];if(i&&c&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)o||(o=n(e.shape)),d=o(d,p);else{d.value={};let b=l.shape;for(let E of l.keys){let P=b[E],X=P._zod.run({value:f[E],issues:[]},p),be=P._zod.optin==="optional"&&P._zod.optout==="optional";X instanceof Promise?g.push(X.then(et=>be?Ip(et,d,E,f):Ms(et,d,E))):be?Ip(X,d,E,f):Ms(X,d,E)}}if(!u)return g.length?Promise.all(g).then(()=>d):d;let v=[],m=l.keySet,_=u._zod,w=_.def.type;for(let b of Object.keys(f)){if(m.has(b))continue;if(w==="never"){v.push(b);continue}let E=_.run({value:f[b],issues:[]},p);E instanceof Promise?g.push(E.then(P=>Ms(P,d,b))):Ms(E,d,b)}return v.length&&d.issues.push({code:"unrecognized_keys",keys:v,input:f,inst:t}),g.length?Promise.all(g).then(()=>d):d}});function Op(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>dt(s,n,Xe())))}),e}var Va=y("$ZodUnion",(t,e)=>{oe.init(t,e),ae(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ae(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ae(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ae(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>uo(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Op(i,r,t,n)):Op(s,r,t,n)}}),wf=y("$ZodDiscriminatedUnion",(t,e)=>{Va.init(t,e);let r=t._zod.parse;ae(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=ao(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!pn(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i==null?void 0:i[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),bf=y("$ZodIntersection",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Cp(r,c,u)):Cp(r,s,i)}});function La(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(fn(t)&&fn(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=La(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}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 o=t[n],s=e[n],i=La(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Cp(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Ar(t))return t;let n=La(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 xf=y("$ZodRecord",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!fn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...zt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...zt(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a!=null?a:[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>dt(u,n,Xe())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...zt(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...zt(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var $f=y("$ZodEnum",(t,e)=>{oe.init(t,e);let r=xa(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>Ea.has(typeof n)).map(n=>typeof n=="string"?rr(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),kf=y("$ZodLiteral",(t,e)=>{oe.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?rr(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var Sf=y("$ZodTransform",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new qt;return r.value=o,r}}),zf=y("$ZodOptional",(t,e)=>{oe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ae(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ae(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${uo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Ef=y("$ZodNullable",(t,e)=>{oe.init(t,e),ae(t._zod,"optin",()=>e.innerType._zod.optin),ae(t._zod,"optout",()=>e.innerType._zod.optout),ae(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${uo(r.source)}|null)$`):void 0}),ae(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)}),Tf=y("$ZodDefault",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Np(s,e)):Np(o,e)}});function Np(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Pf=y("$ZodPrefault",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Rf=y("$ZodNonOptional",(t,e)=>{oe.init(t,e),ae(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 o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>jp(s,t)):jp(o,t)}});function jp(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 If=y("$ZodCatch",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ae(t._zod,"optout",()=>e.innerType._zod.optout),ae(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>dt(i,n,Xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>dt(s,n,Xe()))},input:r.value}),r.issues=[]),r)}});var Of=y("$ZodPipe",(t,e)=>{oe.init(t,e),ae(t._zod,"values",()=>e.in._zod.values),ae(t._zod,"optin",()=>e.in._zod.optin),ae(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ap(s,e,n)):Ap(o,e,n)}});function Ap(t,e,r){return Ar(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var Cf=y("$ZodReadonly",(t,e)=>{oe.init(t,e),ae(t._zod,"propValues",()=>e.innerType._zod.propValues),ae(t._zod,"values",()=>e.innerType._zod.values),ae(t._zod,"optin",()=>e.innerType._zod.optin),ae(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Mp):Mp(o)}});function Mp(t){return t.value=Object.freeze(t.value),t}var Nf=y("$ZodCustom",(t,e)=>{Ie.init(t,e),oe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Zp(s,r,n,t));Zp(o,r,n,t)}});function Zp(t,e,r,n){var o;if(!t){let s={code:"custom",input:r,inst:n,path:[...(o=n._zod.def.path)!=null?o:[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(Ra(s))}}var tb=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},rb=()=>{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){var o;return(o=t[n])!=null?o: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",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=>{var o,s,i,a;switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${tb(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Cs(n.values[0])}`:`Invalid option: expected one of ${Is(n.values,"|")}`;case"too_big":{let c=n.inclusive?"<=":"<",u=e(n.origin);return u?`Too big: expected ${(o=n.origin)!=null?o:"value"} to have ${c}${n.maximum.toString()} ${(s=u.unit)!=null?s:"elements"}`:`Too big: expected ${(i=n.origin)!=null?i:"value"} to be ${c}${n.maximum.toString()}`}case"too_small":{let c=n.inclusive?">=":">",u=e(n.origin);return u?`Too small: expected ${n.origin} to have ${c}${n.minimum.toString()} ${u.unit}`:`Too small: expected ${n.origin} to be ${c}${n.minimum.toString()}`}case"invalid_format":{let c=n;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${(a=r[c.format])!=null?a: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":""}: ${Is(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 jf(){return{localeError:rb()}}var nb=Symbol("ZodOutput"),ob=Symbol("ZodInput"),Fa=class{constructor(){this._map=new Map,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 Map,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){var n;let r=e._zod.parent;if(r){let o={...(n=this.get(r))!=null?n:{}};return delete o.id,{...o,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Af(){return new Fa}var hn=Af();function Mf(t,e){return new t({type:"string",...A(e)})}function Zf(t,e){return new t({type:"string",coerce:!0,...A(e)})}function qf(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...A(e)})}function Ha(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...A(e)})}function Df(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...A(e)})}function Lf(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(e)})}function Uf(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(e)})}function Vf(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(e)})}function Ba(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...A(e)})}function Ff(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...A(e)})}function Hf(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(e)})}function Bf(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...A(e)})}function Wf(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(e)})}function Jf(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...A(e)})}function Kf(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...A(e)})}function Gf(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(e)})}function Yf(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(e)})}function Xf(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(e)})}function Qf(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(e)})}function eh(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(e)})}function th(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...A(e)})}function rh(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...A(e)})}function nh(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...A(e)})}function oh(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...A(e)})}function sh(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(e)})}function ih(t,e){return new t({type:"string",format:"date",check:"string_format",...A(e)})}function ah(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...A(e)})}function ch(t,e){return new t({type:"string",format:"duration",check:"string_format",...A(e)})}function uh(t,e){return new t({type:"number",checks:[],...A(e)})}function lh(t,e){return new t({type:"number",coerce:!0,checks:[],...A(e)})}function dh(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...A(e)})}function ph(t,e){return new t({type:"boolean",...A(e)})}function fh(t,e){return new t({type:"boolean",coerce:!0,...A(e)})}function hh(t,e){return new t({type:"bigint",coerce:!0,...A(e)})}function mh(t,e){return new t({type:"null",...A(e)})}function _h(t){return new t({type:"any"})}function gh(t){return new t({type:"unknown"})}function vh(t,e){return new t({type:"never",...A(e)})}function yh(t,e){return new t({type:"date",coerce:!0,...A(e)})}function mn(t,e){return new qa({check:"less_than",...A(e),value:t,inclusive:!1})}function Dt(t,e){return new qa({check:"less_than",...A(e),value:t,inclusive:!0})}function _n(t,e){return new Da({check:"greater_than",...A(e),value:t,inclusive:!1})}function pt(t,e){return new Da({check:"greater_than",...A(e),value:t,inclusive:!0})}function ho(t,e){return new _p({check:"multiple_of",...A(e),value:t})}function qs(t,e){return new vp({check:"max_length",...A(e),maximum:t})}function gn(t,e){return new yp({check:"min_length",...A(e),minimum:t})}function Ds(t,e){return new wp({check:"length_equals",...A(e),length:t})}function Wa(t,e){return new bp({check:"string_format",format:"regex",...A(e),pattern:t})}function Ja(t){return new xp({check:"string_format",format:"lowercase",...A(t)})}function Ka(t){return new $p({check:"string_format",format:"uppercase",...A(t)})}function Ga(t,e){return new kp({check:"string_format",format:"includes",...A(e),includes:t})}function Ya(t,e){return new Sp({check:"string_format",format:"starts_with",...A(e),prefix:t})}function Xa(t,e){return new zp({check:"string_format",format:"ends_with",...A(e),suffix:t})}function Mr(t){return new Ep({check:"overwrite",tx:t})}function Qa(t){return Mr(e=>e.normalize(t))}function ec(){return Mr(t=>t.trim())}function tc(){return Mr(t=>t.toLowerCase())}function rc(){return Mr(t=>t.toUpperCase())}function wh(t,e,r){return new t({type:"array",element:e,...A(r)})}function bh(t,e,r){var s;let n=A(r);return(s=n.abort)!=null||(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function xh(t,e,r){return new t({type:"custom",check:"custom",fn:e,...A(r)})}function nr(t){return!!t._zod}function Me(t,e){return nr(t)?po(t,e):t.safeParse(e)}function vn(t){var e,r;if(!t)return;let n;if(nr(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 $h(t){var e;if(nr(t)){let i=(e=t._zod)===null||e===void 0?void 0:e.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 o=t.value;if(o!==void 0)return o}var yn={};ro(yn,{ZodISODate:()=>Sh,ZodISODateTime:()=>kh,ZodISODuration:()=>Eh,ZodISOTime:()=>zh,date:()=>oc,datetime:()=>nc,duration:()=>ic,time:()=>sc});var kh=y("ZodISODateTime",(t,e)=>{Gp.init(t,e),he.init(t,e)});function nc(t){return sh(kh,t)}var Sh=y("ZodISODate",(t,e)=>{Yp.init(t,e),he.init(t,e)});function oc(t){return ih(Sh,t)}var zh=y("ZodISOTime",(t,e)=>{Xp.init(t,e),he.init(t,e)});function sc(t){return ah(zh,t)}var Eh=y("ZodISODuration",(t,e)=>{Qp.init(t,e),he.init(t,e)});function ic(t){return ch(Eh,t)}var Ph=(t,e)=>{Ns.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ca(t,r)},flatten:{value:r=>Oa(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},XO=y("ZodError",Ph),_o=y("ZodError",Ph,{Parent:Error});var Rh=Md(_o),Ih=Zd(_o),Oh=Na(_o),Ch=ja(_o);var ce=y("ZodType",(t,e)=>(oe.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>{var n;return t.clone({...e,checks:[...(n=e.checks)!=null?n:[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})},t.clone=(r,n)=>lt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Rh(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Oh(t,r,n),t.parseAsync=async(r,n)=>Ih(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Ch(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Yb(r,n)),t.superRefine=r=>t.check(Xb(r)),t.overwrite=r=>t.check(Mr(r)),t.optional=()=>N(t),t.nullable=()=>Ah(t),t.nullish=()=>N(Ah(t)),t.nonoptional=r=>Fb(t,r),t.array=()=>z(t),t.or=r=>de([t,r]),t.and=r=>Vs(t,r),t.transform=r=>cc(t,Hh(r)),t.default=r=>Lb(t,r),t.prefault=r=>Vb(t,r),t.catch=r=>Bb(t,r),t.pipe=r=>cc(t,r),t.readonly=()=>Kb(t),t.describe=r=>{let n=t.clone();return hn.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){var r;return(r=hn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return hn.get(t);let n=t.clone();return hn.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Mh=y("_ZodString",(t,e)=>{var n,o,s;Zs.init(t,e),ce.init(t,e);let r=t._zod.bag;t.format=(n=r.format)!=null?n:null,t.minLength=(o=r.minimum)!=null?o:null,t.maxLength=(s=r.maximum)!=null?s:null,t.regex=(...i)=>t.check(Wa(...i)),t.includes=(...i)=>t.check(Ga(...i)),t.startsWith=(...i)=>t.check(Ya(...i)),t.endsWith=(...i)=>t.check(Xa(...i)),t.min=(...i)=>t.check(gn(...i)),t.max=(...i)=>t.check(qs(...i)),t.length=(...i)=>t.check(Ds(...i)),t.nonempty=(...i)=>t.check(gn(1,...i)),t.lowercase=i=>t.check(Ja(i)),t.uppercase=i=>t.check(Ka(i)),t.trim=()=>t.check(ec()),t.normalize=(...i)=>t.check(Qa(...i)),t.toLowerCase=()=>t.check(tc()),t.toUpperCase=()=>t.check(rc())}),uc=y("ZodString",(t,e)=>{Zs.init(t,e),Mh.init(t,e),t.email=r=>t.check(qf(db,r)),t.url=r=>t.check(Ba(Zh,r)),t.jwt=r=>t.check(oh(zb,r)),t.emoji=r=>t.check(Ff(pb,r)),t.guid=r=>t.check(Ha(Nh,r)),t.uuid=r=>t.check(Df(Ls,r)),t.uuidv4=r=>t.check(Lf(Ls,r)),t.uuidv6=r=>t.check(Uf(Ls,r)),t.uuidv7=r=>t.check(Vf(Ls,r)),t.nanoid=r=>t.check(Hf(fb,r)),t.guid=r=>t.check(Ha(Nh,r)),t.cuid=r=>t.check(Bf(hb,r)),t.cuid2=r=>t.check(Wf(mb,r)),t.ulid=r=>t.check(Jf(_b,r)),t.base64=r=>t.check(th($b,r)),t.base64url=r=>t.check(rh(kb,r)),t.xid=r=>t.check(Kf(gb,r)),t.ksuid=r=>t.check(Gf(vb,r)),t.ipv4=r=>t.check(Yf(yb,r)),t.ipv6=r=>t.check(Xf(wb,r)),t.cidrv4=r=>t.check(Qf(bb,r)),t.cidrv6=r=>t.check(eh(xb,r)),t.e164=r=>t.check(nh(Sb,r)),t.datetime=r=>t.check(nc(r)),t.date=r=>t.check(oc(r)),t.time=r=>t.check(sc(r)),t.duration=r=>t.check(ic(r))});function h(t){return Mf(uc,t)}var he=y("ZodStringFormat",(t,e)=>{le.init(t,e),Mh.init(t,e)}),db=y("ZodEmail",(t,e)=>{Lp.init(t,e),he.init(t,e)});var Nh=y("ZodGUID",(t,e)=>{qp.init(t,e),he.init(t,e)});var Ls=y("ZodUUID",(t,e)=>{Dp.init(t,e),he.init(t,e)});var Zh=y("ZodURL",(t,e)=>{Up.init(t,e),he.init(t,e)});function qh(t){return Ba(Zh,t)}var pb=y("ZodEmoji",(t,e)=>{Vp.init(t,e),he.init(t,e)});var fb=y("ZodNanoID",(t,e)=>{Fp.init(t,e),he.init(t,e)});var hb=y("ZodCUID",(t,e)=>{Hp.init(t,e),he.init(t,e)});var mb=y("ZodCUID2",(t,e)=>{Bp.init(t,e),he.init(t,e)});var _b=y("ZodULID",(t,e)=>{Wp.init(t,e),he.init(t,e)});var gb=y("ZodXID",(t,e)=>{Jp.init(t,e),he.init(t,e)});var vb=y("ZodKSUID",(t,e)=>{Kp.init(t,e),he.init(t,e)});var yb=y("ZodIPv4",(t,e)=>{ef.init(t,e),he.init(t,e)});var wb=y("ZodIPv6",(t,e)=>{tf.init(t,e),he.init(t,e)});var bb=y("ZodCIDRv4",(t,e)=>{rf.init(t,e),he.init(t,e)});var xb=y("ZodCIDRv6",(t,e)=>{nf.init(t,e),he.init(t,e)});var $b=y("ZodBase64",(t,e)=>{sf.init(t,e),he.init(t,e)});var kb=y("ZodBase64URL",(t,e)=>{af.init(t,e),he.init(t,e)});var Sb=y("ZodE164",(t,e)=>{cf.init(t,e),he.init(t,e)});var zb=y("ZodJWT",(t,e)=>{uf.init(t,e),he.init(t,e)});var Us=y("ZodNumber",(t,e)=>{var n,o,s,i,a,c,u,l,d;Ua.init(t,e),ce.init(t,e),t.gt=(p,f)=>t.check(_n(p,f)),t.gte=(p,f)=>t.check(pt(p,f)),t.min=(p,f)=>t.check(pt(p,f)),t.lt=(p,f)=>t.check(mn(p,f)),t.lte=(p,f)=>t.check(Dt(p,f)),t.max=(p,f)=>t.check(Dt(p,f)),t.int=p=>t.check(jh(p)),t.safe=p=>t.check(jh(p)),t.positive=p=>t.check(_n(0,p)),t.nonnegative=p=>t.check(pt(0,p)),t.negative=p=>t.check(mn(0,p)),t.nonpositive=p=>t.check(Dt(0,p)),t.multipleOf=(p,f)=>t.check(ho(p,f)),t.step=(p,f)=>t.check(ho(p,f)),t.finite=()=>t;let r=t._zod.bag;t.minValue=(s=Math.max((n=r.minimum)!=null?n:Number.NEGATIVE_INFINITY,(o=r.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?s:null,t.maxValue=(c=Math.min((i=r.maximum)!=null?i:Number.POSITIVE_INFINITY,(a=r.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY))!=null?c:null,t.isInt=((u=r.format)!=null?u:"").includes("int")||Number.isSafeInteger((l=r.multipleOf)!=null?l:.5),t.isFinite=!0,t.format=(d=r.format)!=null?d:null});function ne(t){return uh(Us,t)}var Eb=y("ZodNumberFormat",(t,e)=>{lf.init(t,e),Us.init(t,e)});function jh(t){return dh(Eb,t)}var lc=y("ZodBoolean",(t,e)=>{df.init(t,e),ce.init(t,e)});function ue(t){return ph(lc,t)}var Dh=y("ZodBigInt",(t,e)=>{var n,o,s;pf.init(t,e),ce.init(t,e),t.gte=(i,a)=>t.check(pt(i,a)),t.min=(i,a)=>t.check(pt(i,a)),t.gt=(i,a)=>t.check(_n(i,a)),t.gte=(i,a)=>t.check(pt(i,a)),t.min=(i,a)=>t.check(pt(i,a)),t.lt=(i,a)=>t.check(mn(i,a)),t.lte=(i,a)=>t.check(Dt(i,a)),t.max=(i,a)=>t.check(Dt(i,a)),t.positive=i=>t.check(_n(BigInt(0),i)),t.negative=i=>t.check(mn(BigInt(0),i)),t.nonpositive=i=>t.check(Dt(BigInt(0),i)),t.nonnegative=i=>t.check(pt(BigInt(0),i)),t.multipleOf=(i,a)=>t.check(ho(i,a));let r=t._zod.bag;t.minValue=(n=r.minimum)!=null?n:null,t.maxValue=(o=r.maximum)!=null?o:null,t.format=(s=r.format)!=null?s:null});var Tb=y("ZodNull",(t,e)=>{ff.init(t,e),ce.init(t,e)});function dc(t){return mh(Tb,t)}var Pb=y("ZodAny",(t,e)=>{hf.init(t,e),ce.init(t,e)});function Lh(){return _h(Pb)}var Rb=y("ZodUnknown",(t,e)=>{mf.init(t,e),ce.init(t,e)});function ye(){return gh(Rb)}var Ib=y("ZodNever",(t,e)=>{_f.init(t,e),ce.init(t,e)});function Ob(t){return vh(Ib,t)}var Uh=y("ZodDate",(t,e)=>{gf.init(t,e),ce.init(t,e),t.min=(n,o)=>t.check(pt(n,o)),t.max=(n,o)=>t.check(Dt(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var Cb=y("ZodArray",(t,e)=>{vf.init(t,e),ce.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(gn(r,n)),t.nonempty=r=>t.check(gn(1,r)),t.max=(r,n)=>t.check(qs(r,n)),t.length=(r,n)=>t.check(Ds(r,n)),t.unwrap=()=>t.element});function z(t,e){return wh(Cb,t,e)}var Vh=y("ZodObject",(t,e)=>{yf.init(t,e),ce.init(t,e),ee.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Se(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ye()}),t.loose=()=>t.clone({...t._zod.def,catchall:ye()}),t.strict=()=>t.clone({...t._zod.def,catchall:Ob()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ee.extend(t,r),t.merge=r=>ee.merge(t,r),t.pick=r=>ee.pick(t,r),t.omit=r=>ee.omit(t,r),t.partial=(...r)=>ee.partial(Bh,t,r[0]),t.required=(...r)=>ee.required(Wh,t,r[0])});function S(t,e){let r={type:"object",get shape(){return ee.assignProp(this,"shape",{...t}),this.shape},...ee.normalizeParams(e)};return new Vh(r)}function Oe(t,e){return new Vh({type:"object",get shape(){return ee.assignProp(this,"shape",{...t}),this.shape},catchall:ye(),...ee.normalizeParams(e)})}var Fh=y("ZodUnion",(t,e)=>{Va.init(t,e),ce.init(t,e),t.options=e.options});function de(t,e){return new Fh({type:"union",options:t,...ee.normalizeParams(e)})}var Nb=y("ZodDiscriminatedUnion",(t,e)=>{Fh.init(t,e),wf.init(t,e)});function pc(t,e,r){return new Nb({type:"union",options:e,discriminator:t,...ee.normalizeParams(r)})}var jb=y("ZodIntersection",(t,e)=>{bf.init(t,e),ce.init(t,e)});function Vs(t,e){return new jb({type:"intersection",left:t,right:e})}var Ab=y("ZodRecord",(t,e)=>{xf.init(t,e),ce.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function we(t,e,r){return new Ab({type:"record",keyType:t,valueType:e,...ee.normalizeParams(r)})}var ac=y("ZodEnum",(t,e)=>{$f.init(t,e),ce.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...e,checks:[],...ee.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...e,checks:[],...ee.normalizeParams(o),entries:s})}});function Se(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ac({type:"enum",entries:r,...ee.normalizeParams(e)})}var Mb=y("ZodLiteral",(t,e)=>{kf.init(t,e),ce.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 O(t,e){return new Mb({type:"literal",values:Array.isArray(t)?t:[t],...ee.normalizeParams(e)})}var Zb=y("ZodTransform",(t,e)=>{Sf.init(t,e),ce.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{var i,a,c,u;if(typeof s=="string")r.issues.push(ee.issue(s,r.value,e));else{let l=s;l.fatal&&(l.continue=!1),(i=l.code)!=null||(l.code="custom"),(a=l.input)!=null||(l.input=r.value),(c=l.inst)!=null||(l.inst=t),(u=l.continue)!=null||(l.continue=!0),r.issues.push(ee.issue(l))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Hh(t){return new Zb({type:"transform",transform:t})}var Bh=y("ZodOptional",(t,e)=>{zf.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType});function N(t){return new Bh({type:"optional",innerType:t})}var qb=y("ZodNullable",(t,e)=>{Ef.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ah(t){return new qb({type:"nullable",innerType:t})}var Db=y("ZodDefault",(t,e)=>{Tf.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Lb(t,e){return new Db({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Ub=y("ZodPrefault",(t,e)=>{Pf.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vb(t,e){return new Ub({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Wh=y("ZodNonOptional",(t,e)=>{Rf.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Fb(t,e){return new Wh({type:"nonoptional",innerType:t,...ee.normalizeParams(e)})}var Hb=y("ZodCatch",(t,e)=>{If.init(t,e),ce.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Bb(t,e){return new Hb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Wb=y("ZodPipe",(t,e)=>{Of.init(t,e),ce.init(t,e),t.in=e.in,t.out=e.out});function cc(t,e){return new Wb({type:"pipe",in:t,out:e})}var Jb=y("ZodReadonly",(t,e)=>{Cf.init(t,e),ce.init(t,e)});function Kb(t){return new Jb({type:"readonly",innerType:t})}var Jh=y("ZodCustom",(t,e)=>{Nf.init(t,e),ce.init(t,e)});function Gb(t){let e=new Ie({check:"custom"});return e._zod.check=t,e}function Kh(t,e){return bh(Jh,t!=null?t:(()=>!0),e)}function Yb(t,e={}){return xh(Jh,t,e)}function Xb(t){let e=Gb(r=>(r.addIssue=n=>{var o,s,i,a;if(typeof n=="string")r.issues.push(ee.issue(n,r.value,e._zod.def));else{let c=n;c.fatal&&(c.continue=!1),(o=c.code)!=null||(c.code="custom"),(s=c.input)!=null||(c.input=r.value),(i=c.inst)!=null||(c.inst=e),(a=c.continue)!=null||(c.continue=!e._zod.def.abort),r.issues.push(ee.issue(c))}},t(r.value,r)));return e}function fc(t,e){return cc(Hh(t),e)}var Gh={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 go={};ro(go,{bigint:()=>rx,boolean:()=>tx,date:()=>nx,number:()=>ex,string:()=>Qb});function Qb(t){return Zf(uc,t)}function ex(t){return lh(Us,t)}function tx(t){return fh(lc,t)}function rx(t){return hh(Dh,t)}function nx(t){return yh(Uh,t)}Xe(jf());var or="2025-11-25",Yh="2025-03-26",Zr=[or,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Tt="io.modelcontextprotocol/related-task",Hs="2.0",Et=Kh(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Xh=de([h(),ne().int()]),Qh=h(),sx=Oe({ttl:de([ne(),dc()]).optional(),pollInterval:ne().optional()}),mc=Oe({taskId:h()}),ix=Oe({progressToken:Xh.optional(),[Tt]:mc.optional()}),He=Oe({task:sx.optional(),_meta:ix.optional()}),ze=S({method:h(),params:He.optional()}),qr=Oe({_meta:S({[Tt]:N(mc)}).passthrough().optional()}),ot=S({method:h(),params:qr.optional()}),Ce=Oe({_meta:Oe({[Tt]:mc.optional()}).optional()}),Bs=de([h(),ne().int()]),em=S({jsonrpc:O(Hs),id:Bs,...ze.shape}).strict(),Lt=t=>em.safeParse(t).success,tm=S({jsonrpc:O(Hs),...ot.shape}).strict(),rm=t=>tm.safeParse(t).success,nm=S({jsonrpc:O(Hs),id:Bs,result:Ce}).strict(),ft=t=>nm.safeParse(t).success,M;(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"})(M||(M={}));var om=S({jsonrpc:O(Hs),id:Bs,error:S({code:ne().int(),message:h(),data:N(ye())})}).strict(),bn=t=>om.safeParse(t).success,Qe=de([em,tm,nm,om]),Ut=Ce.strict(),ax=qr.extend({requestId:Bs,reason:h().optional()}),Ws=ot.extend({method:O("notifications/cancelled"),params:ax}),cx=S({src:h(),mimeType:h().optional(),sizes:z(h()).optional()}),vo=S({icons:z(cx).optional()}),wn=S({name:h(),title:h().optional()}),sm=wn.extend({...wn.shape,...vo.shape,version:h(),websiteUrl:h().optional()}),ux=Vs(S({applyDefaults:ue().optional()}),we(h(),ye())),lx=fc(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Vs(S({form:ux.optional(),url:Et.optional()}),we(h(),ye()).optional())),dx=S({list:N(S({}).passthrough()),cancel:N(S({}).passthrough()),requests:N(S({sampling:N(S({createMessage:N(S({}).passthrough())}).passthrough()),elicitation:N(S({create:N(S({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),px=S({list:N(S({}).passthrough()),cancel:N(S({}).passthrough()),requests:N(S({tools:N(S({call:N(S({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),fx=S({experimental:we(h(),Et).optional(),sampling:S({context:Et.optional(),tools:Et.optional()}).optional(),elicitation:lx.optional(),roots:S({listChanged:ue().optional()}).optional(),tasks:N(dx)}),hx=He.extend({protocolVersion:h(),capabilities:fx,clientInfo:sm}),Js=ze.extend({method:O("initialize"),params:hx}),im=t=>Js.safeParse(t).success,mx=S({experimental:we(h(),Et).optional(),logging:Et.optional(),completions:Et.optional(),prompts:N(S({listChanged:N(ue())})),resources:S({subscribe:ue().optional(),listChanged:ue().optional()}).optional(),tools:S({listChanged:ue().optional()}).optional(),tasks:N(px)}).passthrough(),_c=Ce.extend({protocolVersion:h(),capabilities:mx,serverInfo:sm,instructions:h().optional()}),Ks=ot.extend({method:O("notifications/initialized")}),am=t=>Ks.safeParse(t).success,xn=ze.extend({method:O("ping")}),_x=S({progress:ne(),total:N(ne()),message:N(h())}),gx=S({...qr.shape,..._x.shape,progressToken:Xh}),$n=ot.extend({method:O("notifications/progress"),params:gx}),vx=He.extend({cursor:Qh.optional()}),yo=ze.extend({params:vx.optional()}),wo=Ce.extend({nextCursor:N(Qh)}),bo=S({taskId:h(),status:Se(["working","input_required","completed","failed","cancelled"]),ttl:de([ne(),dc()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:N(ne()),statusMessage:N(h())}),Vt=Ce.extend({task:bo}),yx=qr.merge(bo),xo=ot.extend({method:O("notifications/tasks/status"),params:yx}),Gs=ze.extend({method:O("tasks/get"),params:He.extend({taskId:h()})}),Ys=Ce.merge(bo),Xs=ze.extend({method:O("tasks/result"),params:He.extend({taskId:h()})}),Qs=yo.extend({method:O("tasks/list")}),ei=wo.extend({tasks:z(bo)}),cm=ze.extend({method:O("tasks/cancel"),params:He.extend({taskId:h()})}),um=Ce.merge(bo),lm=S({uri:h(),mimeType:N(h()),_meta:we(h(),ye()).optional()}),dm=lm.extend({text:h()}),gc=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),pm=lm.extend({blob:gc}),kn=S({audience:z(Se(["user","assistant"])).optional(),priority:ne().min(0).max(1).optional(),lastModified:yn.datetime({offset:!0}).optional()}),fm=S({...wn.shape,...vo.shape,uri:h(),description:N(h()),mimeType:N(h()),annotations:kn.optional(),_meta:N(Oe({}))}),wx=S({...wn.shape,...vo.shape,uriTemplate:h(),description:N(h()),mimeType:N(h()),annotations:kn.optional(),_meta:N(Oe({}))}),bx=yo.extend({method:O("resources/list")}),vc=wo.extend({resources:z(fm)}),xx=yo.extend({method:O("resources/templates/list")}),yc=wo.extend({resourceTemplates:z(wx)}),wc=He.extend({uri:h()}),$x=wc,kx=ze.extend({method:O("resources/read"),params:$x}),bc=Ce.extend({contents:z(de([dm,pm]))}),Sx=ot.extend({method:O("notifications/resources/list_changed")}),zx=wc,Ex=ze.extend({method:O("resources/subscribe"),params:zx}),Tx=wc,Px=ze.extend({method:O("resources/unsubscribe"),params:Tx}),Rx=qr.extend({uri:h()}),Ix=ot.extend({method:O("notifications/resources/updated"),params:Rx}),Ox=S({name:h(),description:N(h()),required:N(ue())}),Cx=S({...wn.shape,...vo.shape,description:N(h()),arguments:N(z(Ox)),_meta:N(Oe({}))}),Nx=yo.extend({method:O("prompts/list")}),xc=wo.extend({prompts:z(Cx)}),jx=He.extend({name:h(),arguments:we(h(),h()).optional()}),Ax=ze.extend({method:O("prompts/get"),params:jx}),$c=S({type:O("text"),text:h(),annotations:kn.optional(),_meta:we(h(),ye()).optional()}),kc=S({type:O("image"),data:gc,mimeType:h(),annotations:kn.optional(),_meta:we(h(),ye()).optional()}),Sc=S({type:O("audio"),data:gc,mimeType:h(),annotations:kn.optional(),_meta:we(h(),ye()).optional()}),Mx=S({type:O("tool_use"),name:h(),id:h(),input:S({}).passthrough(),_meta:N(S({}).passthrough())}).passthrough(),Zx=S({type:O("resource"),resource:de([dm,pm]),annotations:kn.optional(),_meta:we(h(),ye()).optional()}),qx=fm.extend({type:O("resource_link")}),zc=de([$c,kc,Sc,qx,Zx]),Dx=S({role:Se(["user","assistant"]),content:zc}),Ec=Ce.extend({description:N(h()),messages:z(Dx)}),Lx=ot.extend({method:O("notifications/prompts/list_changed")}),Ux=S({title:h().optional(),readOnlyHint:ue().optional(),destructiveHint:ue().optional(),idempotentHint:ue().optional(),openWorldHint:ue().optional()}),Vx=S({taskSupport:Se(["required","optional","forbidden"]).optional()}),hm=S({...wn.shape,...vo.shape,description:h().optional(),inputSchema:S({type:O("object"),properties:we(h(),Et).optional(),required:z(h()).optional()}).catchall(ye()),outputSchema:S({type:O("object"),properties:we(h(),Et).optional(),required:z(h()).optional()}).catchall(ye()).optional(),annotations:N(Ux),execution:N(Vx),_meta:we(h(),ye()).optional()}),Tc=yo.extend({method:O("tools/list")}),Pc=wo.extend({tools:z(hm)}),sr=Ce.extend({content:z(zc).default([]),structuredContent:we(h(),ye()).optional(),isError:N(ue())}),BC=sr.or(Ce.extend({toolResult:ye()})),Fx=He.extend({name:h(),arguments:N(we(h(),ye()))}),$o=ze.extend({method:O("tools/call"),params:Fx}),Hx=ot.extend({method:O("notifications/tools/list_changed")}),ko=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),Bx=He.extend({level:ko}),Rc=ze.extend({method:O("logging/setLevel"),params:Bx}),Wx=qr.extend({level:ko,logger:h().optional(),data:ye()}),Jx=ot.extend({method:O("notifications/message"),params:Wx}),Kx=S({name:h().optional()}),Gx=S({hints:N(z(Kx)),costPriority:N(ne().min(0).max(1)),speedPriority:N(ne().min(0).max(1)),intelligencePriority:N(ne().min(0).max(1))}),Yx=S({mode:N(Se(["auto","required","none"]))}),Xx=S({type:O("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:z(zc).default([]),structuredContent:S({}).passthrough().optional(),isError:N(ue()),_meta:N(S({}).passthrough())}).passthrough(),Qx=pc("type",[$c,kc,Sc]),Fs=pc("type",[$c,kc,Sc,Mx,Xx]),e$=S({role:Se(["user","assistant"]),content:de([Fs,z(Fs)]),_meta:N(S({}).passthrough())}).passthrough(),t$=He.extend({messages:z(e$),modelPreferences:Gx.optional(),systemPrompt:h().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:z(h()).optional(),metadata:Et.optional(),tools:N(z(hm)),toolChoice:N(Yx)}),Ic=ze.extend({method:O("sampling/createMessage"),params:t$}),So=Ce.extend({model:h(),stopReason:N(Se(["endTurn","stopSequence","maxTokens"]).or(h())),role:Se(["user","assistant"]),content:Qx}),Oc=Ce.extend({model:h(),stopReason:N(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Se(["user","assistant"]),content:de([Fs,z(Fs)])}),r$=S({type:O("boolean"),title:h().optional(),description:h().optional(),default:ue().optional()}),n$=S({type:O("string"),title:h().optional(),description:h().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:h().optional()}),o$=S({type:Se(["number","integer"]),title:h().optional(),description:h().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),s$=S({type:O("string"),title:h().optional(),description:h().optional(),enum:z(h()),default:h().optional()}),i$=S({type:O("string"),title:h().optional(),description:h().optional(),oneOf:z(S({const:h(),title:h()})),default:h().optional()}),a$=S({type:O("string"),title:h().optional(),description:h().optional(),enum:z(h()),enumNames:z(h()).optional(),default:h().optional()}),c$=de([s$,i$]),u$=S({type:O("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:S({type:O("string"),enum:z(h())}),default:z(h()).optional()}),l$=S({type:O("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:S({anyOf:z(S({const:h(),title:h()}))}),default:z(h()).optional()}),d$=de([u$,l$]),p$=de([a$,c$,d$]),f$=de([p$,r$,n$,o$]),h$=He.extend({mode:O("form").optional(),message:h(),requestedSchema:S({type:O("object"),properties:we(h(),f$),required:z(h()).optional()})}),m$=He.extend({mode:O("url"),message:h(),elicitationId:h(),url:h().url()}),_$=de([h$,m$]),Cc=ze.extend({method:O("elicitation/create"),params:_$}),g$=qr.extend({elicitationId:h()}),v$=ot.extend({method:O("notifications/elicitation/complete"),params:g$}),Sn=Ce.extend({action:Se(["accept","decline","cancel"]),content:fc(t=>t===null?void 0:t,we(h(),de([h(),ne(),ue(),z(h())])).optional())}),y$=S({type:O("ref/resource"),uri:h()});var w$=S({type:O("ref/prompt"),name:h()}),b$=He.extend({ref:de([w$,y$]),argument:S({name:h(),value:h()}),context:S({arguments:we(h(),h()).optional()}).optional()}),x$=ze.extend({method:O("completion/complete"),params:b$});var Nc=Ce.extend({completion:Oe({values:z(h()).max(100),total:N(ne().int()),hasMore:N(ue())})}),$$=S({uri:h().startsWith("file://"),name:h().optional(),_meta:we(h(),ye()).optional()}),jc=ze.extend({method:O("roots/list")}),Ac=Ce.extend({roots:z($$)}),k$=ot.extend({method:O("notifications/roots/list_changed")}),WC=de([xn,Js,x$,Rc,Ax,Nx,bx,xx,kx,Ex,Px,$o,Tc,Gs,Xs,Qs]),JC=de([Ws,$n,Ks,k$,xo]),KC=de([Ut,So,Oc,Sn,Ac,Ys,ei,Vt]),GC=de([xn,Ic,Cc,jc,Gs,Xs,Qs]),YC=de([Ws,$n,Jx,Ix,Sx,Hx,Lx,xo,v$]),XC=de([Ut,_c,Nc,Ec,xc,vc,yc,bc,sr,Pc,Ys,ei,Vt]),C=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===M.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new hc(o.elicitations,r)}return new t(e,r,n)}},hc=class extends C{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(M.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 ir(t){return t==="completed"||t==="failed"||t==="cancelled"}var _m=Symbol("Let zodToJsonSchema decide on which parser to use");var mm={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},gm=t=>typeof t=="string"?{...mm,name:t}:{...mm,...t};var vm=t=>{let e=gm(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Mc(t,e,r,n){n!=null&&n.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function G(t,e,r,n,o){t[e]=r,Mc(t,e,n,o)}var ti=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function me(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?ti(e,t.currentPath):e.join("/")}}function ym(t,e){var n,o,s;let r={type:"array"};return(n=t.type)!=null&&n._def&&((s=(o=t.type)==null?void 0:o._def)==null?void 0:s.typeName)!==k.ZodAny&&(r.items=q(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&G(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&G(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(G(r,"minItems",t.exactLength.value,t.exactLength.message,e),G(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function wm(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}function bm(){return{type:"boolean"}}function ri(t,e){return q(t.type._def,e)}var xm=(t,e)=>q(t.innerType._def,e);function Zc(t,e,r){let n=r!=null?r:e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Zc(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return S$(t,e)}}var S$=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":G(r,"minimum",n.value,n.message,e);break;case"max":G(r,"maximum",n.value,n.message,e);break}return r};function $m(t,e){return{...q(t.innerType._def,e),default:t.defaultValue()}}function km(t,e){return e.effectStrategy==="input"?q(t.schema._def,e):me(e)}function Sm(t){return{type:"string",enum:Array.from(t.values)}}var z$=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function zm(t,e){let r=[q(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),q(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(z$(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function Em(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var qc,ht={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(qc===void 0&&(qc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qc),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ni(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":mt(r,"email",n.message,e);break;case"format:idn-email":mt(r,"idn-email",n.message,e);break;case"pattern:zod":Ze(r,ht.email,n.message,e);break}break;case"url":mt(r,"uri",n.message,e);break;case"uuid":mt(r,"uuid",n.message,e);break;case"regex":Ze(r,n.regex,n.message,e);break;case"cuid":Ze(r,ht.cuid,n.message,e);break;case"cuid2":Ze(r,ht.cuid2,n.message,e);break;case"startsWith":Ze(r,RegExp(`^${Dc(n.value,e)}`),n.message,e);break;case"endsWith":Ze(r,RegExp(`${Dc(n.value,e)}$`),n.message,e);break;case"datetime":mt(r,"date-time",n.message,e);break;case"date":mt(r,"date",n.message,e);break;case"time":mt(r,"time",n.message,e);break;case"duration":mt(r,"duration",n.message,e);break;case"length":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ze(r,RegExp(Dc(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&mt(r,"ipv4",n.message,e),n.version!=="v4"&&mt(r,"ipv6",n.message,e);break}case"base64url":Ze(r,ht.base64url,n.message,e);break;case"jwt":Ze(r,ht.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ze(r,ht.ipv4Cidr,n.message,e),n.version!=="v4"&&Ze(r,ht.ipv6Cidr,n.message,e);break}case"emoji":Ze(r,ht.emoji(),n.message,e);break;case"ulid":{Ze(r,ht.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{mt(r,"binary",n.message,e);break}case"contentEncoding:base64":{G(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ze(r,ht.base64,n.message,e);break}}break}case"nanoid":Ze(r,ht.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Dc(t,e){return e.patternStrategy==="escape"?T$(t):t}var E$=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function T$(t){let e="";for(let r=0;r<t.length;r++)E$.has(t[r])||(e+="\\"),e+=t[r];return e}function mt(t,e,r,n){var o;t.format||(o=t.anyOf)!=null&&o.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):G(t,"format",e,r,n)}function Ze(t,e,r,n){var o;t.pattern||(o=t.allOf)!=null&&o.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Tm(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):G(t,"pattern",Tm(e,n),r,n)}function Tm(t,e){var c;if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let u=0;u<n.length;u++){if(s){o+=n[u],s=!1;continue}if(r.i){if(i){if(n[u].match(/[a-z]/)){a?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),a=!1):n[u+1]==="-"&&((c=n[u+2])!=null&&c.match(/[a-z]/))?(o+=n[u],a=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
|
|
87
|
+
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
|
|
88
|
+
]))`;continue}}if(r.s&&n[u]==="."){o+=i?`${n[u]}\r
|
|
89
|
+
`:`[${n[u]}\r
|
|
90
|
+
]`;continue}o+=n[u],n[u]==="\\"?s=!0:i&&n[u]==="]"?i=!1:!i&&n[u]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function oi(t,e){var n,o,s,i,a,c,u;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)===k.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,d)=>{var p;return{...l,[d]:(p=q(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",d]}))!=null?p:me(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:(o=q(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?o:e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(((s=t.keyType)==null?void 0:s._def.typeName)===k.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){let{type:l,...d}=ni(t.keyType._def,e);return{...r,propertyNames:d}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===k.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(((c=t.keyType)==null?void 0:c._def.typeName)===k.ZodBranded&&t.keyType._def.type._def.typeName===k.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){let{type:l,...d}=ri(t.keyType._def,e);return{...r,propertyNames:d}}}return r}function Pm(t,e){if(e.mapStrategy==="record")return oi(t,e);let r=q(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||me(e),n=q(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||me(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Rm(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Im(t){return t.target==="openAi"?void 0:{not:me({...t,currentPath:[...t.currentPath,"not"]})}}function Om(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var zo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Nm(t,e){if(e.target==="openApi3")return Cm(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in zo&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=zo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return Cm(t,e)}var Cm=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>q(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function jm(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:zo[t.innerType._def.typeName],nullable:!0}:{type:[zo[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=q(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=q(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Am(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Mc(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}function Mm(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],s=t.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=R$(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=q(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let i=P$(t,e);return i!==void 0&&(n.additionalProperties=i),n}function P$(t,e){if(t.catchall._def.typeName!=="ZodNever")return q(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function R$(t){try{return t.isOptional()}catch{return!0}}var Zm=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return q(t.innerType._def,e);let r=q(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:me(e)},r]}:me(e)};var qm=(t,e)=>{if(e.pipeStrategy==="input")return q(t.in._def,e);if(e.pipeStrategy==="output")return q(t.out._def,e);let r=q(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=q(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function Dm(t,e){return q(t.type._def,e)}function Lm(t,e){let n={type:"array",uniqueItems:!0,items:q(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&G(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&G(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Um(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>q(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:q(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>q(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Vm(t){return{not:me(t)}}function Fm(t){return me(t)}var Hm=(t,e)=>q(t.innerType._def,e);var Bm=(t,e,r)=>{switch(e){case k.ZodString:return ni(t,r);case k.ZodNumber:return Am(t,r);case k.ZodObject:return Mm(t,r);case k.ZodBigInt:return wm(t,r);case k.ZodBoolean:return bm();case k.ZodDate:return Zc(t,r);case k.ZodUndefined:return Vm(r);case k.ZodNull:return Om(r);case k.ZodArray:return ym(t,r);case k.ZodUnion:case k.ZodDiscriminatedUnion:return Nm(t,r);case k.ZodIntersection:return zm(t,r);case k.ZodTuple:return Um(t,r);case k.ZodRecord:return oi(t,r);case k.ZodLiteral:return Em(t,r);case k.ZodEnum:return Sm(t);case k.ZodNativeEnum:return Rm(t);case k.ZodNullable:return jm(t,r);case k.ZodOptional:return Zm(t,r);case k.ZodMap:return Pm(t,r);case k.ZodSet:return Lm(t,r);case k.ZodLazy:return()=>t.getter()._def;case k.ZodPromise:return Dm(t,r);case k.ZodNaN:case k.ZodNever:return Im(r);case k.ZodEffects:return km(t,r);case k.ZodAny:return me(r);case k.ZodUnknown:return Fm(r);case k.ZodDefault:return $m(t,r);case k.ZodBranded:return ri(t,r);case k.ZodReadonly:return Hm(t,r);case k.ZodCatch:return xm(t,r);case k.ZodPipeline:return qm(t,r);case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:return;default:return(n=>{})(e)}};function q(t,e,r=!1){var a;let n=e.seen.get(t);if(e.override){let c=(a=e.override)==null?void 0:a.call(e,t,e,n,r);if(c!==_m)return c}if(n&&!r){let c=I$(n,e);if(c!==void 0)return c}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=Bm(t,t.typeName,e),i=typeof s=="function"?q(s(),e):s;if(i&&O$(t,e,i),e.postProcess){let c=e.postProcess(i,t,e);return o.jsonSchema=i,c}return o.jsonSchema=i,i}var I$=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:ti(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),me(e)):e.$refStrategy==="seen"?me(e):void 0}},O$=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var si=(t,e)=>{var c;let r=vm(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,d])=>{var p;return{...u,[l]:(p=q(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0))!=null?p:me(r)}},{}):void 0,o=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,s=(c=q(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1))!=null?c:me(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function Lc(t){let e=vn(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");let n=$h(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Uc(t,e){let r=Me(t,e);if(!r.success)throw r.error;return r.data}var C$=6e4,zn=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(Ws,r=>{this._oncancel(r)}),this.setNotificationHandler($n,r=>{this._onprogress(r)}),this.setRequestHandler(xn,r=>({})),this._taskStore=e==null?void 0:e.taskStore,this._taskMessageQueue=e==null?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Gs,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(M.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Xs,async(r,n)=>{let o=async()=>{var s;let i=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(c.type==="response"||c.type==="error"){let u=c.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),c.type==="response")d(u);else{let p=u,f=new C(p.error.code,p.error.message,p.error.data);d(f)}else{let p=c.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${l}`))}continue}await((s=this._transport)===null||s===void 0?void 0:s.send(c.message,{relatedRequestId:n.requestId}))}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new C(M.InvalidParams,`Task not found: ${i}`);if(!ir(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(ir(a.status)){let c=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...c,_meta:{...c._meta,[Tt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Qs,async(r,n)=>{var o;try{let{tasks:s,nextCursor:i}=await this._taskStore.listTasks((o=r.params)===null||o===void 0?void 0:o.cursor,n.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new C(M.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(cm,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(M.InvalidParams,`Task not found: ${r.params.taskId}`);if(ir(o.status))throw new C(M.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new C(M.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof C?o:new C(M.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r==null||r.abort(e.params.reason)}_setupTimeout(e,r,n,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_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),C.fromError(M.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,o;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s==null||s(),this._onclose()};let i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i==null||i(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a==null||a(c,u),ft(c)||bn(c)?this._onresponse(c):Lt(c)?this._onrequest(c,u):rm(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},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=C.fromError(M.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let o of r.values())o(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(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o,s,i,a,c;let u=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,l=this._transport,d=(i=(s=(o=e.params)===null||o===void 0?void 0:o._meta)===null||s===void 0?void 0:s[Tt])===null||i===void 0?void 0:i.taskId;if(u===void 0){let m={jsonrpc:"2.0",id:e.id,error:{code:M.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:m,timestamp:Date.now()},l==null?void 0:l.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):l==null||l.send(m).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}let p=new AbortController;this._requestHandlerAbortControllers.set(e.id,p);let f=(a=e.params)===null||a===void 0?void 0:a.task,g=this._taskStore?this.requestTaskStore(e,l==null?void 0:l.sessionId):void 0,v={signal:p.signal,sessionId:l==null?void 0:l.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async m=>{let _={relatedRequestId:e.id};d&&(_.relatedTask={taskId:d}),await this.notification(m,_)},sendRequest:async(m,_,w)=>{var b,E;let P={...w,relatedRequestId:e.id};d&&!P.relatedTask&&(P.relatedTask={taskId:d});let X=(E=(b=P.relatedTask)===null||b===void 0?void 0:b.taskId)!==null&&E!==void 0?E:d;return X&&g&&await g.updateTaskStatus(X,"input_required"),await this.request(m,_,P)},authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo,taskId:d,taskStore:g,taskRequestedTtl:f==null?void 0:f.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{f&&this.assertTaskHandlerCapability(e.method)}).then(()=>u(e,v)).then(async m=>{if(p.signal.aborted)return;let _={result:m,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:_,timestamp:Date.now()},l==null?void 0:l.sessionId):await(l==null?void 0:l.send(_))},async m=>{var _;if(p.signal.aborted)return;let w={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(m.code)?m.code:M.InternalError,message:(_=m.message)!==null&&_!==void 0?_:"Internal error",...m.data!==void 0&&{data:m.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:w,timestamp:Date.now()},l==null?void 0:l.sessionId):await(l==null?void 0:l.send(w))}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),ft(e))n(e);else{let i=new C(e.error.code,e.error.message,e.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===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 s=!1;if(ft(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),ft(e))o(e);else{let i=C.fromError(e.error.code,e.error.message,e.error.data);o(i)}}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 o,s,i,a;let{task:c}=n!=null?n:{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(l){yield{type:"error",error:l instanceof C?l:new C(M.InternalError,String(l))}}return}let u;try{let l=await this.request(e,Vt,n);if(l.task)u=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new C(M.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:u},n);if(yield{type:"taskStatus",task:d},ir(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)}:d.status==="failed"?yield{type:"error",error:new C(M.InternalError,`Task ${u} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new C(M.InternalError,`Task ${u} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:u},r,n)};return}let p=(i=(o=d.pollInterval)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;await new Promise(f=>setTimeout(f,p)),(a=n==null?void 0:n.signal)===null||a===void 0||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof C?l:new C(M.InternalError,String(l))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n!=null?n:{};return new Promise((u,l)=>{var d,p,f,g,v,m,_;let w=K=>{l(K)};if(!this._transport){w(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(K){w(K);return}(p=n==null?void 0:n.signal)===null||p===void 0||p.throwIfAborted();let b=this._requestMessageId++,E={...e,jsonrpc:"2.0",id:b};n!=null&&n.onprogress&&(this._progressHandlers.set(b,n.onprogress),E.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:b}}),a&&(E.params={...E.params,task:a}),c&&(E.params={...E.params,_meta:{...((g=E.params)===null||g===void 0?void 0:g._meta)||{},[Tt]:c}});let P=K=>{var xe;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(xe=this._transport)===null||xe===void 0||xe.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(K)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(xs=>this._onerror(new Error(`Failed to send cancellation: ${xs}`)));let Ue=K instanceof C?K:new C(M.RequestTimeout,String(K));l(Ue)};this._responseHandlers.set(b,K=>{var xe;if(!(!((xe=n==null?void 0:n.signal)===null||xe===void 0)&&xe.aborted)){if(K instanceof Error)return l(K);try{let Ue=Me(r,K.result);Ue.success?u(Ue.data):l(Ue.error)}catch(Ue){l(Ue)}}}),(v=n==null?void 0:n.signal)===null||v===void 0||v.addEventListener("abort",()=>{var K;P((K=n==null?void 0:n.signal)===null||K===void 0?void 0:K.reason)});let X=(m=n==null?void 0:n.timeout)!==null&&m!==void 0?m:C$,be=()=>P(C.fromError(M.RequestTimeout,"Request timed out",{timeout:X}));this._setupTimeout(b,X,n==null?void 0:n.maxTotalTimeout,be,(_=n==null?void 0:n.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1);let et=c==null?void 0:c.taskId;if(et){let K=xe=>{let Ue=this._responseHandlers.get(b);Ue?Ue(xe):this._onerror(new Error(`Response handler missing for side-channeled request ${b}`))};this._requestResolvers.set(b,K),this._enqueueTaskMessage(et,{type:"request",message:E,timestamp:Date.now()}).catch(xe=>{this._cleanupTimeout(b),l(xe)})}else this._transport.send(E,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(K=>{this._cleanupTimeout(b),l(K)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ys,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},ei,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},um,r)}async notification(e,r){var n,o,s,i,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let c=(n=r==null?void 0:r.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){let p={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((o=e.params)===null||o===void 0?void 0:o._meta)||{},[Tt]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:p,timestamp:Date.now()});return}if(((i=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var p,f;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let g={...e,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(g={...g,params:{...g.params,_meta:{...((p=g.params)===null||p===void 0?void 0:p._meta)||{},[Tt]:r.relatedTask}}}),(f=this._transport)===null||f===void 0||f.send(g,r).catch(v=>this._onerror(v))});return}let d={...e,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(d={...d,params:{...d.params,_meta:{...((a=d.params)===null||a===void 0?void 0:a._meta)||{},[Tt]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=Lc(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Uc(e,o);return Promise.resolve(r(i,s))})}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=Lc(e);this._notificationHandlers.set(n,o=>{let s=Uc(e,o);return Promise.resolve(r(s))})}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 o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=(o=this._options)===null||o===void 0?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,s)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Lt(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new C(M.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,o,s;let i=(o=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;try{let a=await((s=this._taskStore)===null||s===void 0?void 0:s.getTask(e));a!=null&&a.pollInterval&&(i=a.pollInterval)}catch{}return new Promise((a,c)=>{if(r.aborted){c(new C(M.InvalidRequest,"Request cancelled"));return}let u=setTimeout(a,i);r.addEventListener("abort",()=>{clearTimeout(u),c(new C(M.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new C(M.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=xo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ir(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new C(M.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(ir(a.status))throw new C(M.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=xo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ir(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wm(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ii(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];Wm(i)&&Wm(s)?r[o]={...i,...s}:r[o]=s}return r}var Cv=xt(El(),1),Nv=xt(Ov(),1);function $P(){let t=new Cv.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Nv.default)(t),t}var Vn=class{constructor(e){this._ajv=e!=null?e:$P()}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 o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Vi=class{constructor(e){this._client=e}async*callToolStream(e,r=sr,n){var o;let s=this._client,i={...n,task:(o=n==null?void 0:n.task)!==null&&o!==void 0?o:s.isToolTask(e.name)?{}:void 0},a=s.requestStream({method:"tools/call",params:e},r,i),c=s.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&c){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new C(M.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=c(l.structuredContent);if(!d.valid){yield{type:"error",error:new C(M.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof C){yield{type:"error",error:d};return}yield{type:"error",error:new C(M.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}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 Fi(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 Hi(t,e,r){var n,o;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(!(!((o=t.elicitation)===null||o===void 0)&&o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Bi(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 o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Bi(s,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Bi(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Bi(r,e)}}function kP(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 Wi=class extends zn{constructor(e,r){var n,o;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r==null?void 0:r.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(o=r==null?void 0:r.jsonSchemaValidator)!==null&&o!==void 0?o:new Vn}get experimental(){return this._experimental||(this._experimental={tasks:new Vi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ii(this._capabilities,e)}setRequestHandler(e,r){var n,o,s;let i=vn(e),a=i==null?void 0:i.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(nr(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d==null?void 0:d.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(s=d==null?void 0:d.value)!==null&&s!==void 0?s:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");let u=c;if(u==="elicitation/create"){let l=async(d,p)=>{var f,g,v;let m=Me(Cc,d);if(!m.success){let K=m.error instanceof Error?m.error.message:String(m.error);throw new C(M.InvalidParams,`Invalid elicitation request: ${K}`)}let{params:_}=m.data,w=(f=_.mode)!==null&&f!==void 0?f:"form",{supportsFormMode:b,supportsUrlMode:E}=kP(this._capabilities.elicitation);if(w==="form"&&!b)throw new C(M.InvalidParams,"Client does not support form-mode elicitation requests");if(w==="url"&&!E)throw new C(M.InvalidParams,"Client does not support URL-mode elicitation requests");let P=await Promise.resolve(r(d,p));if(_.task){let K=Me(Vt,P);if(!K.success){let xe=K.error instanceof Error?K.error.message:String(K.error);throw new C(M.InvalidParams,`Invalid task creation result: ${xe}`)}return K.data}let X=Me(Sn,P);if(!X.success){let K=X.error instanceof Error?X.error.message:String(X.error);throw new C(M.InvalidParams,`Invalid elicitation result: ${K}`)}let be=X.data,et=w==="form"?_.requestedSchema:void 0;if(w==="form"&&be.action==="accept"&&be.content&&et&&!((v=(g=this._capabilities.elicitation)===null||g===void 0?void 0:g.form)===null||v===void 0)&&v.applyDefaults)try{Bi(et,be.content)}catch{}return be};return super.setRequestHandler(e,l)}if(u==="sampling/createMessage"){let l=async(d,p)=>{let f=Me(Ic,d);if(!f.success){let _=f.error instanceof Error?f.error.message:String(f.error);throw new C(M.InvalidParams,`Invalid sampling request: ${_}`)}let{params:g}=f.data,v=await Promise.resolve(r(d,p));if(g.task){let _=Me(Vt,v);if(!_.success){let w=_.error instanceof Error?_.error.message:String(_.error);throw new C(M.InvalidParams,`Invalid task creation result: ${w}`)}return _.data}let m=Me(So,v);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new C(M.InvalidParams,`Invalid sampling result: ${_}`)}return m.data};return super.setRequestHandler(e,l)}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:or,capabilities:this._capabilities,clientInfo:this._clientInfo}},_c,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Zr.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,o,s,i;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(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.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;Fi((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&&Hi((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ut,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Nc,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ut,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Ec,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},xc,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},vc,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},yc,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},bc,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ut,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ut,r)}async callTool(e,r=sr,n){if(this.isToolTaskRequired(e.name))throw new C(M.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),s=this.getToolOutputValidator(e.name);if(s){if(!o.structuredContent&&!o.isError)throw new C(M.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new C(M.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof C?i:new C(M.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}isToolTask(e){var r,n,o,s;return!((s=(o=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||o===void 0?void 0:o.tools)===null||s===void 0)&&s.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 s=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,s)}let o=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(n.name),o==="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},Pc,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Ji=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};var Ki=class extends zn{constructor(e,r){var n,o;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ko.options.map((s,i)=>[s,i])),this.isMessageIgnored=(s,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=(n=r==null?void 0:r.capabilities)!==null&&n!==void 0?n:{},this._instructions=r==null?void 0:r.instructions,this._jsonSchemaValidator=(o=r==null?void 0:r.jsonSchemaValidator)!==null&&o!==void 0?o:new Vn,this.setRequestHandler(Js,s=>this._oninitialize(s)),this.setNotificationHandler(Ks,()=>{var s;return(s=this.oninitialized)===null||s===void 0?void 0:s.call(this)}),this._capabilities.logging&&this.setRequestHandler(Rc,async(s,i)=>{var a;let c=i.sessionId||((a=i.requestInfo)===null||a===void 0?void 0:a.headers["mcp-session-id"])||void 0,{level:u}=s.params,l=ko.safeParse(u);return l.success&&this._loggingLevels.set(c,l.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Ji(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ii(this._capabilities,e)}setRequestHandler(e,r){var n,o,s;let i=vn(e),a=i==null?void 0:i.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(nr(a)){let l=a,d=(n=l._zod)===null||n===void 0?void 0:n.def;c=(o=d==null?void 0:d.value)!==null&&o!==void 0?o:l.value}else{let l=a,d=l._def;c=(s=d==null?void 0:d.value)!==null&&s!==void 0?s:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");if(c==="tools/call"){let l=async(d,p)=>{let f=Me($o,d);if(!f.success){let _=f.error instanceof Error?f.error.message:String(f.error);throw new C(M.InvalidParams,`Invalid tools/call request: ${_}`)}let{params:g}=f.data,v=await Promise.resolve(r(d,p));if(g.task){let _=Me(Vt,v);if(!_.success){let w=_.error instanceof Error?_.error.message:String(_.error);throw new C(M.InvalidParams,`Invalid task creation result: ${w}`)}return _.data}let m=Me(sr,v);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new C(M.InvalidParams,`Invalid tools/call result: ${_}`)}return m.data};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){var r,n,o;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((o=this._clientCapabilities)===null||o===void 0)&&o.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){var r,n;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(!((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.elicitation)===null||n===void 0)&&n.url))throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){var r,n;Hi((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Client")}assertTaskHandlerCapability(e){var r;this._capabilities&&Fi((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Zr.includes(r)?r:or,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ut)}async createMessage(e,r){var n,o;if((e.tools||e.toolChoice)&&!(!((o=(n=this._clientCapabilities)===null||n===void 0?void 0:n.sampling)===null||o===void 0)&&o.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],i=Array.isArray(s.content)?s.content:[s.content],a=i.some(d=>d.type==="tool_result"),c=e.messages.length>1?e.messages[e.messages.length-2]:void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(d=>d.type==="tool_use");if(a){if(i.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter(f=>f.type==="tool_use").map(f=>f.id)),p=new Set(i.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(d.size!==p.size||![...d].every(f=>p.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Oc,r):this.request({method:"sampling/createMessage",params:e},So,r)}async elicitInput(e,r){var n,o,s,i,a;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((s=(o=this._clientCapabilities)===null||o===void 0?void 0:o.elicitation)===null||s===void 0)&&s.url))throw new Error("Client does not support url elicitation.");let u=e;return this.request({method:"elicitation/create",params:u},Sn,r)}case"form":{if(!(!((a=(i=this._clientCapabilities)===null||i===void 0?void 0:i.elicitation)===null||a===void 0)&&a.form))throw new Error("Client does not support form elicitation.");let u=e.mode==="form"?e:{...e,mode:"form"},l=await this.request({method:"elicitation/create",params:u},Sn,r);if(l.action==="accept"&&l.content&&u.requestedSchema)try{let p=this._jsonSchemaValidator.getValidator(u.requestedSchema)(l.content);if(!p.valid)throw new C(M.InvalidParams,`Elicitation response content does not match requested schema: ${p.errorMessage}`)}catch(d){throw d instanceof C?d:new C(M.InternalError,`Error validating elicitation response: ${d instanceof Error?d.message:String(d)}`)}return l}}}createElicitationCompletionNotifier(e,r){var n,o;if(!(!((o=(n=this._clientCapabilities)===null||n===void 0?void 0:n.elicitation)===null||o===void 0)&&o.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ac,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Gi=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 jl(t){}function Yi(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=jl,onError:r=jl,onRetry:n=jl,onComment:o}=t,s="",i=!0,a,c="",u="";function l(v){let m=i?v.replace(/^\xEF\xBB\xBF/,""):v,[_,w]=SP(`${s}${m}`);for(let b of _)d(b);s=w,i=!1}function d(v){if(v===""){f();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let m=v.indexOf(":");if(m!==-1){let _=v.slice(0,m),w=v[m+1]===" "?2:1,b=v.slice(m+w);p(_,b,v);return}p(v,"",v)}function p(v,m,_){switch(v){case"event":u=m;break;case"data":c=`${c}${m}
|
|
91
|
+
`;break;case"id":a=m.includes("\0")?void 0:m;break;case"retry":/^\d+$/.test(m)?n(parseInt(m,10)):r(new Gi(`Invalid \`retry\` value: "${m}"`,{type:"invalid-retry",value:m,line:_}));break;default:r(new Gi(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:m,line:_}));break}}function f(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
92
|
+
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function g(v={}){s&&v.consume&&d(s),i=!0,a=void 0,c="",u="",s=""}return{feed:l,reset:g}}function SP(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),s=t.indexOf(`
|
|
93
|
+
`,n),i=-1;if(o!==-1&&s!==-1?i=Math.min(o,s):o!==-1?i=o:s!==-1&&(i=s),i===-1){r=t.slice(n);break}else{let a=t.slice(n,i);e.push(a),n=i+1,t[n-1]==="\r"&&t[n]===`
|
|
94
|
+
`&&n++}}return[e,r]}var Qi=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r==null?void 0:r.code)!=null?n:void 0,this.message=(o=r==null?void 0:r.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(jv(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(jv(this),r)}};function zP(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Al(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Al).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Al(t.cause)}`:t.message:`${t}`}function jv(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Mv=t=>{throw TypeError(t)},Fl=(t,e,r)=>e.has(t)||Mv("Cannot "+r),J=(t,e,r)=>(Fl(t,e,"read from private field"),r?r.call(t):e.get(t)),$e=(t,e,r)=>e.has(t)?Mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),_e=(t,e,r,n)=>(Fl(t,e,"write to private field"),e.set(t,r),r),Kt=(t,e,r)=>(Fl(t,e,"access private method"),r),Ge,Gr,Fn,Xi,ea,os,Wn,ss,mr,Hn,Jn,Bn,rs,bt,Ml,Zl,ql,Av,Dl,Ll,ns,Ul,Vl,Yr=class extends EventTarget{constructor(e,r){var n,o;super(),$e(this,bt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,$e(this,Ge),$e(this,Gr),$e(this,Fn),$e(this,Xi),$e(this,ea),$e(this,os),$e(this,Wn),$e(this,ss,null),$e(this,mr),$e(this,Hn),$e(this,Jn,null),$e(this,Bn,null),$e(this,rs,null),$e(this,Zl,async s=>{var i;J(this,Hn).reset();let{body:a,redirected:c,status:u,headers:l}=s;if(u===204){Kt(this,bt,ns).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?_e(this,Fn,new URL(s.url)):_e(this,Fn,void 0),u!==200){Kt(this,bt,ns).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get("content-type")||"").startsWith("text/event-stream")){Kt(this,bt,ns).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(J(this,Ge)===this.CLOSED)return;_e(this,Ge,this.OPEN);let d=new Event("open");if((i=J(this,rs))==null||i.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){Kt(this,bt,ns).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,f=a.getReader(),g=!0;do{let{done:v,value:m}=await f.read();m&&J(this,Hn).feed(p.decode(m,{stream:!v})),v&&(g=!1,J(this,Hn).reset(),Kt(this,bt,Ul).call(this))}while(g)}),$e(this,ql,s=>{_e(this,mr,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Kt(this,bt,Ul).call(this,Al(s))}),$e(this,Dl,s=>{typeof s.id=="string"&&_e(this,ss,s.id);let i=new MessageEvent(s.event||"message",{data:s.data,origin:J(this,Fn)?J(this,Fn).origin:J(this,Gr).origin,lastEventId:s.id||""});J(this,Bn)&&(!s.event||s.event==="message")&&J(this,Bn).call(this,i),this.dispatchEvent(i)}),$e(this,Ll,s=>{_e(this,os,s)}),$e(this,Vl,()=>{_e(this,Wn,void 0),J(this,Ge)===this.CONNECTING&&Kt(this,bt,Ml).call(this)});try{if(e instanceof URL)_e(this,Gr,e);else if(typeof e=="string")_e(this,Gr,new URL(e,EP()));else throw new Error("Invalid URL")}catch{throw zP("An invalid or illegal string was specified")}_e(this,Hn,Yi({onEvent:J(this,Dl),onRetry:J(this,Ll)})),_e(this,Ge,this.CONNECTING),_e(this,os,3e3),_e(this,ea,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),_e(this,Xi,(o=r==null?void 0:r.withCredentials)!=null?o:!1),Kt(this,bt,Ml).call(this)}get readyState(){return J(this,Ge)}get url(){return J(this,Gr).href}get withCredentials(){return J(this,Xi)}get onerror(){return J(this,Jn)}set onerror(e){_e(this,Jn,e)}get onmessage(){return J(this,Bn)}set onmessage(e){_e(this,Bn,e)}get onopen(){return J(this,rs)}set onopen(e){_e(this,rs,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){J(this,Wn)&&clearTimeout(J(this,Wn)),J(this,Ge)!==this.CLOSED&&(J(this,mr)&&J(this,mr).abort(),_e(this,Ge,this.CLOSED),_e(this,mr,void 0))}};Ge=new WeakMap,Gr=new WeakMap,Fn=new WeakMap,Xi=new WeakMap,ea=new WeakMap,os=new WeakMap,Wn=new WeakMap,ss=new WeakMap,mr=new WeakMap,Hn=new WeakMap,Jn=new WeakMap,Bn=new WeakMap,rs=new WeakMap,bt=new WeakSet,Ml=function(){_e(this,Ge,this.CONNECTING),_e(this,mr,new AbortController),J(this,ea)(J(this,Gr),Kt(this,bt,Av).call(this)).then(J(this,Zl)).catch(J(this,ql))},Zl=new WeakMap,ql=new WeakMap,Av=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...J(this,ss)?{"Last-Event-ID":J(this,ss)}:void 0},cache:"no-store",signal:(t=J(this,mr))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Dl=new WeakMap,Ll=new WeakMap,ns=function(t,e){var r;J(this,Ge)!==this.CLOSED&&_e(this,Ge,this.CLOSED);let n=new Qi("error",{code:e,message:t});(r=J(this,Jn))==null||r.call(this,n),this.dispatchEvent(n)},Ul=function(t,e){var r;if(J(this,Ge)===this.CLOSED)return;_e(this,Ge,this.CONNECTING);let n=new Qi("error",{code:e,message:t});(r=J(this,Jn))==null||r.call(this,n),this.dispatchEvent(n),_e(this,Wn,setTimeout(J(this,Vl),J(this,os)))},Vl=new WeakMap,Yr.CONNECTING=0,Yr.OPEN=1,Yr.CLOSED=2;function EP(){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}function Kn(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function ta(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n!=null&&n.headers?{...Kn(e.headers),...Kn(n.headers)}:e.headers};return t(r,o)}:t}var Hl,Zv,qv,Dv;Hl=(Dv=(qv=(Zv=globalThis.crypto)==null?void 0:Zv.webcrypto)!=null?qv:globalThis.crypto)!=null?Dv:import("node:crypto").then(t=>t.webcrypto);async function TP(t){return(await Hl).getRandomValues(new Uint8Array(t))}async function PP(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await TP(t);for(let o=0;o<t;o++){let s=n[o]%e.length;r+=e[s]}return r}async function RP(t){return await PP(t)}async function IP(t){let e=await(await Hl).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Bl(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await RP(t),r=await IP(e);return{code_verifier:e,code_challenge:r}}var Pe=qh().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Gh.custom,message:"URL must be parseable",fatal:!0}),ya}).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"}),Uv=Oe({resource:h().url(),authorization_servers:z(Pe).optional(),jwks_uri:h().url().optional(),scopes_supported:z(h()).optional(),bearer_methods_supported:z(h()).optional(),resource_signing_alg_values_supported:z(h()).optional(),resource_name:h().optional(),resource_documentation:h().optional(),resource_policy_uri:h().url().optional(),resource_tos_uri:h().url().optional(),tls_client_certificate_bound_access_tokens:ue().optional(),authorization_details_types_supported:z(h()).optional(),dpop_signing_alg_values_supported:z(h()).optional(),dpop_bound_access_tokens_required:ue().optional()}),Wl=Oe({issuer:h(),authorization_endpoint:Pe,token_endpoint:Pe,registration_endpoint:Pe.optional(),scopes_supported:z(h()).optional(),response_types_supported:z(h()),response_modes_supported:z(h()).optional(),grant_types_supported:z(h()).optional(),token_endpoint_auth_methods_supported:z(h()).optional(),token_endpoint_auth_signing_alg_values_supported:z(h()).optional(),service_documentation:Pe.optional(),revocation_endpoint:Pe.optional(),revocation_endpoint_auth_methods_supported:z(h()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(h()).optional(),introspection_endpoint:h().optional(),introspection_endpoint_auth_methods_supported:z(h()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(h()).optional(),code_challenge_methods_supported:z(h()).optional(),client_id_metadata_document_supported:ue().optional()}),OP=Oe({issuer:h(),authorization_endpoint:Pe,token_endpoint:Pe,userinfo_endpoint:Pe.optional(),jwks_uri:Pe,registration_endpoint:Pe.optional(),scopes_supported:z(h()).optional(),response_types_supported:z(h()),response_modes_supported:z(h()).optional(),grant_types_supported:z(h()).optional(),acr_values_supported:z(h()).optional(),subject_types_supported:z(h()),id_token_signing_alg_values_supported:z(h()),id_token_encryption_alg_values_supported:z(h()).optional(),id_token_encryption_enc_values_supported:z(h()).optional(),userinfo_signing_alg_values_supported:z(h()).optional(),userinfo_encryption_alg_values_supported:z(h()).optional(),userinfo_encryption_enc_values_supported:z(h()).optional(),request_object_signing_alg_values_supported:z(h()).optional(),request_object_encryption_alg_values_supported:z(h()).optional(),request_object_encryption_enc_values_supported:z(h()).optional(),token_endpoint_auth_methods_supported:z(h()).optional(),token_endpoint_auth_signing_alg_values_supported:z(h()).optional(),display_values_supported:z(h()).optional(),claim_types_supported:z(h()).optional(),claims_supported:z(h()).optional(),service_documentation:h().optional(),claims_locales_supported:z(h()).optional(),ui_locales_supported:z(h()).optional(),claims_parameter_supported:ue().optional(),request_parameter_supported:ue().optional(),request_uri_parameter_supported:ue().optional(),require_request_uri_registration:ue().optional(),op_policy_uri:Pe.optional(),op_tos_uri:Pe.optional(),client_id_metadata_document_supported:ue().optional()}),Vv=S({...OP.shape,...Wl.pick({code_challenge_methods_supported:!0}).shape}),Fv=S({access_token:h(),id_token:h().optional(),token_type:h(),expires_in:go.number().optional(),scope:h().optional(),refresh_token:h().optional()}).strip(),Hv=S({error:h(),error_description:h().optional(),error_uri:h().optional()}),Lv=Pe.optional().or(O("").transform(()=>{})),CP=S({redirect_uris:z(Pe),token_endpoint_auth_method:h().optional(),grant_types:z(h()).optional(),response_types:z(h()).optional(),client_name:h().optional(),client_uri:Pe.optional(),logo_uri:Lv,scope:h().optional(),contacts:z(h()).optional(),tos_uri:Lv,policy_uri:h().optional(),jwks_uri:Pe.optional(),jwks:Lh().optional(),software_id:h().optional(),software_version:h().optional(),software_statement:h().optional()}).strip(),NP=S({client_id:h(),client_secret:h().optional(),client_id_issued_at:ne().optional(),client_secret_expires_at:ne().optional()}).strip(),Bv=CP.merge(NP),qM=S({error:h(),error_description:h().optional()}).strip(),DM=S({token:h(),token_type_hint:h().optional()}).strip();function Wv(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Jv({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 o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var ve=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}},is=class extends ve{};is.errorCode="invalid_request";var Xr=class extends ve{};Xr.errorCode="invalid_client";var Qr=class extends ve{};Qr.errorCode="invalid_grant";var en=class extends ve{};en.errorCode="unauthorized_client";var as=class extends ve{};as.errorCode="unsupported_grant_type";var cs=class extends ve{};cs.errorCode="invalid_scope";var us=class extends ve{};us.errorCode="access_denied";var Gt=class extends ve{};Gt.errorCode="server_error";var ls=class extends ve{};ls.errorCode="temporarily_unavailable";var ds=class extends ve{};ds.errorCode="unsupported_response_type";var ps=class extends ve{};ps.errorCode="unsupported_token_type";var fs=class extends ve{};fs.errorCode="invalid_token";var hs=class extends ve{};hs.errorCode="method_not_allowed";var ms=class extends ve{};ms.errorCode="too_many_requests";var tn=class extends ve{};tn.errorCode="invalid_client_metadata";var _s=class extends ve{};_s.errorCode="insufficient_scope";var gs=class extends ve{};gs.errorCode="invalid_target";var Kv={[is.errorCode]:is,[Xr.errorCode]:Xr,[Qr.errorCode]:Qr,[en.errorCode]:en,[as.errorCode]:as,[cs.errorCode]:cs,[us.errorCode]:us,[Gt.errorCode]:Gt,[ls.errorCode]:ls,[ds.errorCode]:ds,[ps.errorCode]:ps,[fs.errorCode]:fs,[hs.errorCode]:hs,[ms.errorCode]:ms,[tn.errorCode]:tn,[_s.errorCode]:_s,[gs.errorCode]:gs};var Le=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function jP(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var Jl="code",Kl="S256";function AP(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&&jP(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 MP(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":ZP(o,s,r);return;case"client_secret_post":qP(o,s,n);return;case"none":DP(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function ZP(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 qP(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function DP(t,e){e.set("client_id",t)}async function Yv(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Hv.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=Kv[o]||Gt;return new a(s||"",i)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Gt(o)}}async function Yt(t,e){var r,n;try{return await Gl(t,e)}catch(o){if(o instanceof Xr||o instanceof en)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Gl(t,e);if(o instanceof Qr)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await Gl(t,e);throw o}}async function Gl(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){var i,a;let c,u;try{c=await VP(e,{resourceMetadataUrl:o},s),c.authorization_servers&&c.authorization_servers.length>0&&(u=c.authorization_servers[0])}catch{}u||(u=new URL("/",e));let l=await UP(e,t,c),d=await JP(u,{fetchFn:s}),p=await Promise.resolve(t.clientInformation());if(!p){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let w=(d==null?void 0:d.client_id_metadata_document_supported)===!0,b=t.clientMetadataUrl;if(b&&!LP(b))throw new tn(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${b}`);if(w&&b)p={client_id:b},await((i=t.saveClientInformation)===null||i===void 0?void 0:i.call(t,p));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let P=await QP(u,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(P),p=P}}let f=!t.redirectUrl;if(r!==void 0||f){let w=await XP(t,u,{metadata:d,resource:l,authorizationCode:r,fetchFn:s});return await t.saveTokens(w),"AUTHORIZED"}let g=await t.tokens();if(g!=null&&g.refresh_token)try{let w=await YP(u,{metadata:d,clientInformation:p,refreshToken:g.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(w),"AUTHORIZED"}catch(w){if(!(!(w instanceof ve)||w instanceof Gt))throw w}let v=t.state?await t.state():void 0,{authorizationUrl:m,codeVerifier:_}=await KP(u,{metadata:d,clientInformation:p,state:v,redirectUrl:t.redirectUrl,scope:n||((a=c==null?void 0:c.scopes_supported)===null||a===void 0?void 0:a.join(" "))||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(_),await t.redirectToAuthorization(m),"REDIRECT"}function LP(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function UP(t,e,r){let n=Wv(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!Jv({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 Gn(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Yl(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=Yl(t,"scope")||void 0,a=Yl(t,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Yl(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function VP(t,e,r=fetch){var n,o;let s=await BP(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw await((n=s==null?void 0:s.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await((o=s.body)===null||o===void 0?void 0:o.cancel()),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Uv.parse(await s.json())}async function Xl(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Xl(t,void 0,r):void 0;throw n}}function FP(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Gv(t,e,r=fetch){return await Xl(t,{"MCP-Protocol-Version":e},r)}function HP(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function BP(t,e,r,n){var o,s;let i=new URL(t),a=(o=n==null?void 0:n.protocolVersion)!==null&&o!==void 0?o:or,c;if(n!=null&&n.metadataUrl)c=new URL(n.metadataUrl);else{let l=FP(e,i.pathname);c=new URL(l,(s=n==null?void 0:n.metadataServerUrl)!==null&&s!==void 0?s:i),c.search=i.search}let u=await Gv(c,a,r);if(!(n!=null&&n.metadataUrl)&&HP(u,i.pathname)){let l=new URL(`/.well-known/${e}`,i);u=await Gv(l,a,r)}return u}function WP(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 o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function JP(t,{fetchFn:e=fetch,protocolVersion:r=or}={}){var n;let o={"MCP-Protocol-Version":r,Accept:"application/json"},s=WP(t);for(let{url:i,type:a}of s){let c=await Xl(i,o,e);if(c){if(!c.ok){if(await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?Wl.parse(await c.json()):Vv.parse(await c.json())}}}async function KP(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Jl))throw new Error(`Incompatible auth server: does not support response type ${Jl}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Kl))throw new Error(`Incompatible auth server: does not support code challenge method ${Kl}`)}else a=new URL("/authorize",t);let c=await Bl(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",Jl),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Kl),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o!=null&&o.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function GP(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Xv(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){var a;let c=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(u,r,c,e);else if(n){let d=(a=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],p=AP(n,d);MP(p,n,u,r)}let l=await(i!=null?i:fetch)(c,{method:"POST",headers:u,body:r});if(!l.ok)throw await Yv(l);return Fv.parse(await l.json())}async function YP(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await Xv(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function XP(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(i)),!a){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await t.codeVerifier();a=GP(o,u,t.redirectUrl)}let c=await t.clientInformation();return Xv(e,{metadata:r,tokenRequestParams:a,clientInformation:c!=null?c:void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function QP(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n!=null?n:fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await Yv(s);return Bv.parse(await s.json())}var Ql=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},ra=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r==null?void 0:r.eventSourceInit,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=ta(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new Le("No auth provider");let r;try{r=await Yt(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 Le;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Kn((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let o=(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((s,i)=>{this._eventSource=new Yr(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let l=await o(a,{...c,headers:u});if(l.status===401&&l.headers.has("www-authenticate")){let{resourceMetadataUrl:d,scope:p}=Gn(l);this._resourceMetadataUrl=d,this._scope=p}return l}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(s,i);return}let u=new Ql(a.code,a.message,a);i(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(l){i(l),(c=this.onerror)===null||c===void 0||c.call(this,l),this.close();return}s()}),this._eventSource.onmessage=a=>{var c,u;let l=a,d;try{d=Qe.parse(JSON.parse(l.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.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 Le("No auth provider");if(await Yt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Le("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,o;if(!this._endpoint)throw new Error("Not connected");try{let s=await this._commonHeaders();s.set("content-type","application/json");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,i);if(!a.ok){let c=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:l}=Gn(a);if(this._resourceMetadataUrl=u,this._scope=l,await Yt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Le;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(s){throw(o=this.onerror)===null||o===void 0||o.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}};var iy=require("node:crypto");var ry=xt(ty());function vs(t,{limit:e,encoding:r}){let n=ry.default.parse(e);return new Promise((o,s)=>{let i=0,a=[];t.on("data",c=>{if(i+=c.length,i>n)return s(new Error(`Message size exceeds limit of ${e} bytes`));a.push(c)}),t.on("end",()=>{try{o(Buffer.concat(a).toString(r))}catch(c){s(c)}}),t.on("error",c=>{s(c)})})}var ay=xt(td(),1),cy=require("node:url"),pR="4mb",oa=class{constructor(e,r,n){this._endpoint=e,this.res=r,this._sessionId=(0,iy.randomUUID)(),this._options=n||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let r=e.headers.host;if(!r||!this._options.allowedHosts.includes(r))return`Invalid Host header: ${r}`}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let r=e.headers.origin;if(r&&!this._options.allowedOrigins.includes(r))return`Invalid Origin header: ${r}`}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",r=new cy.URL(this._endpoint,e);r.searchParams.set("sessionId",this._sessionId);let n=r.pathname+r.search+r.hash;this.res.write(`event: endpoint
|
|
95
|
+
data: ${n}
|
|
96
|
+
|
|
97
|
+
`),this._sseResponse=this.res,this.res.on("close",()=>{var o;this._sseResponse=void 0,(o=this.onclose)===null||o===void 0||o.call(this)})}async handlePostMessage(e,r,n){var o,s,i,a;if(!this._sseResponse){let p="SSE connection not established";throw r.writeHead(500).end(p),new Error(p)}let c=this.validateRequestHeaders(e);if(c){r.writeHead(403).end(c),(o=this.onerror)===null||o===void 0||o.call(this,new Error(c));return}let u=e.auth,l={headers:e.headers},d;try{let p=ay.default.parse((s=e.headers["content-type"])!==null&&s!==void 0?s:"");if(p.type!=="application/json")throw new Error(`Unsupported content-type: ${p.type}`);d=n!=null?n:await vs(e,{limit:pR,encoding:(i=p.parameters.charset)!==null&&i!==void 0?i:"utf-8"})}catch(p){r.writeHead(400).end(String(p)),(a=this.onerror)===null||a===void 0||a.call(this,p);return}try{await this.handleMessage(typeof d=="string"?JSON.parse(d):d,{requestInfo:l,authInfo:u})}catch{r.writeHead(400).end(`Invalid message: ${d}`);return}r.writeHead(202).end("Accepted")}async handleMessage(e,r){var n,o;let s;try{s=Qe.parse(e)}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}(o=this.onmessage)===null||o===void 0||o.call(this,s,r)}async close(){var e,r;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
|
|
64
98
|
data: ${JSON.stringify(e)}
|
|
65
99
|
|
|
66
|
-
`)}get sessionId(){return this._sessionId}};var
|
|
67
|
-
`);if(e===-1)return null;let
|
|
68
|
-
`}var
|
|
69
|
-
|
|
70
|
-
`),a+=`data: ${JSON.stringify(t)}
|
|
71
|
-
|
|
72
|
-
`,e.write(a)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,t,s){var a,n,o,i,c;try{let l=e.headers.accept;if(!(l!=null&&l.includes("application/json"))||!l.includes("text/event-stream")){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let d=e.headers["content-type"];if(!d||!d.includes("application/json")){t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let m=e.auth,v={headers:e.headers},p;if(s!==void 0)p=s;else{let w=gh.default.parse(d),C=await Ds(e,{limit:ny,encoding:(a=w.parameters.charset)!==null&&a!==void 0?a:"utf-8"});p=JSON.parse(C.toString())}let b;Array.isArray(p)?b=p.map(w=>ht.parse(w)):b=[ht.parse(p)];let y=b.some(Jl);if(y){if(this._initialized&&this.sessionId!==void 0){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(b.length>1){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(n=this.sessionIdGenerator)===null||n===void 0?void 0:n.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!y&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let _=b.some(Qr);if(_){if(_){let w=(0,_h.randomUUID)();if(!this._enableJsonResponse){let C={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(C["mcp-session-id"]=this.sessionId),t.writeHead(200,C)}for(let C of b)Qr(C)&&(this._streamMapping.set(w,t),this._requestToStreamMapping.set(C.id,w));t.on("close",()=>{this._streamMapping.delete(w)});for(let C of b)(i=this.onmessage)===null||i===void 0||i.call(this,C,{authInfo:m,requestInfo:v})}}else{t.writeHead(202).end();for(let w of b)(o=this.onmessage)===null||o===void 0||o.call(this,w,{authInfo:m,requestInfo:v})}}catch(l){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(l)},id:null})),(c=this.onerror)===null||c===void 0||c.call(this,l)}}async handleDeleteRequest(e,t){var s;this.validateSession(e,t)&&this.validateProtocolVersion(e,t)&&(await Promise.resolve((s=this._onsessionclosed)===null||s===void 0?void 0:s.call(this,this.sessionId)),await this.close(),t.writeHead(200).end())}validateSession(e,t){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let s=e.headers["mcp-session-id"];if(s){if(Array.isArray(s))return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(s!==this.sessionId)return t.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,t){var s;let a=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Ml;return Array.isArray(a)&&(a=a[a.length-1]),Gr.includes(a)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${Gr.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(t=>{t.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}async send(e,t){let s=t==null?void 0:t.relatedRequestId;if((er(e)||za(e))&&(s=e.id),s===void 0){if(er(e)||za(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let o=this._streamMapping.get(this._standaloneSseStreamId);if(o===void 0)return;let i;this._eventStore&&(i=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(o,e,i);return}let a=this._requestToStreamMapping.get(s),n=this._streamMapping.get(a);if(!a)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(a,e)),n&&this.writeSSEEvent(n,e,o)}if(er(e)||za(e)){this._requestResponseMap.set(s,e);let o=Array.from(this._requestToStreamMapping.entries()).filter(([c,l])=>this._streamMapping.get(l)===n).map(([c])=>c);if(o.every(c=>this._requestResponseMap.has(c))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let c={"Content-Type":"application/json"};this.sessionId!==void 0&&(c["mcp-session-id"]=this.sessionId);let l=o.map(d=>this._requestResponseMap.get(d));n.writeHead(200,c),l.length===1?n.end(JSON.stringify(l[0])):n.end(JSON.stringify(l))}else n.end();for(let c of o)this._requestResponseMap.delete(c),this._requestToStreamMapping.delete(c)}}}};var Wn=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let a;super({start(n){a=Dn({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:s})},transform(n){a.feed(n)}})}};var oy={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Ms=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Gn=class{constructor(e,t){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch,this._sessionId=t==null?void 0:t.sessionId,this._reconnectionOptions=(s=t==null?void 0:t.reconnectionOptions)!==null&&s!==void 0?s:oy}async _authThenStart(){var e;if(!this._authProvider)throw new nt("No auth provider");let t;try{t=await _r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new nt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...t,...s})}async _startOrAuthSse(e){var t,s,a;let{resumptionToken:n}=e;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);let i=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Ms(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(a=this.onerror)===null||a===void 0||a.call(this,o),o}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),a)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,t=0){var s;let a=this._reconnectionOptions.maxRetries;if(a>0&&t>=a){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,s){if(!e)return;let{onresumptiontoken:a,replayMessageId:n}=t,o;(async()=>{var c,l,d,m;try{let v=e.pipeThrough(new TextDecoderStream).pipeThrough(new Wn).getReader();for(;;){let{value:p,done:b}=await v.read();if(b)break;if(p.id&&(o=p.id,a==null||a(p.id)),!p.event||p.event==="message")try{let y=ht.parse(JSON.parse(p.data));n!==void 0&&er(y)&&(y.id=n),(c=this.onmessage)===null||c===void 0||c.call(this,y)}catch(y){(l=this.onerror)===null||l===void 0||l.call(this,y)}}}catch(v){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${v}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:n},0)}catch(p){(m=this.onerror)===null||m===void 0||m.call(this,new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}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 nt("No auth provider");if(await _r(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new nt("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 s,a,n,o;try{let{resumptionToken:i,onresumptiontoken:c}=t||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:Qr(e)?e.id:void 0}).catch(_=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,_)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},m=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,d),v=m.headers.get("mcp-session-id");if(v&&(this._sessionId=v),!m.ok){if(m.status===401&&this._authProvider){if(this._resourceMetadataUrl=js(m),await _r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new nt;return this.send(e)}let _=await m.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${m.status}): ${_}`)}if(m.status===202){Wl(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(_=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,_)});return}let b=(Array.isArray(e)?e:[e]).filter(_=>"method"in _&&"id"in _&&_.id!==void 0).length>0,y=m.headers.get("content-type");if(b)if(y!=null&&y.includes("text/event-stream"))this._handleSseStream(m.body,{onresumptiontoken:c},!1);else if(y!=null&&y.includes("application/json")){let _=await m.json(),w=Array.isArray(_)?_.map(C=>ht.parse(C)):[ht.parse(_)];for(let C of w)(n=this.onmessage)===null||n===void 0||n.call(this,C)}else throw new Ms(-1,`Unexpected content type: ${y}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,n);if(!o.ok&&o.status!==405)throw new Ms(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var Vt={};Ca(Vt,Tt(kh(),1));Ca(Vt,Tt(ff(),1));var mf=Symbol("Let zodToJsonSchema decide on which parser to use");var pf={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},vf=r=>typeof r=="string"?{...pf,name:r}:{...pf,...r};var gf=r=>{let e=vf(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function cl(r,e,t,s){s!=null&&s.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t})}function de(r,e,t,s,a){r[e]=t,cl(r,e,s,a)}var lo=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return[(r.length-t).toString(),...e.slice(t)].join("/")};function Re(r){if(r.target!=="openAi")return{};let e=[...r.basePath,r.definitionPath,r.openAiAnyTypeName];return r.flags.hasReferencedOpenAiAnyType=!0,{$ref:r.$refStrategy==="relative"?lo(e,r.currentPath):e.join("/")}}function _f(r,e){var s,a,n;let t={type:"array"};return(s=r.type)!=null&&s._def&&((n=(a=r.type)==null?void 0:a._def)==null?void 0:n.typeName)!==$.ZodAny&&(t.items=ee(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&de(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&de(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&(de(t,"minItems",r.exactLength.value,r.exactLength.message,e),de(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}function yf(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?de(t,"minimum",s.value,s.message,e):de(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),de(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?de(t,"maximum",s.value,s.message,e):de(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),de(t,"maximum",s.value,s.message,e));break;case"multipleOf":de(t,"multipleOf",s.value,s.message,e);break}return t}function bf(){return{type:"boolean"}}function co(r,e){return ee(r.type._def,e)}var Sf=(r,e)=>ee(r.innerType._def,e);function ul(r,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,n)=>ul(r,e,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Zb(r,e)}}var Zb=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of r.checks)switch(s.kind){case"min":de(t,"minimum",s.value,s.message,e);break;case"max":de(t,"maximum",s.value,s.message,e);break}return t};function xf(r,e){return{...ee(r.innerType._def,e),default:r.defaultValue()}}function wf(r,e){return e.effectStrategy==="input"?ee(r.schema._def,e):Re(e)}function Ef(r){return{type:"string",enum:Array.from(r.values)}}var Ub=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function Pf(r,e){let t=[ee(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ee(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return t.forEach(n=>{if(Ub(n))a.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:i,...c}=n;o=c}else s=void 0;a.push(o)}}),a.length?{allOf:a,...s}:void 0}function Rf(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}var dl,At={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(dl===void 0&&(dl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),dl),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function uo(r,e){let t={type:"string"};if(r.checks)for(let s of r.checks)switch(s.kind){case"min":de(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":de(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Nt(t,"email",s.message,e);break;case"format:idn-email":Nt(t,"idn-email",s.message,e);break;case"pattern:zod":Xe(t,At.email,s.message,e);break}break;case"url":Nt(t,"uri",s.message,e);break;case"uuid":Nt(t,"uuid",s.message,e);break;case"regex":Xe(t,s.regex,s.message,e);break;case"cuid":Xe(t,At.cuid,s.message,e);break;case"cuid2":Xe(t,At.cuid2,s.message,e);break;case"startsWith":Xe(t,RegExp(`^${hl(s.value,e)}`),s.message,e);break;case"endsWith":Xe(t,RegExp(`${hl(s.value,e)}$`),s.message,e);break;case"datetime":Nt(t,"date-time",s.message,e);break;case"date":Nt(t,"date",s.message,e);break;case"time":Nt(t,"time",s.message,e);break;case"duration":Nt(t,"duration",s.message,e);break;case"length":de(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),de(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Xe(t,RegExp(hl(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Nt(t,"ipv4",s.message,e),s.version!=="v4"&&Nt(t,"ipv6",s.message,e);break}case"base64url":Xe(t,At.base64url,s.message,e);break;case"jwt":Xe(t,At.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Xe(t,At.ipv4Cidr,s.message,e),s.version!=="v4"&&Xe(t,At.ipv6Cidr,s.message,e);break}case"emoji":Xe(t,At.emoji(),s.message,e);break;case"ulid":{Xe(t,At.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Nt(t,"binary",s.message,e);break}case"contentEncoding:base64":{de(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Xe(t,At.base64,s.message,e);break}}break}case"nanoid":Xe(t,At.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function hl(r,e){return e.patternStrategy==="escape"?Vb(r):r}var Fb=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Vb(r){let e="";for(let t=0;t<r.length;t++)Fb.has(r[t])||(e+="\\"),e+=r[t];return e}function Nt(r,e,t,s){var a;r.format||(a=r.anyOf)!=null&&a.some(n=>n.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&s.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):de(r,"format",e,t,s)}function Xe(r,e,t,s){var a;r.pattern||(a=r.allOf)!=null&&a.some(n=>n.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&s.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:Tf(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):de(r,"pattern",Tf(e,s),t,s)}function Tf(r,e){var c;if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},s=t.i?r.source.toLowerCase():r.source,a="",n=!1,o=!1,i=!1;for(let l=0;l<s.length;l++){if(n){a+=s[l],n=!1;continue}if(t.i){if(o){if(s[l].match(/[a-z]/)){i?(a+=s[l],a+=`${s[l-2]}-${s[l]}`.toUpperCase(),i=!1):s[l+1]==="-"&&((c=s[l+2])!=null&&c.match(/[a-z]/))?(a+=s[l],i=!0):a+=`${s[l]}${s[l].toUpperCase()}`;continue}}else if(s[l].match(/[a-z]/)){a+=`[${s[l]}${s[l].toUpperCase()}]`;continue}}if(t.m){if(s[l]==="^"){a+=`(^|(?<=[\r
|
|
73
|
-
]))`;continue}else if(s[l]==="$"){a+=`($|(?=[\r
|
|
74
|
-
]))`;continue}}if(t.s&&s[l]==="."){a+=o?`${s[l]}\r
|
|
75
|
-
`:`[${s[l]}\r
|
|
76
|
-
]`;continue}a+=s[l],s[l]==="\\"?n=!0:o&&s[l]==="]"?o=!1:!o&&s[l]==="["&&(o=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return a}function ho(r,e){var s,a,n,o,i,c,l;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=r.keyType)==null?void 0:s._def.typeName)===$.ZodEnum)return{type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((d,m)=>{var v;return{...d,[m]:(v=ee(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",m]}))!=null?v:Re(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(a=ee(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=r.keyType)==null?void 0:n._def.typeName)===$.ZodString&&((o=r.keyType._def.checks)!=null&&o.length)){let{type:d,...m}=uo(r.keyType._def,e);return{...t,propertyNames:m}}else{if(((i=r.keyType)==null?void 0:i._def.typeName)===$.ZodEnum)return{...t,propertyNames:{enum:r.keyType._def.values}};if(((c=r.keyType)==null?void 0:c._def.typeName)===$.ZodBranded&&r.keyType._def.type._def.typeName===$.ZodString&&((l=r.keyType._def.type._def.checks)!=null&&l.length)){let{type:d,...m}=co(r.keyType._def,e);return{...t,propertyNames:m}}}return t}function Cf(r,e){if(e.mapStrategy==="record")return ho(r,e);let t=ee(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Re(e),s=ee(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Re(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function If(r){let e=r.values,s=Object.keys(r.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),a=Array.from(new Set(s.map(n=>typeof n)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:s}}function Of(r){return r.target==="openAi"?void 0:{not:Re({...r,currentPath:[...r.currentPath,"not"]})}}function kf(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Js={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Nf(r,e){if(e.target==="openApi3")return Af(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in Js&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((a,n)=>{let o=Js[n._def.typeName];return o&&!a.includes(o)?[...a,o]:a},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((a,n)=>{let o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];case"bigint":return[...a,"integer"];case"object":if(n._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(s.length===t.length){let a=s.filter((n,o,i)=>i.indexOf(n)===o);return{type:a.length>1?a:a[0],enum:t.reduce((n,o)=>n.includes(o._def.value)?n:[...n,o._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,a)=>[...s,...a._def.values.filter(n=>!s.includes(n))],[])};return Af(r,e)}var Af=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,a)=>ee(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${a}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function $f(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:Js[r.innerType._def.typeName],nullable:!0}:{type:[Js[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=ee(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=ee(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function jf(r,e){let t={type:"number"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"int":t.type="integer",cl(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?de(t,"minimum",s.value,s.message,e):de(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),de(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?de(t,"maximum",s.value,s.message,e):de(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),de(t,"maximum",s.value,s.message,e));break;case"multipleOf":de(t,"multipleOf",s.value,s.message,e);break}return t}function Df(r,e){let t=e.target==="openAi",s={type:"object",properties:{}},a=[],n=r.shape();for(let i in n){let c=n[i];if(c===void 0||c._def===void 0)continue;let l=Bb(c);l&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let d=ee(c._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});d!==void 0&&(s.properties[i]=d,l||a.push(i))}a.length&&(s.required=a);let o=Hb(r,e);return o!==void 0&&(s.additionalProperties=o),s}function Hb(r,e){if(r.catchall._def.typeName!=="ZodNever")return ee(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(r.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Bb(r){try{return r.isOptional()}catch{return!0}}var zf=(r,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return ee(r.innerType._def,e);let t=ee(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:Re(e)},t]}:Re(e)};var Mf=(r,e)=>{if(e.pipeStrategy==="input")return ee(r.in._def,e);if(e.pipeStrategy==="output")return ee(r.out._def,e);let t=ee(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=ee(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(a=>a!==void 0)}};function Lf(r,e){return ee(r.type._def,e)}function qf(r,e){let s={type:"array",uniqueItems:!0,items:ee(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&de(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&de(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}function Zf(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>ee(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:ee(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,s)=>ee(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Uf(r){return{not:Re(r)}}function Ff(r){return Re(r)}var Vf=(r,e)=>ee(r.innerType._def,e);var Hf=(r,e,t)=>{switch(e){case $.ZodString:return uo(r,t);case $.ZodNumber:return jf(r,t);case $.ZodObject:return Df(r,t);case $.ZodBigInt:return yf(r,t);case $.ZodBoolean:return bf();case $.ZodDate:return ul(r,t);case $.ZodUndefined:return Uf(t);case $.ZodNull:return kf(t);case $.ZodArray:return _f(r,t);case $.ZodUnion:case $.ZodDiscriminatedUnion:return Nf(r,t);case $.ZodIntersection:return Pf(r,t);case $.ZodTuple:return Zf(r,t);case $.ZodRecord:return ho(r,t);case $.ZodLiteral:return Rf(r,t);case $.ZodEnum:return Ef(r);case $.ZodNativeEnum:return If(r);case $.ZodNullable:return $f(r,t);case $.ZodOptional:return zf(r,t);case $.ZodMap:return Cf(r,t);case $.ZodSet:return qf(r,t);case $.ZodLazy:return()=>r.getter()._def;case $.ZodPromise:return Lf(r,t);case $.ZodNaN:case $.ZodNever:return Of(t);case $.ZodEffects:return wf(r,t);case $.ZodAny:return Re(t);case $.ZodUnknown:return Ff(t);case $.ZodDefault:return xf(r,t);case $.ZodBranded:return co(r,t);case $.ZodReadonly:return Vf(r,t);case $.ZodCatch:return Sf(r,t);case $.ZodPipeline:return Mf(r,t);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(s=>{})(e)}};function ee(r,e,t=!1){var i;let s=e.seen.get(r);if(e.override){let c=(i=e.override)==null?void 0:i.call(e,r,e,s,t);if(c!==mf)return c}if(s&&!t){let c=Jb(s,e);if(c!==void 0)return c}let a={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,a);let n=Hf(r,r.typeName,e),o=typeof n=="function"?ee(n(),e):n;if(o&&Wb(r,e,o),e.postProcess){let c=e.postProcess(o,r,e);return a.jsonSchema=o,c}return a.jsonSchema=o,o}var Jb=(r,e)=>{switch(e.$refStrategy){case"root":return{$ref:r.path.join("/")};case"relative":return{$ref:lo(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Re(e)):e.$refStrategy==="seen"?Re(e):void 0}},Wb=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);var fl=(r,e)=>{var c;let t=gf(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,m])=>{var v;return{...l,[d]:(v=ee(m._def,{...t,currentPath:[...t.basePath,t.definitionPath,d]},!0))!=null?v:Re(t)}},{}):void 0,a=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(c=ee(r._def,a===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,a]},!1))!=null?c:Re(t),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let i=a===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,a].join("/"),[t.definitionPath]:{...s,[a]:n}};return t.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,Loop,PingRequestSchema,ProgressNotificationSchema,SSEClientTransport,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
|
|
77
|
-
/*! Bundled license information:
|
|
100
|
+
`)}get sessionId(){return this._sessionId}};var Yy=xt(Gy(),1),ys=xt(require("node:process"),1),Xy=require("node:stream");var Qn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
101
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),qR(r)}clear(){this._buffer=void 0}};function qR(t){return Qe.parse(JSON.parse(t))}function ia(t){return JSON.stringify(t)+`
|
|
102
|
+
`}var DR=ys.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function LR(){let t={};for(let e of DR){let r=ys.default.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var aa=class{constructor(e){this._readBuffer=new Qn,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new Xy.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,o,s,i,a;this._process=(0,Yy.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...LR(),...this._serverParams.env},stdio:["pipe","pipe",(o=this._serverParams.stderr)!==null&&o!==void 0?o:"inherit"],shell:!1,windowsHide:ys.default.platform==="win32"&&UR(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u;r(c),(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(s=this._process.stdin)===null||s===void 0||s.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),(i=this._process.stdout)===null||i===void 0||i.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(a=this._process.stdout)===null||a===void 0||a.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;if(this._process){let r=this._process;this._process=void 0;let n=new Promise(o=>{r.once("close",()=>{o()})});try{(e=r.stdin)===null||e===void 0||e.end()}catch{}if(await Promise.race([n,new Promise(o=>setTimeout(o,2e3).unref())]),r.exitCode===null){try{r.kill("SIGTERM")}catch{}await Promise.race([n,new Promise(o=>setTimeout(o,2e3).unref())])}if(r.exitCode===null)try{r.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let o=ia(e);this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};function UR(){return"type"in ys.default}var dd=xt(require("node:process"),1);var ca=class{constructor(e=dd.default.stdin,r=dd.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Qn,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=ia(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Qy=xt(td(),1),e0=require("node:crypto"),VR="4mb",ua=class{constructor(e){var r,n;this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=(r=e.enableJsonResponse)!==null&&r!==void 0?r:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(n=e.enableDnsRebindingProtection)!==null&&n!==void 0?n:!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.host;if(!r||!this._allowedHosts.includes(r))return`Invalid Host header: ${r}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.origin;if(r&&!this._allowedOrigins.includes(r))return`Invalid Origin header: ${r}`}}}async handleRequest(e,r,n){var o;let s=this.validateRequestHeaders(e);if(s){r.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:s},id:null})),(o=this.onerror)===null||o===void 0||o.call(this,new Error(s));return}e.method==="POST"?await this.handlePostRequest(e,r,n):e.method==="GET"?await this.handleGetRequest(e,r):e.method==="DELETE"?await this.handleDeleteRequest(e,r):await this.handleUnsupportedRequest(r)}async _maybeWritePrimingEvent(e,r){if(!this._eventStore)return;let n=await this._eventStore.storeEvent(r,{}),o=`id: ${n}
|
|
103
|
+
data:
|
|
78
104
|
|
|
79
|
-
|
|
80
|
-
|
|
105
|
+
`;this._retryInterval!==void 0&&(o=`id: ${n}
|
|
106
|
+
retry: ${this._retryInterval}
|
|
107
|
+
data:
|
|
108
|
+
|
|
109
|
+
`),e.write(o)}async handleGetRequest(e,r){let n=e.headers.accept;if(!(n!=null&&n.includes("text/event-stream"))){r.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept text/event-stream"},id:null}));return}if(!this.validateSession(e,r)||!this.validateProtocolVersion(e,r))return;if(this._eventStore){let s=e.headers["last-event-id"];if(s){await this.replayEvents(s,r);return}}let o={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(o["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){r.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}r.writeHead(200,o).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,r),r.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)}),r.on("error",s=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,s)})}async replayEvents(e,r){var n;if(this._eventStore)try{let o;if(this._eventStore.getStreamIdForEventId){if(o=await this._eventStore.getStreamIdForEventId(e),!o){r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Invalid event ID format"},id:null}));return}if(this._streamMapping.get(o)!==void 0){r.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Stream already has an active connection"},id:null}));return}}let s={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(s["mcp-session-id"]=this.sessionId),r.writeHead(200,s).flushHeaders();let i=await this._eventStore.replayEventsAfter(e,{send:async(a,c)=>{var u;this.writeSSEEvent(r,c,a)||((u=this.onerror)===null||u===void 0||u.call(this,new Error("Failed replay events")),r.end())}});this._streamMapping.set(i,r),r.on("close",()=>{this._streamMapping.delete(i)}),r.on("error",a=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,a)})}catch(o){(n=this.onerror)===null||n===void 0||n.call(this,o)}}writeSSEEvent(e,r,n){let o=`event: message
|
|
110
|
+
`;return n&&(o+=`id: ${n}
|
|
111
|
+
`),o+=`data: ${JSON.stringify(r)}
|
|
112
|
+
|
|
113
|
+
`,e.write(o)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,r,n){var o,s,i,a,c;try{let u=e.headers.accept;if(!(u!=null&&u.includes("application/json"))||!u.includes("text/event-stream")){r.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let l=e.headers["content-type"];if(!l||!l.includes("application/json")){r.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let d=e.auth,p={headers:e.headers},f;if(n!==void 0)f=n;else{let _=Qy.default.parse(l),w=await vs(e,{limit:VR,encoding:(o=_.parameters.charset)!==null&&o!==void 0?o:"utf-8"});f=JSON.parse(w.toString())}let g;Array.isArray(f)?g=f.map(_=>Qe.parse(_)):g=[Qe.parse(f)];let v=g.some(im);if(v){if(this._initialized&&this.sessionId!==void 0){r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(g.length>1){r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(s=this.sessionIdGenerator)===null||s===void 0?void 0:s.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!v&&(!this.validateSession(e,r)||!this.validateProtocolVersion(e,r)))return;let m=g.some(Lt);if(m){if(m){let _=(0,e0.randomUUID)();if(!this._enableJsonResponse){let w={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(w["mcp-session-id"]=this.sessionId),r.writeHead(200,w),await this._maybeWritePrimingEvent(r,_)}for(let w of g)Lt(w)&&(this._streamMapping.set(_,r),this._requestToStreamMapping.set(w.id,_));r.on("close",()=>{this._streamMapping.delete(_)}),r.on("error",w=>{var b;(b=this.onerror)===null||b===void 0||b.call(this,w)});for(let w of g){let b,E;Lt(w)&&this._eventStore&&(b=()=>{this.closeSSEStream(w.id)},E=()=>{this.closeStandaloneSSEStream()}),(a=this.onmessage)===null||a===void 0||a.call(this,w,{authInfo:d,requestInfo:p,closeSSEStream:b,closeStandaloneSSEStream:E})}}}else{r.writeHead(202).end();for(let _ of g)(i=this.onmessage)===null||i===void 0||i.call(this,_,{authInfo:d,requestInfo:p})}}catch(u){r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(u)},id:null})),(c=this.onerror)===null||c===void 0||c.call(this,u)}}async handleDeleteRequest(e,r){var n;this.validateSession(e,r)&&this.validateProtocolVersion(e,r)&&(await Promise.resolve((n=this._onsessionclosed)===null||n===void 0?void 0:n.call(this,this.sessionId)),await this.close(),r.writeHead(200).end())}validateSession(e,r){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let n=e.headers["mcp-session-id"];if(n){if(Array.isArray(n))return r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(n!==this.sessionId)return r.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,r){var n;let o=(n=e.headers["mcp-protocol-version"])!==null&&n!==void 0?n:Yh;return Array.isArray(o)&&(o=o[o.length-1]),Zr.includes(o)?!0:(r.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${Zr.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(r=>{r.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}closeSSEStream(e){let r=this._requestToStreamMapping.get(e);if(!r)return;let n=this._streamMapping.get(r);n&&(n.end(),this._streamMapping.delete(r))}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&(e.end(),this._streamMapping.delete(this._standaloneSseStreamId))}async send(e,r){let n=r==null?void 0:r.relatedRequestId;if((ft(e)||bn(e))&&(n=e.id),n===void 0){if(ft(e)||bn(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let i;this._eventStore&&(i=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let a=this._streamMapping.get(this._standaloneSseStreamId);if(a===void 0)return;this.writeSSEEvent(a,e,i);return}let o=this._requestToStreamMapping.get(n),s=this._streamMapping.get(o);if(!o)throw new Error(`No connection established for request ID: ${String(n)}`);if(!this._enableJsonResponse){let i;this._eventStore&&(i=await this._eventStore.storeEvent(o,e)),s&&this.writeSSEEvent(s,e,i)}if(ft(e)||bn(e)){this._requestResponseMap.set(n,e);let i=Array.from(this._requestToStreamMapping.entries()).filter(([c,u])=>this._streamMapping.get(u)===s).map(([c])=>c);if(i.every(c=>this._requestResponseMap.has(c))){if(!s)throw new Error(`No connection established for request ID: ${String(n)}`);if(this._enableJsonResponse){let c={"Content-Type":"application/json"};this.sessionId!==void 0&&(c["mcp-session-id"]=this.sessionId);let u=i.map(l=>this._requestResponseMap.get(l));s.writeHead(200,c),u.length===1?s.end(JSON.stringify(u[0])):s.end(JSON.stringify(u))}else s.end();for(let c of i)this._requestResponseMap.delete(c),this._requestToStreamMapping.delete(c)}}}};var la=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=Yi({onEvent:i=>{s.enqueue(i)},onError(i){e==="terminate"?s.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}};var FR={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},gr=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},da=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=ta(r==null?void 0:r.fetch,r==null?void 0:r.requestInit),this._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(n=r==null?void 0:r.reconnectionOptions)!==null&&n!==void 0?n:FR}async _authThenStart(){var e;if(!this._authProvider)throw new Le("No auth provider");let r;try{r=await Yt(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 Le;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Kn((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,o,s;let{resumptionToken:i}=e;try{let a=await this._commonHeaders();a.set("Accept","text/event-stream"),i&&a.set("last-event-id",i);let c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:a,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!c.ok){if(await((o=c.body)===null||o===void 0?void 0:o.cancel()),c.status===401&&this._authProvider)return await this._authThenStart();if(c.status===405)return;throw new gr(c.status,`Failed to open SSE stream: ${c.statusText}`)}this._handleSseStream(c.body,e,!0)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){var n;let o=this._reconnectionOptions.maxRetries;if(r>=o){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let s=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,r+1)})},s)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{var l,d,p,f;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new la({onRetry:_=>{this._serverRetryMs=_}})).getReader();for(;;){let{value:_,done:w}=await g.read();if(w)break;if(_.id&&(i=_.id,a=!0,o==null||o(_.id)),!!_.data&&(!_.event||_.event==="message"))try{let b=Qe.parse(JSON.parse(_.data));ft(b)&&(c=!0,s!==void 0&&(b.id=s)),(l=this.onmessage)===null||l===void 0||l.call(this,b)}catch(b){(d=this.onerror)===null||d===void 0||d.call(this,b)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(g){if((p=this.onerror)===null||p===void 0||p.call(this,new Error(`SSE stream disconnected: ${g}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(_){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${_ instanceof Error?_.message:String(_)}`))}}})()}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 Le("No auth provider");if(await Yt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Le("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,o,s,i,a;try{let{resumptionToken:c,onresumptiontoken:u}=r||{};if(c){this._startOrAuthSse({resumptionToken:c,replayMessageId:Lt(e)?e.id:void 0}).catch(_=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,_)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},p=await((o=this._fetch)!==null&&o!==void 0?o:fetch)(this._url,d),f=p.headers.get("mcp-session-id");if(f&&(this._sessionId=f),!p.ok){let _=await p.text().catch(()=>null);if(p.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new gr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:w,scope:b}=Gn(p);if(this._resourceMetadataUrl=w,this._scope=b,await Yt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Le;return this._hasCompletedAuthFlow=!0,this.send(e)}if(p.status===403&&this._authProvider){let{resourceMetadataUrl:w,scope:b,error:E}=Gn(p);if(E==="insufficient_scope"){let P=p.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===P)throw new gr(403,"Server returned 403 after trying upscoping");if(b&&(this._scope=b),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=P!=null?P:void 0,await Yt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Le;return this.send(e)}}throw new gr(p.status,`Error POSTing to endpoint: ${_}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,p.status===202){await((s=p.body)===null||s===void 0?void 0:s.cancel()),am(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(_=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,_)});return}let v=(Array.isArray(e)?e:[e]).filter(_=>"method"in _&&"id"in _&&_.id!==void 0).length>0,m=p.headers.get("content-type");if(v)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let _=await p.json(),w=Array.isArray(_)?_.map(b=>Qe.parse(b)):[Qe.parse(_)];for(let b of w)(i=this.onmessage)===null||i===void 0||i.call(this,b)}else throw new gr(-1,`Unexpected content type: ${m}`)}catch(c){throw(a=this.onerror)===null||a===void 0||a.call(this,c),c}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,o;if(this._sessionId)try{let s=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:s,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,i);if(await((n=a.body)===null||n===void 0?void 0:n.cancel()),!a.ok&&a.status!==405)throw new gr(a.status,`Failed to terminate session: ${a.statusText}`);this._sessionId=void 0}catch(s){throw(o=this.onerror)===null||o===void 0||o.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r==null?void 0:r.onresumptiontoken})}};var eo={};bd(eo,xt(f0(),1));0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,Loop,PingRequestSchema,ProgressNotificationSchema,SSEClientTransport,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
|
|
114
|
+
/*! Bundled license information:
|
|
81
115
|
|
|
82
116
|
bytes/index.js:
|
|
83
117
|
(*!
|