playwright 1.56.0-alpha-1756475278000 → 1.56.0-alpha-2025-08-30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- "use strict";var Tc=Object.create;var sa=Object.defineProperty;var $c=Object.getOwnPropertyDescriptor;var Ic=Object.getOwnPropertyNames;var Ac=Object.getPrototypeOf,kc=Object.prototype.hasOwnProperty;var J=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),En=(a,e)=>{for(var t in e)sa(a,t,{get:e[t],enumerable:!0})},Sn=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ic(e))!kc.call(a,r)&&r!==t&&sa(a,r,{get:()=>e[r],enumerable:!(s=$c(e,r))||s.enumerable});return a};var Lr=(a,e,t)=>(t=a!=null?Tc(Ac(a)):{},Sn(e||!a||!a.__esModule?sa(t,"default",{value:a,enumerable:!0}):t,a)),Cc=a=>Sn(sa({},"__esModule",{value:!0}),a);var ri=J((ba,ei)=>{(function(a,e){typeof ba=="object"&&typeof ei!="undefined"?e(ba):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(ba,function(a){"use strict";function e(){for(var y=arguments.length,f=Array(y),b=0;b<y;b++)f[b]=arguments[b];if(f.length>1){f[0]=f[0].slice(0,-1);for(var P=f.length-1,w=1;w<P;++w)f[w]=f[w].slice(1,-1);return f[P]=f[P].slice(1),f.join("")}else return f[0]}function t(y){return"(?:"+y+")"}function s(y){return y===void 0?"undefined":y===null?"null":Object.prototype.toString.call(y).split(" ").pop().split("]").shift().toLowerCase()}function r(y){return y.toUpperCase()}function n(y){return y!=null?y instanceof Array?y:typeof y.length!="number"||y.split||y.setInterval||y.call?[y]:Array.prototype.slice.call(y):[]}function o(y,f){var b=y;if(f)for(var P in f)b[P]=f[P];return b}function l(y){var f="[A-Za-z]",b="[\\x0D]",P="[0-9]",w="[\\x22]",N=e(P,"[A-Fa-f]"),K="[\\x0A]",ae="[\\x20]",oe=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=e(be,te),xe=y?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=y?"[\\uE000-\\uF8FF]":"[]",ne=e(f,P,"[\\-\\.\\_\\~]",xe),pe=t(f+e(f,P,"[\\+\\-\\.]")+"*"),ce=t(t(oe+"|"+e(ne,te,"[\\:]"))+"*"),jr=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("[1-9]"+P)+"|"+P),qe=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("0?[1-9]"+P)+"|0?0?"+P),Ve=t(qe+"\\."+qe+"\\."+qe+"\\."+qe),ue=t(N+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+Ve),He=t(t(ue+"\\:")+"{6}"+Ue),ar=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),Nr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),ur=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),Tt=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),ra=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),ta=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),ct=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),ut=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),dr=t([He,ar,Nr,ur,Tt,ra,ta,ct,ut].join("|")),dt=t(t(ne+"|"+oe)+"+"),rs=t(dr+"\\%25"+dt),Fr=t(dr+t("\\%25|\\%(?!"+N+"{2})")+dt),xc=t("[vV]"+N+"+\\."+e(ne,te,"[\\:]")+"+"),Pc=t("\\["+t(Fr+"|"+dr+"|"+xc)+"\\]"),bn=t(t(oe+"|"+e(ne,te))+"*"),$t=t(Pc+"|"+Ve+"(?!"+bn+")|"+bn),It=t(P+"*"),xn=t(t(ce+"@")+"?"+$t+t("\\:"+It)+"?"),At=t(oe+"|"+e(ne,te,"[\\:\\@]")),wc=t(At+"*"),Pn=t(At+"+"),Ec=t(t(oe+"|"+e(ne,te,"[\\@]"))+"+"),fr=t(t("\\/"+wc)+"*"),ft=t("\\/"+t(Pn+fr)+"?"),ts=t(Ec+fr),aa=t(Pn+fr),ht="(?!"+At+")",ap=t(fr+"|"+ft+"|"+ts+"|"+aa+"|"+ht),pt=t(t(At+"|"+e("[\\/\\?]",de))+"*"),kt=t(t(At+"|[\\/\\?]")+"*"),wn=t(t("\\/\\/"+xn+fr)+"|"+ft+"|"+aa+"|"+ht),Sc=t(pe+"\\:"+wn+t("\\?"+pt)+"?"+t("\\#"+kt)+"?"),Rc=t(t("\\/\\/"+xn+fr)+"|"+ft+"|"+ts+"|"+ht),Oc=t(Rc+t("\\?"+pt)+"?"+t("\\#"+kt)+"?"),sp=t(Sc+"|"+Oc),np=t(pe+"\\:"+wn+t("\\?"+pt)+"?"),ip="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+$t+")"+t("\\:("+It+")")+"?)")+"?("+fr+"|"+ft+"|"+aa+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+kt+")")+"?$",op="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+$t+")"+t("\\:("+It+")")+"?)")+"?("+fr+"|"+ft+"|"+ts+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+kt+")")+"?$",lp="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+$t+")"+t("\\:("+It+")")+"?)")+"?("+fr+"|"+ft+"|"+aa+"|"+ht+")")+t("\\?("+pt+")")+"?$",cp="^"+t("\\#("+kt+")")+"?$",up="^"+t("("+ce+")@")+"?("+$t+")"+t("\\:("+It+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",f,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,he),"g"),PCT_ENCODED:new RegExp(oe,"g"),IPV4ADDRESS:new RegExp("^("+Ve+")$"),IPV6ADDRESS:new RegExp("^\\[?("+dr+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+dt+")")+"?\\]?$")}}var u=l(!1),c=l(!0),h=function(){function y(f,b){var P=[],w=!0,N=!1,K=void 0;try{for(var ae=f[Symbol.iterator](),oe;!(w=(oe=ae.next()).done)&&(P.push(oe.value),!(b&&P.length===b));w=!0);}catch(be){N=!0,K=be}finally{try{!w&&ae.return&&ae.return()}finally{if(N)throw K}}return P}return function(f,b){if(Array.isArray(f))return f;if(Symbol.iterator in Object(f))return y(f,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(y){if(Array.isArray(y)){for(var f=0,b=Array(y.length);f<y.length;f++)b[f]=y[f];return b}else return Array.from(y)},g=2147483647,d=36,_=1,m=26,v=38,x=700,S=72,E=128,O="-",I=/^xn--/,A=/[^\0-\x7E]/,V=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=d-_,U=Math.floor,M=String.fromCharCode;function F(y){throw new RangeError(q[y])}function $(y,f){for(var b=[],P=y.length;P--;)b[P]=f(y[P]);return b}function C(y,f){var b=y.split("@"),P="";b.length>1&&(P=b[0]+"@",y=b[1]),y=y.replace(V,".");var w=y.split("."),N=$(w,f).join(".");return P+N}function L(y){for(var f=[],b=0,P=y.length;b<P;){var w=y.charCodeAt(b++);if(w>=55296&&w<=56319&&b<P){var N=y.charCodeAt(b++);(N&64512)==56320?f.push(((w&1023)<<10)+(N&1023)+65536):(f.push(w),b--)}else f.push(w)}return f}var le=function(f){return String.fromCodePoint.apply(String,p(f))},Y=function(f){return f-48<10?f-22:f-65<26?f-65:f-97<26?f-97:d},re=function(f,b){return f+22+75*(f<26)-((b!=0)<<5)},W=function(f,b,P){var w=0;for(f=P?U(f/x):f>>1,f+=U(f/b);f>k*m>>1;w+=d)f=U(f/k);return U(w+(k+1)*f/(f+v))},H=function(f){var b=[],P=f.length,w=0,N=E,K=S,ae=f.lastIndexOf(O);ae<0&&(ae=0);for(var oe=0;oe<ae;++oe)f.charCodeAt(oe)>=128&&F("not-basic"),b.push(f.charCodeAt(oe));for(var be=ae>0?ae+1:0;be<P;){for(var te=w,he=1,xe=d;;xe+=d){be>=P&&F("invalid-input");var de=Y(f.charCodeAt(be++));(de>=d||de>U((g-w)/he))&&F("overflow"),w+=de*he;var ne=xe<=K?_:xe>=K+m?m:xe-K;if(de<ne)break;var pe=d-ne;he>U(g/pe)&&F("overflow"),he*=pe}var ce=b.length+1;K=W(w-te,ce,te==0),U(w/ce)>g-N&&F("overflow"),N+=U(w/ce),w%=ce,b.splice(w++,0,N)}return String.fromCodePoint.apply(String,b)},me=function(f){var b=[];f=L(f);var P=f.length,w=E,N=0,K=S,ae=!0,oe=!1,be=void 0;try{for(var te=f[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&b.push(M(xe))}}catch(Fr){oe=!0,be=Fr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw be}}var de=b.length,ne=de;for(de&&b.push(O);ne<P;){var pe=g,ce=!0,jr=!1,qe=void 0;try{for(var Ve=f[Symbol.iterator](),ue;!(ce=(ue=Ve.next()).done);ce=!0){var Ue=ue.value;Ue>=w&&Ue<pe&&(pe=Ue)}}catch(Fr){jr=!0,qe=Fr}finally{try{!ce&&Ve.return&&Ve.return()}finally{if(jr)throw qe}}var He=ne+1;pe-w>U((g-N)/He)&&F("overflow"),N+=(pe-w)*He,w=pe;var ar=!0,Nr=!1,ur=void 0;try{for(var Tt=f[Symbol.iterator](),ra;!(ar=(ra=Tt.next()).done);ar=!0){var ta=ra.value;if(ta<w&&++N>g&&F("overflow"),ta==w){for(var ct=N,ut=d;;ut+=d){var dr=ut<=K?_:ut>=K+m?m:ut-K;if(ct<dr)break;var dt=ct-dr,rs=d-dr;b.push(M(re(dr+dt%rs,0))),ct=U(dt/rs)}b.push(M(re(ct,0))),K=W(N,He,ne==de),N=0,++ne}}}catch(Fr){Nr=!0,ur=Fr}finally{try{!ar&&Tt.return&&Tt.return()}finally{if(Nr)throw ur}}++N,++w}return b.join("")},Re=function(f){return C(f,function(b){return I.test(b)?H(b.slice(4).toLowerCase()):b})},Ie=function(f){return C(f,function(b){return A.test(b)?"xn--"+me(b):b})},se={version:"2.1.0",ucs2:{decode:L,encode:le},decode:H,encode:me,toASCII:Ie,toUnicode:Re},ye={};function we(y){var f=y.charCodeAt(0),b=void 0;return f<16?b="%0"+f.toString(16).toUpperCase():f<128?b="%"+f.toString(16).toUpperCase():f<2048?b="%"+(f>>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():b="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),b}function Ae(y){for(var f="",b=0,P=y.length;b<P;){var w=parseInt(y.substr(b+1,2),16);if(w<128)f+=String.fromCharCode(w),b+=3;else if(w>=194&&w<224){if(P-b>=6){var N=parseInt(y.substr(b+4,2),16);f+=String.fromCharCode((w&31)<<6|N&63)}else f+=y.substr(b,6);b+=6}else if(w>=224){if(P-b>=9){var K=parseInt(y.substr(b+4,2),16),ae=parseInt(y.substr(b+7,2),16);f+=String.fromCharCode((w&15)<<12|(K&63)<<6|ae&63)}else f+=y.substr(b,9);b+=9}else f+=y.substr(b,3),b+=3}return f}function br(y,f){function b(P){var w=Ae(P);return w.match(f.UNRESERVED)?w:P}return y.scheme&&(y.scheme=String(y.scheme).replace(f.PCT_ENCODED,b).toLowerCase().replace(f.NOT_SCHEME,"")),y.userinfo!==void 0&&(y.userinfo=String(y.userinfo).replace(f.PCT_ENCODED,b).replace(f.NOT_USERINFO,we).replace(f.PCT_ENCODED,r)),y.host!==void 0&&(y.host=String(y.host).replace(f.PCT_ENCODED,b).toLowerCase().replace(f.NOT_HOST,we).replace(f.PCT_ENCODED,r)),y.path!==void 0&&(y.path=String(y.path).replace(f.PCT_ENCODED,b).replace(y.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,we).replace(f.PCT_ENCODED,r)),y.query!==void 0&&(y.query=String(y.query).replace(f.PCT_ENCODED,b).replace(f.NOT_QUERY,we).replace(f.PCT_ENCODED,r)),y.fragment!==void 0&&(y.fragment=String(y.fragment).replace(f.PCT_ENCODED,b).replace(f.NOT_FRAGMENT,we).replace(f.PCT_ENCODED,r)),y}function lr(y){return y.replace(/^0*(.*)/,"$1")||"0"}function _e(y,f){var b=y.match(f.IPV4ADDRESS)||[],P=h(b,2),w=P[1];return w?w.split(".").map(lr).join("."):y}function ve(y,f){var b=y.match(f.IPV6ADDRESS)||[],P=h(b,3),w=P[1],N=P[2];if(w){for(var K=w.toLowerCase().split("::").reverse(),ae=h(K,2),oe=ae[0],be=ae[1],te=be?be.split(":").map(lr):[],he=oe.split(":").map(lr),xe=f.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce<de;++ce)pe[ce]=te[ce]||he[ne+ce]||"";xe&&(pe[de-1]=_e(pe[de-1],f));var jr=pe.reduce(function(He,ar,Nr){if(!ar||ar==="0"){var ur=He[He.length-1];ur&&ur.index+ur.length===Nr?ur.length++:He.push({index:Nr,length:1})}return He},[]),qe=jr.sort(function(He,ar){return ar.length-He.length})[0],Ve=void 0;if(qe&&qe.length>1){var ue=pe.slice(0,qe.index),Ue=pe.slice(qe.index+qe.length);Ve=ue.join(":")+"::"+Ue.join(":")}else Ve=pe.join(":");return N&&(Ve+="%"+N),Ve}else return y}var kr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function ie(y){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},P=f.iri!==!1?c:u;f.reference==="suffix"&&(y=(f.scheme?f.scheme+":":"")+"//"+y);var w=y.match(kr);if(w){Oe?(b.scheme=w[1],b.userinfo=w[3],b.host=w[4],b.port=parseInt(w[5],10),b.path=w[6]||"",b.query=w[7],b.fragment=w[8],isNaN(b.port)&&(b.port=w[5])):(b.scheme=w[1]||void 0,b.userinfo=y.indexOf("@")!==-1?w[3]:void 0,b.host=y.indexOf("//")!==-1?w[4]:void 0,b.port=parseInt(w[5],10),b.path=w[6]||"",b.query=y.indexOf("?")!==-1?w[7]:void 0,b.fragment=y.indexOf("#")!==-1?w[8]:void 0,isNaN(b.port)&&(b.port=y.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?w[4]:void 0)),b.host&&(b.host=ve(_e(b.host,P),P)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==b.reference&&(b.error=b.error||"URI is not a "+f.reference+" reference.");var N=ye[(f.scheme||b.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!N||!N.unicodeSupport)){if(b.host&&(f.domainHost||N&&N.domainHost))try{b.host=se.toASCII(b.host.replace(P.PCT_ENCODED,Ae).toLowerCase())}catch(K){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+K}br(b,u)}else br(b,P);N&&N.parse&&N.parse(b,f)}else b.error=b.error||"URI can not be parsed.";return b}function xr(y,f){var b=f.iri!==!1?c:u,P=[];return y.userinfo!==void 0&&(P.push(y.userinfo),P.push("@")),y.host!==void 0&&P.push(ve(_e(String(y.host),b),b).replace(b.IPV6ADDRESS,function(w,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof y.port=="number"||typeof y.port=="string")&&(P.push(":"),P.push(String(y.port))),P.length?P.join(""):void 0}var cr=/^\.\.?\//,Cr=/^\/\.(\/|$)/,Dr=/^\/\.\.(\/|$)/,Ee=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(y){for(var f=[];y.length;)if(y.match(cr))y=y.replace(cr,"");else if(y.match(Cr))y=y.replace(Cr,"/");else if(y.match(Dr))y=y.replace(Dr,"/"),f.pop();else if(y==="."||y==="..")y="";else{var b=y.match(Ee);if(b){var P=b[0];y=y.slice(P.length),f.push(P)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function je(y){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=f.iri?c:u,P=[],w=ye[(f.scheme||y.scheme||"").toLowerCase()];if(w&&w.serialize&&w.serialize(y,f),y.host&&!b.IPV6ADDRESS.test(y.host)){if(f.domainHost||w&&w.domainHost)try{y.host=f.iri?se.toUnicode(y.host):se.toASCII(y.host.replace(b.PCT_ENCODED,Ae).toLowerCase())}catch(ae){y.error=y.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+ae}}br(y,b),f.reference!=="suffix"&&y.scheme&&(P.push(y.scheme),P.push(":"));var N=xr(y,f);if(N!==void 0&&(f.reference!=="suffix"&&P.push("//"),P.push(N),y.path&&y.path.charAt(0)!=="/"&&P.push("/")),y.path!==void 0){var K=y.path;!f.absolutePath&&(!w||!w.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),P.push(K)}return y.query!==void 0&&(P.push("?"),P.push(y.query)),y.fragment!==void 0&&(P.push("#"),P.push(y.fragment)),P.join("")}function ke(y,f){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments[3],w={};return P||(y=ie(je(y,b),b),f=ie(je(f,b),b)),b=b||{},!b.tolerant&&f.scheme?(w.scheme=f.scheme,w.userinfo=f.userinfo,w.host=f.host,w.port=f.port,w.path=ze(f.path||""),w.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(w.userinfo=f.userinfo,w.host=f.host,w.port=f.port,w.path=ze(f.path||""),w.query=f.query):(f.path?(f.path.charAt(0)==="/"?w.path=ze(f.path):((y.userinfo!==void 0||y.host!==void 0||y.port!==void 0)&&!y.path?w.path="/"+f.path:y.path?w.path=y.path.slice(0,y.path.lastIndexOf("/")+1)+f.path:w.path=f.path,w.path=ze(w.path)),w.query=f.query):(w.path=y.path,f.query!==void 0?w.query=f.query:w.query=y.query),w.userinfo=y.userinfo,w.host=y.host,w.port=y.port),w.scheme=y.scheme),w.fragment=f.fragment,w}function rr(y,f,b){var P=o({scheme:"null"},b);return je(ke(ie(y,P),ie(f,P),P,!0),P)}function Me(y,f){return typeof y=="string"?y=je(ie(y,f),f):s(y)==="object"&&(y=ie(je(y,f),f)),y}function ea(y,f,b){return typeof y=="string"?y=je(ie(y,b),b):s(y)==="object"&&(y=je(y,b)),typeof f=="string"?f=je(ie(f,b),b):s(f)==="object"&&(f=je(f,b)),y===f}function Xa(y,f){return y&&y.toString().replace(!f||!f.iri?u.ESCAPE:c.ESCAPE,we)}function Ge(y,f){return y&&y.toString().replace(!f||!f.iri?u.PCT_ENCODED:c.PCT_ENCODED,Ae)}var Rt={scheme:"http",domainHost:!0,parse:function(f,b){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,b){var P=String(f.scheme).toLowerCase()==="https";return(f.port===(P?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},fn={scheme:"https",domainHost:Rt.domainHost,parse:Rt.parse,serialize:Rt.serialize};function hn(y){return typeof y.secure=="boolean"?y.secure:String(y.scheme).toLowerCase()==="wss"}var Ot={scheme:"ws",domainHost:!0,parse:function(f,b){var P=f;return P.secure=hn(P),P.resourceName=(P.path||"/")+(P.query?"?"+P.query:""),P.path=void 0,P.query=void 0,P},serialize:function(f,b){if((f.port===(hn(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var P=f.resourceName.split("?"),w=h(P,2),N=w[0],K=w[1];f.path=N&&N!=="/"?N:void 0,f.query=K,f.resourceName=void 0}return f.fragment=void 0,f}},pn={scheme:"wss",domainHost:Ot.domainHost,parse:Ot.parse,serialize:Ot.serialize},cc={},uc=!0,mn="[A-Za-z0-9\\-\\.\\_\\~"+(uc?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",tr="[0-9A-Fa-f]",dc=t(t("%[EFef]"+tr+"%"+tr+tr+"%"+tr+tr)+"|"+t("%[89A-Fa-f]"+tr+"%"+tr+tr)+"|"+t("%"+tr+tr)),fc="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",hc="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",pc=e(hc,'[\\"\\\\]'),mc="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",vc=new RegExp(mn,"g"),lt=new RegExp(dc,"g"),gc=new RegExp(e("[^]",fc,"[\\.]",'[\\"]',pc),"g"),vn=new RegExp(e("[^]",mn,mc),"g"),yc=vn;function es(y){var f=Ae(y);return f.match(vc)?f:y}var gn={scheme:"mailto",parse:function(f,b){var P=f,w=P.to=P.path?P.path.split(","):[];if(P.path=void 0,P.query){for(var N=!1,K={},ae=P.query.split("&"),oe=0,be=ae.length;oe<be;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe<de;++xe)w.push(he[xe]);break;case"subject":P.subject=Ge(te[1],b);break;case"body":P.body=Ge(te[1],b);break;default:N=!0,K[Ge(te[0],b)]=Ge(te[1],b);break}}N&&(P.headers=K)}P.query=void 0;for(var ne=0,pe=w.length;ne<pe;++ne){var ce=w[ne].split("@");if(ce[0]=Ge(ce[0]),b.unicodeSupport)ce[1]=Ge(ce[1],b).toLowerCase();else try{ce[1]=se.toASCII(Ge(ce[1],b).toLowerCase())}catch(jr){P.error=P.error||"Email address's domain name can not be converted to ASCII via punycode: "+jr}w[ne]=ce.join("@")}return P},serialize:function(f,b){var P=f,w=n(f.to);if(w){for(var N=0,K=w.length;N<K;++N){var ae=String(w[N]),oe=ae.lastIndexOf("@"),be=ae.slice(0,oe).replace(lt,es).replace(lt,r).replace(gc,we),te=ae.slice(oe+1);try{te=b.iri?se.toUnicode(te):se.toASCII(Ge(te,b).toLowerCase())}catch(ne){P.error=P.error||"Email address's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ne}w[N]=be+"@"+te}P.path=w.join(",")}var he=f.headers=f.headers||{};f.subject&&(he.subject=f.subject),f.body&&(he.body=f.body);var xe=[];for(var de in he)he[de]!==cc[de]&&xe.push(de.replace(lt,es).replace(lt,r).replace(vn,we)+"="+he[de].replace(lt,es).replace(lt,r).replace(yc,we));return xe.length&&(P.query=xe.join("&")),P}},_c=/^([^\:]+)\:(.*)/,yn={scheme:"urn",parse:function(f,b){var P=f.path&&f.path.match(_c),w=f;if(P){var N=b.scheme||w.scheme||"urn",K=P[1].toLowerCase(),ae=P[2],oe=N+":"+(b.nid||K),be=ye[oe];w.nid=K,w.nss=ae,w.path=void 0,be&&(w=be.parse(w,b))}else w.error=w.error||"URN can not be parsed.";return w},serialize:function(f,b){var P=b.scheme||f.scheme||"urn",w=f.nid,N=P+":"+(b.nid||w),K=ye[N];K&&(f=K.serialize(f,b));var ae=f,oe=f.nss;return ae.path=(w||b.nid)+":"+oe,ae}},bc=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,_n={scheme:"urn:uuid",parse:function(f,b){var P=f;return P.uuid=P.nss,P.nss=void 0,!b.tolerant&&(!P.uuid||!P.uuid.match(bc))&&(P.error=P.error||"UUID is not valid."),P},serialize:function(f,b){var P=f;return P.nss=(f.uuid||"").toLowerCase(),P}};ye[Rt.scheme]=Rt,ye[fn.scheme]=fn,ye[Ot.scheme]=Ot,ye[pn.scheme]=pn,ye[gn.scheme]=gn,ye[yn.scheme]=yn,ye[_n.scheme]=_n,a.SCHEMES=ye,a.pctEncChar=we,a.pctDecChars=Ae,a.parse=ie,a.removeDotSegments=ze,a.serialize=je,a.resolveComponents=ke,a.resolve=rr,a.normalize=Me,a.equal=ea,a.escapeComponent=Xa,a.unescapeComponent=Ge,Object.defineProperty(a,"__esModule",{value:!0})})});var xa=J((Kp,ti)=>{"use strict";ti.exports=function a(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,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))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(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!a(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var si=J((Gp,ai)=>{"use strict";ai.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var at=J((Wp,oi)=>{"use strict";oi.exports={copy:Ad,checkDataType:Es,checkDataTypes:kd,coerceToTypes:Cd,toHash:Rs,getProperty:Os,escapeQuotes:Ts,equal:xa(),ucs2length:si(),varOccurences:Nd,varReplace:Fd,schemaHasRules:Ld,schemaHasRulesExcept:Md,schemaUnknownRules:qd,toQuotedString:Ss,getPathExpr:Ud,getPath:zd,getData:Zd,unescapeFragment:Bd,unescapeJsonPointer:Is,escapeFragment:Jd,escapeJsonPointer:$s};function Ad(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Es(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",l=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+l+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+l+"("+e+" % 1)"+n+e+r+e+(t?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function kd(a,e,t){switch(a.length){case 1:return Es(a[0],e,t,!0);default:var s="",r=Rs(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Es(n,e,t,!0);return s}}var ni=Rs(["string","number","integer","boolean","null"]);function Cd(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(ni[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(ni[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Rs(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Dd=/^[a-z$_][a-z$_0-9]*$/i,jd=/'|\\/g;function Os(a){return typeof a=="number"?"["+a+"]":Dd.test(a)?"."+a:"['"+Ts(a)+"']"}function Ts(a){return a.replace(jd,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Nd(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function Fd(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Ld(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function Md(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function qd(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Ss(a){return"'"+Ts(a)+"'"}function Ud(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return ii(a,r)}function zd(a,e,t){var s=Ss(t?"/"+$s(e):Os(e));return ii(a,s)}var Vd=/^\/(?:[^~]|~0|~1)*$/,Hd=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Zd(a,e,t){var s,r,n,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Vd.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(o=a.match(Hd),!o)throw new Error("Invalid JSON-pointer: "+a);if(s=+o[1],r=o[2],r=="#"){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||""),!r)return n}for(var l=n,u=r.split("/"),c=0;c<u.length;c++){var h=u[c];h&&(n+=Os(Is(h)),l+=" && "+n)}return l}function ii(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Bd(a){return Is(decodeURIComponent(a))}function Jd(a){return encodeURIComponent($s(a))}function $s(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Is(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var As=J((Yp,li)=>{"use strict";var Qd=at();li.exports=Kd;function Kd(a){Qd.copy(a,this)}});var ui=J((Xp,ci)=>{"use strict";var Or=ci.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Pa(e,s,r,a,"",a)};Or.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Or.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Or.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Or.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 Pa(a,e,t,s,r,n,o,l,u,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,l,u,c);for(var h in s){var p=s[h];if(Array.isArray(p)){if(h in Or.arrayKeywords)for(var g=0;g<p.length;g++)Pa(a,e,t,p[g],r+"/"+h+"/"+g,n,r,h,s,g)}else if(h in Or.propsKeywords){if(p&&typeof p=="object")for(var d in p)Pa(a,e,t,p[d],r+"/"+h+"/"+Gd(d),n,r,h,s,d)}else(h in Or.keywords||a.allKeys&&!(h in Or.skipKeywords))&&Pa(a,e,t,p,r+"/"+h,n,r,h,s)}t(s,r,n,o,l,u,c)}}function Gd(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ta=J((em,pi)=>{"use strict";var Lt=ri(),di=xa(),Ra=at(),wa=As(),Wd=ui();pi.exports=$r;$r.normalizeId=Tr;$r.fullPath=Ea;$r.url=Sa;$r.ids=tf;$r.inlineRef=ks;$r.schema=Oa;function $r(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return $r.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof wa)return ks(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Oa.call(this,e,t),n,o,l;return r&&(n=r.schema,e=r.root,l=r.baseId),n instanceof wa?o=n.validate||a.call(this,n.schema,e,void 0,l):n!==void 0&&(o=ks(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,l)),o}function Oa(a,e){var t=Lt.parse(e),s=hi(t),r=Ea(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Tr(s),o=this._refs[n];if(typeof o=="string")return Yd.call(this,a,o,t);if(o instanceof wa)o.validate||this._compile(o),a=o;else if(o=this._schemas[n],o instanceof wa){if(o.validate||this._compile(o),n==Tr(e))return{schema:o,root:a,baseId:r};a=o}else return;if(!a.schema)return;r=Ea(this._getId(a.schema))}return fi.call(this,t,r,a.schema,a)}function Yd(a,e,t){var s=Oa.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var o=this._getId(r);return o&&(n=Sa(n,o)),fi.call(this,t,n,r,a)}}var Xd=Ra.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function fi(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Ra.unescapeFragment(o),t=t[o],t===void 0)break;var l;if(!Xd[o]&&(l=this._getId(t),l&&(e=Sa(e,l)),t.$ref)){var u=Sa(e,t.$ref),c=Oa.call(this,s,u);c&&(t=c.schema,s=c.root,e=c.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var ef=Ra.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function ks(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return Cs(a);if(e)return Ds(a)<=e}function Cs(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!Cs(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!Cs(e)))return!1;return!0}function Ds(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=Ds(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(ef[r])e++;else if(t=a[r],typeof t=="object"&&(e+=Ds(t)+1),e==1/0)return 1/0}return e}function Ea(a,e){e!==!1&&(a=Tr(a));var t=Lt.parse(a);return hi(t)}function hi(a){return Lt.serialize(a).split("#")[0]+"#"}var rf=/#\/?$/;function Tr(a){return a?a.replace(rf,""):""}function Sa(a,e){return e=Tr(e),Lt.resolve(a,e)}function tf(a){var e=Tr(this._getId(a)),t={"":e},s={"":Ea(e,!1)},r={},n=this;return Wd(a,{allKeys:!0},function(o,l,u,c,h,p,g){if(l!==""){var d=n._getId(o),_=t[c],m=s[c]+"/"+h;if(g!==void 0&&(m+="/"+(typeof g=="number"?g:Ra.escapeFragment(g))),typeof d=="string"){d=_=Tr(_?Lt.resolve(_,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!di(o,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Tr(m))if(d[0]=="#"){if(r[d]&&!di(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=m}t[l]=_,s[l]=m}}),r}});var $a=J((rm,vi)=>{"use strict";var js=Ta();vi.exports={Validation:mi(af),MissingRef:mi(Ns)};function af(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ns.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ns(a,e,t){this.message=t||Ns.message(a,e),this.missingRef=js.url(a,e),this.missingSchema=js.normalizeId(js.fullPath(this.missingRef))}function mi(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Fs=J((tm,gi)=>{"use strict";gi.exports=function(a,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(l,u){var c={key:l,value:o[l]},h={key:u,value:o[u]};return n(c,h)}}}(e.cmp),r=[];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 l,u;if(Array.isArray(o)){for(u="[",l=0;l<o.length;l++)l&&(u+=","),u+=n(o[l])||"null";return u+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,h=Object.keys(o).sort(s&&s(o));for(u="",l=0;l<h.length;l++){var p=h[l],g=n(o[p]);g&&(u&&(u+=","),u+=JSON.stringify(p)+":"+g)}return r.splice(c,1),"{"+u+"}"}}(a)}});var Ls=J((am,yi)=>{"use strict";yi.exports=function(e,t,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var u=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(u){var c="unknown keyword: "+u;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",h=e.level,p=e.dataLevel,g=e.schema[t],d=e.schemaPath+e.util.getProperty(t),_=e.errSchemaPath+"/"+t,I=!e.opts.allErrors,q,m="data"+(p||""),O="valid"+h;if(e.schema===!1){e.isTop?I=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(_)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var S=e.isTop,h=e.level=0,p=e.dataLevel=0,m="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 E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var h=e.level,p=e.dataLevel,m="data"+(p||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+h+" = errors;"}var O="valid"+h,I=!e.opts.allErrors,A="",V="",q,k=e.schema.type,U=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(U?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],U=!0)),U&&k.length==1&&(k=k[0],U=!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&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),k){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,k);var F=e.RULES.types[k];if(M||U||F===!0||F&&!Ee(F)){var d=e.schemaPath+".type",_=e.errSchemaPath+"/type",d=e.schemaPath+".type",_=e.errSchemaPath+"/type",$=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[$](k,m,e.opts.strictNumbers,!0)+") { ",M){var C="dataType"+h,L="coerced"+h;r+=" var "+C+" = typeof "+m+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+m+") && "+m+".length == 1) { "+m+" = "+m+"[0]; "+C+" = typeof "+m+"; if ("+e.util.checkDataType(e.schema.type,m,e.opts.strictNumbers)+") "+L+" = "+m+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,W=le.length-1;re<W;)Y=le[re+=1],Y=="string"?r+=" else if ("+C+" == 'number' || "+C+" == 'boolean') "+L+" = '' + "+m+"; else if ("+m+" === null) "+L+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+C+" == 'boolean' || "+m+" === null || ("+C+" == 'string' && "+m+" && "+m+" == +"+m+" ",Y=="integer"&&(r+=" && !("+m+" % 1)"),r+=")) "+L+" = +"+m+"; "):Y=="boolean"?r+=" else if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+L+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+L+" = true; ":Y=="null"?r+=" else if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+L+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+C+" == 'string' || "+C+" == 'number' || "+C+" == 'boolean' || "+m+" == null) "+L+" = ["+m+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(_)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+L+" !== undefined) { ";var H=p?"data"+(p-1||""):"parentData",me=p?e.dataPathArr[p]:"parentDataProperty";r+=" "+m+" = "+L+"; ",p||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+me+"] = "+L+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(_)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",I&&(r+=" } if (errors === ",S?r+="0":r+="errs_"+h,r+=") { ",V+="}");else{var Re=e.RULES;if(Re){for(var F,Ie=-1,se=Re.length-1;Ie<se;)if(F=Re[Ie+=1],Ee(F)){if(F.type&&(r+=" if ("+e.util.checkDataType(F.type,m,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var g=e.schema.properties,ye=Object.keys(g),we=ye;if(we)for(var Ae,br=-1,lr=we.length-1;br<lr;){Ae=we[br+=1];var _e=g[Ae];if(_e.default!==void 0){var ve=m+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var kr=e.schema.items;if(kr){for(var _e,re=-1,Oe=kr.length-1;re<Oe;)if(_e=kr[re+=1],_e.default!==void 0){var ve=m+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var ie=F.rules;if(ie){for(var xr,cr=-1,Cr=ie.length-1;cr<Cr;)if(xr=ie[cr+=1],ze(xr)){var Dr=xr.code(e,xr.keyword,F.type);Dr&&(r+=" "+Dr+" ",I&&(A+="}"))}}if(I&&(r+=" "+A+" ",A=""),F.type&&(r+=" } ",k&&k===F.type&&!M)){r+=" else { ";var d=e.schemaPath+".type",_=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(_)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}I&&(r+=" if (errors === ",S?r+="0":r+="errs_"+h,r+=") { ",V+="}")}}}I&&(r+=" "+V+" "),S?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+h+";";function Ee(ke){for(var rr=ke.rules,Me=0;Me<rr.length;Me++)if(ze(rr[Me]))return!0}function ze(ke){return e.schema[ke.keyword]!==void 0||ke.implements&&je(ke)}function je(ke){for(var rr=ke.implements,Me=0;Me<rr.length;Me++)if(e.schema[rr[Me]]!==void 0)return!0}return r}});var wi=J((sm,Pi)=>{"use strict";var Ia=Ta(),ka=at(),bi=$a(),sf=Fs(),_i=Ls(),nf=ka.ucs2length,of=xa(),lf=bi.Validation;Pi.exports=Ms;function Ms(a,e,t,s){var r=this,n=this._opts,o=[void 0],l={},u=[],c={},h=[],p={},g=[];e=e||{schema:a,refVal:o,refs:l};var d=cf.call(this,a,e,s),_=this._compilations[d.index];if(d.compiling)return _.callValidate=E;var m=this._formats,v=this.RULES;try{var x=O(a,e,t,s);_.validate=x;var S=_.callValidate;return S&&(S.schema=x.schema,S.errors=null,S.refs=x.refs,S.refVal=x.refVal,S.root=x.root,S.$async=x.$async,n.sourceCode&&(S.source=x.source)),x}finally{uf.call(this,a,e,s)}function E(){var $=_.validate,C=$.apply(this,arguments);return E.errors=$.errors,C}function O($,C,L,le){var Y=!C||C&&C.schema==$;if(C.schema!=e.schema)return Ms.call(r,$,C,L,le);var re=$.$async===!0,W=_i({isTop:!0,schema:$,isRoot:Y,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:bi.MissingRef,RULES:v,validate:_i,util:ka,resolve:Ia,resolveRef:I,usePattern:U,useDefault:M,useCustomRule:F,opts:n,formats:m,logger:r.logger,self:r});W=Aa(o,hf)+Aa(u,df)+Aa(h,ff)+Aa(g,pf)+W,n.processCode&&(W=n.processCode(W,$));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",W);H=me(r,v,m,e,o,h,g,of,nf,lf),o[0]=H}catch(Re){throw r.logger.error("Error compiling schema, function code:",W),Re}return H.schema=$,H.errors=null,H.refs=l,H.refVal=o,H.root=Y?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:W,patterns:u,defaults:h}),H}function I($,C,L){C=Ia.url($,C);var le=l[C],Y,re;if(le!==void 0)return Y=o[le],re="refVal["+le+"]",k(Y,re);if(!L&&e.refs){var W=e.refs[C];if(W!==void 0)return Y=e.refVal[W],re=A(C,Y),k(Y,re)}re=A(C);var H=Ia.call(r,O,e,C);if(H===void 0){var me=t&&t[C];me&&(H=Ia.inlineRef(me,n.inlineRefs)?me:Ms.call(r,me,e,t,$))}if(H===void 0)V(C);else return q(C,H),k(H,re)}function A($,C){var L=o.length;return o[L]=C,l[$]=L,"refVal"+L}function V($){delete l[$]}function q($,C){var L=l[$];o[L]=C}function k($,C){return typeof $=="object"||typeof $=="boolean"?{code:C,schema:$,inline:!0}:{code:C,$async:$&&!!$.$async}}function U($){var C=c[$];return C===void 0&&(C=c[$]=u.length,u[C]=$),"pattern"+C}function M($){switch(typeof $){case"boolean":case"number":return""+$;case"string":return ka.toQuotedString($);case"object":if($===null)return"null";var C=sf($),L=p[C];return L===void 0&&(L=p[C]=h.length,h[L]=$),"default"+L}}function F($,C,L,le){if(r._opts.validateSchema!==!1){var Y=$.definition.dependencies;if(Y&&!Y.every(function(we){return Object.prototype.hasOwnProperty.call(L,we)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=$.definition.validateSchema;if(re){var W=re(C);if(!W){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=$.definition.compile,Re=$.definition.inline,Ie=$.definition.macro,se;if(me)se=me.call(r,C,L,le);else if(Ie)se=Ie.call(r,C,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Re)se=Re.call(r,le,$.keyword,C,L);else if(se=$.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+$.keyword+'"failed to compile');var ye=g.length;return g[ye]=se,{code:"customRule"+ye,validate:se}}}function cf(a,e,t){var s=xi.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function uf(a,e,t){var s=xi.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function xi(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function df(a,e){return"var pattern"+a+" = new RegExp("+ka.toQuotedString(e[a])+");"}function ff(a){return"var default"+a+" = defaults["+a+"];"}function hf(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function pf(a){return"var customRule"+a+" = customRules["+a+"];"}function Aa(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Si=J((nm,Ei)=>{"use strict";var Ca=Ei.exports=function(){this._cache={}};Ca.prototype.put=function(e,t){this._cache[e]=t};Ca.prototype.get=function(e){return this._cache[e]};Ca.prototype.del=function(e){delete this._cache[e]};Ca.prototype.clear=function(){this._cache={}}});var Fi=J((im,Ni)=>{"use strict";var mf=at(),vf=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gf=[0,31,28,31,30,31,30,31,31,30,31,30,31],yf=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ri=/^(?=.{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,_f=/^(?:[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,bf=/^(?:[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,Oi=/^(?:(?:[^\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,Ti=/^(?:(?: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,$i=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ii=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ai=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,ki=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Ni.exports=Da;function Da(a){return a=a=="full"?"full":"fast",mf.copy(Da[a])}Da.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":Oi,url:Ti,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:Ri,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:ji,uuid:$i,"json-pointer":Ii,"json-pointer-uri-fragment":Ai,"relative-json-pointer":ki};Da.full={date:Ci,time:Di,"date-time":wf,uri:Sf,"uri-reference":bf,"uri-template":Oi,url:Ti,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:Ri,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:ji,uuid:$i,"json-pointer":Ii,"json-pointer-uri-fragment":Ai,"relative-json-pointer":ki};function xf(a){return a%4===0&&(a%100!==0||a%400===0)}function Ci(a){var e=a.match(vf);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&xf(t)?29:gf[s])}function Di(a,e){var t=a.match(yf);if(!t)return!1;var s=t[1],r=t[2],n=t[3],o=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var Pf=/t|\s/i;function wf(a){var e=a.split(Pf);return e.length==2&&Ci(e[0])&&Di(e[1],!0)}var Ef=/\/|:/;function Sf(a){return Ef.test(a)&&_f.test(a)}var Rf=/[^\\]\\Z/;function ji(a){if(Rf.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Mi=J((om,Li)=>{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(o||""),p="valid"+n,g,d;if(l=="#"||l=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var _=e.resolveRef(e.baseId,l,e.isRoot);if(_===void 0){var m=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(m);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(m),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,m)}else if(_.inline){var S=e.util.copy(e);S.level++;var E="valid"+S.level;S.schema=_.schema,S.schemaPath="",S.errSchemaPath=l;var O=e.validate(S).replace(/validate\.schema/g,_.code);r+=" "+O+" ",c&&(r+=" if ("+E+") { ")}else g=_.$async===!0||e.async&&_.$async!==!1,d=_.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var I=o?"data"+(o-1||""):"parentData",A=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+I+" , "+A+", rootData) ";var V=r;if(r=v.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+p+"; "),r+=" try { await "+V+"; ",c&&(r+=" "+p+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+p+" = false; "),r+=" } ",c&&(r+=" if ("+p+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r}});var Ui=J((lm,qi)=>{"use strict";qi.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c=e.util.copy(e),h="";c.level++;var p="valid"+c.level,g=c.baseId,d=!0,_=n;if(_)for(var m,v=-1,x=_.length-1;v<x;)m=_[v+=1],(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(d=!1,c.schema=m,c.schemaPath=o+"["+v+"]",c.errSchemaPath=l+"/"+v,r+=" "+e.validate(c)+" ",c.baseId=g,u&&(r+=" if ("+p+") { ",h+="}"));return u&&(d?r+=" if (true) { ":r+=" "+h.slice(0,-1)+" "),r}});var Vi=J((cm,zi)=>{"use strict";zi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,_=e.util.copy(e),m="";_.level++;var v="valid"+_.level,x=l.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(x){var S=_.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var E=e.compositeRule;e.compositeRule=_.compositeRule=!0;var O=l;if(O)for(var I,A=-1,V=O.length-1;A<V;)I=O[A+=1],_.schema=I,_.schemaPath=u+"["+A+"]",_.errSchemaPath=c+"/"+A,r+=" "+e.validate(_)+" ",_.baseId=S,r+=" "+g+" = "+g+" || "+v+"; if (!"+g+") { ",m+="}";e.compositeRule=_.compositeRule=E,r+=" "+m+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else h&&(r+=" if (true) { ");return r}});var Zi=J((um,Hi)=>{"use strict";Hi.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,u=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+u+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+u+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}});var Ji=J((dm,Bi)=>{"use strict";Bi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,_;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",_="schema"+n):_=l,d||(r+=" var schema"+n+" = validate.schema"+u+";"),r+="var "+g+" = equal("+p+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var Ki=J((fm,Qi)=>{"use strict";Qi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,_=e.util.copy(e),m="";_.level++;var v="valid"+_.level,x="i"+n,S=_.dataLevel=e.dataLevel+1,E="data"+S,O=e.baseId,I=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",I){var A=e.compositeRule;e.compositeRule=_.compositeRule=!0,_.schema=l,_.schemaPath=u,_.errSchemaPath=c,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",_.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var V=p+"["+x+"]";_.dataPathArr[S]=x;var q=e.validate(_);_.baseId=O,e.util.varOccurences(q,E)<2?r+=" "+e.util.varReplace(q,E,V)+" ":r+=" var "+E+" = "+V+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=_.compositeRule=A,r+=" "+m+" if (!"+v+") {"}else r+=" if ("+p+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var U=r;return r=k.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",I&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var Wi=J((hm,Gi)=>{"use strict";Gi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),_="";d.level++;var m="valid"+d.level,v={},x={},S=e.opts.ownProperties;for(A in l)if(A!="__proto__"){var E=l[A],O=Array.isArray(E)?x:v;O[A]=E}r+="var "+g+" = errors;";var I=e.errorPath;r+="var missing"+n+";";for(var A in x)if(O=x[A],O.length){if(r+=" if ( "+p+e.util.getProperty(A)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(A)+"') "),h){r+=" && ( ";var V=O;if(V)for(var q,k=-1,U=V.length-1;k<U;){q=V[k+=1],k&&(r+=" || ");var M=e.util.getProperty(q),F=p+M;r+=" ( ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var $="missing"+n,C="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,$,!0):I+" + "+$);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+C+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var le=r;r=L.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,W=Y.length-1;re<W;){q=Y[re+=1];var M=e.util.getProperty(q),C=e.util.escapeQuotes(q),F=p+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,q,e.opts.jsonPointers)),r+=" if ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+C+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",h&&(_+="}",r+=" else { ")}e.errorPath=I;var H=d.baseId;for(var A in v){var E=v[A];(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(r+=" "+m+" = true; if ( "+p+e.util.getProperty(A)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(A)+"') "),r+=") { ",d.schema=E,d.schemaPath=u+e.util.getProperty(A),d.errSchemaPath=c+"/"+e.util.escapeFragment(A),r+=" "+e.validate(d)+" ",d.baseId=H,r+=" } ",h&&(r+=" if ("+m+") { ",_+="}"))}return h&&(r+=" "+_+" if ("+g+" == errors) {"),r}});var Xi=J((pm,Yi)=>{"use strict";Yi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,_;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",_="schema"+n):_=l;var m="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+u+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+v+".length; "+m+"++) if (equal("+p+", "+v+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;return r=x.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var ro=J((mm,eo)=>{"use strict";eo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return h&&(r+=" if (true) { "),r;var g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var _=e.opts.unknownFormats,m=Array.isArray(_);if(g){var v="format"+n,x="isObject"+n,S="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+S+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",_!="ignore"&&(r+=" ("+d+" && !"+v+" ",m&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+S+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+p+") : "+v+"("+p+")) ":r+=" "+v+"("+p+") ",r+=" : "+v+".test("+p+"))))) {"}else{var v=e.formats[l];if(!v){if(_=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(r+=" if (true) { "),r;if(m&&_.indexOf(l)>=0)return h&&(r+=" if (true) { "),r;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,S=x&&v.type||"string";if(x){var E=v.async===!0;v=v.validate}if(S!=s)return h&&(r+=" if (true) { "),r;if(E){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(l)+".validate";r+=" if (!(await "+O+"("+p+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(l);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+p+") ":r+=" "+O+".test("+p+") ",r+=") { "}}var I=I||[];I.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var A=r;return r=I.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var ao=J((vm,to)=>{"use strict";to.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,_=e.util.copy(e);_.level++;var m="valid"+_.level,v=e.schema.then,x=e.schema.else,S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),E=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=_.baseId;if(S||E){var I;_.createErrors=!1,_.schema=l,_.schemaPath=u,_.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var A=e.compositeRule;e.compositeRule=_.compositeRule=!0,r+=" "+e.validate(_)+" ",_.baseId=O,_.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=_.compositeRule=A,S?(r+=" if ("+m+") { ",_.schema=e.schema.then,_.schemaPath=e.schemaPath+".then",_.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(_)+" ",_.baseId=O,r+=" "+g+" = "+m+"; ",S&&E?(I="ifClause"+n,r+=" var "+I+" = 'then'; "):I="'then'",r+=" } ",E&&(r+=" else { ")):r+=" if (!"+m+") { ",E&&(_.schema=e.schema.else,_.schemaPath=e.schemaPath+".else",_.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(_)+" ",_.baseId=O,r+=" "+g+" = "+m+"; ",S&&E?(I="ifClause"+n,r+=" var "+I+" = 'else'; "):I="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+I+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+I+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var no=J((gm,so)=>{"use strict";so.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,_=e.util.copy(e),m="";_.level++;var v="valid"+_.level,x="i"+n,S=_.dataLevel=e.dataLevel+1,E="data"+S,O=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(l)){var I=e.schema.additionalItems;if(I===!1){r+=" "+g+" = "+p+".length <= "+l.length+"; ";var A=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=A,h&&(m+="}",r+=" else { ")}var k=l;if(k){for(var U,M=-1,F=k.length-1;M<F;)if(U=k[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+p+".length > "+M+") { ";var $=p+"["+M+"]";_.schema=U,_.schemaPath=u+"["+M+"]",_.errSchemaPath=c+"/"+M,_.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),_.dataPathArr[S]=M;var C=e.validate(_);_.baseId=O,e.util.varOccurences(C,E)<2?r+=" "+e.util.varReplace(C,E,$)+" ":r+=" var "+E+" = "+$+"; "+C+" ",r+=" } ",h&&(r+=" if ("+v+") { ",m+="}")}}if(typeof I=="object"&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))){_.schema=I,_.schemaPath=e.schemaPath+".additionalItems",_.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+p+".length > "+l.length+") { for (var "+x+" = "+l.length+"; "+x+" < "+p+".length; "+x+"++) { ",_.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";_.dataPathArr[S]=x;var C=e.validate(_);_.baseId=O,e.util.varOccurences(C,E)<2?r+=" "+e.util.varReplace(C,E,$)+" ":r+=" var "+E+" = "+$+"; "+C+" ",h&&(r+=" if (!"+v+") break; "),r+=" } } ",h&&(r+=" if ("+v+") { ",m+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){_.schema=l,_.schemaPath=u,_.errSchemaPath=c,r+=" for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",_.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";_.dataPathArr[S]=x;var C=e.validate(_);_.baseId=O,e.util.varOccurences(C,E)<2?r+=" "+e.util.varReplace(C,E,$)+" ":r+=" var "+E+" = "+$+"; "+C+" ",h&&(r+=" if (!"+v+") break; "),r+=" }"}return h&&(r+=" "+m+" if ("+d+" == errors) {"),r}});var qs=J((ym,io)=>{"use strict";io.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,O,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var _=t=="maximum",m=_?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[m],x=e.opts.$data&&v&&v.$data,S=_?"<":">",E=_?">":"<",O=void 0;if(!(g||typeof l=="number"||l===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(m+" must be number or boolean");if(x){var I=e.util.getData(v.$data,o,e.dataPathArr),A="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,k="op"+n,U="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+I+"; ",I="schemaExcl"+n,r+=" var "+A+"; var "+V+" = typeof "+I+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var O=m,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+A+" = "+d+" === undefined || "+I+" "+S+"= "+d+") ? "+p+" "+E+"= "+I+" : "+p+" "+E+" "+d+" ) : ( ("+A+" = "+I+" === true) ? "+p+" "+E+"= "+d+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { var op"+n+" = "+A+" ? '"+S+"' : '"+S+"='; ",l===void 0&&(O=m,c=e.errSchemaPath+"/"+m,d=I,g=x)}else{var q=typeof v=="number",U=S;if(q&&g){var k="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+S+"= "+d+" ? "+p+" "+E+"= "+v+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { "}else{q&&l===void 0?(A=!0,O=m,c=e.errSchemaPath+"/"+m,d=v,E+="="):(q&&(d=Math[_?"min":"max"](v,l)),v===(q?d:!0)?(A=!0,O=m,c=e.errSchemaPath+"/"+m,E+="="):(A=!1,U+="="));var k="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+" "+E+" "+d+" || "+p+" !== "+p+") { "}}O=O||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+k+", limit: "+d+", exclusive: "+A+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var Us=J((_m,oo)=>{"use strict";oo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var _=t=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+".length "+_+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var zs=J((bm,lo)=>{"use strict";lo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var _=t=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+p+".length ":r+=" ucs2length("+p+") ",r+=" "+_+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var Vs=J((xm,co)=>{"use strict";co.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var _=t=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+p+").length "+_+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var fo=J((Pm,uo)=>{"use strict";uo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var m=r;return r=_.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var po=J((wm,ho)=>{"use strict";ho.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var _="valid"+d.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var m=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=m,r+=" if ("+_+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=x.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(r+=" if (false) { ");return r}});var vo=J((Em,mo)=>{"use strict";mo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,_=e.util.copy(e),m="";_.level++;var v="valid"+_.level,x=_.baseId,S="prevValid"+n,E="passingSchemas"+n;r+="var "+d+" = errors , "+S+" = false , "+g+" = false , "+E+" = null; ";var O=e.compositeRule;e.compositeRule=_.compositeRule=!0;var I=l;if(I)for(var A,V=-1,q=I.length-1;V<q;)A=I[V+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(_.schema=A,_.schemaPath=u+"["+V+"]",_.errSchemaPath=c+"/"+V,r+=" "+e.validate(_)+" ",_.baseId=x):r+=" var "+v+" = true; ",V&&(r+=" if ("+v+" && "+S+") { "+g+" = false; "+E+" = ["+E+", "+V+"]; } else { ",m+="}"),r+=" if ("+v+") { "+g+" = "+S+" = true; "+E+" = "+V+"; }";return e.compositeRule=_.compositeRule=O,r+=""+m+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var yo=J((Sm,go)=>{"use strict";go.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var _=g?"(new RegExp("+d+"))":e.usePattern(l);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+_+".test("+p+") ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var bo=J((Rm,_o)=>{"use strict";_o.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),_="";d.level++;var m="valid"+d.level,v="key"+n,x="idx"+n,S=d.dataLevel=e.dataLevel+1,E="data"+S,O="dataProperties"+n,I=Object.keys(l||{}).filter(re),A=e.schema.patternProperties||{},V=Object.keys(A).filter(re),q=e.schema.additionalProperties,k=I.length||V.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,$=U||M||F,C=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(Ge){return Ge!=="__proto__"}if(r+="var "+g+" = errors;var "+m+" = true;",C&&(r+=" var "+O+" = undefined;"),$){if(C?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",k){if(r+=" var isAdditional"+n+" = !(false ",I.length)if(I.length>8)r+=" || validate.schema"+u+".hasOwnProperty("+v+") ";else{var W=I;if(W)for(var H,me=-1,Re=W.length-1;me<Re;)H=W[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(H)+" "}if(V.length){var Ie=V;if(Ie)for(var se,ye=-1,we=Ie.length-1;ye<we;)se=Ie[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(F=="all")r+=" delete "+p+"["+v+"]; ";else{var Ae=e.errorPath,br="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(F)r+=" delete "+p+"["+v+"]; ";else{r+=" "+m+" = false; ";var lr=c;c=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+br+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,h&&(r+=" break; ")}else if(M)if(F=="failing"){r+=" var "+g+" = errors; ";var kr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var ie=e.validate(d);d.baseId=L,e.util.varOccurences(ie,E)<2?r+=" "+e.util.varReplace(ie,E,Oe)+" ":r+=" var "+E+" = "+Oe+"; "+ie+" ",r+=" if (!"+m+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+v+"]; } ",e.compositeRule=d.compositeRule=kr}else{d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var ie=e.validate(d);d.baseId=L,e.util.varOccurences(ie,E)<2?r+=" "+e.util.varReplace(ie,E,Oe)+" ":r+=" var "+E+" = "+Oe+"; "+ie+" ",h&&(r+=" if (!"+m+") break; ")}e.errorPath=Ae}k&&(r+=" } "),r+=" } ",h&&(r+=" if ("+m+") { ",_+="}")}var xr=e.opts.useDefaults&&!e.compositeRule;if(I.length){var cr=I;if(cr)for(var H,Cr=-1,Dr=cr.length-1;Cr<Dr;){H=cr[Cr+=1];var Ee=l[H];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){var ze=e.util.getProperty(H),Oe=p+ze,je=xr&&Ee.default!==void 0;d.schema=Ee,d.schemaPath=u+ze,d.errSchemaPath=c+"/"+e.util.escapeFragment(H),d.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),d.dataPathArr[S]=e.util.toQuotedString(H);var ie=e.validate(d);if(d.baseId=L,e.util.varOccurences(ie,E)<2){ie=e.util.varReplace(ie,E,Oe);var ke=Oe}else{var ke=E;r+=" var "+E+" = "+Oe+"; "}if(je)r+=" "+ie+" ";else{if(Y&&Y[H]){r+=" if ( "+ke+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+m+" = false; ";var Ae=e.errorPath,lr=c,rr=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,H,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+rr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+rr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,e.errorPath=Ae,r+=" } else { "}else h?(r+=" if ( "+ke+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+m+" = true; } else { "):(r+=" if ("+ke+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}h&&(r+=" if ("+m+") { ",_+="}")}}if(V.length){var Me=V;if(Me)for(var se,ea=-1,Xa=Me.length-1;ea<Xa;){se=Me[ea+=1];var Ee=A[se];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){d.schema=Ee,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var ie=e.validate(d);d.baseId=L,e.util.varOccurences(ie,E)<2?r+=" "+e.util.varReplace(ie,E,Oe)+" ":r+=" var "+E+" = "+Oe+"; "+ie+" ",h&&(r+=" if (!"+m+") break; "),r+=" } ",h&&(r+=" else "+m+" = true; "),r+=" } ",h&&(r+=" if ("+m+") { ",_+="}")}}}return h&&(r+=" "+_+" if ("+g+" == errors) {"),r}});var Po=J((Om,xo)=>{"use strict";xo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),_="";d.level++;var m="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c;var v="key"+n,x="idx"+n,S="i"+n,E="' + "+v+" + '",O=d.dataLevel=e.dataLevel+1,I="data"+O,A="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+A+" = undefined; "),V?r+=" "+A+" = "+A+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+A+".length; "+x+"++) { var "+v+" = "+A+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" var startErrs"+n+" = errors; ";var k=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,I)<2?r+=" "+e.util.varReplace(M,I,k)+" ":r+=" var "+I+" = "+k+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+m+") { for (var "+S+"=startErrs"+n+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+E+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+E+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),h&&(r+=" break; "),r+=" } }"}return h&&(r+=" "+_+" if ("+g+" == errors) {"),r}});var Eo=J((Tm,wo)=>{"use strict";wo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,_;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",_="schema"+n):_=l;var m="schema"+n;if(!d)if(l.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],x=l;if(x)for(var S,E=-1,O=x.length-1;E<O;){S=x[E+=1];var I=e.schema.properties[S];I&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))||(v[v.length]=S)}}else var v=l;if(d||v.length){var A=e.errorPath,V=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(h)if(r+=" var missing"+n+"; ",V){d||(r+=" var "+m+" = validate.schema"+u+"; ");var k="i"+n,U="schema"+n+"["+k+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,U,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+m+".length; "+k+"++) { "+g+" = "+p+"["+m+"["+k+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", "+m+"["+k+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var L,k=-1,le=C.length-1;k<le;){L=C[k+=1],k&&(r+=" || ");var Y=e.util.getProperty(L),re=p+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:Y)+") ) "}r+=") { ";var U="missing"+n,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,U,!0):A+" + "+U);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(V){d||(r+=" var "+m+" = validate.schema"+u+"; ");var k="i"+n,U="schema"+n+"["+k+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,U,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+k+" = 0; "+k+" < "+m+".length; "+k+"++) { if ("+p+"["+m+"["+k+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+m+"["+k+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var W=v;if(W)for(var L,H=-1,me=W.length-1;H<me;){L=W[H+=1];var Y=e.util.getProperty(L),M=e.util.escapeQuotes(L),re=p+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,L,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=A}else h&&(r+=" if (true) {");return r}});var Ro=J(($m,So)=>{"use strict";So.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,_;if(d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",_="schema"+n):_=l,(l||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+_+" === false || "+_+" === undefined) "+g+" = true; else if (typeof "+_+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+p+".length , "+g+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,v=Array.isArray(m);if(!m||m=="object"||m=="array"||v&&(m.indexOf("object")>=0||m.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](m,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var E=r;r=S.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var To=J((Im,Oo)=>{"use strict";Oo.exports={$ref:Mi(),allOf:Ui(),anyOf:Vi(),$comment:Zi(),const:Ji(),contains:Ki(),dependencies:Wi(),enum:Xi(),format:ro(),if:ao(),items:no(),maximum:qs(),minimum:qs(),maxItems:Us(),minItems:Us(),maxLength:zs(),minLength:zs(),maxProperties:Vs(),minProperties:Vs(),multipleOf:fo(),not:po(),oneOf:vo(),pattern:yo(),properties:bo(),propertyNames:Po(),required:Eo(),uniqueItems:Ro(),validate:Ls()}});var Ao=J((Am,Io)=>{"use strict";var $o=To(),Hs=at().toHash;Io.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"],r=["number","integer","string","array","object","boolean","null"];return e.all=Hs(t),e.types=Hs(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var l;if(typeof o=="object"){var u=Object.keys(o)[0];l=o[u],o=u,l.forEach(function(h){t.push(h),e.all[h]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:$o[o],implements:l};return c}),e.all.$comment={keyword:"$comment",code:$o.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=Hs(t.concat(s)),e.custom={},e}});var Do=J((km,Co)=>{"use strict";var ko=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Co.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<ko.length;n++){var o=ko[n],l=r[o];l&&(r[o]={anyOf:[l,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Fo=J((Cm,No)=>{"use strict";var Of=$a().MissingRef;No.exports=jo;function jo(a,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 r=n(a).then(function(){var l=s._addSchema(a,void 0,e);return l.validate||o(l)});return t&&r.then(function(l){t(null,l)},t),r;function n(l){var u=l.$schema;return u&&!s.getSchema(u)?jo.call(s,{$ref:u},!0):Promise.resolve()}function o(l){try{return s._compile(l)}catch(c){if(c instanceof Of)return u(c);throw c}function u(c){var h=c.missingSchema;if(d(h))throw new Error("Schema "+h+" is loaded but "+c.missingRef+" cannot be resolved");var p=s._loadingSchemas[h];return p||(p=s._loadingSchemas[h]=s._opts.loadSchema(h),p.then(g,g)),p.then(function(_){if(!d(h))return n(_).then(function(){d(h)||s.addSchema(_,h,void 0,e)})}).then(function(){return o(l)});function g(){delete s._loadingSchemas[h]}function d(_){return s._refs[_]||s._schemas[_]}}}}});var Mo=J((Dm,Lo)=>{"use strict";Lo.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,p,g="data"+(o||""),d="valid"+n,_="errs__"+n,m=e.opts.$data&&l&&l.$data,v;m?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",v="schema"+n):v=l;var x=this,S="definition"+n,E=x.definition,O="",I,A,V,q,k;if(m&&E.$data){k="keywordValidate"+n;var U=E.validateSchema;r+=" var "+S+" = RULES.custom['"+t+"'].definition; var "+k+" = "+S+".validate;"}else{if(q=e.useCustomRule(x,l,e.schema,e),!q)return;v="validate.schema"+u,k=q.code,I=E.compile,A=E.inline,V=E.macro}var M=k+".errors",F="i"+n,$="ruleErr"+n,C=E.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(A||V||(r+=""+M+" = null;"),r+="var "+_+" = errors;var "+d+";",m&&E.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(O+="}",r+=" "+d+" = "+S+".validateSchema("+v+"); if ("+d+") { ")),A)E.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(V){var L=e.util.copy(e),O="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,k);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var W=W||[];W.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",I||E.schema===!1?r+=" , "+g+" ":r+=" , "+v+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=o?"data"+(o-1||""):"parentData",me=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Re=r;r=W.pop(),E.errors===!1?(r+=" "+d+" = ",C&&(r+="await "),r+=""+Re+"; "):C?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Re+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Re+"; "}if(E.modifying&&(r+=" if ("+H+") "+g+" = "+H+"["+me+"];"),r+=""+O,E.valid)h&&(r+=" if (true) { ");else{r+=" if ( ",E.valid===void 0?(r+=" !",V?r+=""+le:r+=""+d):r+=" "+!E.valid+" ",r+=") { ",p=x.keyword;var W=W||[];W.push(r),r="";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var Ie=r;r=W.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+Ie+"]); ":r+=" validate.errors = ["+Ie+"]; return false; ":r+=" var err = "+Ie+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=W.pop(),A?E.errors?E.errors!="full"&&(r+=" for (var "+F+"="+_+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } "):E.errors===!1?r+=" "+se+" ":(r+=" if ("+_+" == errors) { "+se+" } else { for (var "+F+"="+_+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } "):V?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):E.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+F+"="+_+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; "+$+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } else { "+se+" } "),r+=" } ",h&&(r+=" else { ")}return r}});var Zs=J((jm,Tf)=>{Tf.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 zo=J((Nm,Uo)=>{"use strict";var qo=Zs();Uo.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:qo.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:qo.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 Ho=J((Fm,Vo)=>{"use strict";var $f=/^[a-z_$][a-z0-9_$-]*$/i,If=Mo(),Af=zo();Vo.exports={add:kf,get:Cf,remove:Df,validate:Bs};function kf(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!$f.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(a,s[r],e);else o(a,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[a]=t.all[a]=!0;function o(l,u,c){for(var h,p=0;p<t.length;p++){var g=t[p];if(g.type==u){h=g;break}}h||(h={type:u,rules:[]},t.push(h));var d={keyword:l,definition:c,custom:!0,code:If,implements:c.implements};h.rules.push(d),t.custom[l]=d}return this}function Cf(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Df(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function Bs(a,e){Bs.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Af,!0);if(t(a))return!0;if(Bs.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var Zo=J((Lm,jf)=>{jf.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 Qs=J((Mm,el)=>{"use strict";var Jo=wi(),st=Ta(),Nf=Si(),Qo=As(),Ff=Fs(),Lf=Fi(),Mf=Ao(),Ko=Do(),Go=at();el.exports=ge;ge.prototype.validate=Uf;ge.prototype.compile=zf;ge.prototype.addSchema=Vf;ge.prototype.addMetaSchema=Hf;ge.prototype.validateSchema=Zf;ge.prototype.getSchema=Jf;ge.prototype.removeSchema=Kf;ge.prototype.addFormat=ah;ge.prototype.errorsText=th;ge.prototype._addSchema=Gf;ge.prototype._compile=Wf;ge.prototype.compileAsync=Fo();var Fa=Ho();ge.prototype.addKeyword=Fa.add;ge.prototype.getKeyword=Fa.get;ge.prototype.removeKeyword=Fa.remove;ge.prototype.validateKeyword=Fa.validate;var Wo=$a();ge.ValidationError=Wo.Validation;ge.MissingRefError=Wo.MissingRef;ge.$dataMetaSchema=Ko;var Na="http://json-schema.org/draft-07/schema",Bo=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],qf=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=Go.copy(a)||{},ch(this),this._schemas={},this._refs={},this._fragments={},this._formats=Lf(a.format),this._cache=a.cache||new Nf,this._loadingSchemas={},this._compilations=[],this.RULES=Mf(),this._getId=Yf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Ff),this._metaOpts=lh(this),a.formats&&ih(this),a.keywords&&oh(this),sh(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),nh(this)}function Uf(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function zf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Vf(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=st.normalizeId(e||n),Xo(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Hf(a,e,t){return this.addSchema(a,e,t,!0),this}function Zf(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||Bf(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function Bf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(Na)?Na:void 0,a._opts.defaultMeta}function Jf(a){var e=Yo(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Qf(this,a)}}function Qf(a,e){var t=st.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,o=Jo.call(a,s,r,void 0,n);return a._fragments[e]=new Qo({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function Yo(a,e){return e=st.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function Kf(a){if(a instanceof RegExp)return ja(this,this._schemas,a),ja(this,this._refs,a),this;switch(typeof a){case"undefined":return ja(this,this._schemas),ja(this,this._refs),this._cache.clear(),this;case"string":var e=Yo(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=st.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function ja(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function Gf(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var l=st.normalizeId(this._getId(a));l&&s&&Xo(this,l);var u=this._opts.validateSchema!==!1&&!e,c;u&&!(c=l&&l==st.normalizeId(a.$schema))&&this.validateSchema(a,!0);var h=st.ids.call(this,a),p=new Qo({id:l,schema:a,localRefs:h,cacheKey:n,meta:t});return l[0]!="#"&&s&&(this._refs[l]=p),this._cache.put(n,p),u&&c&&this.validateSchema(a,!0),p}function Wf(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=Jo.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function Yf(a){switch(a.schemaId){case"auto":return rh;case"id":return Xf;default:return eh}}function Xf(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function eh(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function rh(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function th(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var o=a[n];o&&(r+=s+o.dataPath+" "+o.message+t)}return r.slice(0,-t.length)}function ah(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function sh(a){var e;if(a._opts.$data&&(e=Zo(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=Zs();a._opts.$data&&(t=Ko(t,qf)),a.addMetaSchema(t,Na,!0),a._refs["http://json-schema.org/schema"]=Na}}function nh(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function ih(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function oh(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function Xo(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function lh(a){for(var e=Go.copy(a._opts),t=0;t<Bo.length;t++)delete e[Bo[t]];return e}function ch(a){var e=a._opts.logger;if(e===!1)a.logger={log:Js,warn:Js,error:Js};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");a.logger=e}}function Js(){}});var nl=J((Bm,qa)=>{"use strict";qa.exports=hh;qa.exports.format=al;qa.exports.parse=sl;var uh=/\B(?=(\d{3})+(?!\d))/g,dh=/(?:\.0*|(\.[^0]+)0+)$/,Ir={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},fh=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function hh(a,e){return typeof a=="string"?sl(a):typeof a=="number"?al(a,e):null}function al(a,e){if(!Number.isFinite(a))return null;var t=Math.abs(a),s=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=!!(e&&e.fixedDecimals),l=e&&e.unit||"";(!l||!Ir[l.toLowerCase()])&&(t>=Ir.pb?l="PB":t>=Ir.tb?l="TB":t>=Ir.gb?l="GB":t>=Ir.mb?l="MB":t>=Ir.kb?l="KB":l="B");var u=a/Ir[l.toLowerCase()],c=u.toFixed(n);return o||(c=c.replace(dh,"$1")),s&&(c=c.split(".").map(function(h,p){return p===0?h.replace(uh,s):h}).join(".")),c+r+l}function sl(a){if(typeof a=="number"&&!isNaN(a))return a;if(typeof a!="string")return null;var e=fh.exec(a),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(a,10),s="b"),isNaN(t)?null:Math.floor(Ir[s]*t)}});var Gs=J(Ks=>{"use strict";var ol=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,ph=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,ll=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,mh=/\\([\u000b\u0020-\u00ff])/g,vh=/([\\"])/g,cl=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Ks.format=gh;Ks.parse=yh;function gh(a){if(!a||typeof a!="object")throw new TypeError("argument obj is required");var e=a.parameters,t=a.type;if(!t||!cl.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var r,n=Object.keys(e).sort(),o=0;o<n.length;o++){if(r=n[o],!ll.test(r))throw new TypeError("invalid parameter name");s+="; "+r+"="+bh(e[r])}return s}function yh(a){if(!a)throw new TypeError("argument string is required");var e=typeof a=="object"?_h(a):a;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(!cl.test(s))throw new TypeError("invalid media type");var r=new xh(s.toLowerCase());if(t!==-1){var n,o,l;for(ol.lastIndex=t;o=ol.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,n=o[1].toLowerCase(),l=o[2],l.charCodeAt(0)===34&&(l=l.slice(1,-1),l.indexOf("\\")!==-1&&(l=l.replace(mh,"$1"))),r.parameters[n]=l}if(t!==e.length)throw new TypeError("invalid parameter format")}return r}function _h(a){var e;if(typeof a.getHeader=="function"?e=a.getHeader("content-type"):typeof a.headers=="object"&&(e=a.headers&&a.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function bh(a){var e=String(a);if(ll.test(e))return e;if(e.length>0&&!ph.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(vh,"\\$1")+'"'}function xh(a){this.parameters=Object.create(null),this.type=a}});var tp={};En(tp,{CallToolRequestSchema:()=>ys,Client:()=>La,ListRootsRequestSchema:()=>Ps,ListToolsRequestSchema:()=>vs,PingRequestSchema:()=>Et,SSEServerTransport:()=>Ua,Server:()=>Ma,StdioServerTransport:()=>Va,StreamableHTTPClientTransport:()=>Qa,StreamableHTTPServerTransport:()=>Ha,z:()=>i,zodToJsonSchema:()=>dn});module.exports=Cc(tp);var i={};En(i,{BRAND:()=>nu,DIRTY:()=>Mr,EMPTY_PATH:()=>Fc,INVALID:()=>Z,NEVER:()=>Vu,OK:()=>Te,ParseStatus:()=>Se,Schema:()=>G,ZodAny:()=>Er,ZodArray:()=>vr,ZodBigInt:()=>Ur,ZodBoolean:()=>zr,ZodBranded:()=>Dt,ZodCatch:()=>Xr,ZodDate:()=>Vr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>oa,ZodEffects:()=>Je,ZodEnum:()=>Gr,ZodError:()=>Ne,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>ca,ZodIntersection:()=>Jr,ZodIssueCode:()=>R,ZodLazy:()=>Qr,ZodLiteral:()=>Kr,ZodMap:()=>bt,ZodNaN:()=>Pt,ZodNativeEnum:()=>Wr,ZodNever:()=>We,ZodNull:()=>Zr,ZodNullable:()=>ir,ZodNumber:()=>qr,ZodObject:()=>Fe,ZodOptional:()=>Ze,ZodParsedType:()=>j,ZodPipeline:()=>jt,ZodPromise:()=>Sr,ZodReadonly:()=>et,ZodRecord:()=>la,ZodSchema:()=>G,ZodSet:()=>xt,ZodString:()=>wr,ZodSymbol:()=>yt,ZodTransformer:()=>Je,ZodTuple:()=>nr,ZodType:()=>G,ZodUndefined:()=>Hr,ZodUnion:()=>Br,ZodUnknown:()=>mr,ZodVoid:()=>_t,addIssueToContext:()=>D,any:()=>pu,array:()=>yu,bigint:()=>cu,boolean:()=>Nn,coerce:()=>zu,custom:()=>Cn,date:()=>uu,datetimeRegex:()=>An,defaultErrorMap:()=>hr,discriminatedUnion:()=>Pu,effect:()=>Du,enum:()=>Au,function:()=>Tu,getErrorMap:()=>mt,getParsedType:()=>sr,instanceof:()=>ou,intersection:()=>wu,isAborted:()=>na,isAsync:()=>vt,isDirty:()=>ia,isValid:()=>Pr,late:()=>iu,lazy:()=>$u,literal:()=>Iu,makeIssue:()=>Ct,map:()=>Ru,nan:()=>lu,nativeEnum:()=>ku,never:()=>vu,null:()=>hu,nullable:()=>Nu,number:()=>jn,object:()=>_u,objectUtil:()=>as,oboolean:()=>Uu,onumber:()=>qu,optional:()=>ju,ostring:()=>Mu,pipeline:()=>Lu,preprocess:()=>Fu,promise:()=>Cu,quotelessJson:()=>Dc,record:()=>Su,set:()=>Ou,setErrorMap:()=>Nc,strictObject:()=>bu,string:()=>Dn,symbol:()=>du,transformer:()=>Du,tuple:()=>Eu,undefined:()=>fu,union:()=>xu,unknown:()=>mu,util:()=>X,void:()=>gu});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(l=>typeof r[r[l]]!="number"),o={};for(let l of n)o[l]=r[l];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},a.find=(r,n)=>{for(let o of r)if(n(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var as;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(as||(as={}));var j=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=a=>{switch(typeof a){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(a)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(a)?j.array:a===null?j.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?j.promise:typeof Map!="undefined"&&a instanceof Map?j.map:typeof Set!="undefined"&&a instanceof Set?j.set:typeof Date!="undefined"&&a instanceof Date?j.date:j.object;default:return j.unknown}};var R=X.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"]),Dc=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ne=class a 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:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let l=s,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(l[c]=l[c]||{_errors:[]},l[c]._errors.push(t(o))):l[c]=l[c]||{_errors:[]},l=l[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ne.create=a=>new Ne(a);var jc=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===j.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},hr=jc;var Rn=hr;function Nc(a){Rn=a}function mt(){return Rn}var Ct=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let l="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)l=c(o,{data:e,defaultError:l}).message;return{...r,path:n,message:l}},Fc=[];function D(a,e){let t=mt(),s=Ct({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===hr?void 0:hr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{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 r of t){if(r.status==="aborted")return Z;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,o=await r.value;s.push({key:n,value:o})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return Z;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},Z=Object.freeze({status:"aborted"}),Mr=a=>({status:"dirty",value:a}),Te=a=>({status:"valid",value:a}),na=a=>a.status==="aborted",ia=a=>a.status==="dirty",Pr=a=>a.status==="valid",vt=a=>typeof Promise!="undefined"&&a instanceof Promise;var z;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(z||(z={}));var Be=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}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}},On=(a,e)=>{if(Pr(e))return{success:!0,data:e.value};if(!a.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 Ne(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;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:r}:{errorMap:(o,l)=>{var c,h;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u!=null?u:l.defaultError}:typeof l.data=="undefined"?{message:(c=u!=null?u:s)!=null?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(h=u!=null?u:t)!=null?h:l.defaultError}},description:r}}var G=class{get description(){return this._def.description}_getType(e){return sr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(vt(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:sr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return On(s,r)}"~validate"(e){var s,r;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Pr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Pr(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:sr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(vt(r)?r:Promise.resolve(r));return On(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let o=e(r),l=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Je({schema:this,typeName:T.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 Ze.create(this,this._def)}nullable(){return ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Br.create([this,e],this._def)}and(e){return Jr.create(this,e,this._def)}transform(e){return new Je({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Yr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Dt({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Xr({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return jt.create(this,e)}readonly(){return et.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lc=/^c[^\s-]{8,}$/i,Mc=/^[0-9a-z]+$/,qc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Uc=/^[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,zc=/^[a-z0-9_-]{21}$/i,Vc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hc=/^[-+]?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)?)??$/,Zc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ss,Jc=/^(?:(?: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])$/,Qc=/^(?:(?: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])$/,Kc=/^(([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]))$/,Gc=/^(([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])$/,Wc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Yc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$n="((\\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])))",Xc=new RegExp(`^${$n}$`);function In(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function eu(a){return new RegExp(`^${In(a)}$`)}function An(a){let e=`${$n}T${In(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ru(a,e){return!!((e==="v4"||!e)&&Jc.test(a)||(e==="v6"||!e)&&Kc.test(a))}function tu(a,e){if(!Vc.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function au(a,e){return!!((e==="v4"||!e)&&Qc.test(a)||(e==="v6"||!e)&&Gc.test(a))}var wr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.string,received:n.parsedType}),Z}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.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&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.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,l=e.data.length<n.value;(o||l)&&(r=this._getOrReturnCtx(e,r),o?D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):l&&D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Zc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")ss||(ss=new RegExp(Bc,"u")),ss.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Uc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")zc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Lc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Mc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")qc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),D(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"regex",code:R.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)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.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)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?An(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Xc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?eu(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Hc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?ru(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?tu(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?au(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Wc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Yc.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...z.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.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,...z.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,...z.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...z.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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}};wr.create=a=>{var e;return new wr({checks:[],typeName:T.ZodString,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};function su(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}var qr=class a extends G{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)!==j.number){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.number,received:n.parsedType}),Z}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?su(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.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"&&X.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)}};qr.create=a=>new qr({checks:[],typeName:T.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Ur=class a extends G{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)!==j.bigint)return this._getInvalidInput(e);let s,r=new Se;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),D(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.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}};Ur.create=a=>{var e;return new Ur({checks:[],typeName:T.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};var zr=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.boolean,received:s.parsedType}),Z}return Te(e.data)}};zr.create=a=>new zr({typeName:T.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Vr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_date}),Z}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.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}};Vr.create=a=>new Vr({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:T.ZodDate,...Q(a)});var yt=class extends G{_parse(e){if(this._getType(e)!==j.symbol){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.symbol,received:s.parsedType}),Z}return Te(e.data)}};yt.create=a=>new yt({typeName:T.ZodSymbol,...Q(a)});var Hr=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.undefined,received:s.parsedType}),Z}return Te(e.data)}};Hr.create=a=>new Hr({typeName:T.ZodUndefined,...Q(a)});var Zr=class extends G{_parse(e){if(this._getType(e)!==j.null){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.null,received:s.parsedType}),Z}return Te(e.data)}};Zr.create=a=>new Zr({typeName:T.ZodNull,...Q(a)});var Er=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Te(e.data)}};Er.create=a=>new Er({typeName:T.ZodAny,...Q(a)});var mr=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Te(e.data)}};mr.create=a=>new mr({typeName:T.ZodUnknown,...Q(a)});var We=class extends G{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.never,received:t.parsedType}),Z}};We.create=a=>new We({typeName:T.ZodNever,...Q(a)});var _t=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.void,received:s.parsedType}),Z}return Te(e.data)}};_t.create=a=>new _t({typeName:T.ZodVoid,...Q(a)});var vr=class a extends G{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==j.array)return D(t,{code:R.invalid_type,expected:j.array,received:t.parsedType}),Z;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,l=t.data.length<r.exactLength.value;(o||l)&&(D(t,{code:o?R.too_big:R.too_small,minimum:l?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(D(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(D(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>r.type._parseAsync(new Be(t,o,t.path,l)))).then(o=>Se.mergeArray(s,o));let n=[...t.data].map((o,l)=>r.type._parseSync(new Be(t,o,t.path,l)));return Se.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}};vr.create=(a,e)=>new vr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function gt(a){if(a instanceof Fe){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(gt(s))}return new Fe({...a._def,shape:()=>e})}else return a instanceof vr?new vr({...a._def,type:gt(a.element)}):a instanceof Ze?Ze.create(gt(a.unwrap())):a instanceof ir?ir.create(gt(a.unwrap())):a instanceof nr?nr.create(a.items.map(e=>gt(e))):a}var Fe=class a extends G{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=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return D(c,{code:R.invalid_type,expected:j.object,received:c.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let c in r.data)o.includes(c)||l.push(c);let u=[];for(let c of o){let h=n[c],p=r.data[c];u.push({key:{status:"valid",value:c},value:h._parse(new Be(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof We){let c=this._def.unknownKeys;if(c==="passthrough")for(let h of l)u.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(c==="strict")l.length>0&&(D(r,{code:R.unrecognized_keys,keys:l}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let h of l){let p=r.data[h];u.push({key:{status:"valid",value:h},value:c._parse(new Be(r,p,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let h of u){let p=await h.key,g=await h.value;c.push({key:p,value:g,alwaysSet:h.alwaysSet})}return c}).then(c=>Se.mergeObjectSync(s,c)):Se.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,l,u;let r=(l=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?l:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=z.errToObj(e).message)!=null?u:r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return gt(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return kn(X.objectKeys(this.shape))}};Fe.create=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.strictCreate=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.lazycreate=(a,e)=>new Fe({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});var Br=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let l of n)if(l.result.status==="valid")return l.result;for(let l of n)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let o=n.map(l=>new Ne(l.ctx.common.issues));return D(t,{code:R.invalid_union,unionErrors:o}),Z}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(r);{let n,o=[];for(let u of s){let c={...t,common:{...t.common,issues:[]},parent:null},h=u._parseSync({data:t.data,path:t.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let l=o.map(u=>new Ne(u));return D(t,{code:R.invalid_union,unionErrors:l}),Z}}get options(){return this._def.options}};Br.create=(a,e)=>new Br({options:a,typeName:T.ZodUnion,...Q(e)});var pr=a=>a instanceof Qr?pr(a.schema):a instanceof Je?pr(a.innerType()):a instanceof Kr?[a.value]:a instanceof Gr?a.options:a instanceof Wr?X.objectValues(a.enum):a instanceof Yr?pr(a._def.innerType):a instanceof Hr?[void 0]:a instanceof Zr?[null]:a instanceof Ze?[void 0,...pr(a.unwrap())]:a instanceof ir?[null,...pr(a.unwrap())]:a instanceof Dt||a instanceof et?pr(a.unwrap()):a instanceof Xr?pr(a._def.innerType):[],oa=class a extends G{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return D(t,{code:R.invalid_type,expected:j.object,received:t.parsedType}),Z;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);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}):(D(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let o=pr(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 l of o){if(r.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);r.set(l,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function ns(a,e){let t=sr(a),s=sr(e);if(a===e)return{valid:!0,data:a};if(t===j.object&&s===j.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(l=>r.indexOf(l)!==-1),o={...a,...e};for(let l of n){let u=ns(a[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===j.array&&s===j.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let o=a[n],l=e[n],u=ns(o,l);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===j.date&&s===j.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Jr=class extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(na(n)||na(o))return Z;let l=ns(n.value,o.value);return l.valid?((ia(n)||ia(o))&&t.dirty(),{status:t.value,value:l.data}):(D(s,{code:R.invalid_intersection_types}),Z)};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])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Jr.create=(a,e,t)=>new Jr({left:a,right:e,typeName:T.ZodIntersection,...Q(t)});var nr=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.array)return D(s,{code:R.invalid_type,expected:j.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return D(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Be(s,o,s.path,l)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Se.mergeArray(t,o)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};nr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nr({items:a,typeName:T.ZodTuple,rest:null,...Q(e)})};var la=class a extends G{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!==j.object)return D(s,{code:R.invalid_type,expected:j.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,o=this._def.valueType;for(let l in s.data)r.push({key:n._parse(new Be(s,l,s.path,l)),value:o._parse(new Be(s,s.data[l],s.path,l)),alwaysSet:l in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof G?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(s)}):new a({keyType:wr.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},bt=class extends G{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!==j.map)return D(s,{code:R.invalid_type,expected:j.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([l,u],c)=>({key:r._parse(new Be(s,l,s.path,[c,"key"])),value:n._parse(new Be(s,u,s.path,[c,"value"]))}));if(s.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,h=await u.value;if(c.status==="aborted"||h.status==="aborted")return Z;(c.status==="dirty"||h.status==="dirty")&&t.dirty(),l.set(c.value,h.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let u of o){let c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return Z;(c.status==="dirty"||h.status==="dirty")&&t.dirty(),l.set(c.value,h.value)}return{status:t.value,value:l}}}};bt.create=(a,e,t)=>new bt({valueType:e,keyType:a,typeName:T.ZodMap,...Q(t)});var xt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.set)return D(s,{code:R.invalid_type,expected:j.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(D(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(D(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function o(u){let c=new Set;for(let h of u){if(h.status==="aborted")return Z;h.status==="dirty"&&t.dirty(),c.add(h.value)}return{status:t.value,value:c}}let l=[...s.data.values()].map((u,c)=>n._parse(new Be(s,u,s.path,c)));return s.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new a({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};xt.create=(a,e)=>new xt({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var ca=class a extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return D(t,{code:R.invalid_type,expected:j.function,received:t.parsedType}),Z;function s(l,u){return Ct({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),hr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:u}})}function r(l,u){return Ct({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),hr].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:u}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Sr){let l=this;return Te(async function(...u){let c=new Ne([]),h=await l._def.args.parseAsync(u,n).catch(d=>{throw c.addIssue(s(u,d)),c}),p=await Reflect.apply(o,this,h);return await l._def.returns._def.type.parseAsync(p,n).catch(d=>{throw c.addIssue(r(p,d)),c})})}else{let l=this;return Te(function(...u){let c=l._def.args.safeParse(u,n);if(!c.success)throw new Ne([s(u,c.error)]);let h=Reflect.apply(o,this,c.data),p=l._def.returns.safeParse(h,n);if(!p.success)throw new Ne([r(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:nr.create(e).rest(mr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||nr.create([]).rest(mr.create()),returns:t||mr.create(),typeName:T.ZodFunction,...Q(s)})}},Qr=class extends G{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})}};Qr.create=(a,e)=>new Qr({getter:a,typeName:T.ZodLazy,...Q(e)});var Kr=class extends G{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Kr.create=(a,e)=>new Kr({value:a,typeName:T.ZodLiteral,...Q(e)});function kn(a,e){return new Gr({values:a,typeName:T.ZodEnum,...Q(e)})}var Gr=class a extends G{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:X.joinValues(s),received:t.parsedType,code:R.invalid_type}),Z}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 D(t,{received:t.data,code:R.invalid_enum_value,options:s}),Z}return Te(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 a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Gr.create=kn;var Wr=class extends G{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==j.string&&s.parsedType!==j.number){let r=X.objectValues(t);return D(s,{expected:X.joinValues(r),received:s.parsedType,code:R.invalid_type}),Z}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return D(s,{received:s.data,code:R.invalid_enum_value,options:r}),Z}return Te(e.data)}get enum(){return this._def.values}};Wr.create=(a,e)=>new Wr({values:a,typeName:T.ZodNativeEnum,...Q(e)});var Sr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return D(t,{code:R.invalid_type,expected:j.promise,received:t.parsedType}),Z;let s=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return Te(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Sr.create=(a,e)=>new Sr({type:a,typeName:T.ZodPromise,...Q(e)});var Je=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{D(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async l=>{if(t.value==="aborted")return Z;let u=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return u.status==="aborted"?Z:u.status==="dirty"?Mr(u.value):t.value==="dirty"?Mr(u.value):u});{if(t.value==="aborted")return Z;let l=this._def.schema._parseSync({data:o,path:s.path,parent:s});return l.status==="aborted"?Z:l.status==="dirty"?Mr(l.value):t.value==="dirty"?Mr(l.value):l}}if(r.type==="refinement"){let o=l=>{let u=r.refinement(l,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?Z:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?Z:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(r.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Pr(o))return Z;let l=r.transform(o.value,n);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Pr(o)?Promise.resolve(r.transform(o.value,n)).then(l=>({status:t.value,value:l})):Z);X.assertNever(r)}};Je.create=(a,e,t)=>new Je({schema:a,typeName:T.ZodEffects,effect:e,...Q(t)});Je.createWithPreprocess=(a,e,t)=>new Je({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...Q(t)});var Ze=class extends G{_parse(e){return this._getType(e)===j.undefined?Te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:T.ZodOptional,...Q(e)});var ir=class extends G{_parse(e){return this._getType(e)===j.null?Te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ir.create=(a,e)=>new ir({innerType:a,typeName:T.ZodNullable,...Q(e)});var Yr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===j.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(a,e)=>new Yr({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Xr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return vt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var Pt=class extends G{_parse(e){if(this._getType(e)!==j.nan){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};Pt.create=a=>new Pt({typeName:T.ZodNaN,...Q(a)});var nu=Symbol("zod_brand"),Dt=class extends G{_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}},jt=class a extends G{_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"?Z:n.status==="dirty"?(t.dirty(),Mr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Z:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:T.ZodPipeline})}},et=class extends G{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Pr(r)&&(r.value=Object.freeze(r.value)),r);return vt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};et.create=(a,e)=>new et({innerType:a,typeName:T.ZodReadonly,...Q(e)});function Tn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Cn(a,e={},t){return a?Er.create().superRefine((s,r)=>{var o,l;let n=a(s);if(n instanceof Promise)return n.then(u=>{var c,h;if(!u){let p=Tn(e,s),g=(h=(c=p.fatal)!=null?c:t)!=null?h:!0;r.addIssue({code:"custom",...p,fatal:g})}});if(!n){let u=Tn(e,s),c=(l=(o=u.fatal)!=null?o:t)!=null?l:!0;r.addIssue({code:"custom",...u,fatal:c})}}):Er.create()}var iu={object:Fe.lazycreate},T;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(T||(T={}));var ou=(a,e={message:`Input not instance of ${a.name}`})=>Cn(t=>t instanceof a,e),Dn=wr.create,jn=qr.create,lu=Pt.create,cu=Ur.create,Nn=zr.create,uu=Vr.create,du=yt.create,fu=Hr.create,hu=Zr.create,pu=Er.create,mu=mr.create,vu=We.create,gu=_t.create,yu=vr.create,_u=Fe.create,bu=Fe.strictCreate,xu=Br.create,Pu=oa.create,wu=Jr.create,Eu=nr.create,Su=la.create,Ru=bt.create,Ou=xt.create,Tu=ca.create,$u=Qr.create,Iu=Kr.create,Au=Gr.create,ku=Wr.create,Cu=Sr.create,Du=Je.create,ju=Ze.create,Nu=ir.create,Fu=Je.createWithPreprocess,Lu=jt.create,Mu=()=>Dn().optional(),qu=()=>jn().optional(),Uu=()=>Nn().optional(),zu={string:a=>wr.create({...a,coerce:!0}),number:a=>qr.create({...a,coerce:!0}),boolean:a=>zr.create({...a,coerce:!0}),bigint:a=>Ur.create({...a,coerce:!0}),date:a=>Vr.create({...a,coerce:!0})};var Vu=Z;var Rr="2025-06-18",Fn="2025-03-26",rt=[Rr,"2025-03-26","2024-11-05","2024-10-07"],ua="2.0",Ln=i.union([i.string(),i.number().int()]),Mn=i.string(),Hu=i.object({progressToken:i.optional(Ln)}).passthrough(),Qe=i.object({_meta:i.optional(Hu)}).passthrough(),Le=i.object({method:i.string(),params:i.optional(Qe)}),Nt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),or=i.object({method:i.string(),params:i.optional(Nt)}),Ke=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),da=i.union([i.string(),i.number().int()]),qn=i.object({jsonrpc:i.literal(ua),id:da}).merge(Le).strict(),tt=a=>qn.safeParse(a).success,Un=i.object({jsonrpc:i.literal(ua)}).merge(or).strict(),zn=a=>Un.safeParse(a).success,Vn=i.object({jsonrpc:i.literal(ua),id:da,result:Ke}).strict(),gr=a=>Vn.safeParse(a).success,Ce;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ce||(Ce={}));var Hn=i.object({jsonrpc:i.literal(ua),id:da,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),wt=a=>Hn.safeParse(a).success,Ye=i.union([qn,Un,Vn,Hn]),yr=Ke.strict(),fa=or.extend({method:i.literal("notifications/cancelled"),params:Nt.extend({requestId:da,reason:i.string().optional()})}),Ft=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),Zn=Ft.extend({version:i.string()}),Zu=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),ha=Le.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:Zu,clientInfo:Zn})}),Bn=a=>ha.safeParse(a).success,Bu=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),is=Ke.extend({protocolVersion:i.string(),capabilities:Bu,serverInfo:Zn,instructions:i.optional(i.string())}),pa=or.extend({method:i.literal("notifications/initialized")}),Jn=a=>pa.safeParse(a).success,Et=Le.extend({method:i.literal("ping")}),Ju=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),ma=or.extend({method:i.literal("notifications/progress"),params:Nt.merge(Ju).extend({progressToken:Ln})}),va=Le.extend({params:Qe.extend({cursor:i.optional(Mn)}).optional()}),ga=Ke.extend({nextCursor:i.optional(Mn)}),Qn=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Kn=Qn.extend({text:i.string()}),os=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gn=Qn.extend({blob:os}),Wn=Ft.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Qu=Ft.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Ku=va.extend({method:i.literal("resources/list")}),ls=ga.extend({resources:i.array(Wn)}),Gu=va.extend({method:i.literal("resources/templates/list")}),cs=ga.extend({resourceTemplates:i.array(Qu)}),Wu=Le.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),us=Ke.extend({contents:i.array(i.union([Kn,Gn]))}),Yu=or.extend({method:i.literal("notifications/resources/list_changed")}),Xu=Le.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),ed=Le.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),rd=or.extend({method:i.literal("notifications/resources/updated"),params:Nt.extend({uri:i.string()})}),td=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),ad=Ft.extend({description:i.optional(i.string()),arguments:i.optional(i.array(td)),_meta:i.optional(i.object({}).passthrough())}),sd=va.extend({method:i.literal("prompts/list")}),ds=ga.extend({prompts:i.array(ad)}),nd=Le.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),fs=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),hs=i.object({type:i.literal("image"),data:os,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ps=i.object({type:i.literal("audio"),data:os,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),id=i.object({type:i.literal("resource"),resource:i.union([Kn,Gn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),od=Wn.extend({type:i.literal("resource_link")}),Yn=i.union([fs,hs,ps,od,id]),ld=i.object({role:i.enum(["user","assistant"]),content:Yn}).passthrough(),ms=Ke.extend({description:i.optional(i.string()),messages:i.array(ld)}),cd=or.extend({method:i.literal("notifications/prompts/list_changed")}),ud=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),dd=Ft.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(ud),_meta:i.optional(i.object({}).passthrough())}),vs=va.extend({method:i.literal("tools/list")}),gs=ga.extend({tools:i.array(dd)}),ya=Ke.extend({content:i.array(Yn).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),Mp=ya.or(Ke.extend({toolResult:i.unknown()})),ys=Le.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),fd=or.extend({method:i.literal("notifications/tools/list_changed")}),Xn=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),hd=Le.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:Xn})}),pd=or.extend({method:i.literal("notifications/message"),params:Nt.extend({level:Xn,logger:i.optional(i.string()),data:i.unknown()})}),md=i.object({name:i.string().optional()}).passthrough(),vd=i.object({hints:i.optional(i.array(md)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),gd=i.object({role:i.enum(["user","assistant"]),content:i.union([fs,hs,ps])}).passthrough(),yd=Le.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(gd),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(vd)})}),_s=Ke.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[fs,hs,ps])}),_d=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),bd=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),xd=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),Pd=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),wd=i.union([_d,bd,xd,Pd]),Ed=Le.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),wd),required:i.optional(i.array(i.string()))}).passthrough()})}),bs=Ke.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),Sd=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var Rd=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),Od=Le.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([Rd,Sd]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),xs=Ke.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Td=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ps=Le.extend({method:i.literal("roots/list")}),ws=Ke.extend({roots:i.array(Td)}),$d=or.extend({method:i.literal("notifications/roots/list_changed")}),qp=i.union([Et,ha,Od,hd,nd,sd,Ku,Gu,Wu,Xu,ed,ys,vs]),Up=i.union([fa,ma,pa,$d]),zp=i.union([yr,_s,bs,ws]),Vp=i.union([Et,yd,Ed,Ps]),Hp=i.union([fa,ma,pd,rd,Yu,fd,cd]),Zp=i.union([yr,is,xs,ms,ds,ls,cs,us,ya,gs]),$e=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Id=6e4,St=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(fa,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(ma,t=>{this._onprogress(t)}),this.setRequestHandler(Et,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_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 $e(Ce.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,r;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=u=>{o==null||o(u),this._onerror(u)};let l=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,c)=>{l==null||l(u,c),gr(u)||wt(u)?this._onresponse(u):tt(u)?this._onrequest(u,c):zn(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},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 $e(Ce.ConnectionClosed,"Connection closed");for(let r of t.values())r(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(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;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:Ce.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let u={signal:l.signal,sessionId:o==null?void 0:o.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,h,p)=>this.request(c,h,{...p,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,u)).then(c=>{if(!l.signal.aborted)return o==null?void 0:o.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var h;if(!l.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Ce.InternalError,message:(h=c.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(r),l=this._timeoutInfo.get(r);if(l&&o&&l.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){o(u);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),gr(e))s(e);else{let r=new $e(e.error.code,e.error.message,e.error.data);s(r)}}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:r,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((l,u)=>{var c,h,p,g,d,_;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=s==null?void 0:s.signal)===null||h===void 0||h.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};s!=null&&s.onprogress&&(this._progressHandlers.set(m,s.onprogress),v.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:m}});let x=O=>{var I;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(I=this._transport)===null||I===void 0||I.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),u(O)};this._responseHandlers.set(m,O=>{var I;if(!(!((I=s==null?void 0:s.signal)===null||I===void 0)&&I.aborted)){if(O instanceof Error)return u(O);try{let A=t.parse(O.result);l(A)}catch(A){u(A)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var O;x((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let S=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:Id,E=()=>x(new $e(Ce.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,s==null?void 0:s.maxTotalTimeout,E,(_=s==null?void 0:s.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(m),u(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).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 u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,t).catch(h=>this._onerror(h))});return}let l={...e,jsonrpc:"2.0"};await this._transport.send(l,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),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 _a(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var rl=Lr(Qs(),1),La=class extends St{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 rl.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_a(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:Rr,capabilities:this._capabilities,clientInfo:this._clientInfo}},is,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!rt.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,r,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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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"},yr,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},xs,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},yr,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ms,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ds,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ls,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},cs,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},us,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},yr,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},yr,t)}async callTool(e,t=ya,s){let r=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new $e(Ce.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new $e(Ce.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof $e?o:new $e(Ce.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}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},gs,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var tl=Lr(Qs(),1),Ma=class extends St{constructor(e,t){var s;super(t),this._serverInfo=e,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(ha,r=>this._oninitialize(r)),this.setNotificationHandler(pa,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_a(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;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(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.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:rt.includes(t)?t:Rr,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"},yr)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},_s,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},bs,t);if(s.action==="accept"&&s.content)try{let r=new tl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new $e(Ce.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof $e?r:new $e(Ce.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},ws,t)}async sendLoggingMessage(e){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 ul=require("node:crypto");var il=Lr(nl());function Mt(a,{limit:e,encoding:t}){let s=il.default.parse(e);return new Promise((r,n)=>{let o=0,l=[];a.on("data",u=>{if(o+=u.length,o>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));l.push(u)}),a.on("end",()=>{try{r(Buffer.concat(l).toString(t))}catch(u){n(u)}}),a.on("error",u=>{n(u)})})}var dl=Lr(Gs(),1),fl=require("url"),Ph="4mb",Ua=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,ul.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 fl.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
1
+ "use strict";var Cu=Object.create;var la=Object.defineProperty;var ku=Object.getOwnPropertyDescriptor;var Du=Object.getOwnPropertyNames;var ju=Object.getPrototypeOf,Nu=Object.prototype.hasOwnProperty;var z=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Mn=(a,e)=>{for(var t in e)la(a,t,{get:e[t],enumerable:!0})},qn=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Du(e))!Nu.call(a,r)&&r!==t&&la(a,r,{get:()=>e[r],enumerable:!(s=ku(e,r))||s.enumerable});return a};var hr=(a,e,t)=>(t=a!=null?Cu(ju(a)):{},qn(e||!a||!a.__esModule?la(t,"default",{value:a,enumerable:!0}):t,a)),Fu=a=>qn(la({},"__esModule",{value:!0}),a);var go=z((Pa,vo)=>{(function(a,e){typeof Pa=="object"&&typeof vo!="undefined"?e(Pa):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Pa,function(a){"use strict";function e(){for(var _=arguments.length,h=Array(_),b=0;b<_;b++)h[b]=arguments[b];if(h.length>1){h[0]=h[0].slice(0,-1);for(var w=h.length-1,E=1;E<w;++E)h[E]=h[E].slice(1,-1);return h[w]=h[w].slice(1),h.join("")}else return h[0]}function t(_){return"(?:"+_+")"}function s(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function r(_){return _.toUpperCase()}function n(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,h){var b=_;if(h)for(var w in h)b[w]=h[w];return b}function l(_){var h="[A-Za-z]",b="[\\x0D]",w="[0-9]",E="[\\x22]",N=e(w,"[A-Fa-f]"),K="[\\x0A]",ae="[\\x20]",ie=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=e(be,te),xe=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=_?"[\\uE000-\\uF8FF]":"[]",ne=e(h,w,"[\\-\\.\\_\\~]",xe),pe=t(h+e(h,w,"[\\+\\-\\.]")+"*"),ce=t(t(ie+"|"+e(ne,te,"[\\:]"))+"*"),Nr=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("[1-9]"+w)+"|"+w),qe=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("0?[1-9]"+w)+"|0?0?"+w),Ve=t(qe+"\\."+qe+"\\."+qe+"\\."+qe),ue=t(N+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+Ve),He=t(t(ue+"\\:")+"{6}"+Ue),ar=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),Fr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),ur=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),It=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),na=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),oa=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),ct=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),ut=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),dr=t([He,ar,Fr,ur,It,na,oa,ct,ut].join("|")),dt=t(t(ne+"|"+ie)+"+"),is=t(dr+"\\%25"+dt),Lr=t(dr+t("\\%25|\\%(?!"+N+"{2})")+dt),Su=t("[vV]"+N+"+\\."+e(ne,te,"[\\:]")+"+"),Ru=t("\\["+t(Lr+"|"+dr+"|"+Su)+"\\]"),jn=t(t(ie+"|"+e(ne,te))+"*"),Ct=t(Ru+"|"+Ve+"(?!"+jn+")|"+jn),kt=t(w+"*"),Nn=t(t(ce+"@")+"?"+Ct+t("\\:"+kt)+"?"),Dt=t(ie+"|"+e(ne,te,"[\\:\\@]")),Ou=t(Dt+"*"),Fn=t(Dt+"+"),Tu=t(t(ie+"|"+e(ne,te,"[\\@]"))+"+"),fr=t(t("\\/"+Ou)+"*"),ft=t("\\/"+t(Fn+fr)+"?"),ls=t(Tu+fr),ia=t(Fn+fr),ht="(?!"+Dt+")",Nm=t(fr+"|"+ft+"|"+ls+"|"+ia+"|"+ht),pt=t(t(Dt+"|"+e("[\\/\\?]",de))+"*"),jt=t(t(Dt+"|[\\/\\?]")+"*"),Ln=t(t("\\/\\/"+Nn+fr)+"|"+ft+"|"+ia+"|"+ht),$u=t(pe+"\\:"+Ln+t("\\?"+pt)+"?"+t("\\#"+jt)+"?"),Au=t(t("\\/\\/"+Nn+fr)+"|"+ft+"|"+ls+"|"+ht),Iu=t(Au+t("\\?"+pt)+"?"+t("\\#"+jt)+"?"),Fm=t($u+"|"+Iu),Lm=t(pe+"\\:"+Ln+t("\\?"+pt)+"?"),Mm="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ia+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+jt+")")+"?$",qm="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ls+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+jt+")")+"?$",Um="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ia+"|"+ht+")")+t("\\?("+pt+")")+"?$",zm="^"+t("\\#("+jt+")")+"?$",Vm="^"+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",h,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,he),"g"),PCT_ENCODED:new RegExp(ie,"g"),IPV4ADDRESS:new RegExp("^("+Ve+")$"),IPV6ADDRESS:new RegExp("^\\[?("+dr+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+dt+")")+"?\\]?$")}}var u=l(!1),c=l(!0),f=function(){function _(h,b){var w=[],E=!0,N=!1,K=void 0;try{for(var ae=h[Symbol.iterator](),ie;!(E=(ie=ae.next()).done)&&(w.push(ie.value),!(b&&w.length===b));E=!0);}catch(be){N=!0,K=be}finally{try{!E&&ae.return&&ae.return()}finally{if(N)throw K}}return w}return function(h,b){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return _(h,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(_){if(Array.isArray(_)){for(var h=0,b=Array(_.length);h<_.length;h++)b[h]=_[h];return b}else return Array.from(_)},g=2147483647,d=36,y=1,m=26,v=38,x=700,S=72,P=128,O="-",A=/^xn--/,I=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=d-y,U=Math.floor,M=String.fromCharCode;function F(_){throw new RangeError(q[_])}function $(_,h){for(var b=[],w=_.length;w--;)b[w]=h(_[w]);return b}function k(_,h){var b=_.split("@"),w="";b.length>1&&(w=b[0]+"@",_=b[1]),_=_.replace(H,".");var E=_.split("."),N=$(E,h).join(".");return w+N}function L(_){for(var h=[],b=0,w=_.length;b<w;){var E=_.charCodeAt(b++);if(E>=55296&&E<=56319&&b<w){var N=_.charCodeAt(b++);(N&64512)==56320?h.push(((E&1023)<<10)+(N&1023)+65536):(h.push(E),b--)}else h.push(E)}return h}var le=function(h){return String.fromCodePoint.apply(String,p(h))},Y=function(h){return h-48<10?h-22:h-65<26?h-65:h-97<26?h-97:d},re=function(h,b){return h+22+75*(h<26)-((b!=0)<<5)},W=function(h,b,w){var E=0;for(h=w?U(h/x):h>>1,h+=U(h/b);h>C*m>>1;E+=d)h=U(h/C);return U(E+(C+1)*h/(h+v))},Z=function(h){var b=[],w=h.length,E=0,N=P,K=S,ae=h.lastIndexOf(O);ae<0&&(ae=0);for(var ie=0;ie<ae;++ie)h.charCodeAt(ie)>=128&&F("not-basic"),b.push(h.charCodeAt(ie));for(var be=ae>0?ae+1:0;be<w;){for(var te=E,he=1,xe=d;;xe+=d){be>=w&&F("invalid-input");var de=Y(h.charCodeAt(be++));(de>=d||de>U((g-E)/he))&&F("overflow"),E+=de*he;var ne=xe<=K?y:xe>=K+m?m:xe-K;if(de<ne)break;var pe=d-ne;he>U(g/pe)&&F("overflow"),he*=pe}var ce=b.length+1;K=W(E-te,ce,te==0),U(E/ce)>g-N&&F("overflow"),N+=U(E/ce),E%=ce,b.splice(E++,0,N)}return String.fromCodePoint.apply(String,b)},me=function(h){var b=[];h=L(h);var w=h.length,E=P,N=0,K=S,ae=!0,ie=!1,be=void 0;try{for(var te=h[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&b.push(M(xe))}}catch(Lr){ie=!0,be=Lr}finally{try{!ae&&te.return&&te.return()}finally{if(ie)throw be}}var de=b.length,ne=de;for(de&&b.push(O);ne<w;){var pe=g,ce=!0,Nr=!1,qe=void 0;try{for(var Ve=h[Symbol.iterator](),ue;!(ce=(ue=Ve.next()).done);ce=!0){var Ue=ue.value;Ue>=E&&Ue<pe&&(pe=Ue)}}catch(Lr){Nr=!0,qe=Lr}finally{try{!ce&&Ve.return&&Ve.return()}finally{if(Nr)throw qe}}var He=ne+1;pe-E>U((g-N)/He)&&F("overflow"),N+=(pe-E)*He,E=pe;var ar=!0,Fr=!1,ur=void 0;try{for(var It=h[Symbol.iterator](),na;!(ar=(na=It.next()).done);ar=!0){var oa=na.value;if(oa<E&&++N>g&&F("overflow"),oa==E){for(var ct=N,ut=d;;ut+=d){var dr=ut<=K?y:ut>=K+m?m:ut-K;if(ct<dr)break;var dt=ct-dr,is=d-dr;b.push(M(re(dr+dt%is,0))),ct=U(dt/is)}b.push(M(re(ct,0))),K=W(N,He,ne==de),N=0,++ne}}}catch(Lr){Fr=!0,ur=Lr}finally{try{!ar&&It.return&&It.return()}finally{if(Fr)throw ur}}++N,++E}return b.join("")},Re=function(h){return k(h,function(b){return A.test(b)?Z(b.slice(4).toLowerCase()):b})},Ae=function(h){return k(h,function(b){return I.test(b)?"xn--"+me(b):b})},se={version:"2.1.0",ucs2:{decode:L,encode:le},decode:Z,encode:me,toASCII:Ae,toUnicode:Re},ye={};function Ee(_){var h=_.charCodeAt(0),b=void 0;return h<16?b="%0"+h.toString(16).toUpperCase():h<128?b="%"+h.toString(16).toUpperCase():h<2048?b="%"+(h>>6|192).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase():b="%"+(h>>12|224).toString(16).toUpperCase()+"%"+(h>>6&63|128).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase(),b}function Ie(_){for(var h="",b=0,w=_.length;b<w;){var E=parseInt(_.substr(b+1,2),16);if(E<128)h+=String.fromCharCode(E),b+=3;else if(E>=194&&E<224){if(w-b>=6){var N=parseInt(_.substr(b+4,2),16);h+=String.fromCharCode((E&31)<<6|N&63)}else h+=_.substr(b,6);b+=6}else if(E>=224){if(w-b>=9){var K=parseInt(_.substr(b+4,2),16),ae=parseInt(_.substr(b+7,2),16);h+=String.fromCharCode((E&15)<<12|(K&63)<<6|ae&63)}else h+=_.substr(b,9);b+=9}else h+=_.substr(b,3),b+=3}return h}function xr(_,h){function b(w){var E=Ie(w);return E.match(h.UNRESERVED)?E:w}return _.scheme&&(_.scheme=String(_.scheme).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(h.PCT_ENCODED,b).replace(h.NOT_USERINFO,Ee).replace(h.PCT_ENCODED,r)),_.host!==void 0&&(_.host=String(_.host).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_HOST,Ee).replace(h.PCT_ENCODED,r)),_.path!==void 0&&(_.path=String(_.path).replace(h.PCT_ENCODED,b).replace(_.scheme?h.NOT_PATH:h.NOT_PATH_NOSCHEME,Ee).replace(h.PCT_ENCODED,r)),_.query!==void 0&&(_.query=String(_.query).replace(h.PCT_ENCODED,b).replace(h.NOT_QUERY,Ee).replace(h.PCT_ENCODED,r)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(h.PCT_ENCODED,b).replace(h.NOT_FRAGMENT,Ee).replace(h.PCT_ENCODED,r)),_}function lr(_){return _.replace(/^0*(.*)/,"$1")||"0"}function _e(_,h){var b=_.match(h.IPV4ADDRESS)||[],w=f(b,2),E=w[1];return E?E.split(".").map(lr).join("."):_}function ve(_,h){var b=_.match(h.IPV6ADDRESS)||[],w=f(b,3),E=w[1],N=w[2];if(E){for(var K=E.toLowerCase().split("::").reverse(),ae=f(K,2),ie=ae[0],be=ae[1],te=be?be.split(":").map(lr):[],he=ie.split(":").map(lr),xe=h.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce<de;++ce)pe[ce]=te[ce]||he[ne+ce]||"";xe&&(pe[de-1]=_e(pe[de-1],h));var Nr=pe.reduce(function(He,ar,Fr){if(!ar||ar==="0"){var ur=He[He.length-1];ur&&ur.index+ur.length===Fr?ur.length++:He.push({index:Fr,length:1})}return He},[]),qe=Nr.sort(function(He,ar){return ar.length-He.length})[0],Ve=void 0;if(qe&&qe.length>1){var ue=pe.slice(0,qe.index),Ue=pe.slice(qe.index+qe.length);Ve=ue.join(":")+"::"+Ue.join(":")}else Ve=pe.join(":");return N&&(Ve+="%"+N),Ve}else return _}var kr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function oe(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},w=h.iri!==!1?c:u;h.reference==="suffix"&&(_=(h.scheme?h.scheme+":":"")+"//"+_);var E=_.match(kr);if(E){Oe?(b.scheme=E[1],b.userinfo=E[3],b.host=E[4],b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=E[7],b.fragment=E[8],isNaN(b.port)&&(b.port=E[5])):(b.scheme=E[1]||void 0,b.userinfo=_.indexOf("@")!==-1?E[3]:void 0,b.host=_.indexOf("//")!==-1?E[4]:void 0,b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=_.indexOf("?")!==-1?E[7]:void 0,b.fragment=_.indexOf("#")!==-1?E[8]:void 0,isNaN(b.port)&&(b.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),b.host&&(b.host=ve(_e(b.host,w),w)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",h.reference&&h.reference!=="suffix"&&h.reference!==b.reference&&(b.error=b.error||"URI is not a "+h.reference+" reference.");var N=ye[(h.scheme||b.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!N||!N.unicodeSupport)){if(b.host&&(h.domainHost||N&&N.domainHost))try{b.host=se.toASCII(b.host.replace(w.PCT_ENCODED,Ie).toLowerCase())}catch(K){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+K}xr(b,u)}else xr(b,w);N&&N.parse&&N.parse(b,h)}else b.error=b.error||"URI can not be parsed.";return b}function wr(_,h){var b=h.iri!==!1?c:u,w=[];return _.userinfo!==void 0&&(w.push(_.userinfo),w.push("@")),_.host!==void 0&&w.push(ve(_e(String(_.host),b),b).replace(b.IPV6ADDRESS,function(E,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(w.push(":"),w.push(String(_.port))),w.length?w.join(""):void 0}var cr=/^\.\.?\//,Dr=/^\/\.(\/|$)/,jr=/^\/\.\.(\/|$)/,Pe=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(_){for(var h=[];_.length;)if(_.match(cr))_=_.replace(cr,"");else if(_.match(Dr))_=_.replace(Dr,"/");else if(_.match(jr))_=_.replace(jr,"/"),h.pop();else if(_==="."||_==="..")_="";else{var b=_.match(Pe);if(b){var w=b[0];_=_.slice(w.length),h.push(w)}else throw new Error("Unexpected dot segment condition")}return h.join("")}function je(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=h.iri?c:u,w=[],E=ye[(h.scheme||_.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(_,h),_.host&&!b.IPV6ADDRESS.test(_.host)){if(h.domainHost||E&&E.domainHost)try{_.host=h.iri?se.toUnicode(_.host):se.toASCII(_.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(ae){_.error=_.error||"Host's domain name can not be converted to "+(h.iri?"Unicode":"ASCII")+" via punycode: "+ae}}xr(_,b),h.reference!=="suffix"&&_.scheme&&(w.push(_.scheme),w.push(":"));var N=wr(_,h);if(N!==void 0&&(h.reference!=="suffix"&&w.push("//"),w.push(N),_.path&&_.path.charAt(0)!=="/"&&w.push("/")),_.path!==void 0){var K=_.path;!h.absolutePath&&(!E||!E.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),w.push(K)}return _.query!==void 0&&(w.push("?"),w.push(_.query)),_.fragment!==void 0&&(w.push("#"),w.push(_.fragment)),w.join("")}function Ce(_,h){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],E={};return w||(_=oe(je(_,b),b),h=oe(je(h,b),b)),b=b||{},!b.tolerant&&h.scheme?(E.scheme=h.scheme,E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=ze(h.path||""),E.query=h.query):(h.userinfo!==void 0||h.host!==void 0||h.port!==void 0?(E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=ze(h.path||""),E.query=h.query):(h.path?(h.path.charAt(0)==="/"?E.path=ze(h.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?E.path="/"+h.path:_.path?E.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+h.path:E.path=h.path,E.path=ze(E.path)),E.query=h.query):(E.path=_.path,h.query!==void 0?E.query=h.query:E.query=_.query),E.userinfo=_.userinfo,E.host=_.host,E.port=_.port),E.scheme=_.scheme),E.fragment=h.fragment,E}function rr(_,h,b){var w=o({scheme:"null"},b);return je(Ce(oe(_,w),oe(h,w),w,!0),w)}function Me(_,h){return typeof _=="string"?_=je(oe(_,h),h):s(_)==="object"&&(_=oe(je(_,h),h)),_}function sa(_,h,b){return typeof _=="string"?_=je(oe(_,b),b):s(_)==="object"&&(_=je(_,b)),typeof h=="string"?h=je(oe(h,b),b):s(h)==="object"&&(h=je(h,b)),_===h}function ns(_,h){return _&&_.toString().replace(!h||!h.iri?u.ESCAPE:c.ESCAPE,Ee)}function Ge(_,h){return _&&_.toString().replace(!h||!h.iri?u.PCT_ENCODED:c.PCT_ENCODED,Ie)}var $t={scheme:"http",domainHost:!0,parse:function(h,b){return h.host||(h.error=h.error||"HTTP URIs must have a host."),h},serialize:function(h,b){var w=String(h.scheme).toLowerCase()==="https";return(h.port===(w?443:80)||h.port==="")&&(h.port=void 0),h.path||(h.path="/"),h}},On={scheme:"https",domainHost:$t.domainHost,parse:$t.parse,serialize:$t.serialize};function Tn(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var At={scheme:"ws",domainHost:!0,parse:function(h,b){var w=h;return w.secure=Tn(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(h,b){if((h.port===(Tn(h)?443:80)||h.port==="")&&(h.port=void 0),typeof h.secure=="boolean"&&(h.scheme=h.secure?"wss":"ws",h.secure=void 0),h.resourceName){var w=h.resourceName.split("?"),E=f(w,2),N=E[0],K=E[1];h.path=N&&N!=="/"?N:void 0,h.query=K,h.resourceName=void 0}return h.fragment=void 0,h}},$n={scheme:"wss",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize},hu={},pu=!0,An="[A-Za-z0-9\\-\\.\\_\\~"+(pu?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",tr="[0-9A-Fa-f]",mu=t(t("%[EFef]"+tr+"%"+tr+tr+"%"+tr+tr)+"|"+t("%[89A-Fa-f]"+tr+"%"+tr+tr)+"|"+t("%"+tr+tr)),vu="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",gu="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",yu=e(gu,'[\\"\\\\]'),_u="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",bu=new RegExp(An,"g"),lt=new RegExp(mu,"g"),xu=new RegExp(e("[^]",vu,"[\\.]",'[\\"]',yu),"g"),In=new RegExp(e("[^]",An,_u),"g"),wu=In;function os(_){var h=Ie(_);return h.match(bu)?h:_}var Cn={scheme:"mailto",parse:function(h,b){var w=h,E=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var N=!1,K={},ae=w.query.split("&"),ie=0,be=ae.length;ie<be;++ie){var te=ae[ie].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe<de;++xe)E.push(he[xe]);break;case"subject":w.subject=Ge(te[1],b);break;case"body":w.body=Ge(te[1],b);break;default:N=!0,K[Ge(te[0],b)]=Ge(te[1],b);break}}N&&(w.headers=K)}w.query=void 0;for(var ne=0,pe=E.length;ne<pe;++ne){var ce=E[ne].split("@");if(ce[0]=Ge(ce[0]),b.unicodeSupport)ce[1]=Ge(ce[1],b).toLowerCase();else try{ce[1]=se.toASCII(Ge(ce[1],b).toLowerCase())}catch(Nr){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+Nr}E[ne]=ce.join("@")}return w},serialize:function(h,b){var w=h,E=n(h.to);if(E){for(var N=0,K=E.length;N<K;++N){var ae=String(E[N]),ie=ae.lastIndexOf("@"),be=ae.slice(0,ie).replace(lt,os).replace(lt,r).replace(xu,Ee),te=ae.slice(ie+1);try{te=b.iri?se.toUnicode(te):se.toASCII(Ge(te,b).toLowerCase())}catch(ne){w.error=w.error||"Email address's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ne}E[N]=be+"@"+te}w.path=E.join(",")}var he=h.headers=h.headers||{};h.subject&&(he.subject=h.subject),h.body&&(he.body=h.body);var xe=[];for(var de in he)he[de]!==hu[de]&&xe.push(de.replace(lt,os).replace(lt,r).replace(In,Ee)+"="+he[de].replace(lt,os).replace(lt,r).replace(wu,Ee));return xe.length&&(w.query=xe.join("&")),w}},Eu=/^([^\:]+)\:(.*)/,kn={scheme:"urn",parse:function(h,b){var w=h.path&&h.path.match(Eu),E=h;if(w){var N=b.scheme||E.scheme||"urn",K=w[1].toLowerCase(),ae=w[2],ie=N+":"+(b.nid||K),be=ye[ie];E.nid=K,E.nss=ae,E.path=void 0,be&&(E=be.parse(E,b))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(h,b){var w=b.scheme||h.scheme||"urn",E=h.nid,N=w+":"+(b.nid||E),K=ye[N];K&&(h=K.serialize(h,b));var ae=h,ie=h.nss;return ae.path=(E||b.nid)+":"+ie,ae}},Pu=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Dn={scheme:"urn:uuid",parse:function(h,b){var w=h;return w.uuid=w.nss,w.nss=void 0,!b.tolerant&&(!w.uuid||!w.uuid.match(Pu))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(h,b){var w=h;return w.nss=(h.uuid||"").toLowerCase(),w}};ye[$t.scheme]=$t,ye[On.scheme]=On,ye[At.scheme]=At,ye[$n.scheme]=$n,ye[Cn.scheme]=Cn,ye[kn.scheme]=kn,ye[Dn.scheme]=Dn,a.SCHEMES=ye,a.pctEncChar=Ee,a.pctDecChars=Ie,a.parse=oe,a.removeDotSegments=ze,a.serialize=je,a.resolveComponents=Ce,a.resolve=rr,a.normalize=Me,a.equal=sa,a.escapeComponent=ns,a.unescapeComponent=Ge,Object.defineProperty(a,"__esModule",{value:!0})})});var Sa=z((Tv,yo)=>{"use strict";yo.exports=function a(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,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))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(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!a(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var bo=z(($v,_o)=>{"use strict";_o.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var at=z((Av,Eo)=>{"use strict";Eo.exports={copy:Nf,checkDataType:As,checkDataTypes:Ff,coerceToTypes:Lf,toHash:Cs,getProperty:ks,escapeQuotes:Ds,equal:Sa(),ucs2length:bo(),varOccurences:Uf,varReplace:zf,schemaHasRules:Vf,schemaHasRulesExcept:Hf,schemaUnknownRules:Zf,toQuotedString:Is,getPathExpr:Bf,getPath:Jf,getData:Gf,unescapeFragment:Wf,unescapeJsonPointer:Ns,escapeFragment:Yf,escapeJsonPointer:js};function Nf(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function As(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",l=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+l+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+l+"("+e+" % 1)"+n+e+r+e+(t?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ff(a,e,t){switch(a.length){case 1:return As(a[0],e,t,!0);default:var s="",r=Cs(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+As(n,e,t,!0);return s}}var xo=Cs(["string","number","integer","boolean","null"]);function Lf(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(xo[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(xo[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Cs(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Mf=/^[a-z$_][a-z$_0-9]*$/i,qf=/'|\\/g;function ks(a){return typeof a=="number"?"["+a+"]":Mf.test(a)?"."+a:"['"+Ds(a)+"']"}function Ds(a){return a.replace(qf,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Uf(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function zf(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Vf(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function Hf(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function Zf(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Is(a){return"'"+Ds(a)+"'"}function Bf(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return wo(a,r)}function Jf(a,e,t){var s=Is(t?"/"+js(e):ks(e));return wo(a,s)}var Qf=/^\/(?:[^~]|~0|~1)*$/,Kf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Gf(a,e,t){var s,r,n,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Qf.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(o=a.match(Kf),!o)throw new Error("Invalid JSON-pointer: "+a);if(s=+o[1],r=o[2],r=="#"){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||""),!r)return n}for(var l=n,u=r.split("/"),c=0;c<u.length;c++){var f=u[c];f&&(n+=ks(Ns(f)),l+=" && "+n)}return l}function wo(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Wf(a){return Ns(decodeURIComponent(a))}function Yf(a){return encodeURIComponent(js(a))}function js(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ns(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var Fs=z((Iv,Po)=>{"use strict";var Xf=at();Po.exports=eh;function eh(a){Xf.copy(a,this)}});var Ro=z((Cv,So)=>{"use strict";var Tr=So.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Ra(e,s,r,a,"",a)};Tr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Tr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Tr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Tr.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 Ra(a,e,t,s,r,n,o,l,u,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,l,u,c);for(var f in s){var p=s[f];if(Array.isArray(p)){if(f in Tr.arrayKeywords)for(var g=0;g<p.length;g++)Ra(a,e,t,p[g],r+"/"+f+"/"+g,n,r,f,s,g)}else if(f in Tr.propsKeywords){if(p&&typeof p=="object")for(var d in p)Ra(a,e,t,p[d],r+"/"+f+"/"+rh(d),n,r,f,s,d)}else(f in Tr.keywords||a.allKeys&&!(f in Tr.skipKeywords))&&Ra(a,e,t,p,r+"/"+f,n,r,f,s)}t(s,r,n,o,l,u,c)}}function rh(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ca=z((kv,Ao)=>{"use strict";var Ut=go(),Oo=Sa(),Aa=at(),Oa=Fs(),th=Ro();Ao.exports=Ar;Ar.normalizeId=$r;Ar.fullPath=Ta;Ar.url=$a;Ar.ids=ih;Ar.inlineRef=Ls;Ar.schema=Ia;function Ar(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Ar.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Oa)return Ls(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ia.call(this,e,t),n,o,l;return r&&(n=r.schema,e=r.root,l=r.baseId),n instanceof Oa?o=n.validate||a.call(this,n.schema,e,void 0,l):n!==void 0&&(o=Ls(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,l)),o}function Ia(a,e){var t=Ut.parse(e),s=$o(t),r=Ta(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=$r(s),o=this._refs[n];if(typeof o=="string")return ah.call(this,a,o,t);if(o instanceof Oa)o.validate||this._compile(o),a=o;else if(o=this._schemas[n],o instanceof Oa){if(o.validate||this._compile(o),n==$r(e))return{schema:o,root:a,baseId:r};a=o}else return;if(!a.schema)return;r=Ta(this._getId(a.schema))}return To.call(this,t,r,a.schema,a)}function ah(a,e,t){var s=Ia.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var o=this._getId(r);return o&&(n=$a(n,o)),To.call(this,t,n,r,a)}}var sh=Aa.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function To(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Aa.unescapeFragment(o),t=t[o],t===void 0)break;var l;if(!sh[o]&&(l=this._getId(t),l&&(e=$a(e,l)),t.$ref)){var u=$a(e,t.$ref),c=Ia.call(this,s,u);c&&(t=c.schema,s=c.root,e=c.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var nh=Aa.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Ls(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return Ms(a);if(e)return qs(a)<=e}function Ms(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!Ms(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!Ms(e)))return!1;return!0}function qs(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=qs(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(nh[r])e++;else if(t=a[r],typeof t=="object"&&(e+=qs(t)+1),e==1/0)return 1/0}return e}function Ta(a,e){e!==!1&&(a=$r(a));var t=Ut.parse(a);return $o(t)}function $o(a){return Ut.serialize(a).split("#")[0]+"#"}var oh=/#\/?$/;function $r(a){return a?a.replace(oh,""):""}function $a(a,e){return e=$r(e),Ut.resolve(a,e)}function ih(a){var e=$r(this._getId(a)),t={"":e},s={"":Ta(e,!1)},r={},n=this;return th(a,{allKeys:!0},function(o,l,u,c,f,p,g){if(l!==""){var d=n._getId(o),y=t[c],m=s[c]+"/"+f;if(g!==void 0&&(m+="/"+(typeof g=="number"?g:Aa.escapeFragment(g))),typeof d=="string"){d=y=$r(y?Ut.resolve(y,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!Oo(o,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=$r(m))if(d[0]=="#"){if(r[d]&&!Oo(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=m}t[l]=y,s[l]=m}}),r}});var ka=z((Dv,Co)=>{"use strict";var Us=Ca();Co.exports={Validation:Io(lh),MissingRef:Io(zs)};function lh(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}zs.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function zs(a,e,t){this.message=t||zs.message(a,e),this.missingRef=Us.url(a,e),this.missingSchema=Us.normalizeId(Us.fullPath(this.missingRef))}function Io(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Vs=z((jv,ko)=>{"use strict";ko.exports=function(a,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(l,u){var c={key:l,value:o[l]},f={key:u,value:o[u]};return n(c,f)}}}(e.cmp),r=[];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 l,u;if(Array.isArray(o)){for(u="[",l=0;l<o.length;l++)l&&(u+=","),u+=n(o[l])||"null";return u+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,f=Object.keys(o).sort(s&&s(o));for(u="",l=0;l<f.length;l++){var p=f[l],g=n(o[p]);g&&(u&&(u+=","),u+=JSON.stringify(p)+":"+g)}return r.splice(c,1),"{"+u+"}"}}(a)}});var Hs=z((Nv,Do)=>{"use strict";Do.exports=function(e,t,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var u=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(u){var c="unknown keyword: "+u;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",f=e.level,p=e.dataLevel,g=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,m="data"+(p||""),O="valid"+f;if(e.schema===!1){e.isTop?A=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var S=e.isTop,f=e.level=0,p=e.dataLevel=0,m="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 P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,p=e.dataLevel,m="data"+(p||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;"}var O="valid"+f,A=!e.opts.allErrors,I="",H="",q,C=e.schema.type,U=Array.isArray(C);if(C&&e.opts.nullable&&e.schema.nullable===!0&&(U?C.indexOf("null")==-1&&(C=C.concat("null")):C!="null"&&(C=[C,"null"],U=!0)),U&&C.length==1&&(C=C[0],U=!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&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),C){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,C);var F=e.RULES.types[C];if(M||U||F===!0||F&&!Pe(F)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",$=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[$](C,m,e.opts.strictNumbers,!0)+") { ",M){var k="dataType"+f,L="coerced"+f;r+=" var "+k+" = typeof "+m+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+k+" == 'object' && Array.isArray("+m+") && "+m+".length == 1) { "+m+" = "+m+"[0]; "+k+" = typeof "+m+"; if ("+e.util.checkDataType(e.schema.type,m,e.opts.strictNumbers)+") "+L+" = "+m+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,W=le.length-1;re<W;)Y=le[re+=1],Y=="string"?r+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+L+" = '' + "+m+"; else if ("+m+" === null) "+L+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+k+" == 'boolean' || "+m+" === null || ("+k+" == 'string' && "+m+" && "+m+" == +"+m+" ",Y=="integer"&&(r+=" && !("+m+" % 1)"),r+=")) "+L+" = +"+m+"; "):Y=="boolean"?r+=" else if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+L+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+L+" = true; ":Y=="null"?r+=" else if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+L+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+m+" == null) "+L+" = ["+m+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+L+" !== undefined) { ";var Z=p?"data"+(p-1||""):"parentData",me=p?e.dataPathArr[p]:"parentDataProperty";r+=" "+m+" = "+L+"; ",p||(r+="if ("+Z+" !== undefined)"),r+=" "+Z+"["+me+"] = "+L+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",A&&(r+=" } if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}");else{var Re=e.RULES;if(Re){for(var F,Ae=-1,se=Re.length-1;Ae<se;)if(F=Re[Ae+=1],Pe(F)){if(F.type&&(r+=" if ("+e.util.checkDataType(F.type,m,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var g=e.schema.properties,ye=Object.keys(g),Ee=ye;if(Ee)for(var Ie,xr=-1,lr=Ee.length-1;xr<lr;){Ie=Ee[xr+=1];var _e=g[Ie];if(_e.default!==void 0){var ve=m+e.util.getProperty(Ie);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var kr=e.schema.items;if(kr){for(var _e,re=-1,Oe=kr.length-1;re<Oe;)if(_e=kr[re+=1],_e.default!==void 0){var ve=m+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var oe=F.rules;if(oe){for(var wr,cr=-1,Dr=oe.length-1;cr<Dr;)if(wr=oe[cr+=1],ze(wr)){var jr=wr.code(e,wr.keyword,F.type);jr&&(r+=" "+jr+" ",A&&(I+="}"))}}if(A&&(r+=" "+I+" ",I=""),F.type&&(r+=" } ",C&&C===F.type&&!M)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}A&&(r+=" if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}")}}}A&&(r+=" "+H+" "),S?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+f+";";function Pe(Ce){for(var rr=Ce.rules,Me=0;Me<rr.length;Me++)if(ze(rr[Me]))return!0}function ze(Ce){return e.schema[Ce.keyword]!==void 0||Ce.implements&&je(Ce)}function je(Ce){for(var rr=Ce.implements,Me=0;Me<rr.length;Me++)if(e.schema[rr[Me]]!==void 0)return!0}return r}});var Mo=z((Fv,Lo)=>{"use strict";var Da=Ca(),Na=at(),No=ka(),ch=Vs(),jo=Hs(),uh=Na.ucs2length,dh=Sa(),fh=No.Validation;Lo.exports=Zs;function Zs(a,e,t,s){var r=this,n=this._opts,o=[void 0],l={},u=[],c={},f=[],p={},g=[];e=e||{schema:a,refVal:o,refs:l};var d=hh.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=P;var m=this._formats,v=this.RULES;try{var x=O(a,e,t,s);y.validate=x;var S=y.callValidate;return S&&(S.schema=x.schema,S.errors=null,S.refs=x.refs,S.refVal=x.refVal,S.root=x.root,S.$async=x.$async,n.sourceCode&&(S.source=x.source)),x}finally{ph.call(this,a,e,s)}function P(){var $=y.validate,k=$.apply(this,arguments);return P.errors=$.errors,k}function O($,k,L,le){var Y=!k||k&&k.schema==$;if(k.schema!=e.schema)return Zs.call(r,$,k,L,le);var re=$.$async===!0,W=jo({isTop:!0,schema:$,isRoot:Y,baseId:le,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:No.MissingRef,RULES:v,validate:jo,util:Na,resolve:Da,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:F,opts:n,formats:m,logger:r.logger,self:r});W=ja(o,gh)+ja(u,mh)+ja(f,vh)+ja(g,yh)+W,n.processCode&&(W=n.processCode(W,$));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",W);Z=me(r,v,m,e,o,f,g,dh,uh,fh),o[0]=Z}catch(Re){throw r.logger.error("Error compiling schema, function code:",W),Re}return Z.schema=$,Z.errors=null,Z.refs=l,Z.refVal=o,Z.root=Y?Z:k,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:W,patterns:u,defaults:f}),Z}function A($,k,L){k=Da.url($,k);var le=l[k],Y,re;if(le!==void 0)return Y=o[le],re="refVal["+le+"]",C(Y,re);if(!L&&e.refs){var W=e.refs[k];if(W!==void 0)return Y=e.refVal[W],re=I(k,Y),C(Y,re)}re=I(k);var Z=Da.call(r,O,e,k);if(Z===void 0){var me=t&&t[k];me&&(Z=Da.inlineRef(me,n.inlineRefs)?me:Zs.call(r,me,e,t,$))}if(Z===void 0)H(k);else return q(k,Z),C(Z,re)}function I($,k){var L=o.length;return o[L]=k,l[$]=L,"refVal"+L}function H($){delete l[$]}function q($,k){var L=l[$];o[L]=k}function C($,k){return typeof $=="object"||typeof $=="boolean"?{code:k,schema:$,inline:!0}:{code:k,$async:$&&!!$.$async}}function U($){var k=c[$];return k===void 0&&(k=c[$]=u.length,u[k]=$),"pattern"+k}function M($){switch(typeof $){case"boolean":case"number":return""+$;case"string":return Na.toQuotedString($);case"object":if($===null)return"null";var k=ch($),L=p[k];return L===void 0&&(L=p[k]=f.length,f[L]=$),"default"+L}}function F($,k,L,le){if(r._opts.validateSchema!==!1){var Y=$.definition.dependencies;if(Y&&!Y.every(function(Ee){return Object.prototype.hasOwnProperty.call(L,Ee)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=$.definition.validateSchema;if(re){var W=re(k);if(!W){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=$.definition.compile,Re=$.definition.inline,Ae=$.definition.macro,se;if(me)se=me.call(r,k,L,le);else if(Ae)se=Ae.call(r,k,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Re)se=Re.call(r,le,$.keyword,k,L);else if(se=$.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+$.keyword+'"failed to compile');var ye=g.length;return g[ye]=se,{code:"customRule"+ye,validate:se}}}function hh(a,e,t){var s=Fo.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function ph(a,e,t){var s=Fo.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Fo(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function mh(a,e){return"var pattern"+a+" = new RegExp("+Na.toQuotedString(e[a])+");"}function vh(a){return"var default"+a+" = defaults["+a+"];"}function gh(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function yh(a){return"var customRule"+a+" = customRules["+a+"];"}function ja(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Uo=z((Lv,qo)=>{"use strict";var Fa=qo.exports=function(){this._cache={}};Fa.prototype.put=function(e,t){this._cache[e]=t};Fa.prototype.get=function(e){return this._cache[e]};Fa.prototype.del=function(e){delete this._cache[e]};Fa.prototype.clear=function(){this._cache={}}});var Xo=z((Mv,Yo)=>{"use strict";var _h=at(),bh=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,xh=[0,31,28,31,30,31,30,31,31,30,31,30,31],wh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,zo=/^(?=.{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,Eh=/^(?:[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,Ph=/^(?:[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,Vo=/^(?:(?:[^\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,Ho=/^(?:(?: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,Zo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Bo=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Jo=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Qo=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Yo.exports=La;function La(a){return a=a=="full"?"full":"fast",_h.copy(La[a])}La.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":Vo,url:Ho,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:zo,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:Wo,uuid:Zo,"json-pointer":Bo,"json-pointer-uri-fragment":Jo,"relative-json-pointer":Qo};La.full={date:Ko,time:Go,"date-time":Oh,uri:$h,"uri-reference":Ph,"uri-template":Vo,url:Ho,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:zo,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:Wo,uuid:Zo,"json-pointer":Bo,"json-pointer-uri-fragment":Jo,"relative-json-pointer":Qo};function Sh(a){return a%4===0&&(a%100!==0||a%400===0)}function Ko(a){var e=a.match(bh);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Sh(t)?29:xh[s])}function Go(a,e){var t=a.match(wh);if(!t)return!1;var s=t[1],r=t[2],n=t[3],o=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var Rh=/t|\s/i;function Oh(a){var e=a.split(Rh);return e.length==2&&Ko(e[0])&&Go(e[1],!0)}var Th=/\/|:/;function $h(a){return Th.test(a)&&Eh.test(a)}var Ah=/[^\\]\\Z/;function Wo(a){if(Ah.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ri=z((qv,ei)=>{"use strict";ei.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,f="data"+(o||""),p="valid"+n,g,d;if(l=="#"||l=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,l,e.isRoot);if(y===void 0){var m=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(m);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(m),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,m)}else if(y.inline){var S=e.util.copy(e);S.level++;var P="valid"+S.level;S.schema=y.schema,S.schemaPath="",S.errSchemaPath=l;var O=e.validate(S).replace(/validate\.schema/g,y.code);r+=" "+O+" ",c&&(r+=" if ("+P+") { ")}else g=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=o?"data"+(o-1||""):"parentData",I=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+A+" , "+I+", rootData) ";var H=r;if(r=v.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+p+"; "),r+=" try { await "+H+"; ",c&&(r+=" "+p+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+p+" = false; "),r+=" } ",c&&(r+=" if ("+p+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r}});var ai=z((Uv,ti)=>{"use strict";ti.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c=e.util.copy(e),f="";c.level++;var p="valid"+c.level,g=c.baseId,d=!0,y=n;if(y)for(var m,v=-1,x=y.length-1;v<x;)m=y[v+=1],(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(d=!1,c.schema=m,c.schemaPath=o+"["+v+"]",c.errSchemaPath=l+"/"+v,r+=" "+e.validate(c)+" ",c.baseId=g,u&&(r+=" if ("+p+") { ",f+="}"));return u&&(d?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}});var ni=z((zv,si)=>{"use strict";si.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=l.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(x){var S=y.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=l;if(O)for(var A,I=-1,H=O.length-1;I<H;)A=O[I+=1],y.schema=A,y.schemaPath=u+"["+I+"]",y.errSchemaPath=c+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=S,r+=" "+g+" = "+g+" || "+v+"; if (!"+g+") { ",m+="}";e.compositeRule=y.compositeRule=P,r+=" "+m+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else f&&(r+=" if (true) { ");return r}});var ii=z((Vv,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,u=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+u+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+u+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}});var ci=z((Hv,li)=>{"use strict";li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l,d||(r+=" var schema"+n+" = validate.schema"+u+";"),r+="var "+g+" = equal("+p+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var di=z((Zv,ui)=>{"use strict";ui.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId,A=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",A){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var H=p+"["+x+"]";y.dataPathArr[S]=x;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,H)+" ":r+=" var "+P+" = "+H+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+m+" if (!"+v+") {"}else r+=" if ("+p+".length == 0) {";var C=C||[];C.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var U=r;return r=C.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",A&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var hi=z((Bv,fi)=>{"use strict";fi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v={},x={},S=e.opts.ownProperties;for(I in l)if(I!="__proto__"){var P=l[I],O=Array.isArray(P)?x:v;O[I]=P}r+="var "+g+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var I in x)if(O=x[I],O.length){if(r+=" if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),f){r+=" && ( ";var H=O;if(H)for(var q,C=-1,U=H.length-1;C<U;){q=H[C+=1],C&&(r+=" || ");var M=e.util.getProperty(q),F=p+M;r+=" ( ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var $="missing"+n,k="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,$,!0):A+" + "+$);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var le=r;r=L.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,W=Y.length-1;re<W;){q=Y[re+=1];var M=e.util.getProperty(q),k=e.util.escapeQuotes(q),F=p+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,q,e.opts.jsonPointers)),r+=" if ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",f&&(y+="}",r+=" else { ")}e.errorPath=A;var Z=d.baseId;for(var I in v){var P=v[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+m+" = true; if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",d.schema=P,d.schemaPath=u+e.util.getProperty(I),d.errSchemaPath=c+"/"+e.util.escapeFragment(I),r+=" "+e.validate(d)+" ",d.baseId=Z,r+=" } ",f&&(r+=" if ("+m+") { ",y+="}"))}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var mi=z((Jv,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l;var m="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+u+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+v+".length; "+m+"++) if (equal("+p+", "+v+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;return r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var gi=z((Qv,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return f&&(r+=" if (true) { "),r;var g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=e.opts.unknownFormats,m=Array.isArray(y);if(g){var v="format"+n,x="isObject"+n,S="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+S+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+v+" ",m&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+S+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+p+") : "+v+"("+p+")) ":r+=" "+v+"("+p+") ",r+=" : "+v+".test("+p+"))))) {"}else{var v=e.formats[l];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(m&&y.indexOf(l)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,S=x&&v.type||"string";if(x){var P=v.async===!0;v=v.validate}if(S!=s)return f&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(l)+".validate";r+=" if (!(await "+O+"("+p+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(l);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+p+") ":r+=" "+O+".test("+p+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var I=r;return r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var _i=z((Kv,yi)=>{"use strict";yi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var m="valid"+y.level,v=e.schema.then,x=e.schema.else,S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=y.baseId;if(S||P){var A;y.createErrors=!1,y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,S?(r+=" if ("+m+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+m+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var xi=z((Gv,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(l)){var A=e.schema.additionalItems;if(A===!1){r+=" "+g+" = "+p+".length <= "+l.length+"; ";var I=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var q=r;r=H.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=I,f&&(m+="}",r+=" else { ")}var C=l;if(C){for(var U,M=-1,F=C.length-1;M<F;)if(U=C[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+p+".length > "+M+") { ";var $=p+"["+M+"]";y.schema=U,y.schemaPath=u+"["+M+"]",y.errSchemaPath=c+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[S]=M;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",r+=" } ",f&&(r+=" if ("+v+") { ",m+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){y.schema=A,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+p+".length > "+l.length+") { for (var "+x+" = "+l.length+"; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" } } ",f&&(r+=" if ("+v+") { ",m+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" }"}return f&&(r+=" "+m+" if ("+d+" == errors) {"),r}});var Bs=z((Wv,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,O,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=t=="maximum",m=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[m],x=e.opts.$data&&v&&v.$data,S=y?"<":">",P=y?">":"<",O=void 0;if(!(g||typeof l=="number"||l===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(m+" must be number or boolean");if(x){var A=e.util.getData(v.$data,o,e.dataPathArr),I="exclusive"+n,H="exclType"+n,q="exclIsNumber"+n,C="op"+n,U="' + "+C+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+I+"; var "+H+" = typeof "+A+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var O=m,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+I+" = "+d+" === undefined || "+A+" "+S+"= "+d+") ? "+p+" "+P+"= "+A+" : "+p+" "+P+" "+d+" ) : ( ("+I+" = "+A+" === true) ? "+p+" "+P+"= "+d+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { var op"+n+" = "+I+" ? '"+S+"' : '"+S+"='; ",l===void 0&&(O=m,c=e.errSchemaPath+"/"+m,d=A,g=x)}else{var q=typeof v=="number",U=S;if(q&&g){var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+S+"= "+d+" ? "+p+" "+P+"= "+v+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { "}else{q&&l===void 0?(I=!0,O=m,c=e.errSchemaPath+"/"+m,d=v,P+="="):(q&&(d=Math[y?"min":"max"](v,l)),v===(q?d:!0)?(I=!0,O=m,c=e.errSchemaPath+"/"+m,P+="="):(I=!1,U+="="));var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+" "+P+" "+d+" || "+p+" !== "+p+") { "}}O=O||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+C+", limit: "+d+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var Js=z((Yv,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+".length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Qs=z((Xv,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+p+".length ":r+=" ucs2length("+p+") ",r+=" "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Ks=z((eg,Si)=>{"use strict";Si.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+p+").length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Oi=z((rg,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var m=r;return r=y.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var $i=z((tg,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var m=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=m,r+=" if ("+y+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}});var Ii=z((ag,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=y.baseId,S="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+S+" = false , "+g+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var A=l;if(A)for(var I,H=-1,q=A.length-1;H<q;)I=A[H+=1],(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=u+"["+H+"]",y.errSchemaPath=c+"/"+H,r+=" "+e.validate(y)+" ",y.baseId=x):r+=" var "+v+" = true; ",H&&(r+=" if ("+v+" && "+S+") { "+g+" = false; "+P+" = ["+P+", "+H+"]; } else { ",m+="}"),r+=" if ("+v+") { "+g+" = "+S+" = true; "+P+" = "+H+"; }";return e.compositeRule=y.compositeRule=O,r+=""+m+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var ki=z((sg,Ci)=>{"use strict";Ci.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=g?"(new RegExp("+d+"))":e.usePattern(l);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+p+") ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var ji=z((ng,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v="key"+n,x="idx"+n,S=d.dataLevel=e.dataLevel+1,P="data"+S,O="dataProperties"+n,A=Object.keys(l||{}).filter(re),I=e.schema.patternProperties||{},H=Object.keys(I).filter(re),q=e.schema.additionalProperties,C=A.length||H.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,$=U||M||F,k=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(Ge){return Ge!=="__proto__"}if(r+="var "+g+" = errors;var "+m+" = true;",k&&(r+=" var "+O+" = undefined;"),$){if(k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",C){if(r+=" var isAdditional"+n+" = !(false ",A.length)if(A.length>8)r+=" || validate.schema"+u+".hasOwnProperty("+v+") ";else{var W=A;if(W)for(var Z,me=-1,Re=W.length-1;me<Re;)Z=W[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(Z)+" "}if(H.length){var Ae=H;if(Ae)for(var se,ye=-1,Ee=Ae.length-1;ye<Ee;)se=Ae[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(F=="all")r+=" delete "+p+"["+v+"]; ";else{var Ie=e.errorPath,xr="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(F)r+=" delete "+p+"["+v+"]; ";else{r+=" "+m+" = false; ";var lr=c;c=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+xr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,f&&(r+=" break; ")}else if(M)if(F=="failing"){r+=" var "+g+" = errors; ";var kr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",r+=" if (!"+m+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+v+"]; } ",e.compositeRule=d.compositeRule=kr}else{d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+m+") break; ")}e.errorPath=Ie}C&&(r+=" } "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}var wr=e.opts.useDefaults&&!e.compositeRule;if(A.length){var cr=A;if(cr)for(var Z,Dr=-1,jr=cr.length-1;Dr<jr;){Z=cr[Dr+=1];var Pe=l[Z];if(e.opts.strictKeywords?typeof Pe=="object"&&Object.keys(Pe).length>0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){var ze=e.util.getProperty(Z),Oe=p+ze,je=wr&&Pe.default!==void 0;d.schema=Pe,d.schemaPath=u+ze,d.errSchemaPath=c+"/"+e.util.escapeFragment(Z),d.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),d.dataPathArr[S]=e.util.toQuotedString(Z);var oe=e.validate(d);if(d.baseId=L,e.util.varOccurences(oe,P)<2){oe=e.util.varReplace(oe,P,Oe);var Ce=Oe}else{var Ce=P;r+=" var "+P+" = "+Oe+"; "}if(je)r+=" "+oe+" ";else{if(Y&&Y[Z]){r+=" if ( "+Ce+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = false; ";var Ie=e.errorPath,lr=c,rr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,Z,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+rr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+rr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,e.errorPath=Ie,r+=" } else { "}else f?(r+=" if ( "+Ce+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = true; } else { "):(r+=" if ("+Ce+" !== undefined ",k&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+oe+" } "}}f&&(r+=" if ("+m+") { ",y+="}")}}if(H.length){var Me=H;if(Me)for(var se,sa=-1,ns=Me.length-1;sa<ns;){se=Me[sa+=1];var Pe=I[se];if(e.opts.strictKeywords?typeof Pe=="object"&&Object.keys(Pe).length>0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){d.schema=Pe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+m+") break; "),r+=" } ",f&&(r+=" else "+m+" = true; "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}}}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Fi=z((og,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c;var v="key"+n,x="idx"+n,S="i"+n,P="' + "+v+" + '",O=d.dataLevel=e.dataLevel+1,A="data"+O,I="dataProperties"+n,H=e.opts.ownProperties,q=e.baseId;H&&(r+=" var "+I+" = undefined; "),H?r+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+I+".length; "+x+"++) { var "+v+" = "+I+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" var startErrs"+n+" = errors; ";var C=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,C)+" ":r+=" var "+A+" = "+C+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+m+") { for (var "+S+"=startErrs"+n+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }"}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Mi=z((ig,Li)=>{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l;var m="schema"+n;if(!d)if(l.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],x=l;if(x)for(var S,P=-1,O=x.length-1;P<O;){S=x[P+=1];var A=e.schema.properties[S];A&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=S)}}else var v=l;if(d||v.length){var I=e.errorPath,H=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(f)if(r+=" var missing"+n+"; ",H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { "+g+" = "+p+"["+m+"["+C+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var k=v;if(k)for(var L,C=-1,le=k.length-1;C<le;){L=k[C+=1],C&&(r+=" || ");var Y=e.util.getProperty(L),re=p+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:Y)+") ) "}r+=") { ";var U="missing"+n,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,U,!0):I+" + "+U);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { if ("+p+"["+m+"["+C+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var W=v;if(W)for(var L,Z=-1,me=W.length-1;Z<me;){L=W[Z+=1];var Y=e.util.getProperty(L),M=e.util.escapeQuotes(L),re=p+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,L,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else f&&(r+=" if (true) {");return r}});var Ui=z((lg,qi)=>{"use strict";qi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l,(l||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+y+" === false || "+y+" === undefined) "+g+" = true; else if (typeof "+y+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+p+".length , "+g+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,v=Array.isArray(m);if(!m||m=="object"||m=="array"||v&&(m.indexOf("object")>=0||m.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](m,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Vi=z((cg,zi)=>{"use strict";zi.exports={$ref:ri(),allOf:ai(),anyOf:ni(),$comment:ii(),const:ci(),contains:di(),dependencies:hi(),enum:mi(),format:gi(),if:_i(),items:xi(),maximum:Bs(),minimum:Bs(),maxItems:Js(),minItems:Js(),maxLength:Qs(),minLength:Qs(),maxProperties:Ks(),minProperties:Ks(),multipleOf:Oi(),not:$i(),oneOf:Ii(),pattern:ki(),properties:ji(),propertyNames:Fi(),required:Mi(),uniqueItems:Ui(),validate:Hs()}});var Bi=z((ug,Zi)=>{"use strict";var Hi=Vi(),Gs=at().toHash;Zi.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"],r=["number","integer","string","array","object","boolean","null"];return e.all=Gs(t),e.types=Gs(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var l;if(typeof o=="object"){var u=Object.keys(o)[0];l=o[u],o=u,l.forEach(function(f){t.push(f),e.all[f]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:Hi[o],implements:l};return c}),e.all.$comment={keyword:"$comment",code:Hi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=Gs(t.concat(s)),e.custom={},e}});var Ki=z((dg,Qi)=>{"use strict";var Ji=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Qi.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Ji.length;n++){var o=Ji[n],l=r[o];l&&(r[o]={anyOf:[l,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Yi=z((fg,Wi)=>{"use strict";var Ih=ka().MissingRef;Wi.exports=Gi;function Gi(a,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 r=n(a).then(function(){var l=s._addSchema(a,void 0,e);return l.validate||o(l)});return t&&r.then(function(l){t(null,l)},t),r;function n(l){var u=l.$schema;return u&&!s.getSchema(u)?Gi.call(s,{$ref:u},!0):Promise.resolve()}function o(l){try{return s._compile(l)}catch(c){if(c instanceof Ih)return u(c);throw c}function u(c){var f=c.missingSchema;if(d(f))throw new Error("Schema "+f+" is loaded but "+c.missingRef+" cannot be resolved");var p=s._loadingSchemas[f];return p||(p=s._loadingSchemas[f]=s._opts.loadSchema(f),p.then(g,g)),p.then(function(y){if(!d(f))return n(y).then(function(){d(f)||s.addSchema(y,f,void 0,e)})}).then(function(){return o(l)});function g(){delete s._loadingSchemas[f]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var el=z((hg,Xi)=>{"use strict";Xi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p,g="data"+(o||""),d="valid"+n,y="errs__"+n,m=e.opts.$data&&l&&l.$data,v;m?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",v="schema"+n):v=l;var x=this,S="definition"+n,P=x.definition,O="",A,I,H,q,C;if(m&&P.$data){C="keywordValidate"+n;var U=P.validateSchema;r+=" var "+S+" = RULES.custom['"+t+"'].definition; var "+C+" = "+S+".validate;"}else{if(q=e.useCustomRule(x,l,e.schema,e),!q)return;v="validate.schema"+u,C=q.code,A=P.compile,I=P.inline,H=P.macro}var M=C+".errors",F="i"+n,$="ruleErr"+n,k=P.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(I||H||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+d+";",m&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(O+="}",r+=" "+d+" = "+S+".validateSchema("+v+"); if ("+d+") { ")),I)P.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(H){var L=e.util.copy(e),O="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,C);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var W=W||[];W.push(r),r="",r+=" "+C+".call( ",e.opts.passContext?r+="this":r+="self",A||P.schema===!1?r+=" , "+g+" ":r+=" , "+v+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=o?"data"+(o-1||""):"parentData",me=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var Re=r;r=W.pop(),P.errors===!1?(r+=" "+d+" = ",k&&(r+="await "),r+=""+Re+"; "):k?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Re+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Re+"; "}if(P.modifying&&(r+=" if ("+Z+") "+g+" = "+Z+"["+me+"];"),r+=""+O,P.valid)f&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",H?r+=""+le:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",p=x.keyword;var W=W||[];W.push(r),r="";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var Ae=r;r=W.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+Ae+"]); ":r+=" validate.errors = ["+Ae+"]; return false; ":r+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=W.pop(),I?P.errors?P.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; "+$+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } else { "+se+" } "),r+=" } ",f&&(r+=" else { ")}return r}});var Ws=z((pg,Ch)=>{Ch.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 al=z((mg,tl)=>{"use strict";var rl=Ws();tl.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:rl.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:rl.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 nl=z((vg,sl)=>{"use strict";var kh=/^[a-z_$][a-z0-9_$-]*$/i,Dh=el(),jh=al();sl.exports={add:Nh,get:Fh,remove:Lh,validate:Ys};function Nh(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!kh.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(a,s[r],e);else o(a,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[a]=t.all[a]=!0;function o(l,u,c){for(var f,p=0;p<t.length;p++){var g=t[p];if(g.type==u){f=g;break}}f||(f={type:u,rules:[]},t.push(f));var d={keyword:l,definition:c,custom:!0,code:Dh,implements:c.implements};f.rules.push(d),t.custom[l]=d}return this}function Fh(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Lh(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function Ys(a,e){Ys.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(jh,!0);if(t(a))return!0;if(Ys.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var ol=z((gg,Mh)=>{Mh.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 en=z((yg,ml)=>{"use strict";var ll=Mo(),st=Ca(),qh=Uo(),cl=Fs(),Uh=Vs(),zh=Xo(),Vh=Bi(),ul=Ki(),dl=at();ml.exports=ge;ge.prototype.validate=Zh;ge.prototype.compile=Bh;ge.prototype.addSchema=Jh;ge.prototype.addMetaSchema=Qh;ge.prototype.validateSchema=Kh;ge.prototype.getSchema=Wh;ge.prototype.removeSchema=Xh;ge.prototype.addFormat=ip;ge.prototype.errorsText=op;ge.prototype._addSchema=ep;ge.prototype._compile=rp;ge.prototype.compileAsync=Yi();var Ua=nl();ge.prototype.addKeyword=Ua.add;ge.prototype.getKeyword=Ua.get;ge.prototype.removeKeyword=Ua.remove;ge.prototype.validateKeyword=Ua.validate;var fl=ka();ge.ValidationError=fl.Validation;ge.MissingRefError=fl.MissingRef;ge.$dataMetaSchema=ul;var qa="http://json-schema.org/draft-07/schema",il=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Hh=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=dl.copy(a)||{},hp(this),this._schemas={},this._refs={},this._fragments={},this._formats=zh(a.format),this._cache=a.cache||new qh,this._loadingSchemas={},this._compilations=[],this.RULES=Vh(),this._getId=tp(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Uh),this._metaOpts=fp(this),a.formats&&up(this),a.keywords&&dp(this),lp(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),cp(this)}function Zh(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Bh(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Jh(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=st.normalizeId(e||n),pl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Qh(a,e,t){return this.addSchema(a,e,t,!0),this}function Kh(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||Gh(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function Gh(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(qa)?qa:void 0,a._opts.defaultMeta}function Wh(a){var e=hl(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Yh(this,a)}}function Yh(a,e){var t=st.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,o=ll.call(a,s,r,void 0,n);return a._fragments[e]=new cl({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function hl(a,e){return e=st.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function Xh(a){if(a instanceof RegExp)return Ma(this,this._schemas,a),Ma(this,this._refs,a),this;switch(typeof a){case"undefined":return Ma(this,this._schemas),Ma(this,this._refs),this._cache.clear(),this;case"string":var e=hl(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=st.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ma(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function ep(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var l=st.normalizeId(this._getId(a));l&&s&&pl(this,l);var u=this._opts.validateSchema!==!1&&!e,c;u&&!(c=l&&l==st.normalizeId(a.$schema))&&this.validateSchema(a,!0);var f=st.ids.call(this,a),p=new cl({id:l,schema:a,localRefs:f,cacheKey:n,meta:t});return l[0]!="#"&&s&&(this._refs[l]=p),this._cache.put(n,p),u&&c&&this.validateSchema(a,!0),p}function rp(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=ll.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function tp(a){switch(a.schemaId){case"auto":return np;case"id":return ap;default:return sp}}function ap(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function sp(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function np(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function op(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var o=a[n];o&&(r+=s+o.dataPath+" "+o.message+t)}return r.slice(0,-t.length)}function ip(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function lp(a){var e;if(a._opts.$data&&(e=ol(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=Ws();a._opts.$data&&(t=ul(t,Hh)),a.addMetaSchema(t,qa,!0),a._refs["http://json-schema.org/schema"]=qa}}function cp(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function up(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function dp(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function pl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function fp(a){for(var e=dl.copy(a._opts),t=0;t<il.length;t++)delete e[il[t]];return e}function hp(a){var e=a._opts.logger;if(e===!1)a.logger={log:Xs,warn:Xs,error:Xs};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");a.logger=e}}function Xs(){}});var bl=z((Sg,Ha)=>{"use strict";Ha.exports=gp;Ha.exports.format=yl;Ha.exports.parse=_l;var pp=/\B(?=(\d{3})+(?!\d))/g,mp=/(?:\.0*|(\.[^0]+)0+)$/,Ir={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},vp=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function gp(a,e){return typeof a=="string"?_l(a):typeof a=="number"?yl(a,e):null}function yl(a,e){if(!Number.isFinite(a))return null;var t=Math.abs(a),s=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=!!(e&&e.fixedDecimals),l=e&&e.unit||"";(!l||!Ir[l.toLowerCase()])&&(t>=Ir.pb?l="PB":t>=Ir.tb?l="TB":t>=Ir.gb?l="GB":t>=Ir.mb?l="MB":t>=Ir.kb?l="KB":l="B");var u=a/Ir[l.toLowerCase()],c=u.toFixed(n);return o||(c=c.replace(mp,"$1")),s&&(c=c.split(".").map(function(f,p){return p===0?f.replace(pp,s):f}).join(".")),c+r+l}function _l(a){if(typeof a=="number"&&!isNaN(a))return a;if(typeof a!="string")return null;var e=vp.exec(a),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(a,10),s="b"),isNaN(t)?null:Math.floor(Ir[s]*t)}});var tn=z(rn=>{"use strict";var wl=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,yp=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,El=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_p=/\\([\u000b\u0020-\u00ff])/g,bp=/([\\"])/g,Pl=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;rn.format=xp;rn.parse=wp;function xp(a){if(!a||typeof a!="object")throw new TypeError("argument obj is required");var e=a.parameters,t=a.type;if(!t||!Pl.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var r,n=Object.keys(e).sort(),o=0;o<n.length;o++){if(r=n[o],!El.test(r))throw new TypeError("invalid parameter name");s+="; "+r+"="+Pp(e[r])}return s}function wp(a){if(!a)throw new TypeError("argument string is required");var e=typeof a=="object"?Ep(a):a;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(!Pl.test(s))throw new TypeError("invalid media type");var r=new Sp(s.toLowerCase());if(t!==-1){var n,o,l;for(wl.lastIndex=t;o=wl.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,n=o[1].toLowerCase(),l=o[2],l.charCodeAt(0)===34&&(l=l.slice(1,-1),l.indexOf("\\")!==-1&&(l=l.replace(_p,"$1"))),r.parameters[n]=l}if(t!==e.length)throw new TypeError("invalid parameter format")}return r}function Ep(a){var e;if(typeof a.getHeader=="function"?e=a.getHeader("content-type"):typeof a.headers=="object"&&(e=a.headers&&a.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function Pp(a){var e=String(a);if(El.test(e))return e;if(e.length>0&&!yp.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(bp,"\\$1")+'"'}function Sp(a){this.parameters=Object.create(null),this.type=a}});var Cl=z((Ig,Il)=>{Il.exports=Al;Al.sync=Tp;var Tl=require("fs");function Op(a,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 r=t[s].toLowerCase();if(r&&a.substr(-r.length).toLowerCase()===r)return!0}return!1}function $l(a,e,t){return!a.isSymbolicLink()&&!a.isFile()?!1:Op(e,t)}function Al(a,e,t){Tl.stat(a,function(s,r){t(s,s?!1:$l(r,a,e))})}function Tp(a,e){return $l(Tl.statSync(a),a,e)}});var Fl=z((Cg,Nl)=>{Nl.exports=Dl;Dl.sync=$p;var kl=require("fs");function Dl(a,e,t){kl.stat(a,function(s,r){t(s,s?!1:jl(r,e))})}function $p(a,e){return jl(kl.statSync(a),e)}function jl(a,e){return a.isFile()&&Ap(a,e)}function Ap(a,e){var t=a.mode,s=a.uid,r=a.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),f=l|u,p=t&c||t&u&&r===o||t&l&&s===n||t&f&&n===0;return p}});var Ml=z((Dg,Ll)=>{var kg=require("fs"),Ba;process.platform==="win32"||global.TESTING_WINDOWS?Ba=Cl():Ba=Fl();Ll.exports=an;an.sync=Ip;function an(a,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,r){an(a,e||{},function(n,o){n?r(n):s(o)})})}Ba(a,e||{},function(s,r){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,r=!1),t(s,r)})}function Ip(a,e){try{return Ba.sync(a,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Bl=z((jg,Zl)=>{var Rt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ql=require("path"),Cp=Rt?";":":",Ul=Ml(),zl=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),Vl=(a,e)=>{let t=e.colon||Cp,s=a.match(/\//)||Rt&&a.match(/\\/)?[""]:[...Rt?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],r=Rt?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Rt?r.split(t):[""];return Rt&&a.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:r}},Hl=(a,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:s,pathExt:r,pathExtExe:n}=Vl(a,e),o=[],l=c=>new Promise((f,p)=>{if(c===s.length)return e.all&&o.length?f(o):p(zl(a));let g=s[c],d=/^".*"$/.test(g)?g.slice(1,-1):g,y=ql.join(d,a),m=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+y:y;f(u(m,c,0))}),u=(c,f,p)=>new Promise((g,d)=>{if(p===r.length)return g(l(f+1));let y=r[p];Ul(c+y,{pathExt:n},(m,v)=>{if(!m&&v)if(e.all)o.push(c+y);else return g(c+y);return g(u(c,f,p+1))})});return t?l(0).then(c=>t(null,c),t):l(0)},kp=(a,e)=>{e=e||{};let{pathEnv:t,pathExt:s,pathExtExe:r}=Vl(a,e),n=[];for(let o=0;o<t.length;o++){let l=t[o],u=/^".*"$/.test(l)?l.slice(1,-1):l,c=ql.join(u,a),f=!u&&/^\.[\\\/]/.test(a)?a.slice(0,2)+c:c;for(let p=0;p<s.length;p++){let g=f+s[p];try{if(Ul.sync(g,{pathExt:r}))if(e.all)n.push(g);else return g}catch{}}}if(e.all&&n.length)return n;if(e.nothrow)return null;throw zl(a)};Zl.exports=Hl;Hl.sync=kp});var Ql=z((Ng,sn)=>{"use strict";var Jl=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};sn.exports=Jl;sn.exports.default=Jl});var Yl=z((Fg,Wl)=>{"use strict";var Kl=require("path"),Dp=Bl(),jp=Ql();function Gl(a,e){let t=a.options.env||process.env,s=process.cwd(),r=a.options.cwd!=null,n=r&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(a.options.cwd)}catch{}let o;try{o=Dp.sync(a.command,{path:t[jp({env:t})],pathExt:e?Kl.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return o&&(o=Kl.resolve(r?a.options.cwd:"",o)),o}function Np(a){return Gl(a)||Gl(a,!0)}Wl.exports=Np});var Xl=z((Lg,on)=>{"use strict";var nn=/([()\][%!^"`<>&|;, *?])/g;function Fp(a){return a=a.replace(nn,"^$1"),a}function Lp(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(nn,"^$1"),e&&(a=a.replace(nn,"^$1")),a}on.exports.command=Fp;on.exports.argument=Lp});var rc=z((Mg,ec)=>{"use strict";ec.exports=/^#!(.*)/});var ac=z((qg,tc)=>{"use strict";var Mp=rc();tc.exports=(a="")=>{let e=a.match(Mp);if(!e)return null;let[t,s]=e[0].replace(/#! ?/,"").split(" "),r=t.split("/").pop();return r==="env"?s:s?`${r} ${s}`:r}});var nc=z((Ug,sc)=>{"use strict";var ln=require("fs"),qp=ac();function Up(a){let t=Buffer.alloc(150),s;try{s=ln.openSync(a,"r"),ln.readSync(s,t,0,150,0),ln.closeSync(s)}catch{}return qp(t.toString())}sc.exports=Up});var cc=z((zg,lc)=>{"use strict";var zp=require("path"),oc=Yl(),ic=Xl(),Vp=nc(),Hp=process.platform==="win32",Zp=/\.(?:com|exe)$/i,Bp=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Jp(a){a.file=oc(a);let e=a.file&&Vp(a.file);return e?(a.args.unshift(a.file),a.command=e,oc(a)):a.file}function Qp(a){if(!Hp)return a;let e=Jp(a),t=!Zp.test(e);if(a.options.forceShell||t){let s=Bp.test(e);a.command=zp.normalize(a.command),a.command=ic.command(a.command),a.args=a.args.map(n=>ic.argument(n,s));let r=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${r}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function Kp(a,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let s={command:a,args:e,options:t,file:void 0,original:{command:a,args:e}};return t.shell?s:Qp(s)}lc.exports=Kp});var fc=z((Vg,dc)=>{"use strict";var cn=process.platform==="win32";function un(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function Gp(a,e){if(!cn)return;let t=a.emit;a.emit=function(s,r){if(s==="exit"){let n=uc(r,e);if(n)return t.call(a,"error",n)}return t.apply(a,arguments)}}function uc(a,e){return cn&&a===1&&!e.file?un(e.original,"spawn"):null}function Wp(a,e){return cn&&a===1&&!e.file?un(e.original,"spawnSync"):null}dc.exports={hookChildProcess:Gp,verifyENOENT:uc,verifyENOENTSync:Wp,notFoundError:un}});var mc=z((Hg,Ot)=>{"use strict";var hc=require("child_process"),dn=cc(),fn=fc();function pc(a,e,t){let s=dn(a,e,t),r=hc.spawn(s.command,s.args,s.options);return fn.hookChildProcess(r,s),r}function Yp(a,e,t){let s=dn(a,e,t),r=hc.spawnSync(s.command,s.args,s.options);return r.error=r.error||fn.verifyENOENTSync(r.status,s),r}Ot.exports=pc;Ot.exports.spawn=pc;Ot.exports.sync=Yp;Ot.exports._parse=dn;Ot.exports._enoent=fn});var jm={};Mn(jm,{CallToolRequestSchema:()=>Ps,Client:()=>za,ListRootsRequestSchema:()=>Ts,ListToolsRequestSchema:()=>ws,PingRequestSchema:()=>Pt,SSEServerTransport:()=>Za,Server:()=>Va,StdioClientTransport:()=>Qa,StdioServerTransport:()=>Ka,StreamableHTTPClientTransport:()=>es,StreamableHTTPServerTransport:()=>Ga,z:()=>i,zodToJsonSchema:()=>Rn});module.exports=Fu(jm);var i={};Mn(i,{BRAND:()=>cd,DIRTY:()=>Mr,EMPTY_PATH:()=>Uu,INVALID:()=>B,NEVER:()=>Jd,OK:()=>Te,ParseStatus:()=>Se,Schema:()=>G,ZodAny:()=>Sr,ZodArray:()=>gr,ZodBigInt:()=>Ur,ZodBoolean:()=>zr,ZodBranded:()=>Ft,ZodCatch:()=>Xr,ZodDate:()=>Vr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>da,ZodEffects:()=>Je,ZodEnum:()=>Gr,ZodError:()=>Ne,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>ha,ZodIntersection:()=>Jr,ZodIssueCode:()=>R,ZodLazy:()=>Qr,ZodLiteral:()=>Kr,ZodMap:()=>bt,ZodNaN:()=>wt,ZodNativeEnum:()=>Wr,ZodNever:()=>We,ZodNull:()=>Zr,ZodNullable:()=>or,ZodNumber:()=>qr,ZodObject:()=>Fe,ZodOptional:()=>Ze,ZodParsedType:()=>j,ZodPipeline:()=>Lt,ZodPromise:()=>Rr,ZodReadonly:()=>et,ZodRecord:()=>fa,ZodSchema:()=>G,ZodSet:()=>xt,ZodString:()=>Pr,ZodSymbol:()=>yt,ZodTransformer:()=>Je,ZodTuple:()=>nr,ZodType:()=>G,ZodUndefined:()=>Hr,ZodUnion:()=>Br,ZodUnknown:()=>vr,ZodVoid:()=>_t,addIssueToContext:()=>D,any:()=>yd,array:()=>wd,bigint:()=>hd,boolean:()=>Wn,coerce:()=>Bd,custom:()=>Qn,date:()=>pd,datetimeRegex:()=>Bn,defaultErrorMap:()=>pr,discriminatedUnion:()=>Rd,effect:()=>Ld,enum:()=>jd,function:()=>Cd,getErrorMap:()=>mt,getParsedType:()=>sr,instanceof:()=>dd,intersection:()=>Od,isAborted:()=>ca,isAsync:()=>vt,isDirty:()=>ua,isValid:()=>Er,late:()=>ud,lazy:()=>kd,literal:()=>Dd,makeIssue:()=>Nt,map:()=>Ad,nan:()=>fd,nativeEnum:()=>Nd,never:()=>bd,null:()=>gd,nullable:()=>qd,number:()=>Gn,object:()=>Ed,objectUtil:()=>cs,oboolean:()=>Zd,onumber:()=>Hd,optional:()=>Md,ostring:()=>Vd,pipeline:()=>zd,preprocess:()=>Ud,promise:()=>Fd,quotelessJson:()=>Lu,record:()=>$d,set:()=>Id,setErrorMap:()=>qu,strictObject:()=>Pd,string:()=>Kn,symbol:()=>md,transformer:()=>Ld,tuple:()=>Td,undefined:()=>vd,union:()=>Sd,unknown:()=>_d,util:()=>X,void:()=>xd});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(l=>typeof r[r[l]]!="number"),o={};for(let l of n)o[l]=r[l];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},a.find=(r,n)=>{for(let o of r)if(n(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var cs;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(cs||(cs={}));var j=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=a=>{switch(typeof a){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(a)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(a)?j.array:a===null?j.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?j.promise:typeof Map!="undefined"&&a instanceof Map?j.map:typeof Set!="undefined"&&a instanceof Set?j.set:typeof Date!="undefined"&&a instanceof Date?j.date:j.object;default:return j.unknown}};var R=X.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"]),Lu=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ne=class a 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:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let l=s,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(l[c]=l[c]||{_errors:[]},l[c]._errors.push(t(o))):l[c]=l[c]||{_errors:[]},l=l[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ne.create=a=>new Ne(a);var Mu=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===j.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},pr=Mu;var Un=pr;function qu(a){Un=a}function mt(){return Un}var Nt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let l="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)l=c(o,{data:e,defaultError:l}).message;return{...r,path:n,message:l}},Uu=[];function D(a,e){let t=mt(),s=Nt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{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 r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,o=await r.value;s.push({key:n,value:o})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return B;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Mr=a=>({status:"dirty",value:a}),Te=a=>({status:"valid",value:a}),ca=a=>a.status==="aborted",ua=a=>a.status==="dirty",Er=a=>a.status==="valid",vt=a=>typeof Promise!="undefined"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Be=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}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}},zn=(a,e)=>{if(Er(e))return{success:!0,data:e.value};if(!a.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 Ne(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;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:r}:{errorMap:(o,l)=>{var c,f;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u!=null?u:l.defaultError}:typeof l.data=="undefined"?{message:(c=u!=null?u:s)!=null?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(f=u!=null?u:t)!=null?f:l.defaultError}},description:r}}var G=class{get description(){return this._def.description}_getType(e){return sr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(vt(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:sr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return zn(s,r)}"~validate"(e){var s,r;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Er(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Er(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:sr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(vt(r)?r:Promise.resolve(r));return zn(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let o=e(r),l=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Je({schema:this,typeName:T.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 Ze.create(this,this._def)}nullable(){return or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gr.create(this)}promise(){return Rr.create(this,this._def)}or(e){return Br.create([this,e],this._def)}and(e){return Jr.create(this,e,this._def)}transform(e){return new Je({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Yr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Ft({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Xr({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Lt.create(this,e)}readonly(){return et.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zu=/^c[^\s-]{8,}$/i,Vu=/^[0-9a-z]+$/,Hu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zu=/^[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,Bu=/^[a-z0-9_-]{21}$/i,Ju=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qu=/^[-+]?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)?)??$/,Ku=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",us,Wu=/^(?:(?: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])$/,Yu=/^(?:(?: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])$/,Xu=/^(([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]))$/,ed=/^(([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])$/,rd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,td=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hn="((\\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])))",ad=new RegExp(`^${Hn}$`);function Zn(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function sd(a){return new RegExp(`^${Zn(a)}$`)}function Bn(a){let e=`${Hn}T${Zn(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function nd(a,e){return!!((e==="v4"||!e)&&Wu.test(a)||(e==="v6"||!e)&&Xu.test(a))}function od(a,e){if(!Ju.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function id(a,e){return!!((e==="v4"||!e)&&Yu.test(a)||(e==="v6"||!e)&&ed.test(a))}var Pr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.string,received:n.parsedType}),B}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.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&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.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,l=e.data.length<n.value;(o||l)&&(r=this._getOrReturnCtx(e,r),o?D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):l&&D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Ku.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")us||(us=new RegExp(Gu,"u")),us.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Zu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Bu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")zu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Vu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Hu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),D(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"regex",code:R.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)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.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)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Bn(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?ad.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?sd(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Qu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?nd(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?od(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?id(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?rd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?td.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...V.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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}};Pr.create=a=>{var e;return new Pr({checks:[],typeName:T.ZodString,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};function ld(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}var qr=class a extends G{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)!==j.number){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.number,received:n.parsedType}),B}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ld(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.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"&&X.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)}};qr.create=a=>new qr({checks:[],typeName:T.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Ur=class a extends G{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)!==j.bigint)return this._getInvalidInput(e);let s,r=new Se;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),D(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.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}};Ur.create=a=>{var e;return new Ur({checks:[],typeName:T.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};var zr=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.boolean,received:s.parsedType}),B}return Te(e.data)}};zr.create=a=>new zr({typeName:T.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Vr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_date}),B}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.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}};Vr.create=a=>new Vr({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:T.ZodDate,...Q(a)});var yt=class extends G{_parse(e){if(this._getType(e)!==j.symbol){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.symbol,received:s.parsedType}),B}return Te(e.data)}};yt.create=a=>new yt({typeName:T.ZodSymbol,...Q(a)});var Hr=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.undefined,received:s.parsedType}),B}return Te(e.data)}};Hr.create=a=>new Hr({typeName:T.ZodUndefined,...Q(a)});var Zr=class extends G{_parse(e){if(this._getType(e)!==j.null){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.null,received:s.parsedType}),B}return Te(e.data)}};Zr.create=a=>new Zr({typeName:T.ZodNull,...Q(a)});var Sr=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Te(e.data)}};Sr.create=a=>new Sr({typeName:T.ZodAny,...Q(a)});var vr=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Te(e.data)}};vr.create=a=>new vr({typeName:T.ZodUnknown,...Q(a)});var We=class extends G{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.never,received:t.parsedType}),B}};We.create=a=>new We({typeName:T.ZodNever,...Q(a)});var _t=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.void,received:s.parsedType}),B}return Te(e.data)}};_t.create=a=>new _t({typeName:T.ZodVoid,...Q(a)});var gr=class a extends G{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==j.array)return D(t,{code:R.invalid_type,expected:j.array,received:t.parsedType}),B;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,l=t.data.length<r.exactLength.value;(o||l)&&(D(t,{code:o?R.too_big:R.too_small,minimum:l?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(D(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(D(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>r.type._parseAsync(new Be(t,o,t.path,l)))).then(o=>Se.mergeArray(s,o));let n=[...t.data].map((o,l)=>r.type._parseSync(new Be(t,o,t.path,l)));return Se.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};gr.create=(a,e)=>new gr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function gt(a){if(a instanceof Fe){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(gt(s))}return new Fe({...a._def,shape:()=>e})}else return a instanceof gr?new gr({...a._def,type:gt(a.element)}):a instanceof Ze?Ze.create(gt(a.unwrap())):a instanceof or?or.create(gt(a.unwrap())):a instanceof nr?nr.create(a.items.map(e=>gt(e))):a}var Fe=class a extends G{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=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return D(c,{code:R.invalid_type,expected:j.object,received:c.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let c in r.data)o.includes(c)||l.push(c);let u=[];for(let c of o){let f=n[c],p=r.data[c];u.push({key:{status:"valid",value:c},value:f._parse(new Be(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof We){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of l)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(c==="strict")l.length>0&&(D(r,{code:R.unrecognized_keys,keys:l}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of l){let p=r.data[f];u.push({key:{status:"valid",value:f},value:c._parse(new Be(r,p,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of u){let p=await f.key,g=await f.value;c.push({key:p,value:g,alwaysSet:f.alwaysSet})}return c}).then(c=>Se.mergeObjectSync(s,c)):Se.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,l,u;let r=(l=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?l:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return gt(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Jn(X.objectKeys(this.shape))}};Fe.create=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.strictCreate=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.lazycreate=(a,e)=>new Fe({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});var Br=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let l of n)if(l.result.status==="valid")return l.result;for(let l of n)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let o=n.map(l=>new Ne(l.ctx.common.issues));return D(t,{code:R.invalid_union,unionErrors:o}),B}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(r);{let n,o=[];for(let u of s){let c={...t,common:{...t.common,issues:[]},parent:null},f=u._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let l=o.map(u=>new Ne(u));return D(t,{code:R.invalid_union,unionErrors:l}),B}}get options(){return this._def.options}};Br.create=(a,e)=>new Br({options:a,typeName:T.ZodUnion,...Q(e)});var mr=a=>a instanceof Qr?mr(a.schema):a instanceof Je?mr(a.innerType()):a instanceof Kr?[a.value]:a instanceof Gr?a.options:a instanceof Wr?X.objectValues(a.enum):a instanceof Yr?mr(a._def.innerType):a instanceof Hr?[void 0]:a instanceof Zr?[null]:a instanceof Ze?[void 0,...mr(a.unwrap())]:a instanceof or?[null,...mr(a.unwrap())]:a instanceof Ft||a instanceof et?mr(a.unwrap()):a instanceof Xr?mr(a._def.innerType):[],da=class a extends G{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return D(t,{code:R.invalid_type,expected:j.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);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}):(D(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let o=mr(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 l of o){if(r.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);r.set(l,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function ds(a,e){let t=sr(a),s=sr(e);if(a===e)return{valid:!0,data:a};if(t===j.object&&s===j.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(l=>r.indexOf(l)!==-1),o={...a,...e};for(let l of n){let u=ds(a[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===j.array&&s===j.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let o=a[n],l=e[n],u=ds(o,l);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===j.date&&s===j.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Jr=class extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(ca(n)||ca(o))return B;let l=ds(n.value,o.value);return l.valid?((ua(n)||ua(o))&&t.dirty(),{status:t.value,value:l.data}):(D(s,{code:R.invalid_intersection_types}),B)};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])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Jr.create=(a,e,t)=>new Jr({left:a,right:e,typeName:T.ZodIntersection,...Q(t)});var nr=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.array)return D(s,{code:R.invalid_type,expected:j.array,received:s.parsedType}),B;if(s.data.length<this._def.items.length)return D(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Be(s,o,s.path,l)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Se.mergeArray(t,o)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};nr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nr({items:a,typeName:T.ZodTuple,rest:null,...Q(e)})};var fa=class a extends G{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!==j.object)return D(s,{code:R.invalid_type,expected:j.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,o=this._def.valueType;for(let l in s.data)r.push({key:n._parse(new Be(s,l,s.path,l)),value:o._parse(new Be(s,s.data[l],s.path,l)),alwaysSet:l in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof G?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(s)}):new a({keyType:Pr.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},bt=class extends G{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!==j.map)return D(s,{code:R.invalid_type,expected:j.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([l,u],c)=>({key:r._parse(new Be(s,l,s.path,[c,"key"])),value:n._parse(new Be(s,u,s.path,[c,"value"]))}));if(s.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,f=await u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),l.set(c.value,f.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let u of o){let c=u.key,f=u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),l.set(c.value,f.value)}return{status:t.value,value:l}}}};bt.create=(a,e,t)=>new bt({valueType:e,keyType:a,typeName:T.ZodMap,...Q(t)});var xt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.set)return D(s,{code:R.invalid_type,expected:j.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(D(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(D(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function o(u){let c=new Set;for(let f of u){if(f.status==="aborted")return B;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}let l=[...s.data.values()].map((u,c)=>n._parse(new Be(s,u,s.path,c)));return s.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};xt.create=(a,e)=>new xt({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var ha=class a extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return D(t,{code:R.invalid_type,expected:j.function,received:t.parsedType}),B;function s(l,u){return Nt({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),pr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:u}})}function r(l,u){return Nt({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),pr].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:u}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Rr){let l=this;return Te(async function(...u){let c=new Ne([]),f=await l._def.args.parseAsync(u,n).catch(d=>{throw c.addIssue(s(u,d)),c}),p=await Reflect.apply(o,this,f);return await l._def.returns._def.type.parseAsync(p,n).catch(d=>{throw c.addIssue(r(p,d)),c})})}else{let l=this;return Te(function(...u){let c=l._def.args.safeParse(u,n);if(!c.success)throw new Ne([s(u,c.error)]);let f=Reflect.apply(o,this,c.data),p=l._def.returns.safeParse(f,n);if(!p.success)throw new Ne([r(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:nr.create(e).rest(vr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||nr.create([]).rest(vr.create()),returns:t||vr.create(),typeName:T.ZodFunction,...Q(s)})}},Qr=class extends G{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})}};Qr.create=(a,e)=>new Qr({getter:a,typeName:T.ZodLazy,...Q(e)});var Kr=class extends G{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};Kr.create=(a,e)=>new Kr({value:a,typeName:T.ZodLiteral,...Q(e)});function Jn(a,e){return new Gr({values:a,typeName:T.ZodEnum,...Q(e)})}var Gr=class a extends G{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:X.joinValues(s),received:t.parsedType,code:R.invalid_type}),B}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 D(t,{received:t.data,code:R.invalid_enum_value,options:s}),B}return Te(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 a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Gr.create=Jn;var Wr=class extends G{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==j.string&&s.parsedType!==j.number){let r=X.objectValues(t);return D(s,{expected:X.joinValues(r),received:s.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return D(s,{received:s.data,code:R.invalid_enum_value,options:r}),B}return Te(e.data)}get enum(){return this._def.values}};Wr.create=(a,e)=>new Wr({values:a,typeName:T.ZodNativeEnum,...Q(e)});var Rr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return D(t,{code:R.invalid_type,expected:j.promise,received:t.parsedType}),B;let s=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return Te(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Rr.create=(a,e)=>new Rr({type:a,typeName:T.ZodPromise,...Q(e)});var Je=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{D(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async l=>{if(t.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return u.status==="aborted"?B:u.status==="dirty"?Mr(u.value):t.value==="dirty"?Mr(u.value):u});{if(t.value==="aborted")return B;let l=this._def.schema._parseSync({data:o,path:s.path,parent:s});return l.status==="aborted"?B:l.status==="dirty"?Mr(l.value):t.value==="dirty"?Mr(l.value):l}}if(r.type==="refinement"){let o=l=>{let u=r.refinement(l,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(r.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Er(o))return B;let l=r.transform(o.value,n);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Er(o)?Promise.resolve(r.transform(o.value,n)).then(l=>({status:t.value,value:l})):B);X.assertNever(r)}};Je.create=(a,e,t)=>new Je({schema:a,typeName:T.ZodEffects,effect:e,...Q(t)});Je.createWithPreprocess=(a,e,t)=>new Je({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...Q(t)});var Ze=class extends G{_parse(e){return this._getType(e)===j.undefined?Te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:T.ZodOptional,...Q(e)});var or=class extends G{_parse(e){return this._getType(e)===j.null?Te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:T.ZodNullable,...Q(e)});var Yr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===j.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(a,e)=>new Yr({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Xr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return vt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var wt=class extends G{_parse(e){if(this._getType(e)!==j.nan){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};wt.create=a=>new wt({typeName:T.ZodNaN,...Q(a)});var cd=Symbol("zod_brand"),Ft=class extends G{_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}},Lt=class a extends G{_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"?B:n.status==="dirty"?(t.dirty(),Mr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:T.ZodPipeline})}},et=class extends G{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Er(r)&&(r.value=Object.freeze(r.value)),r);return vt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};et.create=(a,e)=>new et({innerType:a,typeName:T.ZodReadonly,...Q(e)});function Vn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Qn(a,e={},t){return a?Sr.create().superRefine((s,r)=>{var o,l;let n=a(s);if(n instanceof Promise)return n.then(u=>{var c,f;if(!u){let p=Vn(e,s),g=(f=(c=p.fatal)!=null?c:t)!=null?f:!0;r.addIssue({code:"custom",...p,fatal:g})}});if(!n){let u=Vn(e,s),c=(l=(o=u.fatal)!=null?o:t)!=null?l:!0;r.addIssue({code:"custom",...u,fatal:c})}}):Sr.create()}var ud={object:Fe.lazycreate},T;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(T||(T={}));var dd=(a,e={message:`Input not instance of ${a.name}`})=>Qn(t=>t instanceof a,e),Kn=Pr.create,Gn=qr.create,fd=wt.create,hd=Ur.create,Wn=zr.create,pd=Vr.create,md=yt.create,vd=Hr.create,gd=Zr.create,yd=Sr.create,_d=vr.create,bd=We.create,xd=_t.create,wd=gr.create,Ed=Fe.create,Pd=Fe.strictCreate,Sd=Br.create,Rd=da.create,Od=Jr.create,Td=nr.create,$d=fa.create,Ad=bt.create,Id=xt.create,Cd=ha.create,kd=Qr.create,Dd=Kr.create,jd=Gr.create,Nd=Wr.create,Fd=Rr.create,Ld=Je.create,Md=Ze.create,qd=or.create,Ud=Je.createWithPreprocess,zd=Lt.create,Vd=()=>Kn().optional(),Hd=()=>Gn().optional(),Zd=()=>Wn().optional(),Bd={string:a=>Pr.create({...a,coerce:!0}),number:a=>qr.create({...a,coerce:!0}),boolean:a=>zr.create({...a,coerce:!0}),bigint:a=>Ur.create({...a,coerce:!0}),date:a=>Vr.create({...a,coerce:!0})};var Jd=B;var Or="2025-06-18",Yn="2025-03-26",rt=[Or,"2025-03-26","2024-11-05","2024-10-07"],pa="2.0",Xn=i.union([i.string(),i.number().int()]),eo=i.string(),Qd=i.object({progressToken:i.optional(Xn)}).passthrough(),Qe=i.object({_meta:i.optional(Qd)}).passthrough(),Le=i.object({method:i.string(),params:i.optional(Qe)}),Mt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),ir=i.object({method:i.string(),params:i.optional(Mt)}),Ke=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),ma=i.union([i.string(),i.number().int()]),ro=i.object({jsonrpc:i.literal(pa),id:ma}).merge(Le).strict(),tt=a=>ro.safeParse(a).success,to=i.object({jsonrpc:i.literal(pa)}).merge(ir).strict(),ao=a=>to.safeParse(a).success,so=i.object({jsonrpc:i.literal(pa),id:ma,result:Ke}).strict(),yr=a=>so.safeParse(a).success,ke;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(ke||(ke={}));var no=i.object({jsonrpc:i.literal(pa),id:ma,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),Et=a=>no.safeParse(a).success,Ye=i.union([ro,to,so,no]),_r=Ke.strict(),va=ir.extend({method:i.literal("notifications/cancelled"),params:Mt.extend({requestId:ma,reason:i.string().optional()})}),qt=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),oo=qt.extend({version:i.string()}),Kd=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),ga=Le.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:Kd,clientInfo:oo})}),io=a=>ga.safeParse(a).success,Gd=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),fs=Ke.extend({protocolVersion:i.string(),capabilities:Gd,serverInfo:oo,instructions:i.optional(i.string())}),ya=ir.extend({method:i.literal("notifications/initialized")}),lo=a=>ya.safeParse(a).success,Pt=Le.extend({method:i.literal("ping")}),Wd=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),_a=ir.extend({method:i.literal("notifications/progress"),params:Mt.merge(Wd).extend({progressToken:Xn})}),ba=Le.extend({params:Qe.extend({cursor:i.optional(eo)}).optional()}),xa=Ke.extend({nextCursor:i.optional(eo)}),co=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),uo=co.extend({text:i.string()}),hs=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),fo=co.extend({blob:hs}),ho=qt.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Yd=qt.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Xd=ba.extend({method:i.literal("resources/list")}),ps=xa.extend({resources:i.array(ho)}),ef=ba.extend({method:i.literal("resources/templates/list")}),ms=xa.extend({resourceTemplates:i.array(Yd)}),rf=Le.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),vs=Ke.extend({contents:i.array(i.union([uo,fo]))}),tf=ir.extend({method:i.literal("notifications/resources/list_changed")}),af=Le.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),sf=Le.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),nf=ir.extend({method:i.literal("notifications/resources/updated"),params:Mt.extend({uri:i.string()})}),of=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),lf=qt.extend({description:i.optional(i.string()),arguments:i.optional(i.array(of)),_meta:i.optional(i.object({}).passthrough())}),cf=ba.extend({method:i.literal("prompts/list")}),gs=xa.extend({prompts:i.array(lf)}),uf=Le.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),ys=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),_s=i.object({type:i.literal("image"),data:hs,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),bs=i.object({type:i.literal("audio"),data:hs,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),df=i.object({type:i.literal("resource"),resource:i.union([uo,fo]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ff=ho.extend({type:i.literal("resource_link")}),po=i.union([ys,_s,bs,ff,df]),hf=i.object({role:i.enum(["user","assistant"]),content:po}).passthrough(),xs=Ke.extend({description:i.optional(i.string()),messages:i.array(hf)}),pf=ir.extend({method:i.literal("notifications/prompts/list_changed")}),mf=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),vf=qt.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(mf),_meta:i.optional(i.object({}).passthrough())}),ws=ba.extend({method:i.literal("tools/list")}),Es=xa.extend({tools:i.array(vf)}),wa=Ke.extend({content:i.array(po).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),yv=wa.or(Ke.extend({toolResult:i.unknown()})),Ps=Le.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),gf=ir.extend({method:i.literal("notifications/tools/list_changed")}),mo=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),yf=Le.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:mo})}),_f=ir.extend({method:i.literal("notifications/message"),params:Mt.extend({level:mo,logger:i.optional(i.string()),data:i.unknown()})}),bf=i.object({name:i.string().optional()}).passthrough(),xf=i.object({hints:i.optional(i.array(bf)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),wf=i.object({role:i.enum(["user","assistant"]),content:i.union([ys,_s,bs])}).passthrough(),Ef=Le.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(wf),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(xf)})}),Ss=Ke.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[ys,_s,bs])}),Pf=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),Sf=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),Rf=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),Of=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),Tf=i.union([Pf,Sf,Rf,Of]),$f=Le.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),Tf),required:i.optional(i.array(i.string()))}).passthrough()})}),Rs=Ke.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),Af=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var If=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),Cf=Le.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([If,Af]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),Os=Ke.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),kf=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ts=Le.extend({method:i.literal("roots/list")}),$s=Ke.extend({roots:i.array(kf)}),Df=ir.extend({method:i.literal("notifications/roots/list_changed")}),_v=i.union([Pt,ga,Cf,yf,uf,cf,Xd,ef,rf,af,sf,Ps,ws]),bv=i.union([va,_a,ya,Df]),xv=i.union([_r,Ss,Rs,$s]),wv=i.union([Pt,Ef,$f,Ts]),Ev=i.union([va,_a,_f,nf,tf,gf,pf]),Pv=i.union([_r,fs,Os,xs,gs,ps,ms,vs,wa,Es]),$e=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var jf=6e4,St=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(va,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(_a,t=>{this._onprogress(t)}),this.setRequestHandler(Pt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_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 $e(ke.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,r;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=u=>{o==null||o(u),this._onerror(u)};let l=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,c)=>{l==null||l(u,c),yr(u)||Et(u)?this._onresponse(u):tt(u)?this._onrequest(u,c):ao(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},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 $e(ke.ConnectionClosed,"Connection closed");for(let r of t.values())r(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(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;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:ke.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let u={signal:l.signal,sessionId:o==null?void 0:o.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,f,p)=>this.request(c,f,{...p,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,u)).then(c=>{if(!l.signal.aborted)return o==null?void 0:o.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var f;if(!l.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:ke.InternalError,message:(f=c.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(r),l=this._timeoutInfo.get(r);if(l&&o&&l.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){o(u);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),yr(e))s(e);else{let r=new $e(e.error.code,e.error.message,e.error.data);s(r)}}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:r,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((l,u)=>{var c,f,p,g,d,y;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=s==null?void 0:s.signal)===null||f===void 0||f.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};s!=null&&s.onprogress&&(this._progressHandlers.set(m,s.onprogress),v.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:m}});let x=O=>{var A;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),u(O)};this._responseHandlers.set(m,O=>{var A;if(!(!((A=s==null?void 0:s.signal)===null||A===void 0)&&A.aborted)){if(O instanceof Error)return u(O);try{let I=t.parse(O.result);l(I)}catch(I){u(I)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var O;x((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let S=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:jf,P=()=>x(new $e(ke.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,s==null?void 0:s.maxTotalTimeout,P,(y=s==null?void 0:s.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(m),u(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).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 u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,t).catch(f=>this._onerror(f))});return}let l={...e,jsonrpc:"2.0"};await this._transport.send(l,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),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 Ea(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var vl=hr(en(),1),za=class extends St{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 vl.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ea(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:Or,capabilities:this._capabilities,clientInfo:this._clientInfo}},fs,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!rt.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,r,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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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"},_r,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Os,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},_r,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},xs,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},gs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ps,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},ms,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},vs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},_r,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},_r,t)}async callTool(e,t=wa,s){let r=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new $e(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new $e(ke.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof $e?o:new $e(ke.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}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},Es,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var gl=hr(en(),1),Va=class extends St{constructor(e,t){var s;super(t),this._serverInfo=e,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(ga,r=>this._oninitialize(r)),this.setNotificationHandler(ya,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ea(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;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(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.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:rt.includes(t)?t: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"},_r)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ss,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Rs,t);if(s.action==="accept"&&s.content)try{let r=new gl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new $e(ke.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof $e?r:new $e(ke.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},$s,t)}async sendLoggingMessage(e){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 Sl=require("node:crypto");var xl=hr(bl());function zt(a,{limit:e,encoding:t}){let s=xl.default.parse(e);return new Promise((r,n)=>{let o=0,l=[];a.on("data",u=>{if(o+=u.length,o>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));l.push(u)}),a.on("end",()=>{try{r(Buffer.concat(l).toString(t))}catch(u){n(u)}}),a.on("error",u=>{n(u)})})}var Rl=hr(tn(),1),Ol=require("url"),Rp="4mb",Za=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,Sl.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 Ol.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
2
2
  data: ${s}
3
3
 
4
- `),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,o,l;if(!this._sseResponse){let g="SSE connection not established";throw t.writeHead(500).end(g),new Error(g)}let u=this.validateRequestHeaders(e);if(u){t.writeHead(403).end(u),(r=this.onerror)===null||r===void 0||r.call(this,new Error(u));return}let c=e.auth,h={headers:e.headers},p;try{let g=dl.default.parse((n=e.headers["content-type"])!==null&&n!==void 0?n:"");if(g.type!=="application/json")throw new Error(`Unsupported content-type: ${g.type}`);p=s!=null?s:await Mt(e,{limit:Ph,encoding:(o=g.parameters.charset)!==null&&o!==void 0?o:"utf-8"})}catch(g){t.writeHead(400).end(String(g)),(l=this.onerror)===null||l===void 0||l.call(this,g);return}try{await this.handleMessage(typeof p=="string"?JSON.parse(p):p,{requestInfo:h,authInfo:c})}catch{t.writeHead(400).end(`Invalid message: ${p}`);return}t.writeHead(202).end("Accepted")}async handleMessage(e,t){var s,r;let n;try{n=Ye.parse(e)}catch(o){throw(s=this.onerror)===null||s===void 0||s.call(this,o),o}(r=this.onmessage)===null||r===void 0||r.call(this,n,t)}async close(){var e,t;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(t=this.onclose)===null||t===void 0||t.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
4
+ `),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,o,l;if(!this._sseResponse){let g="SSE connection not established";throw t.writeHead(500).end(g),new Error(g)}let u=this.validateRequestHeaders(e);if(u){t.writeHead(403).end(u),(r=this.onerror)===null||r===void 0||r.call(this,new Error(u));return}let c=e.auth,f={headers:e.headers},p;try{let g=Rl.default.parse((n=e.headers["content-type"])!==null&&n!==void 0?n:"");if(g.type!=="application/json")throw new Error(`Unsupported content-type: ${g.type}`);p=s!=null?s:await zt(e,{limit:Rp,encoding:(o=g.parameters.charset)!==null&&o!==void 0?o:"utf-8"})}catch(g){t.writeHead(400).end(String(g)),(l=this.onerror)===null||l===void 0||l.call(this,g);return}try{await this.handleMessage(typeof p=="string"?JSON.parse(p):p,{requestInfo:f,authInfo:c})}catch{t.writeHead(400).end(`Invalid message: ${p}`);return}t.writeHead(202).end("Accepted")}async handleMessage(e,t){var s,r;let n;try{n=Ye.parse(e)}catch(o){throw(s=this.onerror)===null||s===void 0||s.call(this,o),o}(r=this.onmessage)===null||r===void 0||r.call(this,n,t)}async close(){var e,t;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(t=this.onclose)===null||t===void 0||t.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
5
5
  data: ${JSON.stringify(e)}
6
6
 
7
- `)}get sessionId(){return this._sessionId}};var Ws=Lr(require("node:process"),1);var za=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
8
- `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),wh(t)}clear(){this._buffer=void 0}};function wh(a){return Ye.parse(JSON.parse(a))}function hl(a){return JSON.stringify(a)+`
9
- `}var Va=class{constructor(e=Ws.default.stdin,t=Ws.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new za,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}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,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(){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(t=>{let s=hl(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var pl=Lr(Gs(),1),ml=require("node:crypto"),Eh="4mb",Ha=class{constructor(e){var t,s;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=(t=e.enableJsonResponse)!==null&&t!==void 0?t:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(s=e.enableDnsRebindingProtection)!==null&&s!==void 0?s:!1}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 t=e.headers.host;if(!t||!this._allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async handleRequest(e,t,s){var r;let n=this.validateRequestHeaders(e);if(n){t.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:n},id:null})),(r=this.onerror)===null||r===void 0||r.call(this,new Error(n));return}e.method==="POST"?await this.handlePostRequest(e,t,s):e.method==="GET"?await this.handleGetRequest(e,t):e.method==="DELETE"?await this.handleDeleteRequest(e,t):await this.handleUnsupportedRequest(t)}async handleGetRequest(e,t){let s=e.headers.accept;if(!(s!=null&&s.includes("text/event-stream"))){t.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,t)||!this.validateProtocolVersion(e,t))return;if(this._eventStore){let n=e.headers["last-event-id"];if(n){await this.replayEvents(n,t);return}}let r={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(r["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){t.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}t.writeHead(200,r).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,t),t.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)})}async replayEvents(e,t){var s,r;if(this._eventStore)try{let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(n["mcp-session-id"]=this.sessionId),t.writeHead(200,n).flushHeaders();let o=await((s=this._eventStore)===null||s===void 0?void 0:s.replayEventsAfter(e,{send:async(l,u)=>{var c;this.writeSSEEvent(t,u,l)||((c=this.onerror)===null||c===void 0||c.call(this,new Error("Failed replay events")),t.end())}}));this._streamMapping.set(o,t)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}writeSSEEvent(e,t,s){let r=`event: message
7
+ `)}get sessionId(){return this._sessionId}};var vc=hr(mc(),1),Vt=hr(require("node:process"),1),gc=require("node:stream");var Tt=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
8
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Xp(t)}clear(){this._buffer=void 0}};function Xp(a){return Ye.parse(JSON.parse(a))}function Ja(a){return JSON.stringify(a)+`
9
+ `}var em=Vt.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function rm(){let a={};for(let e of em){let t=Vt.default.env[e];t!==void 0&&(t.startsWith("()")||(a[e]=t))}return a}var Qa=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Tt,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new gc.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,r,n,o,l;this._process=(0,vc.default)(this._serverParams.command,(s=this._serverParams.args)!==null&&s!==void 0?s:[],{env:{...rm(),...this._serverParams.env},stdio:["pipe","pipe",(r=this._serverParams.stderr)!==null&&r!==void 0?r:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Vt.default.platform==="win32"&&tm(),cwd:this._serverParams.cwd}),this._process.on("error",u=>{var c,f;if(u.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}t(u),(f=this.onerror)===null||f===void 0||f.call(this,u)}),this._process.on("spawn",()=>{e()}),this._process.on("close",u=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(n=this._process.stdin)===null||n===void 0||n.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),(o=this._process.stdout)===null||o===void 0||o.on("data",u=>{this._readBuffer.append(u),this.processReadBuffer()}),(l=this._process.stdout)===null||l===void 0||l.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),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 r=Ja(e);this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};function tm(){return"type"in Vt.default}var hn=hr(require("node:process"),1);var Ka=class{constructor(e=hn.default.stdin,t=hn.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Tt,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}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,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(){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(t=>{let s=Ja(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var yc=hr(tn(),1),_c=require("node:crypto"),am="4mb",Ga=class{constructor(e){var t,s;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=(t=e.enableJsonResponse)!==null&&t!==void 0?t:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(s=e.enableDnsRebindingProtection)!==null&&s!==void 0?s:!1}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 t=e.headers.host;if(!t||!this._allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async handleRequest(e,t,s){var r;let n=this.validateRequestHeaders(e);if(n){t.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:n},id:null})),(r=this.onerror)===null||r===void 0||r.call(this,new Error(n));return}e.method==="POST"?await this.handlePostRequest(e,t,s):e.method==="GET"?await this.handleGetRequest(e,t):e.method==="DELETE"?await this.handleDeleteRequest(e,t):await this.handleUnsupportedRequest(t)}async handleGetRequest(e,t){let s=e.headers.accept;if(!(s!=null&&s.includes("text/event-stream"))){t.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,t)||!this.validateProtocolVersion(e,t))return;if(this._eventStore){let n=e.headers["last-event-id"];if(n){await this.replayEvents(n,t);return}}let r={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(r["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){t.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}t.writeHead(200,r).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,t),t.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)})}async replayEvents(e,t){var s,r;if(this._eventStore)try{let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(n["mcp-session-id"]=this.sessionId),t.writeHead(200,n).flushHeaders();let o=await((s=this._eventStore)===null||s===void 0?void 0:s.replayEventsAfter(e,{send:async(l,u)=>{var c;this.writeSSEEvent(t,u,l)||((c=this.onerror)===null||c===void 0||c.call(this,new Error("Failed replay events")),t.end())}}));this._streamMapping.set(o,t)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}writeSSEEvent(e,t,s){let r=`event: message
10
10
  `;return s&&(r+=`id: ${s}
11
11
  `),r+=`data: ${JSON.stringify(t)}
12
12
 
13
- `,e.write(r)}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 r,n,o,l,u;try{let c=e.headers.accept;if(!(c!=null&&c.includes("application/json"))||!c.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 h=e.headers["content-type"];if(!h||!h.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 p=e.auth,g={headers:e.headers},d;if(s!==void 0)d=s;else{let x=pl.default.parse(h),S=await Mt(e,{limit:Eh,encoding:(r=x.parameters.charset)!==null&&r!==void 0?r:"utf-8"});d=JSON.parse(S.toString())}let _;Array.isArray(d)?_=d.map(x=>Ye.parse(x)):_=[Ye.parse(d)];let m=_.some(Bn);if(m){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(_.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(!m&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let v=_.some(tt);if(v){if(v){let x=(0,ml.randomUUID)();if(!this._enableJsonResponse){let S={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(S["mcp-session-id"]=this.sessionId),t.writeHead(200,S)}for(let S of _)tt(S)&&(this._streamMapping.set(x,t),this._requestToStreamMapping.set(S.id,x));t.on("close",()=>{this._streamMapping.delete(x)});for(let S of _)(l=this.onmessage)===null||l===void 0||l.call(this,S,{authInfo:p,requestInfo:g})}}else{t.writeHead(202).end();for(let x of _)(o=this.onmessage)===null||o===void 0||o.call(this,x,{authInfo:p,requestInfo:g})}}catch(c){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(c)},id:null})),(u=this.onerror)===null||u===void 0||u.call(this,c)}}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 r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Fn;return Array.isArray(r)&&(r=r[r.length-1]),rt.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${rt.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((gr(e)||wt(e))&&(s=e.id),s===void 0){if(gr(e)||wt(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 l;this._eventStore&&(l=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(o,e,l);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,o)}if(gr(e)||wt(e)){this._requestResponseMap.set(s,e);let o=Array.from(this._requestToStreamMapping.entries()).filter(([u,c])=>this._streamMapping.get(c)===n).map(([u])=>u);if(o.every(u=>this._requestResponseMap.has(u))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let u={"Content-Type":"application/json"};this.sessionId!==void 0&&(u["mcp-session-id"]=this.sessionId);let c=o.map(h=>this._requestResponseMap.get(h));n.writeHead(200,u),c.length===1?n.end(JSON.stringify(c[0])):n.end(JSON.stringify(c))}else n.end();for(let u of o)this._requestResponseMap.delete(u),this._requestToStreamMapping.delete(u)}}}};var Ys,vl,gl,yl;Ys=(yl=(gl=(vl=globalThis.crypto)==null?void 0:vl.webcrypto)!=null?gl:globalThis.crypto)!=null?yl:import("node:crypto").then(a=>a.webcrypto);async function Sh(a){return(await Ys).getRandomValues(new Uint8Array(a))}async function Rh(a){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await Sh(a);for(let r=0;r<a;r++){let n=s[r]%e.length;t+=e[n]}return t}async function Oh(a){return await Rh(a)}async function Th(a){let e=await(await Ys).subtle.digest("SHA-256",new TextEncoder().encode(a));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Xs(a){if(a||(a=43),a<43||a>128)throw`Expected a length between 43 and 128. Received ${a}.`;let e=await Oh(a),t=await Th(e);return{code_verifier:e,code_challenge:t}}var _l=i.object({resource:i.string().url(),authorization_servers:i.array(i.string().url()).optional(),jwks_uri:i.string().url().optional(),scopes_supported:i.array(i.string()).optional(),bearer_methods_supported:i.array(i.string()).optional(),resource_signing_alg_values_supported:i.array(i.string()).optional(),resource_name:i.string().optional(),resource_documentation:i.string().optional(),resource_policy_uri:i.string().url().optional(),resource_tos_uri:i.string().url().optional(),tls_client_certificate_bound_access_tokens:i.boolean().optional(),authorization_details_types_supported:i.array(i.string()).optional(),dpop_signing_alg_values_supported:i.array(i.string()).optional(),dpop_bound_access_tokens_required:i.boolean().optional()}).passthrough(),en=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),revocation_endpoint:i.string().optional(),revocation_endpoint_auth_methods_supported:i.array(i.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),introspection_endpoint:i.string().optional(),introspection_endpoint_auth_methods_supported:i.array(i.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),code_challenge_methods_supported:i.array(i.string()).optional()}).passthrough(),$h=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),userinfo_endpoint:i.string().optional(),jwks_uri:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),acr_values_supported:i.array(i.string()).optional(),subject_types_supported:i.array(i.string()),id_token_signing_alg_values_supported:i.array(i.string()),id_token_encryption_alg_values_supported:i.array(i.string()).optional(),id_token_encryption_enc_values_supported:i.array(i.string()).optional(),userinfo_signing_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_enc_values_supported:i.array(i.string()).optional(),request_object_signing_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_enc_values_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),display_values_supported:i.array(i.string()).optional(),claim_types_supported:i.array(i.string()).optional(),claims_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),claims_locales_supported:i.array(i.string()).optional(),ui_locales_supported:i.array(i.string()).optional(),claims_parameter_supported:i.boolean().optional(),request_parameter_supported:i.boolean().optional(),request_uri_parameter_supported:i.boolean().optional(),require_request_uri_registration:i.boolean().optional(),op_policy_uri:i.string().optional(),op_tos_uri:i.string().optional()}).passthrough(),bl=$h.merge(en.pick({code_challenge_methods_supported:!0})),rn=i.object({access_token:i.string(),id_token:i.string().optional(),token_type:i.string(),expires_in:i.number().optional(),scope:i.string().optional(),refresh_token:i.string().optional()}).strip(),xl=i.object({error:i.string(),error_description:i.string().optional(),error_uri:i.string().optional()}),Ih=i.object({redirect_uris:i.array(i.string()).refine(a=>a.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:i.string().optional(),grant_types:i.array(i.string()).optional(),response_types:i.array(i.string()).optional(),client_name:i.string().optional(),client_uri:i.string().optional(),logo_uri:i.string().optional(),scope:i.string().optional(),contacts:i.array(i.string()).optional(),tos_uri:i.string().optional(),policy_uri:i.string().optional(),jwks_uri:i.string().optional(),jwks:i.any().optional(),software_id:i.string().optional(),software_version:i.string().optional(),software_statement:i.string().optional()}).strip(),Ah=i.object({client_id:i.string(),client_secret:i.string().optional(),client_id_issued_at:i.number().optional(),client_secret_expires_at:i.number().optional()}).strip(),Pl=Ih.merge(Ah),ov=i.object({error:i.string(),error_description:i.string().optional()}).strip(),lv=i.object({token:i.string(),token_type_hint:i.string().optional()}).strip();function wl(a){let e=typeof a=="string"?new URL(a):new URL(a.href);return e.hash="",e}function El({requestedResource:a,configuredResource:e}){let t=typeof a=="string"?new URL(a):new URL(a.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 r=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}var Pe=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}},qt=class extends Pe{};qt.errorCode="invalid_request";var nt=class extends Pe{};nt.errorCode="invalid_client";var it=class extends Pe{};it.errorCode="invalid_grant";var ot=class extends Pe{};ot.errorCode="unauthorized_client";var Ut=class extends Pe{};Ut.errorCode="unsupported_grant_type";var zt=class extends Pe{};zt.errorCode="invalid_scope";var Vt=class extends Pe{};Vt.errorCode="access_denied";var _r=class extends Pe{};_r.errorCode="server_error";var Ht=class extends Pe{};Ht.errorCode="temporarily_unavailable";var Zt=class extends Pe{};Zt.errorCode="unsupported_response_type";var Bt=class extends Pe{};Bt.errorCode="unsupported_token_type";var Jt=class extends Pe{};Jt.errorCode="invalid_token";var Qt=class extends Pe{};Qt.errorCode="method_not_allowed";var Kt=class extends Pe{};Kt.errorCode="too_many_requests";var Gt=class extends Pe{};Gt.errorCode="invalid_client_metadata";var Wt=class extends Pe{};Wt.errorCode="insufficient_scope";var Sl={[qt.errorCode]:qt,[nt.errorCode]:nt,[it.errorCode]:it,[ot.errorCode]:ot,[Ut.errorCode]:Ut,[zt.errorCode]:zt,[Vt.errorCode]:Vt,[_r.errorCode]:_r,[Ht.errorCode]:Ht,[Zt.errorCode]:Zt,[Bt.errorCode]:Bt,[Jt.errorCode]:Jt,[Qt.errorCode]:Qt,[Kt.errorCode]:Kt,[Gt.errorCode]:Gt,[Wt.errorCode]:Wt};var Ar=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function Ol(a,e){let t=a.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 Tl(a,e,t,s){let{client_id:r,client_secret:n}=e;switch(a){case"client_secret_basic":kh(r,n,t);return;case"client_secret_post":Ch(r,n,s);return;case"none":Dh(r,s);return;default:throw new Error(`Unsupported client authentication method: ${a}`)}}function kh(a,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${a}:${e}`);t.set("Authorization",`Basic ${s}`)}function Ch(a,e,t){t.set("client_id",a),e&&t.set("client_secret",e)}function Dh(a,e){e.set("client_id",a)}async function an(a){let e=a instanceof Response?a.status:void 0,t=a instanceof Response?await a.text():a;try{let s=xl.parse(JSON.parse(t)),{error:r,error_description:n,error_uri:o}=s,l=Sl[r]||_r;return new l(n||"",o)}catch(s){let r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new _r(r)}}async function Za(a,e){var t,s;try{return await tn(a,e)}catch(r){if(r instanceof nt||r instanceof ot)return await((t=a.invalidateCredentials)===null||t===void 0?void 0:t.call(a,"all")),await tn(a,e);if(r instanceof it)return await((s=a.invalidateCredentials)===null||s===void 0?void 0:s.call(a,"tokens")),await tn(a,e);throw r}}async function tn(a,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,l;try{o=await Nh(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(l=o.authorization_servers[0])}catch{}l||(l=e);let u=await jh(e,a,o),c=await Uh(l,{fetchFn:n}),h=await Promise.resolve(a.clientInformation());if(!h){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!a.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await Zh(l,{metadata:c,clientMetadata:a.clientMetadata,fetchFn:n});await a.saveClientInformation(m),h=m}if(t!==void 0){let m=await a.codeVerifier(),v=await Vh(l,{metadata:c,clientInformation:h,authorizationCode:t,codeVerifier:m,redirectUri:a.redirectUrl,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(v),"AUTHORIZED"}let p=await a.tokens();if(p!=null&&p.refresh_token)try{let m=await Hh(l,{metadata:c,clientInformation:h,refreshToken:p.refresh_token,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(m),"AUTHORIZED"}catch(m){if(!(!(m instanceof Pe)||m instanceof _r))throw m}let g=a.state?await a.state():void 0,{authorizationUrl:d,codeVerifier:_}=await zh(l,{metadata:c,clientInformation:h,state:g,redirectUrl:a.redirectUrl,scope:s||a.clientMetadata.scope,resource:u});return await a.saveCodeVerifier(_),await a.redirectToAuthorization(d),"REDIRECT"}async function jh(a,e,t){let s=wl(a);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!El({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 $l(a){let e=a.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 Nh(a,e,t=fetch){let s=await Mh(a,"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 _l.parse(await s.json())}async function sn(a,e,t=fetch){try{return await t(a,{headers:e})}catch(s){if(s instanceof TypeError)return e?sn(a,void 0,t):void 0;throw s}}function Fh(a,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${a}`:`/.well-known/${a}${e}`}async function Rl(a,e,t=fetch){return await sn(a,{"MCP-Protocol-Version":e},t)}function Lh(a,e){return!a||a.status===404&&e!=="/"}async function Mh(a,e,t,s){var r,n;let o=new URL(a),l=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Rr,u;if(s!=null&&s.metadataUrl)u=new URL(s.metadataUrl);else{let h=Fh(e,o.pathname);u=new URL(h,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),u.search=o.search}let c=await Rl(u,l,t);if(!(s!=null&&s.metadataUrl)&&Lh(c,o.pathname)){let h=new URL(`/.well-known/${e}`,o);c=await Rl(h,l,t)}return c}function qh(a){let e=typeof a=="string"?new URL(a):a,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 r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,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${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function Uh(a,{fetchFn:e=fetch,protocolVersion:t=Rr}={}){var s;let r={"MCP-Protocol-Version":t},n=qh(a);for(let{url:o,type:l}of n){let u=await sn(o,r,e);if(u){if(!u.ok){if(u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(l==="oauth")return en.parse(await u.json());{let c=bl.parse(await u.json());if(!(!((s=c.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 c}}}}async function zh(a,{metadata:e,clientInformation:t,redirectUrl:s,scope:r,state:n,resource:o}){let l="code",u="S256",c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support response type ${l}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(u))throw new Error(`Incompatible auth server: does not support code challenge method ${u}`)}else c=new URL("/authorize",a);let h=await Xs(),p=h.code_verifier,g=h.code_challenge;return c.searchParams.set("response_type",l),c.searchParams.set("client_id",t.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",u),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:p}}async function Vh(a,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:l,fetchFn:u}){var c;let h="authorization_code",p=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",a);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`);let g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:h,code:s,code_verifier:r,redirect_uri:String(n)});if(l)l(g,d,a,e);else{let m=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],v=Ol(t,m);Tl(v,t,g,d)}o&&d.set("resource",o.href);let _=await(u!=null?u:fetch)(p,{method:"POST",headers:g,body:d});if(!_.ok)throw await an(_);return rn.parse(await _.json())}async function Hh(a,{metadata:e,clientInformation:t,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var l;let u="refresh_token",c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`)}else c=new URL("/token",a);let h=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),p=new URLSearchParams({grant_type:u,refresh_token:s});if(n)n(h,p,a,e);else{let d=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],_=Ol(t,d);Tl(_,t,h,p)}r&&p.set("resource",r.href);let g=await(o!=null?o:fetch)(c,{method:"POST",headers:h,body:p});if(!g.ok)throw await an(g);return rn.parse({refresh_token:s,...await g.json()})}async function Zh(a,{metadata:e,clientMetadata:t,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",a);let n=await(s!=null?s:fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await an(n);return Pl.parse(await n.json())}var Ba=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 nn(a){}function Il(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=nn,onError:t=nn,onRetry:s=nn,onComment:r}=a,n="",o=!0,l,u="",c="";function h(m){let v=o?m.replace(/^\xEF\xBB\xBF/,""):m,[x,S]=Bh(`${n}${v}`);for(let E of x)p(E);n=S,o=!1}function p(m){if(m===""){d();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}let v=m.indexOf(":");if(v!==-1){let x=m.slice(0,v),S=m[v+1]===" "?2:1,E=m.slice(v+S);g(x,E,m);return}g(m,"",m)}function g(m,v,x){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
14
- `;break;case"id":l=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?s(parseInt(v,10)):t(new Ba(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:x}));break;default:t(new Ba(`Unknown field "${m.length>20?`${m.slice(0,20)}\u2026`:m}"`,{type:"unknown-field",field:m,value:v,line:x}));break}}function d(){u.length>0&&e({id:l,event:c||void 0,data:u.endsWith(`
15
- `)?u.slice(0,-1):u}),l=void 0,u="",c=""}function _(m={}){n&&m.consume&&p(n),o=!0,l=void 0,u="",c="",n=""}return{feed:h,reset:_}}function Bh(a){let e=[],t="",s=0;for(;s<a.length;){let r=a.indexOf("\r",s),n=a.indexOf(`
13
+ `,e.write(r)}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 r,n,o,l,u;try{let c=e.headers.accept;if(!(c!=null&&c.includes("application/json"))||!c.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 f=e.headers["content-type"];if(!f||!f.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 p=e.auth,g={headers:e.headers},d;if(s!==void 0)d=s;else{let x=yc.default.parse(f),S=await zt(e,{limit:am,encoding:(r=x.parameters.charset)!==null&&r!==void 0?r:"utf-8"});d=JSON.parse(S.toString())}let y;Array.isArray(d)?y=d.map(x=>Ye.parse(x)):y=[Ye.parse(d)];let m=y.some(io);if(m){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(y.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(!m&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let v=y.some(tt);if(v){if(v){let x=(0,_c.randomUUID)();if(!this._enableJsonResponse){let S={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(S["mcp-session-id"]=this.sessionId),t.writeHead(200,S)}for(let S of y)tt(S)&&(this._streamMapping.set(x,t),this._requestToStreamMapping.set(S.id,x));t.on("close",()=>{this._streamMapping.delete(x)});for(let S of y)(l=this.onmessage)===null||l===void 0||l.call(this,S,{authInfo:p,requestInfo:g})}}else{t.writeHead(202).end();for(let x of y)(o=this.onmessage)===null||o===void 0||o.call(this,x,{authInfo:p,requestInfo:g})}}catch(c){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(c)},id:null})),(u=this.onerror)===null||u===void 0||u.call(this,c)}}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 r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Yn;return Array.isArray(r)&&(r=r[r.length-1]),rt.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${rt.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((yr(e)||Et(e))&&(s=e.id),s===void 0){if(yr(e)||Et(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 l;this._eventStore&&(l=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(o,e,l);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,o)}if(yr(e)||Et(e)){this._requestResponseMap.set(s,e);let o=Array.from(this._requestToStreamMapping.entries()).filter(([u,c])=>this._streamMapping.get(c)===n).map(([u])=>u);if(o.every(u=>this._requestResponseMap.has(u))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let u={"Content-Type":"application/json"};this.sessionId!==void 0&&(u["mcp-session-id"]=this.sessionId);let c=o.map(f=>this._requestResponseMap.get(f));n.writeHead(200,u),c.length===1?n.end(JSON.stringify(c[0])):n.end(JSON.stringify(c))}else n.end();for(let u of o)this._requestResponseMap.delete(u),this._requestToStreamMapping.delete(u)}}}};var pn,bc,xc,wc;pn=(wc=(xc=(bc=globalThis.crypto)==null?void 0:bc.webcrypto)!=null?xc:globalThis.crypto)!=null?wc:import("node:crypto").then(a=>a.webcrypto);async function sm(a){return(await pn).getRandomValues(new Uint8Array(a))}async function nm(a){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await sm(a);for(let r=0;r<a;r++){let n=s[r]%e.length;t+=e[n]}return t}async function om(a){return await nm(a)}async function im(a){let e=await(await pn).subtle.digest("SHA-256",new TextEncoder().encode(a));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function mn(a){if(a||(a=43),a<43||a>128)throw`Expected a length between 43 and 128. Received ${a}.`;let e=await om(a),t=await im(e);return{code_verifier:e,code_challenge:t}}var Ec=i.object({resource:i.string().url(),authorization_servers:i.array(i.string().url()).optional(),jwks_uri:i.string().url().optional(),scopes_supported:i.array(i.string()).optional(),bearer_methods_supported:i.array(i.string()).optional(),resource_signing_alg_values_supported:i.array(i.string()).optional(),resource_name:i.string().optional(),resource_documentation:i.string().optional(),resource_policy_uri:i.string().url().optional(),resource_tos_uri:i.string().url().optional(),tls_client_certificate_bound_access_tokens:i.boolean().optional(),authorization_details_types_supported:i.array(i.string()).optional(),dpop_signing_alg_values_supported:i.array(i.string()).optional(),dpop_bound_access_tokens_required:i.boolean().optional()}).passthrough(),vn=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),revocation_endpoint:i.string().optional(),revocation_endpoint_auth_methods_supported:i.array(i.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),introspection_endpoint:i.string().optional(),introspection_endpoint_auth_methods_supported:i.array(i.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),code_challenge_methods_supported:i.array(i.string()).optional()}).passthrough(),lm=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),userinfo_endpoint:i.string().optional(),jwks_uri:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),acr_values_supported:i.array(i.string()).optional(),subject_types_supported:i.array(i.string()),id_token_signing_alg_values_supported:i.array(i.string()),id_token_encryption_alg_values_supported:i.array(i.string()).optional(),id_token_encryption_enc_values_supported:i.array(i.string()).optional(),userinfo_signing_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_enc_values_supported:i.array(i.string()).optional(),request_object_signing_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_enc_values_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),display_values_supported:i.array(i.string()).optional(),claim_types_supported:i.array(i.string()).optional(),claims_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),claims_locales_supported:i.array(i.string()).optional(),ui_locales_supported:i.array(i.string()).optional(),claims_parameter_supported:i.boolean().optional(),request_parameter_supported:i.boolean().optional(),request_uri_parameter_supported:i.boolean().optional(),require_request_uri_registration:i.boolean().optional(),op_policy_uri:i.string().optional(),op_tos_uri:i.string().optional()}).passthrough(),Pc=lm.merge(vn.pick({code_challenge_methods_supported:!0})),gn=i.object({access_token:i.string(),id_token:i.string().optional(),token_type:i.string(),expires_in:i.number().optional(),scope:i.string().optional(),refresh_token:i.string().optional()}).strip(),Sc=i.object({error:i.string(),error_description:i.string().optional(),error_uri:i.string().optional()}),cm=i.object({redirect_uris:i.array(i.string()).refine(a=>a.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:i.string().optional(),grant_types:i.array(i.string()).optional(),response_types:i.array(i.string()).optional(),client_name:i.string().optional(),client_uri:i.string().optional(),logo_uri:i.string().optional(),scope:i.string().optional(),contacts:i.array(i.string()).optional(),tos_uri:i.string().optional(),policy_uri:i.string().optional(),jwks_uri:i.string().optional(),jwks:i.any().optional(),software_id:i.string().optional(),software_version:i.string().optional(),software_statement:i.string().optional()}).strip(),um=i.object({client_id:i.string(),client_secret:i.string().optional(),client_id_issued_at:i.number().optional(),client_secret_expires_at:i.number().optional()}).strip(),Rc=cm.merge(um),ty=i.object({error:i.string(),error_description:i.string().optional()}).strip(),ay=i.object({token:i.string(),token_type_hint:i.string().optional()}).strip();function Oc(a){let e=typeof a=="string"?new URL(a):new URL(a.href);return e.hash="",e}function Tc({requestedResource:a,configuredResource:e}){let t=typeof a=="string"?new URL(a):new URL(a.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 r=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}var we=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}},Ht=class extends we{};Ht.errorCode="invalid_request";var nt=class extends we{};nt.errorCode="invalid_client";var ot=class extends we{};ot.errorCode="invalid_grant";var it=class extends we{};it.errorCode="unauthorized_client";var Zt=class extends we{};Zt.errorCode="unsupported_grant_type";var Bt=class extends we{};Bt.errorCode="invalid_scope";var Jt=class extends we{};Jt.errorCode="access_denied";var br=class extends we{};br.errorCode="server_error";var Qt=class extends we{};Qt.errorCode="temporarily_unavailable";var Kt=class extends we{};Kt.errorCode="unsupported_response_type";var Gt=class extends we{};Gt.errorCode="unsupported_token_type";var Wt=class extends we{};Wt.errorCode="invalid_token";var Yt=class extends we{};Yt.errorCode="method_not_allowed";var Xt=class extends we{};Xt.errorCode="too_many_requests";var ea=class extends we{};ea.errorCode="invalid_client_metadata";var ra=class extends we{};ra.errorCode="insufficient_scope";var $c={[Ht.errorCode]:Ht,[nt.errorCode]:nt,[ot.errorCode]:ot,[it.errorCode]:it,[Zt.errorCode]:Zt,[Bt.errorCode]:Bt,[Jt.errorCode]:Jt,[br.errorCode]:br,[Qt.errorCode]:Qt,[Kt.errorCode]:Kt,[Gt.errorCode]:Gt,[Wt.errorCode]:Wt,[Yt.errorCode]:Yt,[Xt.errorCode]:Xt,[ea.errorCode]:ea,[ra.errorCode]:ra};var Cr=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function Ic(a,e){let t=a.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 Cc(a,e,t,s){let{client_id:r,client_secret:n}=e;switch(a){case"client_secret_basic":dm(r,n,t);return;case"client_secret_post":fm(r,n,s);return;case"none":hm(r,s);return;default:throw new Error(`Unsupported client authentication method: ${a}`)}}function dm(a,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${a}:${e}`);t.set("Authorization",`Basic ${s}`)}function fm(a,e,t){t.set("client_id",a),e&&t.set("client_secret",e)}function hm(a,e){e.set("client_id",a)}async function _n(a){let e=a instanceof Response?a.status:void 0,t=a instanceof Response?await a.text():a;try{let s=Sc.parse(JSON.parse(t)),{error:r,error_description:n,error_uri:o}=s,l=$c[r]||br;return new l(n||"",o)}catch(s){let r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new br(r)}}async function Wa(a,e){var t,s;try{return await yn(a,e)}catch(r){if(r instanceof nt||r instanceof it)return await((t=a.invalidateCredentials)===null||t===void 0?void 0:t.call(a,"all")),await yn(a,e);if(r instanceof ot)return await((s=a.invalidateCredentials)===null||s===void 0?void 0:s.call(a,"tokens")),await yn(a,e);throw r}}async function yn(a,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,l;try{o=await mm(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(l=o.authorization_servers[0])}catch{}l||(l=e);let u=await pm(e,a,o),c=await bm(l,{fetchFn:n}),f=await Promise.resolve(a.clientInformation());if(!f){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!a.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await Pm(l,{metadata:c,clientMetadata:a.clientMetadata,fetchFn:n});await a.saveClientInformation(m),f=m}if(t!==void 0){let m=await a.codeVerifier(),v=await wm(l,{metadata:c,clientInformation:f,authorizationCode:t,codeVerifier:m,redirectUri:a.redirectUrl,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(v),"AUTHORIZED"}let p=await a.tokens();if(p!=null&&p.refresh_token)try{let m=await Em(l,{metadata:c,clientInformation:f,refreshToken:p.refresh_token,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(m),"AUTHORIZED"}catch(m){if(!(!(m instanceof we)||m instanceof br))throw m}let g=a.state?await a.state():void 0,{authorizationUrl:d,codeVerifier:y}=await xm(l,{metadata:c,clientInformation:f,state:g,redirectUrl:a.redirectUrl,scope:s||a.clientMetadata.scope,resource:u});return await a.saveCodeVerifier(y),await a.redirectToAuthorization(d),"REDIRECT"}async function pm(a,e,t){let s=Oc(a);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!Tc({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 kc(a){let e=a.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 mm(a,e,t=fetch){let s=await ym(a,"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 Ec.parse(await s.json())}async function bn(a,e,t=fetch){try{return await t(a,{headers:e})}catch(s){if(s instanceof TypeError)return e?bn(a,void 0,t):void 0;throw s}}function vm(a,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${a}`:`/.well-known/${a}${e}`}async function Ac(a,e,t=fetch){return await bn(a,{"MCP-Protocol-Version":e},t)}function gm(a,e){return!a||a.status===404&&e!=="/"}async function ym(a,e,t,s){var r,n;let o=new URL(a),l=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Or,u;if(s!=null&&s.metadataUrl)u=new URL(s.metadataUrl);else{let f=vm(e,o.pathname);u=new URL(f,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),u.search=o.search}let c=await Ac(u,l,t);if(!(s!=null&&s.metadataUrl)&&gm(c,o.pathname)){let f=new URL(`/.well-known/${e}`,o);c=await Ac(f,l,t)}return c}function _m(a){let e=typeof a=="string"?new URL(a):a,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 r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,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${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function bm(a,{fetchFn:e=fetch,protocolVersion:t=Or}={}){var s;let r={"MCP-Protocol-Version":t},n=_m(a);for(let{url:o,type:l}of n){let u=await bn(o,r,e);if(u){if(!u.ok){if(u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(l==="oauth")return vn.parse(await u.json());{let c=Pc.parse(await u.json());if(!(!((s=c.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 c}}}}async function xm(a,{metadata:e,clientInformation:t,redirectUrl:s,scope:r,state:n,resource:o}){let l="code",u="S256",c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support response type ${l}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(u))throw new Error(`Incompatible auth server: does not support code challenge method ${u}`)}else c=new URL("/authorize",a);let f=await mn(),p=f.code_verifier,g=f.code_challenge;return c.searchParams.set("response_type",l),c.searchParams.set("client_id",t.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",u),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:p}}async function wm(a,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:l,fetchFn:u}){var c;let f="authorization_code",p=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",a);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:f,code:s,code_verifier:r,redirect_uri:String(n)});if(l)l(g,d,a,e);else{let m=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],v=Ic(t,m);Cc(v,t,g,d)}o&&d.set("resource",o.href);let y=await(u!=null?u:fetch)(p,{method:"POST",headers:g,body:d});if(!y.ok)throw await _n(y);return gn.parse(await y.json())}async function Em(a,{metadata:e,clientInformation:t,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var l;let u="refresh_token",c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`)}else c=new URL("/token",a);let f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),p=new URLSearchParams({grant_type:u,refresh_token:s});if(n)n(f,p,a,e);else{let d=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],y=Ic(t,d);Cc(y,t,f,p)}r&&p.set("resource",r.href);let g=await(o!=null?o:fetch)(c,{method:"POST",headers:f,body:p});if(!g.ok)throw await _n(g);return gn.parse({refresh_token:s,...await g.json()})}async function Pm(a,{metadata:e,clientMetadata:t,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",a);let n=await(s!=null?s:fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await _n(n);return Rc.parse(await n.json())}var Ya=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 xn(a){}function Dc(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=xn,onError:t=xn,onRetry:s=xn,onComment:r}=a,n="",o=!0,l,u="",c="";function f(m){let v=o?m.replace(/^\xEF\xBB\xBF/,""):m,[x,S]=Sm(`${n}${v}`);for(let P of x)p(P);n=S,o=!1}function p(m){if(m===""){d();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}let v=m.indexOf(":");if(v!==-1){let x=m.slice(0,v),S=m[v+1]===" "?2:1,P=m.slice(v+S);g(x,P,m);return}g(m,"",m)}function g(m,v,x){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
14
+ `;break;case"id":l=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?s(parseInt(v,10)):t(new Ya(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:x}));break;default:t(new Ya(`Unknown field "${m.length>20?`${m.slice(0,20)}\u2026`:m}"`,{type:"unknown-field",field:m,value:v,line:x}));break}}function d(){u.length>0&&e({id:l,event:c||void 0,data:u.endsWith(`
15
+ `)?u.slice(0,-1):u}),l=void 0,u="",c=""}function y(m={}){n&&m.consume&&p(n),o=!0,l=void 0,u="",c="",n=""}return{feed:f,reset:y}}function Sm(a){let e=[],t="",s=0;for(;s<a.length;){let r=a.indexOf("\r",s),n=a.indexOf(`
16
16
  `,s),o=-1;if(r!==-1&&n!==-1?o=Math.min(r,n):r!==-1?o=r:n!==-1&&(o=n),o===-1){t=a.slice(s);break}else{let l=a.slice(s,o);e.push(l),s=o+1,a[s-1]==="\r"&&a[s]===`
17
- `&&s++}}return[e,t]}var Ja=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(n){r=Il({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:s})},transform(n){r.feed(n)}})}};var Jh={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Yt=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Qa=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:Jh}async _authThenStart(){var e;if(!this._authProvider)throw new Ar("No auth provider");let t;try{t=await Za(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 Ar;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.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,r;let{resumptionToken:n}=e;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);let l=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(!l.ok){if(l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new Yt(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_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 r=this._reconnectionOptions.maxRetries;if(r>0&&t>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var l;(l=this.onerror)===null||l===void 0||l.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:r,replayMessageId:n}=t,o;(async()=>{var u,c,h,p;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ja).getReader();for(;;){let{value:d,done:_}=await g.read();if(_)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{let m=Ye.parse(JSON.parse(d.data));n!==void 0&&gr(m)&&(m.id=n),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m)}}}catch(g){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}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 Ar("No auth provider");if(await Za(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ar("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,r,n,o;try{let{resumptionToken:l,onresumptiontoken:u}=t||{};if(l){this._startOrAuthSse({resumptionToken:l,replayMessageId:tt(e)?e.id:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");let h={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},p=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,h),g=p.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!p.ok){if(p.status===401&&this._authProvider){if(this._resourceMetadataUrl=$l(p),await Za(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ar;return this.send(e)}let v=await p.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${p.status}): ${v}`)}if(p.status===202){Jn(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let _=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,m=p.headers.get("content-type");if(_)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let v=await p.json(),x=Array.isArray(v)?v.map(S=>Ye.parse(S)):[Ye.parse(v)];for(let S of x)(n=this.onmessage)===null||n===void 0||n.call(this,S)}else throw new Yt(-1,`Unexpected content type: ${m}`)}catch(l){throw(o=this.onerror)===null||o===void 0||o.call(this,l),l}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,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 Yt(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var kl=Symbol("Let zodToJsonSchema decide on which parser to use");var Al={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"},Cl=a=>typeof a=="string"?{...Al,name:a}:{...Al,...a};var Dl=a=>{let e=Cl(a),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,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function on(a,e,t,s){s!=null&&s.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,on(a,e,s,r)}var Ka=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?Ka(e,a.currentPath):e.join("/")}}function jl(a,e){var s,r,n;let t={type:"array"};return(s=a.type)!=null&&s._def&&((n=(r=a.type)==null?void 0:r._def)==null?void 0:n.typeName)!==T.ZodAny&&(t.items=B(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function Nl(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Fl(){return{type:"boolean"}}function Ga(a,e){return B(a.type._def,e)}var Ll=(a,e)=>B(a.innerType._def,e);function ln(a,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>ln(a,e,r))};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 Qh(a,e)}}var Qh=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Ml(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function ql(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function Ul(a){return{type:"string",enum:Array.from(a.values)}}var Kh=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function zl(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Kh(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:l,...u}=n;o=u}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function Vl(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var cn,Xe={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:()=>(cn===void 0&&(cn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),cn),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 Wa(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(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":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":De(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":De(t,s.regex,s.message,e);break;case"cuid":De(t,Xe.cuid,s.message,e);break;case"cuid2":De(t,Xe.cuid2,s.message,e);break;case"startsWith":De(t,RegExp(`^${un(s.value,e)}`),s.message,e);break;case"endsWith":De(t,RegExp(`${un(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{De(t,RegExp(un(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":De(t,Xe.base64url,s.message,e);break;case"jwt":De(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&De(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&De(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":De(t,Xe.emoji(),s.message,e);break;case"ulid":{De(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{De(t,Xe.base64,s.message,e);break}}break}case"nanoid":De(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function un(a,e){return e.patternStrategy==="escape"?Wh(a):a}var Gh=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Wh(a){let e="";for(let t=0;t<a.length;t++)Gh.has(a[t])||(e+="\\"),e+=a[t];return e}function er(a,e,t,s){var r;a.format||(r=a.anyOf)!=null&&r.some(n=>n.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function De(a,e,t,s){var r;a.pattern||(r=a.allOf)!=null&&r.some(n=>n.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Hl(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Hl(e,s),t,s)}function Hl(a,e){var u;if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,o=!1,l=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(o){if(s[c].match(/[a-z]/)){l?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),l=!1):s[c+1]==="-"&&((u=s[c+2])!=null&&u.match(/[a-z]/))?(r+=s[c],l=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
17
+ `&&s++}}return[e,t]}var Xa=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(n){r=Dc({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:s})},transform(n){r.feed(n)}})}};var Rm={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},ta=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},es=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:Rm}async _authThenStart(){var e;if(!this._authProvider)throw new Cr("No auth provider");let t;try{t=await Wa(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 Cr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.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,r;let{resumptionToken:n}=e;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);let l=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(!l.ok){if(l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new ta(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_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 r=this._reconnectionOptions.maxRetries;if(r>0&&t>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var l;(l=this.onerror)===null||l===void 0||l.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:r,replayMessageId:n}=t,o;(async()=>{var u,c,f,p;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new Xa).getReader();for(;;){let{value:d,done:y}=await g.read();if(y)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{let m=Ye.parse(JSON.parse(d.data));n!==void 0&&yr(m)&&(m.id=n),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m)}}}catch(g){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}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 Cr("No auth provider");if(await Wa(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Cr("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,r,n,o;try{let{resumptionToken:l,onresumptiontoken:u}=t||{};if(l){this._startOrAuthSse({resumptionToken:l,replayMessageId:tt(e)?e.id:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},p=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,f),g=p.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!p.ok){if(p.status===401&&this._authProvider){if(this._resourceMetadataUrl=kc(p),await Wa(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Cr;return this.send(e)}let v=await p.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${p.status}): ${v}`)}if(p.status===202){lo(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let y=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,m=p.headers.get("content-type");if(y)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let v=await p.json(),x=Array.isArray(v)?v.map(S=>Ye.parse(S)):[Ye.parse(v)];for(let S of x)(n=this.onmessage)===null||n===void 0||n.call(this,S)}else throw new ta(-1,`Unexpected content type: ${m}`)}catch(l){throw(o=this.onerror)===null||o===void 0||o.call(this,l),l}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,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 ta(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var Nc=Symbol("Let zodToJsonSchema decide on which parser to use");var jc={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"},Fc=a=>typeof a=="string"?{...jc,name:a}:{...jc,...a};var Lc=a=>{let e=Fc(a),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,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function wn(a,e,t,s){s!=null&&s.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,wn(a,e,s,r)}var rs=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?rs(e,a.currentPath):e.join("/")}}function Mc(a,e){var s,r,n;let t={type:"array"};return(s=a.type)!=null&&s._def&&((n=(r=a.type)==null?void 0:r._def)==null?void 0:n.typeName)!==T.ZodAny&&(t.items=J(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function qc(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Uc(){return{type:"boolean"}}function ts(a,e){return J(a.type._def,e)}var zc=(a,e)=>J(a.innerType._def,e);function En(a,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>En(a,e,r))};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 Om(a,e)}}var Om=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Vc(a,e){return{...J(a.innerType._def,e),default:a.defaultValue()}}function Hc(a,e){return e.effectStrategy==="input"?J(a.schema._def,e):fe(e)}function Zc(a){return{type:"string",enum:Array.from(a.values)}}var Tm=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Bc(a,e){let t=[J(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),J(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Tm(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:l,...u}=n;o=u}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function Jc(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var Pn,Xe={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:()=>(Pn===void 0&&(Pn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pn),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 as(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(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":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":De(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":De(t,s.regex,s.message,e);break;case"cuid":De(t,Xe.cuid,s.message,e);break;case"cuid2":De(t,Xe.cuid2,s.message,e);break;case"startsWith":De(t,RegExp(`^${Sn(s.value,e)}`),s.message,e);break;case"endsWith":De(t,RegExp(`${Sn(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{De(t,RegExp(Sn(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":De(t,Xe.base64url,s.message,e);break;case"jwt":De(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&De(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&De(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":De(t,Xe.emoji(),s.message,e);break;case"ulid":{De(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{De(t,Xe.base64,s.message,e);break}}break}case"nanoid":De(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Sn(a,e){return e.patternStrategy==="escape"?Am(a):a}var $m=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Am(a){let e="";for(let t=0;t<a.length;t++)$m.has(a[t])||(e+="\\"),e+=a[t];return e}function er(a,e,t,s){var r;a.format||(r=a.anyOf)!=null&&r.some(n=>n.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function De(a,e,t,s){var r;a.pattern||(r=a.allOf)!=null&&r.some(n=>n.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Qc(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Qc(e,s),t,s)}function Qc(a,e){var u;if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,o=!1,l=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(o){if(s[c].match(/[a-z]/)){l?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),l=!1):s[c+1]==="-"&&((u=s[c+2])!=null&&u.match(/[a-z]/))?(r+=s[c],l=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
18
18
  ]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
19
19
  ]))`;continue}}if(t.s&&s[c]==="."){r+=o?`${s[c]}\r
20
20
  `:`[${s[c]}\r
21
- ]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}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`),a.source}return r}function Ya(a,e){var s,r,n,o,l,u,c;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=a.keyType)==null?void 0:s._def.typeName)===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((h,p)=>{var g;return{...h,[p]:(g=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",p]}))!=null?g:fe(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===T.ZodString&&((o=a.keyType._def.checks)!=null&&o.length)){let{type:h,...p}=Wa(a.keyType._def,e);return{...t,propertyNames:p}}else{if(((l=a.keyType)==null?void 0:l._def.typeName)===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((u=a.keyType)==null?void 0:u._def.typeName)===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&((c=a.keyType._def.type._def.checks)!=null&&c.length)){let{type:h,...p}=Ga(a.keyType._def,e);return{...t,propertyNames:p}}}return t}function Zl(a,e){if(e.mapStrategy==="record")return Ya(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Bl(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Jl(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Ql(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Xt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Gl(a,e){if(e.target==="openApi3")return Kl(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Xt&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let o=Xt[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,o,l)=>l.indexOf(n)===o);return{type:r.length>1?r:r[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,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Kl(a,e)}var Kl=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Wl(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Xt[a.innerType._def.typeName],nullable:!0}:{type:[Xt[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Yl(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",on(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Xl(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let l in n){let u=n[l];if(u===void 0||u._def===void 0)continue;let c=Xh(u);c&&t&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),c=!1);let h=B(u._def,{...e,currentPath:[...e.currentPath,"properties",l],propertyPath:[...e.currentPath,"properties",l]});h!==void 0&&(s.properties[l]=h,c||r.push(l))}r.length&&(s.required=r);let o=Yh(a,e);return o!==void 0&&(s.additionalProperties=o),s}function Yh(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Xh(a){try{return a.isOptional()}catch{return!0}}var ec=(a,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var rc=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function tc(a,e){return B(a.type._def,e)}function ac(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function sc(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function nc(a){return{not:fe(a)}}function ic(a){return fe(a)}var oc=(a,e)=>B(a.innerType._def,e);var lc=(a,e,t)=>{switch(e){case T.ZodString:return Wa(a,t);case T.ZodNumber:return Yl(a,t);case T.ZodObject:return Xl(a,t);case T.ZodBigInt:return Nl(a,t);case T.ZodBoolean:return Fl();case T.ZodDate:return ln(a,t);case T.ZodUndefined:return nc(t);case T.ZodNull:return Ql(t);case T.ZodArray:return jl(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return Gl(a,t);case T.ZodIntersection:return zl(a,t);case T.ZodTuple:return sc(a,t);case T.ZodRecord:return Ya(a,t);case T.ZodLiteral:return Vl(a,t);case T.ZodEnum:return Ul(a);case T.ZodNativeEnum:return Bl(a);case T.ZodNullable:return Wl(a,t);case T.ZodOptional:return ec(a,t);case T.ZodMap:return Zl(a,t);case T.ZodSet:return ac(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return tc(a,t);case T.ZodNaN:case T.ZodNever:return Jl(t);case T.ZodEffects:return ql(a,t);case T.ZodAny:return fe(t);case T.ZodUnknown:return ic(t);case T.ZodDefault:return Ml(a,t);case T.ZodBranded:return Ga(a,t);case T.ZodReadonly:return oc(a,t);case T.ZodCatch:return Ll(a,t);case T.ZodPipeline:return rc(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){var l;let s=e.seen.get(a);if(e.override){let u=(l=e.override)==null?void 0:l.call(e,a,e,s,t);if(u!==kl)return u}if(s&&!t){let u=ep(s,e);if(u!==void 0)return u}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=lc(a,a.typeName,e),o=typeof n=="function"?B(n(),e):n;if(o&&rp(a,e,o),e.postProcess){let u=e.postProcess(o,a,e);return r.jsonSchema=o,u}return r.jsonSchema=o,o}var ep=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:Ka(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},rp=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var dn=(a,e)=>{var u;let t=Dl(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[h,p])=>{var g;return{...c,[h]:(g=B(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,h]},!0))!=null?g:fe(t)}},{}):void 0,r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(u=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1))!=null?u:fe(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 l=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,PingRequestSchema,SSEServerTransport,Server,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
21
+ ]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}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`),a.source}return r}function ss(a,e){var s,r,n,o,l,u,c;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=a.keyType)==null?void 0:s._def.typeName)===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((f,p)=>{var g;return{...f,[p]:(g=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",p]}))!=null?g:fe(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===T.ZodString&&((o=a.keyType._def.checks)!=null&&o.length)){let{type:f,...p}=as(a.keyType._def,e);return{...t,propertyNames:p}}else{if(((l=a.keyType)==null?void 0:l._def.typeName)===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((u=a.keyType)==null?void 0:u._def.typeName)===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&((c=a.keyType._def.type._def.checks)!=null&&c.length)){let{type:f,...p}=ts(a.keyType._def,e);return{...t,propertyNames:p}}}return t}function Kc(a,e){if(e.mapStrategy==="record")return ss(a,e);let t=J(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Gc(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Wc(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Yc(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var aa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function eu(a,e){if(e.target==="openApi3")return Xc(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in aa&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let o=aa[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,o,l)=>l.indexOf(n)===o);return{type:r.length>1?r:r[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,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Xc(a,e)}var Xc=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>J(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function ru(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:aa[a.innerType._def.typeName],nullable:!0}:{type:[aa[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=J(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function tu(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",wn(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function au(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let l in n){let u=n[l];if(u===void 0||u._def===void 0)continue;let c=Cm(u);c&&t&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),c=!1);let f=J(u._def,{...e,currentPath:[...e.currentPath,"properties",l],propertyPath:[...e.currentPath,"properties",l]});f!==void 0&&(s.properties[l]=f,c||r.push(l))}r.length&&(s.required=r);let o=Im(a,e);return o!==void 0&&(s.additionalProperties=o),s}function Im(a,e){if(a.catchall._def.typeName!=="ZodNever")return J(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Cm(a){try{return a.isOptional()}catch{return!0}}var su=(a,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return J(a.innerType._def,e);let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var nu=(a,e)=>{if(e.pipeStrategy==="input")return J(a.in._def,e);if(e.pipeStrategy==="output")return J(a.out._def,e);let t=J(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=J(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function ou(a,e){return J(a.type._def,e)}function iu(a,e){let s={type:"array",uniqueItems:!0,items:J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function lu(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:J(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function cu(a){return{not:fe(a)}}function uu(a){return fe(a)}var du=(a,e)=>J(a.innerType._def,e);var fu=(a,e,t)=>{switch(e){case T.ZodString:return as(a,t);case T.ZodNumber:return tu(a,t);case T.ZodObject:return au(a,t);case T.ZodBigInt:return qc(a,t);case T.ZodBoolean:return Uc();case T.ZodDate:return En(a,t);case T.ZodUndefined:return cu(t);case T.ZodNull:return Yc(t);case T.ZodArray:return Mc(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return eu(a,t);case T.ZodIntersection:return Bc(a,t);case T.ZodTuple:return lu(a,t);case T.ZodRecord:return ss(a,t);case T.ZodLiteral:return Jc(a,t);case T.ZodEnum:return Zc(a);case T.ZodNativeEnum:return Gc(a);case T.ZodNullable:return ru(a,t);case T.ZodOptional:return su(a,t);case T.ZodMap:return Kc(a,t);case T.ZodSet:return iu(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return ou(a,t);case T.ZodNaN:case T.ZodNever:return Wc(t);case T.ZodEffects:return Hc(a,t);case T.ZodAny:return fe(t);case T.ZodUnknown:return uu(t);case T.ZodDefault:return Vc(a,t);case T.ZodBranded:return ts(a,t);case T.ZodReadonly:return du(a,t);case T.ZodCatch:return zc(a,t);case T.ZodPipeline:return nu(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function J(a,e,t=!1){var l;let s=e.seen.get(a);if(e.override){let u=(l=e.override)==null?void 0:l.call(e,a,e,s,t);if(u!==Nc)return u}if(s&&!t){let u=km(s,e);if(u!==void 0)return u}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=fu(a,a.typeName,e),o=typeof n=="function"?J(n(),e):n;if(o&&Dm(a,e,o),e.postProcess){let u=e.postProcess(o,a,e);return r.jsonSchema=o,u}return r.jsonSchema=o,o}var km=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:rs(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Dm=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var Rn=(a,e)=>{var u;let t=Lc(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[f,p])=>{var g;return{...c,[f]:(g=J(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0))!=null?g:fe(t)}},{}):void 0,r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(u=J(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1))!=null?u:fe(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 l=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,PingRequestSchema,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
22
22
  /*! Bundled license information:
23
23
 
24
24
  uri-js/dist/es5/uri.all.js: