@requestly/mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ var Ml=Object.create;var za=Object.defineProperty;var zl=Object.getOwnPropertyDescriptor;var Ul=Object.getOwnPropertyNames;var Hl=Object.getPrototypeOf,Vl=Object.prototype.hasOwnProperty;var B=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Zl=(a,e)=>{for(var t in e)za(a,t,{get:e[t],enumerable:!0})},Ql=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ul(e))!Vl.call(a,r)&&r!==t&&za(a,r,{get:()=>e[r],enumerable:!(s=zl(e,r))||s.enumerable});return a};var Bl=(a,e,t)=>(t=a!=null?Ml(Hl(a)):{},Ql(e||!a||!a.__esModule?za(t,"default",{value:a,enumerable:!0}):t,a));var xn=B((ea,Pn)=>{(function(a,e){typeof ea=="object"&&typeof Pn<"u"?e(ea):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(ea,function(a){"use strict";function e(){for(var h=arguments.length,d=Array(h),v=0;v<h;v++)d[v]=arguments[v];if(d.length>1){d[0]=d[0].slice(0,-1);for(var P=d.length-1,x=1;x<P;++x)d[x]=d[x].slice(1,-1);return d[P]=d[P].slice(1),d.join("")}else return d[0]}function t(h){return"(?:"+h+")"}function s(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function r(h){return h.toUpperCase()}function n(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function o(h,d){var v=h;if(d)for(var P in d)v[P]=d[P];return v}function i(h){var d="[A-Za-z]",v="[\\x0D]",P="[0-9]",x="[\\x22]",N=e(P,"[A-Fa-f]"),G="[\\x0A]",se="[\\x20]",le=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),Ee="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ve=e(Ee,te),Se=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",he=h?"[\\uE000-\\uF8FF]":"[]",ie=e(d,P,"[\\-\\.\\_\\~]",Se),ge=t(d+e(d,P,"[\\+\\-\\.]")+"*"),ue=t(t(le+"|"+e(ie,te,"[\\:]"))+"*"),Ir=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("[1-9]"+P)+"|"+P),Me=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("0?[1-9]"+P)+"|0?0?"+P),He=t(Me+"\\."+Me+"\\."+Me+"\\."+Me),de=t(N+"{1,4}"),ze=t(t(de+"\\:"+de)+"|"+He),Ve=t(t(de+"\\:")+"{6}"+ze),tr=t("\\:\\:"+t(de+"\\:")+"{5}"+ze),kr=t(t(de)+"?\\:\\:"+t(de+"\\:")+"{4}"+ze),cr=t(t(t(de+"\\:")+"{0,1}"+de)+"?\\:\\:"+t(de+"\\:")+"{3}"+ze),vt=t(t(t(de+"\\:")+"{0,2}"+de)+"?\\:\\:"+t(de+"\\:")+"{2}"+ze),$t=t(t(t(de+"\\:")+"{0,3}"+de)+"?\\:\\:"+de+"\\:"+ze),Ot=t(t(t(de+"\\:")+"{0,4}"+de)+"?\\:\\:"+ze),Xr=t(t(t(de+"\\:")+"{0,5}"+de)+"?\\:\\:"+de),et=t(t(t(de+"\\:")+"{0,6}"+de)+"?\\:\\:"),ur=t([Ve,tr,kr,cr,vt,$t,Ot,Xr,et].join("|")),rt=t(t(ie+"|"+le)+"+"),qa=t(ur+"\\%25"+rt),Dr=t(ur+t("\\%25|\\%(?!"+N+"{2})")+rt),Dl=t("[vV]"+N+"+\\."+e(ie,te,"[\\:]")+"+"),Cl=t("\\["+t(Dr+"|"+ur+"|"+Dl)+"\\]"),qs=t(t(le+"|"+e(ie,te))+"*"),gt=t(Cl+"|"+He+"(?!"+qs+")|"+qs),yt=t(P+"*"),Ms=t(t(ue+"@")+"?"+gt+t("\\:"+yt)+"?"),_t=t(le+"|"+e(ie,te,"[\\:\\@]")),jl=t(_t+"*"),zs=t(_t+"+"),Nl=t(t(le+"|"+e(ie,te,"[\\@]"))+"+"),dr=t(t("\\/"+jl)+"*"),tt=t("\\/"+t(zs+dr)+"?"),Ma=t(Nl+dr),It=t(zs+dr),at="(?!"+_t+")",Bf=t(dr+"|"+tt+"|"+Ma+"|"+It+"|"+at),st=t(t(_t+"|"+e("[\\/\\?]",he))+"*"),bt=t(t(_t+"|[\\/\\?]")+"*"),Us=t(t("\\/\\/"+Ms+dr)+"|"+tt+"|"+It+"|"+at),Ll=t(ge+"\\:"+Us+t("\\?"+st)+"?"+t("\\#"+bt)+"?"),Fl=t(t("\\/\\/"+Ms+dr)+"|"+tt+"|"+Ma+"|"+at),ql=t(Fl+t("\\?"+st)+"?"+t("\\#"+bt)+"?"),Kf=t(Ll+"|"+ql),Jf=t(ge+"\\:"+Us+t("\\?"+st)+"?"),Gf="^("+ge+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+gt+")"+t("\\:("+yt+")")+"?)")+"?("+dr+"|"+tt+"|"+It+"|"+at+")")+t("\\?("+st+")")+"?"+t("\\#("+bt+")")+"?$",Yf="^(){0}"+t(t("\\/\\/("+t("("+ue+")@")+"?("+gt+")"+t("\\:("+yt+")")+"?)")+"?("+dr+"|"+tt+"|"+Ma+"|"+at+")")+t("\\?("+st+")")+"?"+t("\\#("+bt+")")+"?$",Wf="^("+ge+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+gt+")"+t("\\:("+yt+")")+"?)")+"?("+dr+"|"+tt+"|"+It+"|"+at+")")+t("\\?("+st+")")+"?$",Xf="^"+t("\\#("+bt+")")+"?$",ep="^"+t("("+ue+")@")+"?("+gt+")"+t("\\:("+yt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",d,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ie,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ie,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ie,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ie,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ie,te,"[\\:\\@\\/\\?]",he),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ie,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ie,te),"g"),UNRESERVED:new RegExp(ie,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ie,ve),"g"),PCT_ENCODED:new RegExp(le,"g"),IPV4ADDRESS:new RegExp("^("+He+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ur+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+rt+")")+"?\\]?$")}}var c=i(!1),f=i(!0),p=function(){function h(d,v){var P=[],x=!0,N=!1,G=void 0;try{for(var se=d[Symbol.iterator](),le;!(x=(le=se.next()).done)&&(P.push(le.value),!(v&&P.length===v));x=!0);}catch(Ee){N=!0,G=Ee}finally{try{!x&&se.return&&se.return()}finally{if(N)throw G}}return P}return function(d,v){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return h(d,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),m=function(h){if(Array.isArray(h)){for(var d=0,v=Array(h.length);d<h.length;d++)v[d]=h[d];return v}else return Array.from(h)},_=2147483647,u=36,y=1,b=26,g=38,E=700,$=72,S=128,w="-",O=/^xn--/,I=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=u-y,z=Math.floor,q=String.fromCharCode;function L(h){throw new RangeError(M[h])}function A(h,d){for(var v=[],P=h.length;P--;)v[P]=d(h[P]);return v}function D(h,d){var v=h.split("@"),P="";v.length>1&&(P=v[0]+"@",h=v[1]),h=h.replace(H,".");var x=h.split("."),N=A(x,d).join(".");return P+N}function F(h){for(var d=[],v=0,P=h.length;v<P;){var x=h.charCodeAt(v++);if(x>=55296&&x<=56319&&v<P){var N=h.charCodeAt(v++);(N&64512)==56320?d.push(((x&1023)<<10)+(N&1023)+65536):(d.push(x),v--)}else d.push(x)}return d}var ce=function(d){return String.fromCodePoint.apply(String,m(d))},W=function(d){return d-48<10?d-22:d-65<26?d-65:d-97<26?d-97:u},re=function(d,v){return d+22+75*(d<26)-((v!=0)<<5)},Y=function(d,v,P){var x=0;for(d=P?z(d/E):d>>1,d+=z(d/v);d>k*b>>1;x+=u)d=z(d/k);return z(x+(k+1)*d/(d+g))},V=function(d){var v=[],P=d.length,x=0,N=S,G=$,se=d.lastIndexOf(w);se<0&&(se=0);for(var le=0;le<se;++le)d.charCodeAt(le)>=128&&L("not-basic"),v.push(d.charCodeAt(le));for(var Ee=se>0?se+1:0;Ee<P;){for(var te=x,ve=1,Se=u;;Se+=u){Ee>=P&&L("invalid-input");var he=W(d.charCodeAt(Ee++));(he>=u||he>z((_-x)/ve))&&L("overflow"),x+=he*ve;var ie=Se<=G?y:Se>=G+b?b:Se-G;if(he<ie)break;var ge=u-ie;ve>z(_/ge)&&L("overflow"),ve*=ge}var ue=v.length+1;G=Y(x-te,ue,te==0),z(x/ue)>_-N&&L("overflow"),N+=z(x/ue),x%=ue,v.splice(x++,0,N)}return String.fromCodePoint.apply(String,v)},ye=function(d){var v=[];d=F(d);var P=d.length,x=S,N=0,G=$,se=!0,le=!1,Ee=void 0;try{for(var te=d[Symbol.iterator](),ve;!(se=(ve=te.next()).done);se=!0){var Se=ve.value;Se<128&&v.push(q(Se))}}catch(Dr){le=!0,Ee=Dr}finally{try{!se&&te.return&&te.return()}finally{if(le)throw Ee}}var he=v.length,ie=he;for(he&&v.push(w);ie<P;){var ge=_,ue=!0,Ir=!1,Me=void 0;try{for(var He=d[Symbol.iterator](),de;!(ue=(de=He.next()).done);ue=!0){var ze=de.value;ze>=x&&ze<ge&&(ge=ze)}}catch(Dr){Ir=!0,Me=Dr}finally{try{!ue&&He.return&&He.return()}finally{if(Ir)throw Me}}var Ve=ie+1;ge-x>z((_-N)/Ve)&&L("overflow"),N+=(ge-x)*Ve,x=ge;var tr=!0,kr=!1,cr=void 0;try{for(var vt=d[Symbol.iterator](),$t;!(tr=($t=vt.next()).done);tr=!0){var Ot=$t.value;if(Ot<x&&++N>_&&L("overflow"),Ot==x){for(var Xr=N,et=u;;et+=u){var ur=et<=G?y:et>=G+b?b:et-G;if(Xr<ur)break;var rt=Xr-ur,qa=u-ur;v.push(q(re(ur+rt%qa,0))),Xr=z(rt/qa)}v.push(q(re(Xr,0))),G=Y(N,Ve,ie==he),N=0,++ie}}}catch(Dr){kr=!0,cr=Dr}finally{try{!tr&&vt.return&&vt.return()}finally{if(kr)throw cr}}++N,++x}return v.join("")},Ae=function(d){return D(d,function(v){return O.test(v)?V(v.slice(4).toLowerCase()):v})},Ie=function(d){return D(d,function(v){return I.test(v)?"xn--"+ye(v):v})},ne={version:"2.1.0",ucs2:{decode:F,encode:ce},decode:V,encode:ye,toASCII:Ie,toUnicode:Ae},Pe={};function Re(h){var d=h.charCodeAt(0),v=void 0;return d<16?v="%0"+d.toString(16).toUpperCase():d<128?v="%"+d.toString(16).toUpperCase():d<2048?v="%"+(d>>6|192).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase():v="%"+(d>>12|224).toString(16).toUpperCase()+"%"+(d>>6&63|128).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase(),v}function ke(h){for(var d="",v=0,P=h.length;v<P;){var x=parseInt(h.substr(v+1,2),16);if(x<128)d+=String.fromCharCode(x),v+=3;else if(x>=194&&x<224){if(P-v>=6){var N=parseInt(h.substr(v+4,2),16);d+=String.fromCharCode((x&31)<<6|N&63)}else d+=h.substr(v,6);v+=6}else if(x>=224){if(P-v>=9){var G=parseInt(h.substr(v+4,2),16),se=parseInt(h.substr(v+7,2),16);d+=String.fromCharCode((x&15)<<12|(G&63)<<6|se&63)}else d+=h.substr(v,9);v+=9}else d+=h.substr(v,3),v+=3}return d}function _r(h,d){function v(P){var x=ke(P);return x.match(d.UNRESERVED)?x:P}return h.scheme&&(h.scheme=String(h.scheme).replace(d.PCT_ENCODED,v).toLowerCase().replace(d.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(d.PCT_ENCODED,v).replace(d.NOT_USERINFO,Re).replace(d.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(d.PCT_ENCODED,v).toLowerCase().replace(d.NOT_HOST,Re).replace(d.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(d.PCT_ENCODED,v).replace(h.scheme?d.NOT_PATH:d.NOT_PATH_NOSCHEME,Re).replace(d.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(d.PCT_ENCODED,v).replace(d.NOT_QUERY,Re).replace(d.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(d.PCT_ENCODED,v).replace(d.NOT_FRAGMENT,Re).replace(d.PCT_ENCODED,r)),h}function or(h){return h.replace(/^0*(.*)/,"$1")||"0"}function xe(h,d){var v=h.match(d.IPV4ADDRESS)||[],P=p(v,2),x=P[1];return x?x.split(".").map(or).join("."):h}function _e(h,d){var v=h.match(d.IPV6ADDRESS)||[],P=p(v,3),x=P[1],N=P[2];if(x){for(var G=x.toLowerCase().split("::").reverse(),se=p(G,2),le=se[0],Ee=se[1],te=Ee?Ee.split(":").map(or):[],ve=le.split(":").map(or),Se=d.IPV4ADDRESS.test(ve[ve.length-1]),he=Se?7:8,ie=ve.length-he,ge=Array(he),ue=0;ue<he;++ue)ge[ue]=te[ue]||ve[ie+ue]||"";Se&&(ge[he-1]=xe(ge[he-1],d));var Ir=ge.reduce(function(Ve,tr,kr){if(!tr||tr==="0"){var cr=Ve[Ve.length-1];cr&&cr.index+cr.length===kr?cr.length++:Ve.push({index:kr,length:1})}return Ve},[]),Me=Ir.sort(function(Ve,tr){return tr.length-Ve.length})[0],He=void 0;if(Me&&Me.length>1){var de=ge.slice(0,Me.index),ze=ge.slice(Me.index+Me.length);He=de.join(":")+"::"+ze.join(":")}else He=ge.join(":");return N&&(He+="%"+N),He}else return h}var Ar=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,$e="".match(/(){0}/)[1]===void 0;function oe(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},P=d.iri!==!1?f:c;d.reference==="suffix"&&(h=(d.scheme?d.scheme+":":"")+"//"+h);var x=h.match(Ar);if(x){$e?(v.scheme=x[1],v.userinfo=x[3],v.host=x[4],v.port=parseInt(x[5],10),v.path=x[6]||"",v.query=x[7],v.fragment=x[8],isNaN(v.port)&&(v.port=x[5])):(v.scheme=x[1]||void 0,v.userinfo=h.indexOf("@")!==-1?x[3]:void 0,v.host=h.indexOf("//")!==-1?x[4]:void 0,v.port=parseInt(x[5],10),v.path=x[6]||"",v.query=h.indexOf("?")!==-1?x[7]:void 0,v.fragment=h.indexOf("#")!==-1?x[8]:void 0,isNaN(v.port)&&(v.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?x[4]:void 0)),v.host&&(v.host=_e(xe(v.host,P),P)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==v.reference&&(v.error=v.error||"URI is not a "+d.reference+" reference.");var N=Pe[(d.scheme||v.scheme||"").toLowerCase()];if(!d.unicodeSupport&&(!N||!N.unicodeSupport)){if(v.host&&(d.domainHost||N&&N.domainHost))try{v.host=ne.toASCII(v.host.replace(P.PCT_ENCODED,ke).toLowerCase())}catch(G){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+G}_r(v,c)}else _r(v,P);N&&N.parse&&N.parse(v,d)}else v.error=v.error||"URI can not be parsed.";return v}function br(h,d){var v=d.iri!==!1?f:c,P=[];return h.userinfo!==void 0&&(P.push(h.userinfo),P.push("@")),h.host!==void 0&&P.push(_e(xe(String(h.host),v),v).replace(v.IPV6ADDRESS,function(x,N,G){return"["+N+(G?"%25"+G:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(P.push(":"),P.push(String(h.port))),P.length?P.join(""):void 0}var lr=/^\.\.?\//,$r=/^\/\.(\/|$)/,Or=/^\/\.\.(\/|$)/,we=/^\/?(?:.|\n)*?(?=\/|$)/;function Ue(h){for(var d=[];h.length;)if(h.match(lr))h=h.replace(lr,"");else if(h.match($r))h=h.replace($r,"/");else if(h.match(Or))h=h.replace(Or,"/"),d.pop();else if(h==="."||h==="..")h="";else{var v=h.match(we);if(v){var P=v[0];h=h.slice(P.length),d.push(P)}else throw new Error("Unexpected dot segment condition")}return d.join("")}function je(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=d.iri?f:c,P=[],x=Pe[(d.scheme||h.scheme||"").toLowerCase()];if(x&&x.serialize&&x.serialize(h,d),h.host&&!v.IPV6ADDRESS.test(h.host)){if(d.domainHost||x&&x.domainHost)try{h.host=d.iri?ne.toUnicode(h.host):ne.toASCII(h.host.replace(v.PCT_ENCODED,ke).toLowerCase())}catch(se){h.error=h.error||"Host's domain name can not be converted to "+(d.iri?"Unicode":"ASCII")+" via punycode: "+se}}_r(h,v),d.reference!=="suffix"&&h.scheme&&(P.push(h.scheme),P.push(":"));var N=br(h,d);if(N!==void 0&&(d.reference!=="suffix"&&P.push("//"),P.push(N),h.path&&h.path.charAt(0)!=="/"&&P.push("/")),h.path!==void 0){var G=h.path;!d.absolutePath&&(!x||!x.absolutePath)&&(G=Ue(G)),N===void 0&&(G=G.replace(/^\/\//,"/%2F")),P.push(G)}return h.query!==void 0&&(P.push("?"),P.push(h.query)),h.fragment!==void 0&&(P.push("#"),P.push(h.fragment)),P.join("")}function De(h,d){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments[3],x={};return P||(h=oe(je(h,v),v),d=oe(je(d,v),v)),v=v||{},!v.tolerant&&d.scheme?(x.scheme=d.scheme,x.userinfo=d.userinfo,x.host=d.host,x.port=d.port,x.path=Ue(d.path||""),x.query=d.query):(d.userinfo!==void 0||d.host!==void 0||d.port!==void 0?(x.userinfo=d.userinfo,x.host=d.host,x.port=d.port,x.path=Ue(d.path||""),x.query=d.query):(d.path?(d.path.charAt(0)==="/"?x.path=Ue(d.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?x.path="/"+d.path:h.path?x.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+d.path:x.path=d.path,x.path=Ue(x.path)),x.query=d.query):(x.path=h.path,d.query!==void 0?x.query=d.query:x.query=h.query),x.userinfo=h.userinfo,x.host=h.host,x.port=h.port),x.scheme=h.scheme),x.fragment=d.fragment,x}function er(h,d,v){var P=o({scheme:"null"},v);return je(De(oe(h,P),oe(d,P),P,!0),P)}function qe(h,d){return typeof h=="string"?h=je(oe(h,d),d):s(h)==="object"&&(h=oe(je(h,d),d)),h}function At(h,d,v){return typeof h=="string"?h=je(oe(h,v),v):s(h)==="object"&&(h=je(h,v)),typeof d=="string"?d=je(oe(d,v),v):s(d)==="object"&&(d=je(d,v)),h===d}function La(h,d){return h&&h.toString().replace(!d||!d.iri?c.ESCAPE:f.ESCAPE,Re)}function Ge(h,d){return h&&h.toString().replace(!d||!d.iri?c.PCT_ENCODED:f.PCT_ENCODED,ke)}var ht={scheme:"http",domainHost:!0,parse:function(d,v){return d.host||(d.error=d.error||"HTTP URIs must have a host."),d},serialize:function(d,v){var P=String(d.scheme).toLowerCase()==="https";return(d.port===(P?443:80)||d.port==="")&&(d.port=void 0),d.path||(d.path="/"),d}},Is={scheme:"https",domainHost:ht.domainHost,parse:ht.parse,serialize:ht.serialize};function ks(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var mt={scheme:"ws",domainHost:!0,parse:function(d,v){var P=d;return P.secure=ks(P),P.resourceName=(P.path||"/")+(P.query?"?"+P.query:""),P.path=void 0,P.query=void 0,P},serialize:function(d,v){if((d.port===(ks(d)?443:80)||d.port==="")&&(d.port=void 0),typeof d.secure=="boolean"&&(d.scheme=d.secure?"wss":"ws",d.secure=void 0),d.resourceName){var P=d.resourceName.split("?"),x=p(P,2),N=x[0],G=x[1];d.path=N&&N!=="/"?N:void 0,d.query=G,d.resourceName=void 0}return d.fragment=void 0,d}},Ds={scheme:"wss",domainHost:mt.domainHost,parse:mt.parse,serialize:mt.serialize},Pl={},xl=!0,Cs="[A-Za-z0-9\\-\\.\\_\\~"+(xl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",El=t(t("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+t("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+t("%"+rr+rr)),Sl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Rl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",wl=e(Rl,'[\\"\\\\]'),Tl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Al=new RegExp(Cs,"g"),Wr=new RegExp(El,"g"),$l=new RegExp(e("[^]",Sl,"[\\.]",'[\\"]',wl),"g"),js=new RegExp(e("[^]",Cs,Tl),"g"),Ol=js;function Fa(h){var d=ke(h);return d.match(Al)?d:h}var Ns={scheme:"mailto",parse:function(d,v){var P=d,x=P.to=P.path?P.path.split(","):[];if(P.path=void 0,P.query){for(var N=!1,G={},se=P.query.split("&"),le=0,Ee=se.length;le<Ee;++le){var te=se[le].split("=");switch(te[0]){case"to":for(var ve=te[1].split(","),Se=0,he=ve.length;Se<he;++Se)x.push(ve[Se]);break;case"subject":P.subject=Ge(te[1],v);break;case"body":P.body=Ge(te[1],v);break;default:N=!0,G[Ge(te[0],v)]=Ge(te[1],v);break}}N&&(P.headers=G)}P.query=void 0;for(var ie=0,ge=x.length;ie<ge;++ie){var ue=x[ie].split("@");if(ue[0]=Ge(ue[0]),v.unicodeSupport)ue[1]=Ge(ue[1],v).toLowerCase();else try{ue[1]=ne.toASCII(Ge(ue[1],v).toLowerCase())}catch(Ir){P.error=P.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ir}x[ie]=ue.join("@")}return P},serialize:function(d,v){var P=d,x=n(d.to);if(x){for(var N=0,G=x.length;N<G;++N){var se=String(x[N]),le=se.lastIndexOf("@"),Ee=se.slice(0,le).replace(Wr,Fa).replace(Wr,r).replace($l,Re),te=se.slice(le+1);try{te=v.iri?ne.toUnicode(te):ne.toASCII(Ge(te,v).toLowerCase())}catch(ie){P.error=P.error||"Email address's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+ie}x[N]=Ee+"@"+te}P.path=x.join(",")}var ve=d.headers=d.headers||{};d.subject&&(ve.subject=d.subject),d.body&&(ve.body=d.body);var Se=[];for(var he in ve)ve[he]!==Pl[he]&&Se.push(he.replace(Wr,Fa).replace(Wr,r).replace(js,Re)+"="+ve[he].replace(Wr,Fa).replace(Wr,r).replace(Ol,Re));return Se.length&&(P.query=Se.join("&")),P}},Il=/^([^\:]+)\:(.*)/,Ls={scheme:"urn",parse:function(d,v){var P=d.path&&d.path.match(Il),x=d;if(P){var N=v.scheme||x.scheme||"urn",G=P[1].toLowerCase(),se=P[2],le=N+":"+(v.nid||G),Ee=Pe[le];x.nid=G,x.nss=se,x.path=void 0,Ee&&(x=Ee.parse(x,v))}else x.error=x.error||"URN can not be parsed.";return x},serialize:function(d,v){var P=v.scheme||d.scheme||"urn",x=d.nid,N=P+":"+(v.nid||x),G=Pe[N];G&&(d=G.serialize(d,v));var se=d,le=d.nss;return se.path=(x||v.nid)+":"+le,se}},kl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Fs={scheme:"urn:uuid",parse:function(d,v){var P=d;return P.uuid=P.nss,P.nss=void 0,!v.tolerant&&(!P.uuid||!P.uuid.match(kl))&&(P.error=P.error||"UUID is not valid."),P},serialize:function(d,v){var P=d;return P.nss=(d.uuid||"").toLowerCase(),P}};Pe[ht.scheme]=ht,Pe[Is.scheme]=Is,Pe[mt.scheme]=mt,Pe[Ds.scheme]=Ds,Pe[Ns.scheme]=Ns,Pe[Ls.scheme]=Ls,Pe[Fs.scheme]=Fs,a.SCHEMES=Pe,a.pctEncChar=Re,a.pctDecChars=ke,a.parse=oe,a.removeDotSegments=Ue,a.serialize=je,a.resolveComponents=De,a.resolve=er,a.normalize=qe,a.equal=At,a.escapeComponent=La,a.unescapeComponent=Ge,Object.defineProperty(a,"__esModule",{value:!0})})});var ra=B((qp,En)=>{"use strict";En.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 Rn=B((Mp,Sn)=>{"use strict";Sn.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 Gr=B((zp,An)=>{"use strict";An.exports={copy:Ku,checkDataType:ts,checkDataTypes:Ju,coerceToTypes:Gu,toHash:ss,getProperty:ns,escapeQuotes:is,equal:ra(),ucs2length:Rn(),varOccurences:Xu,varReplace:ed,schemaHasRules:rd,schemaHasRulesExcept:td,schemaUnknownRules:ad,toQuotedString:as,getPathExpr:sd,getPath:nd,getData:ld,unescapeFragment:cd,unescapeJsonPointer:ls,escapeFragment:ud,escapeJsonPointer:os};function Ku(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function ts(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",i=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+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+i+"("+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 Ju(a,e,t){switch(a.length){case 1:return ts(a[0],e,t,!0);default:var s="",r=ss(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?" && ":"")+ts(n,e,t,!0);return s}}var wn=ss(["string","number","integer","boolean","null"]);function Gu(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(wn[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(wn[e])return[e];if(a==="array"&&e==="array")return["array"]}}function ss(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Yu=/^[a-z$_][a-z$_0-9]*$/i,Wu=/'|\\/g;function ns(a){return typeof a=="number"?"["+a+"]":Yu.test(a)?"."+a:"['"+is(a)+"']"}function is(a){return a.replace(Wu,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Xu(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function ed(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function rd(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function td(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function ad(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function as(a){return"'"+is(a)+"'"}function sd(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Tn(a,r)}function nd(a,e,t){var s=as(t?"/"+os(e):ns(e));return Tn(a,s)}var id=/^\/(?:[^~]|~0|~1)*$/,od=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ld(a,e,t){var s,r,n,o;if(a==="")return"rootData";if(a[0]=="/"){if(!id.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(o=a.match(od),!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 i=n,c=r.split("/"),f=0;f<c.length;f++){var p=c[f];p&&(n+=ns(ls(p)),i+=" && "+n)}return i}function Tn(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function cd(a){return ls(decodeURIComponent(a))}function ud(a){return encodeURIComponent(os(a))}function os(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function ls(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var cs=B((Up,$n)=>{"use strict";var dd=Gr();$n.exports=fd;function fd(a){dd.copy(a,this)}});var In=B((Hp,On)=>{"use strict";var Rr=On.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(){};ta(e,s,r,a,"",a)};Rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Rr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Rr.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 ta(a,e,t,s,r,n,o,i,c,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,c,f);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in Rr.arrayKeywords)for(var _=0;_<m.length;_++)ta(a,e,t,m[_],r+"/"+p+"/"+_,n,r,p,s,_)}else if(p in Rr.propsKeywords){if(m&&typeof m=="object")for(var u in m)ta(a,e,t,m[u],r+"/"+p+"/"+pd(u),n,r,p,s,u)}else(p in Rr.keywords||a.allKeys&&!(p in Rr.skipKeywords))&&ta(a,e,t,m,r+"/"+p,n,r,p,s)}t(s,r,n,o,i,c,f)}}function pd(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var la=B((Vp,jn)=>{"use strict";var wt=xn(),kn=ra(),ia=Gr(),aa=cs(),hd=In();jn.exports=Tr;Tr.normalizeId=wr;Tr.fullPath=sa;Tr.url=na;Tr.ids=_d;Tr.inlineRef=us;Tr.schema=oa;function Tr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Tr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof aa)return us(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=oa.call(this,e,t),n,o,i;return r&&(n=r.schema,e=r.root,i=r.baseId),n instanceof aa?o=n.validate||a.call(this,n.schema,e,void 0,i):n!==void 0&&(o=us(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,i)),o}function oa(a,e){var t=wt.parse(e),s=Cn(t),r=sa(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=wr(s),o=this._refs[n];if(typeof o=="string")return md.call(this,a,o,t);if(o instanceof aa)o.validate||this._compile(o),a=o;else if(o=this._schemas[n],o instanceof aa){if(o.validate||this._compile(o),n==wr(e))return{schema:o,root:a,baseId:r};a=o}else return;if(!a.schema)return;r=sa(this._getId(a.schema))}return Dn.call(this,t,r,a.schema,a)}function md(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=na(n,o)),Dn.call(this,t,n,r,a)}}var vd=ia.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Dn(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=ia.unescapeFragment(o),t=t[o],t===void 0)break;var i;if(!vd[o]&&(i=this._getId(t),i&&(e=na(e,i)),t.$ref)){var c=na(e,t.$ref),f=oa.call(this,s,c);f&&(t=f.schema,s=f.root,e=f.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var gd=ia.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function us(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return ds(a);if(e)return fs(a)<=e}function ds(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!ds(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!ds(e)))return!1;return!0}function fs(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+=fs(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(gd[r])e++;else if(t=a[r],typeof t=="object"&&(e+=fs(t)+1),e==1/0)return 1/0}return e}function sa(a,e){e!==!1&&(a=wr(a));var t=wt.parse(a);return Cn(t)}function Cn(a){return wt.serialize(a).split("#")[0]+"#"}var yd=/#\/?$/;function wr(a){return a?a.replace(yd,""):""}function na(a,e){return e=wr(e),wt.resolve(a,e)}function _d(a){var e=wr(this._getId(a)),t={"":e},s={"":sa(e,!1)},r={},n=this;return hd(a,{allKeys:!0},function(o,i,c,f,p,m,_){if(i!==""){var u=n._getId(o),y=t[f],b=s[f]+"/"+p;if(_!==void 0&&(b+="/"+(typeof _=="number"?_:ia.escapeFragment(_))),typeof u=="string"){u=y=wr(y?wt.resolve(y,u):u);var g=n._refs[u];if(typeof g=="string"&&(g=n._refs[g]),g&&g.schema){if(!kn(o,g.schema))throw new Error('id "'+u+'" resolves to more than one schema')}else if(u!=wr(b))if(u[0]=="#"){if(r[u]&&!kn(o,r[u]))throw new Error('id "'+u+'" resolves to more than one schema');r[u]=o}else n._refs[u]=b}t[i]=y,s[i]=b}}),r}});var ca=B((Zp,Ln)=>{"use strict";var ps=la();Ln.exports={Validation:Nn(bd),MissingRef:Nn(hs)};function bd(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}hs.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function hs(a,e,t){this.message=t||hs.message(a,e),this.missingRef=ps.url(a,e),this.missingSchema=ps.normalizeId(ps.fullPath(this.missingRef))}function Nn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var ms=B((Qp,Fn)=>{"use strict";Fn.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(i,c){var f={key:i,value:o[i]},p={key:c,value:o[c]};return n(f,p)}}}(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 i,c;if(Array.isArray(o)){for(c="[",i=0;i<o.length;i++)i&&(c+=","),c+=n(o[i])||"null";return c+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=r.push(o)-1,p=Object.keys(o).sort(s&&s(o));for(c="",i=0;i<p.length;i++){var m=p[i],_=n(o[m]);_&&(c&&(c+=","),c+=JSON.stringify(m)+":"+_)}return r.splice(f,1),"{"+c+"}"}}(a)}});var vs=B((Bp,qn)=>{"use strict";qn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var f="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,_=e.schema[t],u=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,O=!e.opts.allErrors,M,b="data"+(m||""),w="valid"+p;if(e.schema===!1){e.isTop?O=!0:r+=" var "+w+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(M||"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: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&O?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++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+w+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,p=e.level=0,m=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,b="data"+(m||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+p+" = errors;"}var w="valid"+p,O=!e.opts.allErrors,I="",H="",M,k=e.schema.type,z=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(z?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],z=!0)),z&&k.length==1&&(k=k[0],z=!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 q=e.util.coerceToTypes(e.opts.coerceTypes,k);var L=e.RULES.types[k];if(q||z||L===!0||L&&!we(L)){var u=e.schemaPath+".type",y=e.errSchemaPath+"/type",u=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=z?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](k,b,e.opts.strictNumbers,!0)+") { ",q){var D="dataType"+p,F="coerced"+p;r+=" var "+D+" = typeof "+b+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+D+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+D+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+F+" = "+b+"; } "),r+=" if ("+F+" !== undefined) ; ";var ce=q;if(ce)for(var W,re=-1,Y=ce.length-1;re<Y;)W=ce[re+=1],W=="string"?r+=" else if ("+D+" == 'number' || "+D+" == 'boolean') "+F+" = '' + "+b+"; else if ("+b+" === null) "+F+" = ''; ":W=="number"||W=="integer"?(r+=" else if ("+D+" == 'boolean' || "+b+" === null || ("+D+" == 'string' && "+b+" && "+b+" == +"+b+" ",W=="integer"&&(r+=" && !("+b+" % 1)"),r+=")) "+F+" = +"+b+"; "):W=="boolean"?r+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+F+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+F+" = true; ":W=="null"?r+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+F+" = null; ":e.opts.coerceTypes=="array"&&W=="array"&&(r+=" else if ("+D+" == 'string' || "+D+" == 'number' || "+D+" == 'boolean' || "+b+" == null) "+F+" = ["+b+"]; ");r+=" else { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(M||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&O?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+=" } if ("+F+" !== undefined) { ";var V=m?"data"+(m-1||""):"parentData",ye=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+b+" = "+F+"; ",m||(r+="if ("+V+" !== undefined)"),r+=" "+V+"["+ye+"] = "+F+"; } "}else{var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(M||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&O?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+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",O&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+p,r+=") { ",H+="}");else{var Ae=e.RULES;if(Ae){for(var L,Ie=-1,ne=Ae.length-1;Ie<ne;)if(L=Ae[Ie+=1],we(L)){if(L.type&&(r+=" if ("+e.util.checkDataType(L.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(L.type=="object"&&e.schema.properties){var _=e.schema.properties,Pe=Object.keys(_),Re=Pe;if(Re)for(var ke,_r=-1,or=Re.length-1;_r<or;){ke=Re[_r+=1];var xe=_[ke];if(xe.default!==void 0){var _e=b+e.util.getProperty(ke);if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+_e;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else r+=" if ("+_e+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+_e+" === null || "+_e+" === '' "),r+=" ) "+_e+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}else if(L.type=="array"&&Array.isArray(e.schema.items)){var Ar=e.schema.items;if(Ar){for(var xe,re=-1,$e=Ar.length-1;re<$e;)if(xe=Ar[re+=1],xe.default!==void 0){var _e=b+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+_e;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else r+=" if ("+_e+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+_e+" === null || "+_e+" === '' "),r+=" ) "+_e+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}}var oe=L.rules;if(oe){for(var br,lr=-1,$r=oe.length-1;lr<$r;)if(br=oe[lr+=1],Ue(br)){var Or=br.code(e,br.keyword,L.type);Or&&(r+=" "+Or+" ",O&&(I+="}"))}}if(O&&(r+=" "+I+" ",I=""),L.type&&(r+=" } ",k&&k===L.type&&!q)){r+=" else { ";var u=e.schemaPath+".type",y=e.errSchemaPath+"/type",g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(M||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&O?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+=" } "}O&&(r+=" if (errors === ",$?r+="0":r+="errs_"+p,r+=") { ",H+="}")}}}O&&(r+=" "+H+" "),$?(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 "+w+" = errors === errs_"+p+";";function we(De){for(var er=De.rules,qe=0;qe<er.length;qe++)if(Ue(er[qe]))return!0}function Ue(De){return e.schema[De.keyword]!==void 0||De.implements&&je(De)}function je(De){for(var er=De.implements,qe=0;qe<er.length;qe++)if(e.schema[er[qe]]!==void 0)return!0}return r}});var Vn=B((Kp,Hn)=>{"use strict";var ua=la(),fa=Gr(),zn=ca(),Pd=ms(),Mn=vs(),xd=fa.ucs2length,Ed=ra(),Sd=zn.Validation;Hn.exports=gs;function gs(a,e,t,s){var r=this,n=this._opts,o=[void 0],i={},c=[],f={},p=[],m={},_=[];e=e||{schema:a,refVal:o,refs:i};var u=Rd.call(this,a,e,s),y=this._compilations[u.index];if(u.compiling)return y.callValidate=S;var b=this._formats,g=this.RULES;try{var E=w(a,e,t,s);y.validate=E;var $=y.callValidate;return $&&($.schema=E.schema,$.errors=null,$.refs=E.refs,$.refVal=E.refVal,$.root=E.root,$.$async=E.$async,n.sourceCode&&($.source=E.source)),E}finally{wd.call(this,a,e,s)}function S(){var A=y.validate,D=A.apply(this,arguments);return S.errors=A.errors,D}function w(A,D,F,ce){var W=!D||D&&D.schema==A;if(D.schema!=e.schema)return gs.call(r,A,D,F,ce);var re=A.$async===!0,Y=Mn({isTop:!0,schema:A,isRoot:W,baseId:ce,root:D,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:zn.MissingRef,RULES:g,validate:Mn,util:fa,resolve:ua,resolveRef:O,usePattern:z,useDefault:q,useCustomRule:L,opts:n,formats:b,logger:r.logger,self:r});Y=da(o,$d)+da(c,Td)+da(p,Ad)+da(_,Od)+Y,n.processCode&&(Y=n.processCode(Y,A));var V;try{var ye=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Y);V=ye(r,g,b,e,o,p,_,Ed,xd,Sd),o[0]=V}catch(Ae){throw r.logger.error("Error compiling schema, function code:",Y),Ae}return V.schema=A,V.errors=null,V.refs=i,V.refVal=o,V.root=W?V:D,re&&(V.$async=!0),n.sourceCode===!0&&(V.source={code:Y,patterns:c,defaults:p}),V}function O(A,D,F){D=ua.url(A,D);var ce=i[D],W,re;if(ce!==void 0)return W=o[ce],re="refVal["+ce+"]",k(W,re);if(!F&&e.refs){var Y=e.refs[D];if(Y!==void 0)return W=e.refVal[Y],re=I(D,W),k(W,re)}re=I(D);var V=ua.call(r,w,e,D);if(V===void 0){var ye=t&&t[D];ye&&(V=ua.inlineRef(ye,n.inlineRefs)?ye:gs.call(r,ye,e,t,A))}if(V===void 0)H(D);else return M(D,V),k(V,re)}function I(A,D){var F=o.length;return o[F]=D,i[A]=F,"refVal"+F}function H(A){delete i[A]}function M(A,D){var F=i[A];o[F]=D}function k(A,D){return typeof A=="object"||typeof A=="boolean"?{code:D,schema:A,inline:!0}:{code:D,$async:A&&!!A.$async}}function z(A){var D=f[A];return D===void 0&&(D=f[A]=c.length,c[D]=A),"pattern"+D}function q(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return fa.toQuotedString(A);case"object":if(A===null)return"null";var D=Pd(A),F=m[D];return F===void 0&&(F=m[D]=p.length,p[F]=A),"default"+F}}function L(A,D,F,ce){if(r._opts.validateSchema!==!1){var W=A.definition.dependencies;if(W&&!W.every(function(Re){return Object.prototype.hasOwnProperty.call(F,Re)}))throw new Error("parent schema must have all required keywords: "+W.join(","));var re=A.definition.validateSchema;if(re){var Y=re(D);if(!Y){var V="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(V);else throw new Error(V)}}}var ye=A.definition.compile,Ae=A.definition.inline,Ie=A.definition.macro,ne;if(ye)ne=ye.call(r,D,F,ce);else if(Ie)ne=Ie.call(r,D,F,ce),n.validateSchema!==!1&&r.validateSchema(ne,!0);else if(Ae)ne=Ae.call(r,ce,A.keyword,D,F);else if(ne=A.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var Pe=_.length;return _[Pe]=ne,{code:"customRule"+Pe,validate:ne}}}function Rd(a,e,t){var s=Un.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 wd(a,e,t){var s=Un.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Un(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 Td(a,e){return"var pattern"+a+" = new RegExp("+fa.toQuotedString(e[a])+");"}function Ad(a){return"var default"+a+" = defaults["+a+"];"}function $d(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function Od(a){return"var customRule"+a+" = customRules["+a+"];"}function da(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Qn=B((Jp,Zn)=>{"use strict";var pa=Zn.exports=function(){this._cache={}};pa.prototype.put=function(e,t){this._cache[e]=t};pa.prototype.get=function(e){return this._cache[e]};pa.prototype.del=function(e){delete this._cache[e]};pa.prototype.clear=function(){this._cache={}}});var si=B((Gp,ai)=>{"use strict";var Id=Gr(),kd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Dd=[0,31,28,31,30,31,30,31,31,30,31,30,31],Cd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Bn=/^(?=.{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,jd=/^(?:[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,Nd=/^(?:[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,Kn=/^(?:(?:[^\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,Jn=/^(?:(?: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,Gn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Yn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Wn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Xn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ai.exports=ha;function ha(a){return a=a=="full"?"full":"fast",Id.copy(ha[a])}ha.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":Kn,url:Jn,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:Bn,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:ti,uuid:Gn,"json-pointer":Yn,"json-pointer-uri-fragment":Wn,"relative-json-pointer":Xn};ha.full={date:ei,time:ri,"date-time":qd,uri:zd,"uri-reference":Nd,"uri-template":Kn,url:Jn,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:Bn,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:ti,uuid:Gn,"json-pointer":Yn,"json-pointer-uri-fragment":Wn,"relative-json-pointer":Xn};function Ld(a){return a%4===0&&(a%100!==0||a%400===0)}function ei(a){var e=a.match(kd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Ld(t)?29:Dd[s])}function ri(a,e){var t=a.match(Cd);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 Fd=/t|\s/i;function qd(a){var e=a.split(Fd);return e.length==2&&ei(e[0])&&ri(e[1],!0)}var Md=/\/|:/;function zd(a){return Md.test(a)&&jd.test(a)}var Ud=/[^\\]\\Z/;function ti(a){if(Ud.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ii=B((Yp,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),m="valid"+n,_,u;if(i=="#"||i=="#/")e.isRoot?(_=e.async,u="validate"):(_=e.root.schema.$async===!0,u="root.refVal[0]");else{var y=e.resolveRef(e.baseId,i,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&f?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++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,b)}else if(y.inline){var $=e.util.copy(e);$.level++;var S="valid"+$.level;$.schema=y.schema,$.schemaPath="",$.errSchemaPath=i;var w=e.validate($).replace(/validate\.schema/g,y.code);r+=" "+w+" ",f&&(r+=" if ("+S+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,u=y.code}if(u){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+u+".call(this, ":r+=" "+u+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var O=o?"data"+(o-1||""):"parentData",I=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+O+" , "+I+", rootData) ";var H=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+H+"; ",f&&(r+=" "+m+" = 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; ",f&&(r+=" "+m+" = false; "),r+=" } ",f&&(r+=" if ("+m+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+u+".errors; else vErrors = vErrors.concat("+u+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var li=B((Wp,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),i=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,_=f.baseId,u=!0,y=n;if(y)for(var b,g=-1,E=y.length-1;g<E;)b=y[g+=1],(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(u=!1,f.schema=b,f.schemaPath=o+"["+g+"]",f.errSchemaPath=i+"/"+g,r+=" "+e.validate(f)+" ",f.baseId=_,c&&(r+=" if ("+m+") { ",p+="}"));return c&&(u?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ui=B((Xp,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=i.every(function(M){return e.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:e.util.schemaHasRules(M,e.RULES.all)});if(E){var $=y.baseId;r+=" var "+u+" = errors; var "+_+" = false; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0;var w=i;if(w)for(var O,I=-1,H=w.length-1;I<H;)O=w[I+=1],y.schema=O,y.schemaPath=c+"["+I+"]",y.errSchemaPath=f+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=$,r+=" "+_+" = "+_+" || "+g+"; if (!"+_+") { ",b+="}";e.compositeRule=y.compositeRule=S,r+=" "+b+" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else p&&(r+=" if (true) { ");return r}});var fi=B((eh,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,i=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}});var hi=B((rh,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u=e.opts.$data&&i&&i.$data,y;u?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i,u||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+_+" = equal("+m+", schema"+n+"); if (!"+_+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var vi=B((th,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,w=e.baseId,O=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+u+" = errors;var "+_+";",O){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=i,y.schemaPath=c,y.errSchemaPath=f,r+=" var "+g+" = false; for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var H=m+"["+E+"]";y.dataPathArr[$]=E;var M=e.validate(y);y.baseId=w,e.util.varOccurences(M,S)<2?r+=" "+e.util.varReplace(M,S,H)+" ":r+=" var "+S+" = "+H+"; "+M+" ",r+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+b+" if (!"+g+") {"}else r+=" if ("+m+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;return r=k.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",O&&(r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var yi=B((ah,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="errs__"+n,u=e.util.copy(e),y="";u.level++;var b="valid"+u.level,g={},E={},$=e.opts.ownProperties;for(I in i)if(I!="__proto__"){var S=i[I],w=Array.isArray(S)?E:g;w[I]=S}r+="var "+_+" = errors;";var O=e.errorPath;r+="var missing"+n+";";for(var I in E)if(w=E[I],w.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),p){r+=" && ( ";var H=w;if(H)for(var M,k=-1,z=H.length-1;k<z;){M=H[k+=1],k&&(r+=" || ");var q=e.util.getProperty(M),L=m+q;r+=" ( ( "+L+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:q)+") ) "}r+=")) { ";var A="missing"+n,D="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(O,A,!0):O+" + "+A);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+D+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",w.length==1?r+="property "+e.util.escapeQuotes(w[0]):r+="properties "+e.util.escapeQuotes(w.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ce=r;r=F.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ce+"]); ":r+=" validate.errors = ["+ce+"]; return false; ":r+=" var err = "+ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var W=w;if(W)for(var M,re=-1,Y=W.length-1;re<Y;){M=W[re+=1];var q=e.util.getProperty(M),D=e.util.escapeQuotes(M),L=m+q;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(O,M,e.opts.jsonPointers)),r+=" if ( "+L+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+D+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",w.length==1?r+="property "+e.util.escapeQuotes(w[0]):r+="properties "+e.util.escapeQuotes(w.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",p&&(y+="}",r+=" else { ")}e.errorPath=O;var V=u.baseId;for(var I in g){var S=g[I];(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(r+=" "+b+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",u.schema=S,u.schemaPath=c+e.util.getProperty(I),u.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(u)+" ",u.baseId=V,r+=" } ",p&&(r+=" if ("+b+") { ",y+="}"))}return p&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var bi=B((sh,_i)=>{"use strict";_i.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u=e.opts.$data&&i&&i.$data,y;u?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i;var b="i"+n,g="schema"+n;u||(r+=" var "+g+" = validate.schema"+c+";"),r+="var "+_+";",u&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+m+", "+g+"["+b+"])) { "+_+" = true; break; }",u&&(r+=" } "),r+=" if (!"+_+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;return r=E.pop(),!e.compositeRule&&p?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+=" }",p&&(r+=" else { "),r}});var xi=B((nh,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var _=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var g="format"+n,E="isObject"+n,$="formatType"+n;r+=" var "+g+" = formats["+u+"]; var "+E+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+$+" = "+E+" && "+g+".type || 'string'; if ("+E+") { ",e.async&&(r+=" var async"+n+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+u+" && !"+g+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),r+=") || "),r+=" ("+g+" && "+$+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+g+"("+m+") : "+g+"("+m+")) ":r+=" "+g+"("+m+") ",r+=" : "+g+".test("+m+"))))) {"}else{var g=e.formats[i];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(b&&y.indexOf(i)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var E=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,$=E&&g.type||"string";if(E){var S=g.async===!0;g=g.validate}if($!=s)return p&&(r+=" if (true) { "),r;if(S){if(!e.async)throw new Error("async format in sync schema");var w="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+w+"("+m+"))) { "}else{r+=" if (! ";var w="formats"+e.util.getProperty(i);E&&(w+=".validate"),typeof g=="function"?r+=" "+w+"("+m+") ":r+=" "+w+".test("+m+") ",r+=") { "}}var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",_?r+=""+u:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=O.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { "),r}});var Si=B((ih,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u="errs__"+n,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,E=e.schema.else,$=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),S=E!==void 0&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all)),w=y.baseId;if($||S){var O;y.createErrors=!1,y.schema=i,y.schemaPath=c,y.errSchemaPath=f,r+=" var "+u+" = errors; var "+_+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=w,y.createErrors=!0,r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,$?(r+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=w,r+=" "+_+" = "+b+"; ",$&&S?(O="ifClause"+n,r+=" var "+O+" = 'then'; "):O="'then'",r+=" } ",S&&(r+=" else { ")):r+=" if (!"+b+") { ",S&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=w,r+=" "+_+" = "+b+"; ",$&&S?(O="ifClause"+n,r+=" var "+O+" = 'else'; "):O="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+O+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+O+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var wi=B((oh,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E="i"+n,$=y.dataLevel=e.dataLevel+1,S="data"+$,w=e.baseId;if(r+="var "+u+" = errors;var "+_+";",Array.isArray(i)){var O=e.schema.additionalItems;if(O===!1){r+=" "+_+" = "+m+".length <= "+i.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var M=r;r=H.pop(),!e.compositeRule&&p?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=I,p&&(b+="}",r+=" else { ")}var k=i;if(k){for(var z,q=-1,L=k.length-1;q<L;)if(z=k[q+=1],e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)){r+=" "+g+" = true; if ("+m+".length > "+q+") { ";var A=m+"["+q+"]";y.schema=z,y.schemaPath=c+"["+q+"]",y.errSchemaPath=f+"/"+q,y.errorPath=e.util.getPathExpr(e.errorPath,q,e.opts.jsonPointers,!0),y.dataPathArr[$]=q;var D=e.validate(y);y.baseId=w,e.util.varOccurences(D,S)<2?r+=" "+e.util.varReplace(D,S,A)+" ":r+=" var "+S+" = "+A+"; "+D+" ",r+=" } ",p&&(r+=" if ("+g+") { ",b+="}")}}if(typeof O=="object"&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))){y.schema=O,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+m+".length > "+i.length+") { for (var "+E+" = "+i.length+"; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var A=m+"["+E+"]";y.dataPathArr[$]=E;var D=e.validate(y);y.baseId=w,e.util.varOccurences(D,S)<2?r+=" "+e.util.varReplace(D,S,A)+" ":r+=" var "+S+" = "+A+"; "+D+" ",p&&(r+=" if (!"+g+") break; "),r+=" } } ",p&&(r+=" if ("+g+") { ",b+="}")}}else if(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=c,y.errSchemaPath=f,r+=" for (var "+E+" = 0; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var A=m+"["+E+"]";y.dataPathArr[$]=E;var D=e.validate(y);y.baseId=w,e.util.varOccurences(D,S)<2?r+=" "+e.util.varReplace(D,S,A)+" ":r+=" var "+S+" = "+A+"; "+D+" ",p&&(r+=" if (!"+g+") break; "),r+=" }"}return p&&(r+=" "+b+" if ("+u+" == errors) {"),r}});var ys=B((lh,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,w,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],E=e.opts.$data&&g&&g.$data,$=y?"<":">",S=y?">":"<",w=void 0;if(!(_||typeof i=="number"||i===void 0))throw new Error(t+" must be number");if(!(E||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(E){var O=e.util.getData(g.$data,o,e.dataPathArr),I="exclusive"+n,H="exclType"+n,M="exclIsNumber"+n,k="op"+n,z="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+O+"; ",O="schemaExcl"+n,r+=" var "+I+"; var "+H+" = typeof "+O+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var w=b,q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(w||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var L=r;r=q.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+I+" = "+u+" === undefined || "+O+" "+$+"= "+u+") ? "+m+" "+S+"= "+O+" : "+m+" "+S+" "+u+" ) : ( ("+I+" = "+O+" === true) ? "+m+" "+S+"= "+u+" : "+m+" "+S+" "+u+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+$+"' : '"+$+"='; ",i===void 0&&(w=b,f=e.errSchemaPath+"/"+b,u=O,_=E)}else{var M=typeof g=="number",z=$;if(M&&_){var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" ( "+u+" === undefined || "+g+" "+$+"= "+u+" ? "+m+" "+S+"= "+g+" : "+m+" "+S+" "+u+" ) || "+m+" !== "+m+") { "}else{M&&i===void 0?(I=!0,w=b,f=e.errSchemaPath+"/"+b,u=g,S+="="):(M&&(u=Math[y?"min":"max"](g,i)),g===(M?u:!0)?(I=!0,w=b,f=e.errSchemaPath+"/"+b,S+="="):(I=!1,z+="="));var k="'"+z+"'";r+=" if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+" "+S+" "+u+" || "+m+" !== "+m+") { "}}w=w||t;var q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(w||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+k+", limit: "+u+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+z+" ",_?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var L=r;return r=q.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var _s=B((ch,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i,!(_||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+".length "+y+" "+u+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var bs=B((uh,$i)=>{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i,!(_||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+u+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var Ps=B((dh,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,b,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i,!(_||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+u+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var ki=B((fh,Ii)=>{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i,!(_||typeof i=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+u+" !== undefined && ( typeof "+u+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+u+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+b+"]); ":r+=" validate.errors = ["+b+"]; return false; ":r+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ci=B((ph,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="errs__"+n,u=e.util.copy(e);u.level++;var y="valid"+u.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){u.schema=i,u.schemaPath=c,u.errSchemaPath=f,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var g;u.opts.allErrors&&(g=u.opts.allErrors,u.opts.allErrors=!1),r+=" "+e.validate(u)+" ",u.createErrors=!0,g&&(u.opts.allErrors=g),e.compositeRule=u.compositeRule=b,r+=" if ("+y+") { ";var E=E||[];E.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;r=E.pop(),!e.compositeRule&&p?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 { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; 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(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var Ni=B((hh,ji)=>{"use strict";ji.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=y.baseId,$="prevValid"+n,S="passingSchemas"+n;r+="var "+u+" = errors , "+$+" = false , "+_+" = false , "+S+" = null; ";var w=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=i;if(O)for(var I,H=-1,M=O.length-1;H<M;)I=O[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=c+"["+H+"]",y.errSchemaPath=f+"/"+H,r+=" "+e.validate(y)+" ",y.baseId=E):r+=" var "+g+" = true; ",H&&(r+=" if ("+g+" && "+$+") { "+_+" = false; "+S+" = ["+S+", "+H+"]; } else { ",b+="}"),r+=" if ("+g+") { "+_+" = "+$+" = true; "+S+" = "+H+"; }";return e.compositeRule=y.compositeRule=w,r+=""+b+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+S+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Fi=B((mh,Li)=>{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+n):u=i;var y=_?"(new RegExp("+u+"))":e.usePattern(i);r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",_?r+=""+u:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Mi=B((vh,qi)=>{"use strict";qi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="errs__"+n,u=e.util.copy(e),y="";u.level++;var b="valid"+u.level,g="key"+n,E="idx"+n,$=u.dataLevel=e.dataLevel+1,S="data"+$,w="dataProperties"+n,O=Object.keys(i||{}).filter(re),I=e.schema.patternProperties||{},H=Object.keys(I).filter(re),M=e.schema.additionalProperties,k=O.length||H.length,z=M===!1,q=typeof M=="object"&&Object.keys(M).length,L=e.opts.removeAdditional,A=z||q||L,D=e.opts.ownProperties,F=e.baseId,ce=e.schema.required;if(ce&&!(e.opts.$data&&ce.$data)&&ce.length<e.opts.loopRequired)var W=e.util.toHash(ce);function re(Ge){return Ge!=="__proto__"}if(r+="var "+_+" = errors;var "+b+" = true;",D&&(r+=" var "+w+" = undefined;"),A){if(D?r+=" "+w+" = "+w+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+w+".length; "+E+"++) { var "+g+" = "+w+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",k){if(r+=" var isAdditional"+n+" = !(false ",O.length)if(O.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else{var Y=O;if(Y)for(var V,ye=-1,Ae=Y.length-1;ye<Ae;)V=Y[ye+=1],r+=" || "+g+" == "+e.util.toQuotedString(V)+" "}if(H.length){var Ie=H;if(Ie)for(var ne,Pe=-1,Re=Ie.length-1;Pe<Re;)ne=Ie[Pe+=1],r+=" || "+e.usePattern(ne)+".test("+g+") "}r+=" ); if (isAdditional"+n+") { "}if(L=="all")r+=" delete "+m+"["+g+"]; ";else{var ke=e.errorPath,_r="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),z)if(L)r+=" delete "+m+"["+g+"]; ";else{r+=" "+b+" = false; ";var or=f;f=e.errSchemaPath+"/additionalProperties";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+_r+"' } ",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: "+m+" "),r+=" } "):r+=" {} ";var _e=r;r=xe.pop(),!e.compositeRule&&p?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++; ",f=or,p&&(r+=" break; ")}else if(q)if(L=="failing"){r+=" var "+_+" = errors; ";var Ar=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.schema=M,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var $e=m+"["+g+"]";u.dataPathArr[$]=g;var oe=e.validate(u);u.baseId=F,e.util.varOccurences(oe,S)<2?r+=" "+e.util.varReplace(oe,S,$e)+" ":r+=" var "+S+" = "+$e+"; "+oe+" ",r+=" if (!"+b+") { errors = "+_+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+g+"]; } ",e.compositeRule=u.compositeRule=Ar}else{u.schema=M,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var $e=m+"["+g+"]";u.dataPathArr[$]=g;var oe=e.validate(u);u.baseId=F,e.util.varOccurences(oe,S)<2?r+=" "+e.util.varReplace(oe,S,$e)+" ":r+=" var "+S+" = "+$e+"; "+oe+" ",p&&(r+=" if (!"+b+") break; ")}e.errorPath=ke}k&&(r+=" } "),r+=" } ",p&&(r+=" if ("+b+") { ",y+="}")}var br=e.opts.useDefaults&&!e.compositeRule;if(O.length){var lr=O;if(lr)for(var V,$r=-1,Or=lr.length-1;$r<Or;){V=lr[$r+=1];var we=i[V];if(e.opts.strictKeywords?typeof we=="object"&&Object.keys(we).length>0||we===!1:e.util.schemaHasRules(we,e.RULES.all)){var Ue=e.util.getProperty(V),$e=m+Ue,je=br&&we.default!==void 0;u.schema=we,u.schemaPath=c+Ue,u.errSchemaPath=f+"/"+e.util.escapeFragment(V),u.errorPath=e.util.getPath(e.errorPath,V,e.opts.jsonPointers),u.dataPathArr[$]=e.util.toQuotedString(V);var oe=e.validate(u);if(u.baseId=F,e.util.varOccurences(oe,S)<2){oe=e.util.varReplace(oe,S,$e);var De=$e}else{var De=S;r+=" var "+S+" = "+$e+"; "}if(je)r+=" "+oe+" ";else{if(W&&W[V]){r+=" if ( "+De+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(V)+"') "),r+=") { "+b+" = false; ";var ke=e.errorPath,or=f,er=e.util.escapeQuotes(V);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(ke,V,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+er+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _e=r;r=xe.pop(),!e.compositeRule&&p?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++; ",f=or,e.errorPath=ke,r+=" } else { "}else p?(r+=" if ( "+De+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(V)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+De+" !== undefined ",D&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(V)+"') "),r+=" ) { ");r+=" "+oe+" } "}}p&&(r+=" if ("+b+") { ",y+="}")}}if(H.length){var qe=H;if(qe)for(var ne,At=-1,La=qe.length-1;At<La;){ne=qe[At+=1];var we=I[ne];if(e.opts.strictKeywords?typeof we=="object"&&Object.keys(we).length>0||we===!1:e.util.schemaHasRules(we,e.RULES.all)){u.schema=we,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),D?r+=" "+w+" = "+w+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+w+".length; "+E+"++) { var "+g+" = "+w+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" if ("+e.usePattern(ne)+".test("+g+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var $e=m+"["+g+"]";u.dataPathArr[$]=g;var oe=e.validate(u);u.baseId=F,e.util.varOccurences(oe,S)<2?r+=" "+e.util.varReplace(oe,S,$e)+" ":r+=" var "+S+" = "+$e+"; "+oe+" ",p&&(r+=" if (!"+b+") break; "),r+=" } ",p&&(r+=" else "+b+" = true; "),r+=" } ",p&&(r+=" if ("+b+") { ",y+="}")}}}return p&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Ui=B((gh,zi)=>{"use strict";zi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="errs__"+n,u=e.util.copy(e),y="";u.level++;var b="valid"+u.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){u.schema=i,u.schemaPath=c,u.errSchemaPath=f;var g="key"+n,E="idx"+n,$="i"+n,S="' + "+g+" + '",w=u.dataLevel=e.dataLevel+1,O="data"+w,I="dataProperties"+n,H=e.opts.ownProperties,M=e.baseId;H&&(r+=" var "+I+" = undefined; "),H?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+I+".length; "+E+"++) { var "+g+" = "+I+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var k=g,z=e.compositeRule;e.compositeRule=u.compositeRule=!0;var q=e.validate(u);u.baseId=M,e.util.varOccurences(q,O)<2?r+=" "+e.util.varReplace(q,O,k)+" ":r+=" var "+O+" = "+k+"; "+q+" ",e.compositeRule=u.compositeRule=z,r+=" if (!"+b+") { for (var "+$+"=startErrs"+n+"; "+$+"<errors; "+$+"++) { vErrors["+$+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+S+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),p&&(r+=" break; "),r+=" } }"}return p&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Vi=B((yh,Hi)=>{"use strict";Hi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u=e.opts.$data&&i&&i.$data,y;u?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i;var b="schema"+n;if(!u)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],E=i;if(E)for(var $,S=-1,w=E.length-1;S<w;){$=E[S+=1];var O=e.schema.properties[$];O&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))||(g[g.length]=$)}}else var g=i;if(u||g.length){var I=e.errorPath,H=u||g.length>=e.opts.loopRequired,M=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",H){u||(r+=" var "+b+" = validate.schema"+c+"; ");var k="i"+n,z="schema"+n+"["+k+"]",q="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),r+=" var "+_+" = true; ",u&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+b+".length; "+k+"++) { "+_+" = "+m+"["+b+"["+k+"]] !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+k+"]) "),r+="; if (!"+_+") break; } ",u&&(r+=" } "),r+=" if (!"+_+") { ";var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+q+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=L.pop(),!e.compositeRule&&p?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+=" } else { "}else{r+=" if ( ";var D=g;if(D)for(var F,k=-1,ce=D.length-1;k<ce;){F=D[k+=1],k&&(r+=" || ");var W=e.util.getProperty(F),re=m+W;r+=" ( ( "+re+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:W)+") ) "}r+=") { ";var z="missing"+n,q="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,z,!0):I+" + "+z);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+q+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=L.pop(),!e.compositeRule&&p?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+=" } else { "}else if(H){u||(r+=" var "+b+" = validate.schema"+c+"; ");var k="i"+n,z="schema"+n+"["+k+"]",q="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),u&&(r+=" if ("+b+" && !Array.isArray("+b+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+q+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+b+" !== undefined) { "),r+=" for (var "+k+" = 0; "+k+" < "+b+".length; "+k+"++) { if ("+m+"["+b+"["+k+"]] === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+b+"["+k+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+q+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",u&&(r+=" } ")}else{var Y=g;if(Y)for(var F,V=-1,ye=Y.length-1;V<ye;){F=Y[V+=1];var W=e.util.getProperty(F),q=e.util.escapeQuotes(F),re=m+W;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,F,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+q+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else p&&(r+=" if (true) {");return r}});var Qi=B((_h,Zi)=>{"use strict";Zi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(o||""),_="valid"+n,u=e.opts.$data&&i&&i.$data,y;if(u?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i,(i||u)&&e.opts.uniqueItems!==!1){u&&(r+=" var "+_+"; if ("+y+" === false || "+y+" === undefined) "+_+" = true; else if (typeof "+y+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+m+".length , "+_+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var E="checkDataType"+(g?"s":"");r+=" if ("+e.util[E](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",u&&(r+=" } "),r+=" if (!"+_+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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: ",u?r+="validate.schema"+c:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;r=$.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Ki=B((bh,Bi)=>{"use strict";Bi.exports={$ref:ii(),allOf:li(),anyOf:ui(),$comment:fi(),const:hi(),contains:vi(),dependencies:yi(),enum:bi(),format:xi(),if:Si(),items:wi(),maximum:ys(),minimum:ys(),maxItems:_s(),minItems:_s(),maxLength:bs(),minLength:bs(),maxProperties:Ps(),minProperties:Ps(),multipleOf:ki(),not:Ci(),oneOf:Ni(),pattern:Fi(),properties:Mi(),propertyNames:Ui(),required:Vi(),uniqueItems:Qi(),validate:vs()}});var Yi=B((Ph,Gi)=>{"use strict";var Ji=Ki(),xs=Gr().toHash;Gi.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=xs(t),e.types=xs(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var i;if(typeof o=="object"){var c=Object.keys(o)[0];i=o[c],o=c,i.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(o);var f=e.all[o]={keyword:o,code:Ji[o],implements:i};return f}),e.all.$comment={keyword:"$comment",code:Ji.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=xs(t.concat(s)),e.custom={},e}});var eo=B((xh,Xi)=>{"use strict";var Wi=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Xi.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<Wi.length;n++){var o=Wi[n],i=r[o];i&&(r[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var ao=B((Eh,to)=>{"use strict";var Hd=ca().MissingRef;to.exports=ro;function ro(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 i=s._addSchema(a,void 0,e);return i.validate||o(i)});return t&&r.then(function(i){t(null,i)},t),r;function n(i){var c=i.$schema;return c&&!s.getSchema(c)?ro.call(s,{$ref:c},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(f){if(f instanceof Hd)return c(f);throw f}function c(f){var p=f.missingSchema;if(u(p))throw new Error("Schema "+p+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(_,_)),m.then(function(y){if(!u(p))return n(y).then(function(){u(p)||s.addSchema(y,p,void 0,e)})}).then(function(){return o(i)});function _(){delete s._loadingSchemas[p]}function u(y){return s._refs[y]||s._schemas[y]}}}}});var no=B((Sh,so)=>{"use strict";so.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],c=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,_="data"+(o||""),u="valid"+n,y="errs__"+n,b=e.opts.$data&&i&&i.$data,g;b?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+n):g=i;var E=this,$="definition"+n,S=E.definition,w="",O,I,H,M,k;if(b&&S.$data){k="keywordValidate"+n;var z=S.validateSchema;r+=" var "+$+" = RULES.custom['"+t+"'].definition; var "+k+" = "+$+".validate;"}else{if(M=e.useCustomRule(E,i,e.schema,e),!M)return;g="validate.schema"+c,k=M.code,O=S.compile,I=S.inline,H=S.macro}var q=k+".errors",L="i"+n,A="ruleErr"+n,D=S.async;if(D&&!e.async)throw new Error("async keyword in sync schema");if(I||H||(r+=""+q+" = null;"),r+="var "+y+" = errors;var "+u+";",b&&S.$data&&(w+="}",r+=" if ("+g+" === undefined) { "+u+" = true; } else { ",z&&(w+="}",r+=" "+u+" = "+$+".validateSchema("+g+"); if ("+u+") { ")),I)S.statements?r+=" "+M.validate+" ":r+=" "+u+" = "+M.validate+"; ";else if(H){var F=e.util.copy(e),w="";F.level++;var ce="valid"+F.level;F.schema=M.validate,F.schemaPath="";var W=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,k);e.compositeRule=F.compositeRule=W,r+=" "+re}else{var Y=Y||[];Y.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",O||S.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var V=o?"data"+(o-1||""):"parentData",ye=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+V+" , "+ye+" , rootData ) ";var Ae=r;r=Y.pop(),S.errors===!1?(r+=" "+u+" = ",D&&(r+="await "),r+=""+Ae+"; "):D?(q="customErrors"+n,r+=" var "+q+" = null; try { "+u+" = await "+Ae+"; } catch (e) { "+u+" = false; if (e instanceof ValidationError) "+q+" = e.errors; else throw e; } "):r+=" "+q+" = null; "+u+" = "+Ae+"; "}if(S.modifying&&(r+=" if ("+V+") "+_+" = "+V+"["+ye+"];"),r+=""+w,S.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",S.valid===void 0?(r+=" !",H?r+=""+ce:r+=""+u):r+=" "+!S.valid+" ",r+=") { ",m=E.keyword;var Y=Y||[];Y.push(r),r="";var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+E.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+E.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var Ie=r;r=Y.pop(),!e.compositeRule&&p?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 ne=r;r=Y.pop(),I?S.errors?S.errors!="full"&&(r+=" for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+g+"; "+A+".data = "+_+"; "),r+=" } "):S.errors===!1?r+=" "+ne+" ":(r+=" if ("+y+" == errors) { "+ne+" } else { for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+g+"; "+A+".data = "+_+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+E.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+E.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):S.errors===!1?r+=" "+ne+" ":(r+=" if (Array.isArray("+q+")) { if (vErrors === null) vErrors = "+q+"; else vErrors = vErrors.concat("+q+"); errors = vErrors.length; for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+A+".schema = "+g+"; "+A+".data = "+_+"; "),r+=" } } else { "+ne+" } "),r+=" } ",p&&(r+=" else { ")}return r}});var Es=B((Rh,Vd)=>{Vd.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 lo=B((wh,oo)=>{"use strict";var io=Es();oo.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:io.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:io.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 uo=B((Th,co)=>{"use strict";var Zd=/^[a-z_$][a-z0-9_$-]*$/i,Qd=no(),Bd=lo();co.exports={add:Kd,get:Jd,remove:Gd,validate:Ss};function Kd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Zd.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(i,c,f){for(var p,m=0;m<t.length;m++){var _=t[m];if(_.type==c){p=_;break}}p||(p={type:c,rules:[]},t.push(p));var u={keyword:i,definition:f,custom:!0,code:Qd,implements:f.implements};p.rules.push(u),t.custom[i]=u}return this}function Jd(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Gd(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 Ss(a,e){Ss.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Bd,!0);if(t(a))return!0;if(Ss.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var fo=B((Ah,Yd)=>{Yd.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 xo=B(($h,Po)=>{"use strict";var ho=Vn(),Yr=la(),Wd=Qn(),mo=cs(),Xd=ms(),ef=si(),rf=Yi(),vo=eo(),go=Gr();Po.exports=be;be.prototype.validate=af;be.prototype.compile=sf;be.prototype.addSchema=nf;be.prototype.addMetaSchema=of;be.prototype.validateSchema=lf;be.prototype.getSchema=uf;be.prototype.removeSchema=ff;be.prototype.addFormat=bf;be.prototype.errorsText=_f;be.prototype._addSchema=pf;be.prototype._compile=hf;be.prototype.compileAsync=ao();var ga=uo();be.prototype.addKeyword=ga.add;be.prototype.getKeyword=ga.get;be.prototype.removeKeyword=ga.remove;be.prototype.validateKeyword=ga.validate;var yo=ca();be.ValidationError=yo.Validation;be.MissingRefError=yo.MissingRef;be.$dataMetaSchema=vo;var va="http://json-schema.org/draft-07/schema",po=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],tf=["/properties"];function be(a){if(!(this instanceof be))return new be(a);a=this._opts=go.copy(a)||{},wf(this),this._schemas={},this._refs={},this._fragments={},this._formats=ef(a.format),this._cache=a.cache||new Wd,this._loadingSchemas={},this._compilations=[],this.RULES=rf(),this._getId=mf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Xd),this._metaOpts=Rf(this),a.formats&&Ef(this),a.keywords&&Sf(this),Pf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),xf(this)}function af(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 sf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function nf(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=Yr.normalizeId(e||n),bo(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function of(a,e,t){return this.addSchema(a,e,t,!0),this}function lf(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||cf(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 cf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(va)?va:void 0,a._opts.defaultMeta}function uf(a){var e=_o(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return df(this,a)}}function df(a,e){var t=Yr.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,o=ho.call(a,s,r,void 0,n);return a._fragments[e]=new mo({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function _o(a,e){return e=Yr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function ff(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=_o(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=Yr.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 pf(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 i=Yr.normalizeId(this._getId(a));i&&s&&bo(this,i);var c=this._opts.validateSchema!==!1&&!e,f;c&&!(f=i&&i==Yr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var p=Yr.ids.call(this,a),m=new mo({id:i,schema:a,localRefs:p,cacheKey:n,meta:t});return i[0]!="#"&&s&&(this._refs[i]=m),this._cache.put(n,m),c&&f&&this.validateSchema(a,!0),m}function hf(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=ho.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 mf(a){switch(a.schemaId){case"auto":return yf;case"id":return vf;default:return gf}}function vf(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function gf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function yf(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 _f(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 bf(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function Pf(a){var e;if(a._opts.$data&&(e=fo(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=Es();a._opts.$data&&(t=vo(t,tf)),a.addMetaSchema(t,va,!0),a._refs["http://json-schema.org/schema"]=va}}function xf(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 Ef(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function Sf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function bo(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Rf(a){for(var e=go.copy(a._opts),t=0;t<po.length;t++)delete e[po[t]];return e}function wf(a){var e=a._opts.logger;if(e===!1)a.logger={log:Rs,warn:Rs,error:Rs};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 Rs(){}});var l={};Zl(l,{BRAND:()=>_c,DIRTY:()=>Cr,EMPTY_PATH:()=>Yl,INVALID:()=>Z,NEVER:()=>au,OK:()=>Oe,ParseStatus:()=>Te,Schema:()=>J,ZodAny:()=>Er,ZodArray:()=>mr,ZodBigInt:()=>Nr,ZodBoolean:()=>Lr,ZodBranded:()=>xt,ZodCatch:()=>Kr,ZodDate:()=>Fr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>Ct,ZodEffects:()=>Be,ZodEnum:()=>Zr,ZodError:()=>Ne,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>Nt,ZodIntersection:()=>Ur,ZodIssueCode:()=>R,ZodLazy:()=>Hr,ZodLiteral:()=>Vr,ZodMap:()=>ut,ZodNaN:()=>ft,ZodNativeEnum:()=>Qr,ZodNever:()=>Ye,ZodNull:()=>Mr,ZodNullable:()=>nr,ZodNumber:()=>jr,ZodObject:()=>Le,ZodOptional:()=>Ze,ZodParsedType:()=>j,ZodPipeline:()=>Et,ZodPromise:()=>Sr,ZodReadonly:()=>Jr,ZodRecord:()=>jt,ZodSchema:()=>J,ZodSet:()=>dt,ZodString:()=>xr,ZodSymbol:()=>lt,ZodTransformer:()=>Be,ZodTuple:()=>sr,ZodType:()=>J,ZodUndefined:()=>qr,ZodUnion:()=>zr,ZodUnknown:()=>hr,ZodVoid:()=>ct,addIssueToContext:()=>C,any:()=>Ac,array:()=>kc,bigint:()=>Ec,boolean:()=>Xs,coerce:()=>tu,custom:()=>Gs,date:()=>Sc,datetimeRegex:()=>Ks,defaultErrorMap:()=>fr,discriminatedUnion:()=>Nc,effect:()=>Kc,enum:()=>Zc,function:()=>Uc,getErrorMap:()=>nt,getParsedType:()=>ar,instanceof:()=>Pc,intersection:()=>Lc,isAborted:()=>kt,isAsync:()=>it,isDirty:()=>Dt,isValid:()=>Pr,late:()=>bc,lazy:()=>Hc,literal:()=>Vc,makeIssue:()=>Pt,map:()=>Mc,nan:()=>xc,nativeEnum:()=>Qc,never:()=>Oc,null:()=>Tc,nullable:()=>Gc,number:()=>Ws,object:()=>Dc,objectUtil:()=>Ua,oboolean:()=>ru,onumber:()=>eu,optional:()=>Jc,ostring:()=>Xc,pipeline:()=>Wc,preprocess:()=>Yc,promise:()=>Bc,quotelessJson:()=>Kl,record:()=>qc,set:()=>zc,setErrorMap:()=>Gl,strictObject:()=>Cc,string:()=>Ys,symbol:()=>Rc,transformer:()=>Kc,tuple:()=>Fc,undefined:()=>wc,union:()=>jc,unknown:()=>$c,util:()=>X,void:()=>Ic});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(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];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 Ua;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ua||(Ua={}));var j=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=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<"u"&&a instanceof Map?j.map:typeof Set<"u"&&a instanceof Set?j.set:typeof Date<"u"&&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"]),Kl=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 i=s,c=0;for(;c<o.path.length;){let f=o.path[c];c===o.path.length-1?(i[f]=i[f]||{_errors:[]},i[f]._errors.push(t(o))):i[f]=i[f]||{_errors:[]},i=i[f],c++}}};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 Jl=(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}},fr=Jl;var Hs=fr;function Gl(a){Hs=a}function nt(){return Hs}var Pt=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 i="",c=s.filter(f=>!!f).slice().reverse();for(let f of c)i=f(o,{data:e,defaultError:i}).message;return{...r,path:n,message:i}},Yl=[];function C(a,e){let t=nt(),s=Pt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===fr?void 0:fr].filter(r=>!!r)});a.common.issues.push(s)}var Te=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<"u"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},Z=Object.freeze({status:"aborted"}),Cr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),kt=a=>a.status==="aborted",Dt=a=>a.status==="dirty",Pr=a=>a.status==="valid",it=a=>typeof Promise<"u"&&a instanceof Promise;var U;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(U||(U={}));var Qe=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}},Vs=(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 K(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,i)=>{let{message:c}=a;return o.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:c??t??i.defaultError}},description:r}}var J=class{get description(){return this._def.description}_getType(e){return ar(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Te,ctx:{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(it(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){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Vs(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return Pr(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Pr(s)?{value:s.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?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(it(r)?r:Promise.resolve(r));return Vs(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let o=e(r),i=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(i(),!1)):o?!0:(i(),!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 Be({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 nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Ur.create(this,e,this._def)}transform(e){return new Be({...K(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...K(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new xt({typeName:T.ZodBranded,type:this,...K(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Kr({...K(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 Et.create(this,e)}readonly(){return Jr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wl=/^c[^\s-]{8,}$/i,Xl=/^[0-9a-z]+$/,ec=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rc=/^[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,tc=/^[a-z0-9_-]{21}$/i,ac=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sc=/^[-+]?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)?)??$/,nc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ic="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ha,oc=/^(?:(?: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])$/,lc=/^(?:(?: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])$/,cc=/^(([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]))$/,uc=/^(([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])$/,dc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qs="((\\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])))",pc=new RegExp(`^${Qs}$`);function Bs(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 hc(a){return new RegExp(`^${Bs(a)}$`)}function Ks(a){let e=`${Qs}T${Bs(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 mc(a,e){return!!((e==="v4"||!e)&&oc.test(a)||(e==="v6"||!e)&&cc.test(a))}function vc(a,e){if(!ac.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?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function gc(a,e){return!!((e==="v4"||!e)&&lc.test(a)||(e==="v6"||!e)&&uc.test(a))}var xr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let n=this._getOrReturnCtx(e);return C(n,{code:R.invalid_type,expected:j.string,received:n.parsedType}),Z}let s=new Te,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),C(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),C(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,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?C(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&C(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")nc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Ha||(Ha=new RegExp(ic,"u")),Ha.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")rc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")tc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Wl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Xl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")ec.test(e.data)||(r=this._getOrReturnCtx(e,r),C(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),C(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),C(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),C(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),C(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),C(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ks(n).test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?pc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?hc(n).test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?sc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?mc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?vc(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?gc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?dc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?fc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(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,...U.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...U.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...U.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...U.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errToObj(t)})}nonempty(e){return this.min(1,U.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}};xr.create=a=>new xr({checks:[],typeName:T.ZodString,coerce:a?.coerce??!1,...K(a)});function yc(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 jr=class a extends J{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 C(n,{code:R.invalid_type,expected:j.number,received:n.parsedType}),Z}let s,r=new Te;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),C(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),C(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),C(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?yc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),C(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),C(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,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.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)}};jr.create=a=>new jr({checks:[],typeName:T.ZodNumber,coerce:a?.coerce||!1,...K(a)});var Nr=class a extends J{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 Te;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),C(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),C(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),C(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 C(t,{code:R.invalid_type,expected:j.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:U.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:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.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}};Nr.create=a=>new Nr({checks:[],typeName:T.ZodBigInt,coerce:a?.coerce??!1,...K(a)});var Lr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.boolean,received:s.parsedType}),Z}return Oe(e.data)}};Lr.create=a=>new Lr({typeName:T.ZodBoolean,coerce:a?.coerce||!1,...K(a)});var Fr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let n=this._getOrReturnCtx(e);return C(n,{code:R.invalid_type,expected:j.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return C(n,{code:R.invalid_date}),Z}let s=new Te,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),C(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),C(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:U.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.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}};Fr.create=a=>new Fr({checks:[],coerce:a?.coerce||!1,typeName:T.ZodDate,...K(a)});var lt=class extends J{_parse(e){if(this._getType(e)!==j.symbol){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.symbol,received:s.parsedType}),Z}return Oe(e.data)}};lt.create=a=>new lt({typeName:T.ZodSymbol,...K(a)});var qr=class extends J{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.undefined,received:s.parsedType}),Z}return Oe(e.data)}};qr.create=a=>new qr({typeName:T.ZodUndefined,...K(a)});var Mr=class extends J{_parse(e){if(this._getType(e)!==j.null){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.null,received:s.parsedType}),Z}return Oe(e.data)}};Mr.create=a=>new Mr({typeName:T.ZodNull,...K(a)});var Er=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};Er.create=a=>new Er({typeName:T.ZodAny,...K(a)});var hr=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};hr.create=a=>new hr({typeName:T.ZodUnknown,...K(a)});var Ye=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return C(t,{code:R.invalid_type,expected:j.never,received:t.parsedType}),Z}};Ye.create=a=>new Ye({typeName:T.ZodNever,...K(a)});var ct=class extends J{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.void,received:s.parsedType}),Z}return Oe(e.data)}};ct.create=a=>new ct({typeName:T.ZodVoid,...K(a)});var mr=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==j.array)return C(t,{code:R.invalid_type,expected:j.array,received:t.parsedType}),Z;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(o||i)&&(C(t,{code:o?R.too_big:R.too_small,minimum:i?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&&(C(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&&(C(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,i)=>r.type._parseAsync(new Qe(t,o,t.path,i)))).then(o=>Te.mergeArray(s,o));let n=[...t.data].map((o,i)=>r.type._parseSync(new Qe(t,o,t.path,i)));return Te.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:U.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:U.toString(t)}})}nonempty(e){return this.min(1,e)}};mr.create=(a,e)=>new mr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...K(e)});function ot(a){if(a instanceof Le){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(ot(s))}return new Le({...a._def,shape:()=>e})}else return a instanceof mr?new mr({...a._def,type:ot(a.element)}):a instanceof Ze?Ze.create(ot(a.unwrap())):a instanceof nr?nr.create(ot(a.unwrap())):a instanceof sr?sr.create(a.items.map(e=>ot(e))):a}var Le=class a extends J{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 f=this._getOrReturnCtx(e);return C(f,{code:R.invalid_type,expected:j.object,received:f.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ye&&this._def.unknownKeys==="strip"))for(let f in r.data)o.includes(f)||i.push(f);let c=[];for(let f of o){let p=n[f],m=r.data[f];c.push({key:{status:"valid",value:f},value:p._parse(new Qe(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof Ye){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of i)c.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(f==="strict")i.length>0&&(C(r,{code:R.unrecognized_keys,keys:i}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let p of i){let m=r.data[p];c.push({key:{status:"valid",value:p},value:f._parse(new Qe(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of c){let m=await p.key,_=await p.value;f.push({key:m,value:_,alwaysSet:p.alwaysSet})}return f}).then(f=>Te.mergeObjectSync(s,f)):Te.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:U.errToObj(e).message??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 ot(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 Js(X.objectKeys(this.shape))}};Le.create=(a,e)=>new Le({shape:()=>a,unknownKeys:"strip",catchall:Ye.create(),typeName:T.ZodObject,...K(e)});Le.strictCreate=(a,e)=>new Le({shape:()=>a,unknownKeys:"strict",catchall:Ye.create(),typeName:T.ZodObject,...K(e)});Le.lazycreate=(a,e)=>new Le({shape:a,unknownKeys:"strip",catchall:Ye.create(),typeName:T.ZodObject,...K(e)});var zr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new Ne(i.ctx.common.issues));return C(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 c of s){let f={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(c=>new Ne(c));return C(t,{code:R.invalid_union,unionErrors:i}),Z}}get options(){return this._def.options}};zr.create=(a,e)=>new zr({options:a,typeName:T.ZodUnion,...K(e)});var pr=a=>a instanceof Hr?pr(a.schema):a instanceof Be?pr(a.innerType()):a instanceof Vr?[a.value]:a instanceof Zr?a.options:a instanceof Qr?X.objectValues(a.enum):a instanceof Br?pr(a._def.innerType):a instanceof qr?[void 0]:a instanceof Mr?[null]:a instanceof Ze?[void 0,...pr(a.unwrap())]:a instanceof nr?[null,...pr(a.unwrap())]:a instanceof xt||a instanceof Jr?pr(a.unwrap()):a instanceof Kr?pr(a._def.innerType):[],Ct=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return C(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}):(C(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 i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...K(s)})}};function Va(a,e){let t=ar(a),s=ar(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(i=>r.indexOf(i)!==-1),o={...a,...e};for(let i of n){let c=Va(a[i],e[i]);if(!c.valid)return{valid:!1};o[i]=c.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],i=e[n],c=Va(o,i);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===j.date&&s===j.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Ur=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(kt(n)||kt(o))return Z;let i=Va(n.value,o.value);return i.valid?((Dt(n)||Dt(o))&&t.dirty(),{status:t.value,value:i.data}):(C(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}))}};Ur.create=(a,e,t)=>new Ur({left:a,right:e,typeName:T.ZodIntersection,...K(t)});var sr=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.array)return C(s,{code:R.invalid_type,expected:j.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return C(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&&(C(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,i)=>{let c=this._def.items[i]||this._def.rest;return c?c._parse(new Qe(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Te.mergeArray(t,o)):Te.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};sr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sr({items:a,typeName:T.ZodTuple,rest:null,...K(e)})};var jt=class a extends J{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 C(s,{code:R.invalid_type,expected:j.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in s.data)r.push({key:n._parse(new Qe(s,i,s.path,i)),value:o._parse(new Qe(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?Te.mergeObjectAsync(t,r):Te.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...K(s)}):new a({keyType:xr.create(),valueType:e,typeName:T.ZodRecord,...K(t)})}},ut=class extends J{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 C(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(([i,c],f)=>({key:r._parse(new Qe(s,i,s.path,[f,"key"])),value:n._parse(new Qe(s,c,s.path,[f,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let c of o){let f=await c.key,p=await c.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(f.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let c of o){let f=c.key,p=c.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(f.value,p.value)}return{status:t.value,value:i}}}};ut.create=(a,e,t)=>new ut({valueType:e,keyType:a,typeName:T.ZodMap,...K(t)});var dt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.set)return C(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&&(C(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&&(C(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(c){let f=new Set;for(let p of c){if(p.status==="aborted")return Z;p.status==="dirty"&&t.dirty(),f.add(p.value)}return{status:t.value,value:f}}let i=[...s.data.values()].map((c,f)=>n._parse(new Qe(s,c,s.path,f)));return s.common.async?Promise.all(i).then(c=>o(c)):o(i)}min(e,t){return new a({...this._def,minSize:{value:e,message:U.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:U.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};dt.create=(a,e)=>new dt({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...K(e)});var Nt=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return C(t,{code:R.invalid_type,expected:j.function,received:t.parsedType}),Z;function s(i,c){return Pt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),fr].filter(f=>!!f),issueData:{code:R.invalid_arguments,argumentsError:c}})}function r(i,c){return Pt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),fr].filter(f=>!!f),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Sr){let i=this;return Oe(async function(...c){let f=new Ne([]),p=await i._def.args.parseAsync(c,n).catch(u=>{throw f.addIssue(s(c,u)),f}),m=await Reflect.apply(o,this,p);return await i._def.returns._def.type.parseAsync(m,n).catch(u=>{throw f.addIssue(r(m,u)),f})})}else{let i=this;return Oe(function(...c){let f=i._def.args.safeParse(c,n);if(!f.success)throw new Ne([s(c,f.error)]);let p=Reflect.apply(o,this,f.data),m=i._def.returns.safeParse(p,n);if(!m.success)throw new Ne([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:sr.create(e).rest(hr.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||sr.create([]).rest(hr.create()),returns:t||hr.create(),typeName:T.ZodFunction,...K(s)})}},Hr=class extends J{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})}};Hr.create=(a,e)=>new Hr({getter:a,typeName:T.ZodLazy,...K(e)});var Vr=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return C(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}};Vr.create=(a,e)=>new Vr({value:a,typeName:T.ZodLiteral,...K(e)});function Js(a,e){return new Zr({values:a,typeName:T.ZodEnum,...K(e)})}var Zr=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return C(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 C(t,{received:t.data,code:R.invalid_enum_value,options:s}),Z}return Oe(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})}};Zr.create=Js;var Qr=class extends J{_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 C(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 C(s,{received:s.data,code:R.invalid_enum_value,options:r}),Z}return Oe(e.data)}get enum(){return this._def.values}};Qr.create=(a,e)=>new Qr({values:a,typeName:T.ZodNativeEnum,...K(e)});var Sr=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return C(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 Oe(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,...K(e)});var Be=class extends J{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=>{C(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 i=>{if(t.value==="aborted")return Z;let c=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return c.status==="aborted"?Z:c.status==="dirty"?Cr(c.value):t.value==="dirty"?Cr(c.value):c});{if(t.value==="aborted")return Z;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?Z:i.status==="dirty"?Cr(i.value):t.value==="dirty"?Cr(i.value):i}}if(r.type==="refinement"){let o=i=>{let c=r.refinement(i,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Z:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?Z:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.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 i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Pr(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:t.value,value:i})):Z);X.assertNever(r)}};Be.create=(a,e,t)=>new Be({schema:a,typeName:T.ZodEffects,effect:e,...K(t)});Be.createWithPreprocess=(a,e,t)=>new Be({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...K(t)});var Ze=class extends J{_parse(e){return this._getType(e)===j.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:T.ZodOptional,...K(e)});var nr=class extends J{_parse(e){return this._getType(e)===j.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(a,e)=>new nr({innerType:a,typeName:T.ZodNullable,...K(e)});var Br=class extends J{_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}};Br.create=(a,e)=>new Br({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var Kr=class extends J{_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 it(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}};Kr.create=(a,e)=>new Kr({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});var ft=class extends J{_parse(e){if(this._getType(e)!==j.nan){let s=this._getOrReturnCtx(e);return C(s,{code:R.invalid_type,expected:j.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};ft.create=a=>new ft({typeName:T.ZodNaN,...K(a)});var _c=Symbol("zod_brand"),xt=class extends J{_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}},Et=class a extends J{_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(),Cr(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})}},Jr=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Pr(r)&&(r.value=Object.freeze(r.value)),r);return it(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:T.ZodReadonly,...K(e)});function Zs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Gs(a,e={},t){return a?Er.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(o=>{if(!o){let i=Zs(e,s),c=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:c})}});if(!n){let o=Zs(e,s),i=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:i})}}):Er.create()}var bc={object:Le.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 Pc=(a,e={message:`Input not instance of ${a.name}`})=>Gs(t=>t instanceof a,e),Ys=xr.create,Ws=jr.create,xc=ft.create,Ec=Nr.create,Xs=Lr.create,Sc=Fr.create,Rc=lt.create,wc=qr.create,Tc=Mr.create,Ac=Er.create,$c=hr.create,Oc=Ye.create,Ic=ct.create,kc=mr.create,Dc=Le.create,Cc=Le.strictCreate,jc=zr.create,Nc=Ct.create,Lc=Ur.create,Fc=sr.create,qc=jt.create,Mc=ut.create,zc=dt.create,Uc=Nt.create,Hc=Hr.create,Vc=Vr.create,Zc=Zr.create,Qc=Qr.create,Bc=Sr.create,Kc=Be.create,Jc=Ze.create,Gc=nr.create,Yc=Be.createWithPreprocess,Wc=Et.create,Xc=()=>Ys().optional(),eu=()=>Ws().optional(),ru=()=>Xs().optional(),tu={string:a=>xr.create({...a,coerce:!0}),number:a=>jr.create({...a,coerce:!0}),boolean:a=>Lr.create({...a,coerce:!0}),bigint:a=>Nr.create({...a,coerce:!0}),date:a=>Fr.create({...a,coerce:!0})};var au=Z;var ae=l;var Za="2025-06-18";var en=[Za,"2025-03-26","2024-11-05","2024-10-07"],Lt="2.0",rn=l.union([l.string(),l.number().int()]),tn=l.string(),su=l.object({progressToken:l.optional(rn)}).passthrough(),Ke=l.object({_meta:l.optional(su)}).passthrough(),Fe=l.object({method:l.string(),params:l.optional(Ke)}),St=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),ir=l.object({method:l.string(),params:l.optional(St)}),Je=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ft=l.union([l.string(),l.number().int()]),an=l.object({jsonrpc:l.literal(Lt),id:Ft}).merge(Fe).strict(),sn=a=>an.safeParse(a).success,nn=l.object({jsonrpc:l.literal(Lt)}).merge(ir).strict(),on=a=>nn.safeParse(a).success,ln=l.object({jsonrpc:l.literal(Lt),id:Ft,result:Je}).strict(),Qa=a=>ln.safeParse(a).success,fe;(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"})(fe||(fe={}));var cn=l.object({jsonrpc:l.literal(Lt),id:Ft,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),un=a=>cn.safeParse(a).success,dn=l.union([an,nn,ln,cn]),qt=Je.strict(),Mt=ir.extend({method:l.literal("notifications/cancelled"),params:St.extend({requestId:Ft,reason:l.string().optional()})}),Rt=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),fn=Rt.extend({version:l.string()}),nu=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),Ba=Fe.extend({method:l.literal("initialize"),params:Ke.extend({protocolVersion:l.string(),capabilities:nu,clientInfo:fn})});var iu=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ou=Je.extend({protocolVersion:l.string(),capabilities:iu,serverInfo:fn,instructions:l.optional(l.string())}),Ka=ir.extend({method:l.literal("notifications/initialized")});var zt=Fe.extend({method:l.literal("ping")}),lu=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),Ut=ir.extend({method:l.literal("notifications/progress"),params:St.merge(lu).extend({progressToken:rn})}),Ht=Fe.extend({params:Ke.extend({cursor:l.optional(tn)}).optional()}),Vt=Je.extend({nextCursor:l.optional(tn)}),pn=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),hn=pn.extend({text:l.string()}),Ja=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),mn=pn.extend({blob:Ja}),vn=Rt.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),cu=Rt.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),Zt=Ht.extend({method:l.literal("resources/list")}),uu=Vt.extend({resources:l.array(vn)}),Qt=Ht.extend({method:l.literal("resources/templates/list")}),du=Vt.extend({resourceTemplates:l.array(cu)}),Bt=Fe.extend({method:l.literal("resources/read"),params:Ke.extend({uri:l.string()})}),fu=Je.extend({contents:l.array(l.union([hn,mn]))}),pu=ir.extend({method:l.literal("notifications/resources/list_changed")}),hu=Fe.extend({method:l.literal("resources/subscribe"),params:Ke.extend({uri:l.string()})}),mu=Fe.extend({method:l.literal("resources/unsubscribe"),params:Ke.extend({uri:l.string()})}),vu=ir.extend({method:l.literal("notifications/resources/updated"),params:St.extend({uri:l.string()})}),gu=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),yu=Rt.extend({description:l.optional(l.string()),arguments:l.optional(l.array(gu)),_meta:l.optional(l.object({}).passthrough())}),Kt=Ht.extend({method:l.literal("prompts/list")}),_u=Vt.extend({prompts:l.array(yu)}),Jt=Fe.extend({method:l.literal("prompts/get"),params:Ke.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),Ga=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ya=l.object({type:l.literal("image"),data:Ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Wa=l.object({type:l.literal("audio"),data:Ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),bu=l.object({type:l.literal("resource"),resource:l.union([hn,mn]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Pu=vn.extend({type:l.literal("resource_link")}),gn=l.union([Ga,Ya,Wa,Pu,bu]),xu=l.object({role:l.enum(["user","assistant"]),content:gn}).passthrough(),Eu=Je.extend({description:l.optional(l.string()),messages:l.array(xu)}),Su=ir.extend({method:l.literal("notifications/prompts/list_changed")}),Ru=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),wu=Rt.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(Ru),_meta:l.optional(l.object({}).passthrough())}),Gt=Ht.extend({method:l.literal("tools/list")}),Tu=Vt.extend({tools:l.array(wu)}),yn=Je.extend({content:l.array(gn).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),$p=yn.or(Je.extend({toolResult:l.unknown()})),Yt=Fe.extend({method:l.literal("tools/call"),params:Ke.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),Au=ir.extend({method:l.literal("notifications/tools/list_changed")}),_n=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),$u=Fe.extend({method:l.literal("logging/setLevel"),params:Ke.extend({level:_n})}),Ou=ir.extend({method:l.literal("notifications/message"),params:St.extend({level:_n,logger:l.optional(l.string()),data:l.unknown()})}),Iu=l.object({name:l.string().optional()}).passthrough(),ku=l.object({hints:l.optional(l.array(Iu)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Du=l.object({role:l.enum(["user","assistant"]),content:l.union([Ga,Ya,Wa])}).passthrough(),Cu=Fe.extend({method:l.literal("sampling/createMessage"),params:Ke.extend({messages:l.array(Du),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(ku)})}),Xa=Je.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[Ga,Ya,Wa])}),ju=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Nu=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Lu=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Fu=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),qu=l.union([ju,Nu,Lu,Fu]),Mu=Fe.extend({method:l.literal("elicitation/create"),params:Ke.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),qu),required:l.optional(l.array(l.string()))}).passthrough()})}),es=Je.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),zu=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Uu=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),Wt=Fe.extend({method:l.literal("completion/complete"),params:Ke.extend({ref:l.union([Uu,zu]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Hu=Je.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Vu=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Zu=Fe.extend({method:l.literal("roots/list")}),rs=Je.extend({roots:l.array(Vu)}),Qu=ir.extend({method:l.literal("notifications/roots/list_changed")}),Op=l.union([zt,Ba,Wt,$u,Jt,Kt,Zt,Qt,Bt,hu,mu,Yt,Gt]),Ip=l.union([Mt,Ut,Ka,Qu]),kp=l.union([qt,Xa,es,rs]),Dp=l.union([zt,Cu,Mu,Zu]),Cp=l.union([Mt,Ut,Ou,vu,pu,Au,Su]),jp=l.union([qt,ou,Hu,Eu,_u,uu,du,fu,yn,Tu]),pe=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Bu=6e4,Xt=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(Mt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Ut,t=>{this._onprogress(t)}),this.setRequestHandler(zt,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 pe(fe.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?.(),this._onclose()};let o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{o?.(c),this._onerror(c)};let i=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,f)=>{i?.(c,f),Qa(c)||un(c)?this._onresponse(c):sn(c)?this._onrequest(c,f):on(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new pe(fe.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,n,o;let i=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler;if(i===void 0){(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",id:e.id,error:{code:fe.MethodNotFound,message:"Method not found"}}).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let f={signal:c.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:p=>this.notification(p,{relatedRequestId:e.id}),sendRequest:(p,m,_)=>this.request(p,m,{..._,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>i(e,f)).then(p=>{var m;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({result:p,jsonrpc:"2.0",id:e.id})},p=>{var m,_;if(!c.signal.aborted)return(m=this._transport)===null||m===void 0?void 0:m.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(p.code)?p.code:fe.InternalError,message:(_=p.message)!==null&&_!==void 0?_:"Internal error"}})}).catch(p=>this._onerror(new Error(`Failed to send response: ${p}`))).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),i=this._timeoutInfo.get(r);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){o(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Qa(e))s(e);else{let r=new pe(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??{};return new Promise((i,c)=>{var f,p,m,_,u,y;if(!this._transport){c(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};s?.onprogress&&(this._progressHandlers.set(b,s.onprogress),g.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:b}});let E=w=>{var O;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(w)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),c(w)};this._responseHandlers.set(b,w=>{var O;if(!(!((O=s?.signal)===null||O===void 0)&&O.aborted)){if(w instanceof Error)return c(w);try{let I=t.parse(w.result);i(I)}catch(I){c(I)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var w;E((w=s?.signal)===null||w===void 0?void 0:w.reason)});let $=(u=s?.timeout)!==null&&u!==void 0?u:Bu,S=()=>E(new pe(fe.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(b,$,s?.maxTotalTimeout,S,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(w=>{this._cleanupTimeout(b),c(w)})})}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?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(f,t).catch(p=>this._onerror(p))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(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 bn(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 Eo=Bl(xo(),1),ya=class extends Xt{constructor(e,t){var s;super(t),this._serverInfo=e,this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(Ba,r=>this._oninitialize(r)),this.setNotificationHandler(Ka,()=>{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=bn(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:en.includes(t)?t:Za,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"},qt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Xa,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},es,t);if(s.action==="accept"&&s.content)try{let r=new Eo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new pe(fe.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof pe?r:new pe(fe.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},rs,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 Ro=Symbol("Let zodToJsonSchema decide on which parser to use");var So={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"},wo=a=>typeof a=="string"?{...So,name:a}:{...So,...a};var To=a=>{let e=wo(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 ws(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ws(a,e,s,r)}var _a=(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 me(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?_a(e,a.currentPath):e.join("/")}}function Ao(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==T.ZodAny&&(t.items=Q(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 $o(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 Oo(){return{type:"boolean"}}function ba(a,e){return Q(a.type._def,e)}var Io=(a,e)=>Q(a.innerType._def,e);function Ts(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Ts(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 Tf(a,e)}}var Tf=(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 ko(a,e){return{...Q(a.innerType._def,e),default:a.defaultValue()}}function Do(a,e){return e.effectStrategy==="input"?Q(a.schema._def,e):me(e)}function Co(a){return{type:"string",enum:Array.from(a.values)}}var Af=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function jo(a,e){let t=[Q(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Q(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(Af(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:i,...c}=n;o=c}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function No(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 As,We={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:()=>(As===void 0&&(As=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),As),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 Pa(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":Xe(t,"email",s.message,e);break;case"format:idn-email":Xe(t,"idn-email",s.message,e);break;case"pattern:zod":Ce(t,We.email,s.message,e);break}break;case"url":Xe(t,"uri",s.message,e);break;case"uuid":Xe(t,"uuid",s.message,e);break;case"regex":Ce(t,s.regex,s.message,e);break;case"cuid":Ce(t,We.cuid,s.message,e);break;case"cuid2":Ce(t,We.cuid2,s.message,e);break;case"startsWith":Ce(t,RegExp(`^${$s(s.value,e)}`),s.message,e);break;case"endsWith":Ce(t,RegExp(`${$s(s.value,e)}$`),s.message,e);break;case"datetime":Xe(t,"date-time",s.message,e);break;case"date":Xe(t,"date",s.message,e);break;case"time":Xe(t,"time",s.message,e);break;case"duration":Xe(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":{Ce(t,RegExp($s(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Xe(t,"ipv4",s.message,e),s.version!=="v4"&&Xe(t,"ipv6",s.message,e);break}case"base64url":Ce(t,We.base64url,s.message,e);break;case"jwt":Ce(t,We.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ce(t,We.ipv4Cidr,s.message,e),s.version!=="v4"&&Ce(t,We.ipv6Cidr,s.message,e);break}case"emoji":Ce(t,We.emoji(),s.message,e);break;case"ulid":{Ce(t,We.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Xe(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ce(t,We.base64,s.message,e);break}}break}case"nanoid":Ce(t,We.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function $s(a,e){return e.patternStrategy==="escape"?Of(a):a}var $f=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Of(a){let e="";for(let t=0;t<a.length;t++)$f.has(a[t])||(e+="\\"),e+=a[t];return e}function Xe(a,e,t,s){a.format||a.anyOf?.some(r=>r.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 Ce(a,e,t,s){a.pattern||a.allOf?.some(r=>r.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:Lo(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Lo(e,s),t,s)}function Lo(a,e){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,i=!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]/)){i?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),i=!1):s[c+1]==="-"&&s[c+2]?.match(/[a-z]/)?(r+=s[c],i=!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
3
+ ]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
4
+ ]))`;continue}}if(t.s&&s[c]==="."){r+=o?`${s[c]}\r
5
+ `:`[${s[c]}\r
6
+ ]`;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 xa(a,e){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"&&a.keyType?._def.typeName===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??me(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===T.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=Pa(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ba(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Fo(a,e){if(e.mapStrategy==="record")return xa(a,e);let t=Q(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||me(e),s=Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||me(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function qo(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 Mo(a){return a.target==="openAi"?void 0:{not:me({...a,currentPath:[...a.currentPath,"not"]})}}function zo(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Tt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ho(a,e){if(e.target==="openApi3")return Uo(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Tt&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let o=Tt[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,i)=>i.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 Uo(a,e)}var Uo=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>Q(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 Vo(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:Tt[a.innerType._def.typeName],nullable:!0}:{type:[Tt[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=Q(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=Q(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Zo(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",ws(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 Qo(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let i in n){let c=n[i];if(c===void 0||c._def===void 0)continue;let f=kf(c);f&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),f=!1);let p=Q(c._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});p!==void 0&&(s.properties[i]=p,f||r.push(i))}r.length&&(s.required=r);let o=If(a,e);return o!==void 0&&(s.additionalProperties=o),s}function If(a,e){if(a.catchall._def.typeName!=="ZodNever")return Q(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 kf(a){try{return a.isOptional()}catch{return!0}}var Bo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Q(a.innerType._def,e);let t=Q(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:me(e)},t]}:me(e)};var Ko=(a,e)=>{if(e.pipeStrategy==="input")return Q(a.in._def,e);if(e.pipeStrategy==="output")return Q(a.out._def,e);let t=Q(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Q(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Jo(a,e){return Q(a.type._def,e)}function Go(a,e){let s={type:"array",uniqueItems:!0,items:Q(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 Yo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>Q(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:Q(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>Q(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Wo(a){return{not:me(a)}}function Xo(a){return me(a)}var el=(a,e)=>Q(a.innerType._def,e);var rl=(a,e,t)=>{switch(e){case T.ZodString:return Pa(a,t);case T.ZodNumber:return Zo(a,t);case T.ZodObject:return Qo(a,t);case T.ZodBigInt:return $o(a,t);case T.ZodBoolean:return Oo();case T.ZodDate:return Ts(a,t);case T.ZodUndefined:return Wo(t);case T.ZodNull:return zo(t);case T.ZodArray:return Ao(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return Ho(a,t);case T.ZodIntersection:return jo(a,t);case T.ZodTuple:return Yo(a,t);case T.ZodRecord:return xa(a,t);case T.ZodLiteral:return No(a,t);case T.ZodEnum:return Co(a);case T.ZodNativeEnum:return qo(a);case T.ZodNullable:return Vo(a,t);case T.ZodOptional:return Bo(a,t);case T.ZodMap:return Fo(a,t);case T.ZodSet:return Go(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return Jo(a,t);case T.ZodNaN:case T.ZodNever:return Mo(t);case T.ZodEffects:return Do(a,t);case T.ZodAny:return me(t);case T.ZodUnknown:return Xo(t);case T.ZodDefault:return ko(a,t);case T.ZodBranded:return ba(a,t);case T.ZodReadonly:return el(a,t);case T.ZodCatch:return Io(a,t);case T.ZodPipeline:return Ko(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function Q(a,e,t=!1){let s=e.seen.get(a);if(e.override){let i=e.override?.(a,e,s,t);if(i!==Ro)return i}if(s&&!t){let i=Df(s,e);if(i!==void 0)return i}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=rl(a,a.typeName,e),o=typeof n=="function"?Q(n(),e):n;if(o&&Cf(a,e,o),e.postProcess){let i=e.postProcess(o,a,e);return r.jsonSchema=o,i}return r.jsonSchema=o,o}var Df=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:_a(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`),me(e)):e.$refStrategy==="seen"?me(e):void 0}},Cf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var Ea=(a,e)=>{let t=To(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[f,p])=>({...c,[f]:Q(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??me(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=Q(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??me(t),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let i=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"?i.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};var Os;(function(a){a.Completable="McpCompletable"})(Os||(Os={}));var pt=class extends J{_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}};pt.create=(a,e)=>new pt({type:a,typeName:Os.Completable,complete:e.complete,...jf(e)});function jf(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,i)=>{var c,f;let{message:p}=a;return o.code==="invalid_enum_value"?{message:p??i.defaultError}:typeof i.data>"u"?{message:(c=p??s)!==null&&c!==void 0?c:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(f=p??t)!==null&&f!==void 0?f:i.defaultError}},description:r}}var Ra=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ya(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Gt.shape.method.value),this.server.assertCanSetRequestHandler(Yt.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Gt,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let s={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Ea(t.inputSchema,{strictUnions:!0}):Nf,annotations:t.annotations};return t.outputSchema&&(s.outputSchema=Ea(t.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Yt,async(e,t)=>{let s=this._registeredTools[e.params.name];if(!s)throw new pe(fe.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new pe(fe.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){let n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new pe(fe.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);let o=n.data,i=s.callback;try{r=await Promise.resolve(i(o,t))}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{let n=s.callback;try{r=await Promise.resolve(n(t))}catch(o){r={content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new pe(fe.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);let n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new pe(fe.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Wt.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Wt,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new pe(fe.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let s=this._registeredPrompts[t.name];if(!s)throw new pe(fe.InvalidParams,`Prompt ${t.name} not found`);if(!s.enabled)throw new pe(fe.InvalidParams,`Prompt ${t.name} disabled`);if(!s.argsSchema)return Sa;let r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof pt))return Sa;let o=await r._def.complete(e.params.argument.value,e.params.context);return al(o)}async handleResourceCompletion(e,t){let s=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!s){if(this._registeredResources[t.uri])return Sa;throw new pe(fe.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Sa;let n=await r(e.params.argument.value,e.params.context);return al(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Zt.shape.method.value),this.server.assertCanSetRequestHandler(Qt.shape.method.value),this.server.assertCanSetRequestHandler(Bt.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Zt,async(e,t)=>{let s=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),r=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let o=await n.resourceTemplate.listCallback(t);for(let i of o.resources)r.push({...n.metadata,...i})}return{resources:[...s,...r]}}),this.server.setRequestHandler(Qt,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,s])=>({name:t,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(Bt,async(e,t)=>{let s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new pe(fe.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,t)}for(let n of Object.values(this._registeredResourceTemplates)){let o=n.resourceTemplate.uriTemplate.match(s.toString());if(o)return n.readCallback(s,o,t)}throw new pe(fe.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Kt.shape.method.value),this.server.assertCanSetRequestHandler(Jt.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Kt,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Ff(t.argsSchema):void 0}))})),this.server.setRequestHandler(Jt,async(e,t)=>{let s=this._registeredPrompts[e.params.name];if(!s)throw new pe(fe.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new pe(fe.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){let r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new pe(fe.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);let n=r.data,o=s.callback;return await Promise.resolve(o(n,t))}else{let r=s.callback;return await Promise.resolve(r(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...s){let r;typeof s[0]=="object"&&(r=s.shift());let n=s[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,t,s,r){if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,s,r,n){let o={name:e,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==s&&(delete this._registeredResources[s],i.uri&&(this._registeredResources[i.uri]=o)),typeof i.name<"u"&&(o.name=i.name),typeof i.title<"u"&&(o.title=i.title),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=o,o}_createRegisteredResourceTemplate(e,t,s,r,n){let o={resourceTemplate:s,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredResourceTemplates[e],i.name&&(this._registeredResourceTemplates[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.template<"u"&&(o.resourceTemplate=i.template),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,t,s,r,n){let o={title:t,description:s,argsSchema:r===void 0?void 0:l.object(r),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.description<"u"&&(o.description=i.description),typeof i.argsSchema<"u"&&(o.argsSchema=l.object(i.argsSchema)),typeof i.callback<"u"&&(o.callback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,t,s,r,n,o,i){let c={title:t,description:s,inputSchema:r===void 0?void 0:l.object(r),outputSchema:n===void 0?void 0:l.object(n),annotations:o,callback:i,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:f=>{typeof f.name<"u"&&f.name!==e&&(delete this._registeredTools[e],f.name&&(this._registeredTools[f.name]=c)),typeof f.title<"u"&&(c.title=f.title),typeof f.description<"u"&&(c.description=f.description),typeof f.paramsSchema<"u"&&(c.inputSchema=l.object(f.paramsSchema)),typeof f.callback<"u"&&(c.callback=f.callback),typeof f.annotations<"u"&&(c.annotations=f.annotations),typeof f.enabled<"u"&&(c.enabled=f.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,o;if(typeof t[0]=="string"&&(s=t.shift()),t.length>1){let c=t[0];tl(c)?(r=t.shift(),t.length>1&&typeof t[0]=="object"&&t[0]!==null&&!tl(t[0])&&(o=t.shift())):typeof c=="object"&&c!==null&&(o=t.shift())}let i=t[0];return this._createRegisteredTool(e,void 0,s,r,n,o,i)}registerTool(e,t,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:r,description:n,inputSchema:o,outputSchema:i,annotations:c}=t;return this._createRegisteredTool(e,r,n,o,i,c,s)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof t[0]=="string"&&(s=t.shift());let r;t.length>1&&(r=t.shift());let n=t[0],o=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,t,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:r,description:n,argsSchema:o}=t,i=this._createRegisteredPrompt(e,r,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Nf={type:"object",properties:{}};function tl(a){return typeof a!="object"||a===null?!1:Object.keys(a).length===0||Object.values(a).some(Lf)}function Lf(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}function Ff(a){return Object.entries(a.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))}function al(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}var Sa={completion:{values:[],hasMore:!1}};import nl from"node:process";var wa=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
7
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),qf(t)}clear(){this._buffer=void 0}};function qf(a){return dn.parse(JSON.parse(a))}function sl(a){return JSON.stringify(a)+`
8
+ `}var Ta=class{constructor(e=nl.stdin,t=nl.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new wa,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=sl(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var vr=l.object({key:l.enum(["Url","Host","Path"]).describe("Source key for matching: Url, Host, or Path."),operator:l.enum(["Equals","Contains","Matches","Wildcard_Matches"]).describe("Operator for matching: Equals, Contains, Matches, or Wildcard_Matches."),value:l.string().describe("Value to match against."),filters:l.object({requestMethod:l.array(l.string()).optional().describe("Array of allowed HTTP methods for matching."),requestPayload:l.object({key:l.string().describe("Key in the request payload."),value:l.string().describe("Value for the request payload key.")}).optional().describe("Request payload filter.")}).optional().describe("Optional filters for advanced matching.")}).describe("Source matching criteria for a rule."),Aa=l.object({source:vr,destinationType:l.string().describe("Type of destination for redirect."),destination:l.string().describe("Target URL for redirect.")}).describe("Redirect rule pair: source and destination info."),$a=l.object({source:vr}).describe("Cancel rule pair: source info only."),Oa=l.object({source:vr,from:l.string().describe("String to replace."),to:l.string().describe("Replacement string.")}).describe("Replace rule pair: source, from, and to info."),il=l.object({header:l.string().describe("Header name to modify."),type:l.enum(["Add","Remove","Modify"]).describe("Modification type: Add, Remove, or Modify."),value:l.string().optional().describe("Optional value for header modification.")}).describe("Header modification details."),Ia=l.object({source:vr,modifications:l.object({Request:l.array(il).optional().describe("Request header modifications."),Response:l.array(il).optional().describe("Response header modifications.")}).describe("Header modifications for request/response.")}).describe("Headers rule pair: source and modifications."),ka=l.object({source:vr,userAgent:l.string().describe("Custom user agent string.")}).describe("User agent rule pair: source and user agent."),Mf=l.object({param:l.string().describe("Query parameter name."),type:l.enum(["Add","Remove","Remove All"]).describe("Modification type for query param."),value:l.string().optional().describe("Optional value for query param modification.")}).describe("Query parameter modification details."),Da=l.object({source:vr,modifications:l.array(Mf).describe("Array of query parameter modifications.")}).describe("Query parameter rule pair: source and modifications."),Ca=l.object({source:vr,request:l.object({type:l.enum(["code","static"]).describe("Request type: code or static."),value:l.string().describe("Request content.")}).describe("Request details.")}).describe("Request rule pair: source and request."),ja=l.object({source:vr,response:l.object({type:l.enum(["code","static"]).describe("Response type: code or static."),value:l.string().describe("Response content."),resourceType:l.string().optional().describe("Optional resource type for response."),statusCode:l.union([l.string(),l.number()]).optional().describe("Optional status code for response."),statusText:l.string().optional().describe("Optional status text for response."),serveWithoutRequest:l.boolean().optional().describe("Whether to serve response without request.")}).describe("Response details.")}).describe("Response rule pair: source and response."),Na=l.object({source:vr,delay:l.string().refine(a=>/^\d+$/.test(a),{message:"Delay must be a string containing a number"}).describe("Delay value in milliseconds (stringified number).")}).describe("Delay rule pair: source and delay."),zg=l.enum(["Redirect","Cancel","Replace","Headers","UserAgent","QueryParam","Request","Response","Delay"]).describe("Enumeration of all supported rule types.");function gr(a,e){return ae.object({name:ae.string().describe("Name of the rule."),description:ae.string().optional().describe("Description of the rule."),ruleType:ae.literal(a).describe("Type of the rule."),status:ae.enum(["Active","Inactive"]).optional().default("Active").describe("Status of the rule."),pairs:ae.array(e).describe("List of rule pair objects for the rule type."),groupId:ae.string().optional().describe("ID of the group the rule belongs to.")})}var zf=()=>{let a={name:ae.string().describe("Name of the rule."),description:ae.string().optional().describe("Description of the rule."),ruleType:ae.enum(["Redirect","Cancel","Replace","Headers","UserAgent","QueryParam","Request","Response","Delay"]).describe("Type of the rule. This determines the structure of the pairs array."),status:ae.enum(["Active","Inactive"]).optional().default("Active").describe("Status of the rule."),groupId:ae.string().optional().describe("ID of the group the rule belongs to.")},e={Redirect:"Array of redirect pairs. Each pair must have: source (matching criteria), destinationType (string), destination (target URL)",Cancel:"Array of cancel pairs. Each pair must have: source (matching criteria to cancel requests)",Replace:"Array of replace pairs. Each pair must have: source (matching criteria), from (string to replace), to (replacement string)",Headers:"Array of header pairs. Each pair must have: source (matching criteria), modifications (array of header modifications with header, type, and optional value)",UserAgent:"Array of user agent pairs. Each pair must have: source (matching criteria), userAgent (custom user agent string)",QueryParam:"Array of query param pairs. Each pair must have: source (matching criteria), modifications (array of param modifications)",Request:'Array of request pairs. Each pair must have: type ("code" or "static"), value (request content)',Response:"Array of response pairs. Each pair must have: source (matching criteria), response (object with type, value, and optional serveWithoutRequest)",Delay:"Array of delay pairs. Each pair must have: source (matching criteria), delay (number in milliseconds)"};return{...a,pairs:ae.array(ae.unknown()).describe(`List of rule pair objects. Structure depends on ruleType:
9
+
10
+ - Redirect: ${e.Redirect}
11
+ - Cancel: ${e.Cancel}
12
+ - Replace: ${e.Replace}
13
+ - Headers: ${e.Headers}
14
+ - UserAgent: ${e.UserAgent}
15
+ - QueryParam: ${e.QueryParam}
16
+ - Request: ${e.Request}
17
+ - Response: ${e.Response}
18
+ - Delay: ${e.Delay}
19
+
20
+ All source objects must have: key ("Url", "Host", or "Path"), operator ("Equals", "Contains", "Matches", or "Wildcard_Matches"), value (string to match against)`)}},ol=zf(),Uf=()=>ae.discriminatedUnion("ruleType",[gr("Redirect",Aa),gr("Cancel",$a),gr("Replace",Oa),gr("Headers",Ia),gr("UserAgent",ka),gr("QueryParam",Da),gr("Request",Ca),gr("Response",ja),gr("Delay",Na)]),ll=Uf();function cl(a){a.registerTool("create_rule",{title:"Create Rule",description:"This endpoint allows you to create various types of rules in Requestly, such as Redirect, Cancel, Replace, Headers, User-Agent, Query Param, Modify Request, Modify Response, and Delay. Each rule has a specific structure and parameters based on the ruleType.",inputSchema:ol},async e=>{try{let t=ll.parse(e),{name:s,description:r,ruleType:n,status:o,pairs:i,groupId:c}=t,f=process.env.REQUESTLY_API_KEY;if(!f)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};let p={name:s,objectType:"rule",status:o||"Active",ruleType:n,pairs:i,description:r||void 0};c&&(p.groupId=c);let m=await fetch("https://api2.requestly.io/v1/rules",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":f},body:JSON.stringify(p)});if(!m.ok){let u=await m.text();return{content:[{type:"text",text:`Failed to create rule: ${m.status} ${u}`}]}}let _=await m.json();return{content:[{type:"text",text:JSON.stringify(_,null,2)}]}}catch(t){return console.error("Error in create_rule tool:",t),{content:[{type:"text",text:`Error creating rule: ${t instanceof Error?t.message:String(t)}`}]}}})}var Hf={ruleId:l.string().optional().describe("Unique ID of the rule to retrieve. If omitted, retrieves all rules."),offset:l.number().int().min(0).optional().describe("Index to start results from (for pagination)."),pageSize:l.number().int().min(1).max(75).optional().describe("Number of results to return (max 75).")};function ul(a){a.registerTool("get_rules",{title:"Get Rules",description:"Retrieve all rules or a specific rule from Requestly using its API. Supports pagination and lookup by ruleId.",inputSchema:Hf},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};let{ruleId:s,offset:r,pageSize:n}=e,o="https://api2.requestly.io/v1/rules";if(s)o+=`/${encodeURIComponent(s)}`;else{let i=[];r!==void 0&&i.push(`offset=${r}`),n!==void 0&&i.push(`pageSize=${n}`),i.length>0&&(o+=`?${i.join("&")}`)}try{let i=await fetch(o,{method:"GET",headers:{accept:"application/json","x-api-key":t}});if(!i.ok){let f=await i.text();return{content:[{type:"text",text:`Failed to get rules: ${i.status} ${f}`}]}}let c=await i.json();return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(i){return{content:[{type:"text",text:`Error getting rules: ${i instanceof Error?i.message:String(i)}`}]}}})}function yr(a,e){return ae.object({ruleId:ae.string().describe("Unique identifier for the rule.").optional(),name:ae.string().describe("Name of the rule.").optional(),description:ae.string().optional().describe("Description of the rule."),ruleType:ae.literal(a).describe("Type of the rule."),status:ae.enum(["Active","Inactive"]).optional().default("Active").describe("Status of the rule."),pairs:ae.array(e).optional().describe("List of rule pair objects for the rule type."),objectType:ae.literal("rule").describe('Type of the object, always "rule".').default("rule")})}var Vf=()=>{let a={ruleId:ae.string().describe("Unique identifier for the rule.").optional(),name:ae.string().describe("Name of the rule.").optional(),description:ae.string().optional().describe("Description of the rule."),ruleType:ae.enum(["Redirect","Cancel","Replace","Headers","UserAgent","QueryParam","Request","Response","Delay"]).describe("Type of the rule. This determines the structure of the pairs array."),status:ae.enum(["Active","Inactive"]).optional().default("Active").describe("Status of the rule."),objectType:ae.literal("rule").describe('Type of the object, always "rule".').default("rule")},e={Redirect:"Array of redirect pairs. Each pair must have: source (matching criteria), destinationType (string), destination (target URL)",Cancel:"Array of cancel pairs. Each pair must have: source (matching criteria to cancel requests)",Replace:"Array of replace pairs. Each pair must have: source (matching criteria), from (string to replace), to (replacement string)",Headers:"Array of header pairs. Each pair must have: source (matching criteria), modifications (array of header modifications with header, type, and optional value)",UserAgent:"Array of user agent pairs. Each pair must have: source (matching criteria), userAgent (custom user agent string)",QueryParam:"Array of query param pairs. Each pair must have: source (matching criteria), modifications (array of param modifications)",Request:'Array of request pairs. Each pair must have: type ("code" or "static"), value (request content)',Response:"Array of response pairs. Each pair must have: source (matching criteria), response (object with type, value, and optional serveWithoutRequest)",Delay:"Array of delay pairs. Each pair must have: source (matching criteria), delay (number in milliseconds)"};return{...a,pairs:ae.array(ae.unknown()).describe(`List of rule pair objects. Structure depends on ruleType:
21
+
22
+ - Redirect: ${e.Redirect}
23
+ - Cancel: ${e.Cancel}
24
+ - Replace: ${e.Replace}
25
+ - Headers: ${e.Headers}
26
+ - UserAgent: ${e.UserAgent}
27
+ - QueryParam: ${e.QueryParam}
28
+ - Request: ${e.Request}
29
+ - Response: ${e.Response}
30
+ - Delay: ${e.Delay}
31
+
32
+ All source objects must have: key ("Url", "Host", or "Path"), operator ("Equals", "Contains", "Matches", or "Wildcard_Matches"), value (string to match against)`)}},dl=Vf(),Zf=()=>ae.discriminatedUnion("ruleType",[yr("Redirect",Aa),yr("Cancel",$a),yr("Replace",Oa),yr("Headers",Ia),yr("UserAgent",ka),yr("QueryParam",Da),yr("Request",Ca),yr("Response",ja),yr("Delay",Na)]),fl=Zf();function pl(a){a.registerTool("update_rule",{title:"Update Rule",description:"Update an existing rule in Requestly. Requires ruleId and the updated rule payload.",inputSchema:dl},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let s=fl.parse(e);if(!s.ruleId)return{content:[{type:"text",text:"Error: ruleId is required."}]};let{ruleId:r,...n}=s,o={...n},i=await fetch(`https://api2.requestly.io/v1/rules/${r}`,{method:"PUT",headers:{accept:"application/json","content-type":"application/json","x-api-key":t},body:JSON.stringify(o)});if(!i.ok){let f=await i.text();return{content:[{type:"text",text:`Failed to update rule: ${i.status} ${f}`}]}}let c=await i.json();return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error updating rule: ${s instanceof Error?s.message:String(s)}`}]}}})}function hl(a){a.registerTool("delete_rule",{title:"Delete Rule",description:"Delete a specific rule in Requestly using its ruleId.",inputSchema:{ruleId:l.string().describe("Unique identifier for the rule to delete.")}},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let r=await(await fetch(`https://api2.requestly.io/v1/rules/${e.ruleId}`,{method:"DELETE",headers:{accept:"application/json","x-api-key":t}})).json();return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error deleting rule: ${s instanceof Error?s.message:String(s)}`}]}}})}function ml(a){a.registerTool("create_group",{title:"Create Group",description:"Create a new group in Requestly.",inputSchema:{name:l.string().describe("Name of the group to be created."),status:l.enum(["Active","Inactive"]).optional().default("Active"),isFavourite:l.boolean().optional().default(!1)}},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let r=await(await fetch("https://api2.requestly.io/v1/groups",{method:"POST",headers:{accept:"application/json","content-type":"application/json","x-api-key":t},body:JSON.stringify(e)})).json();return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error creating group: ${s instanceof Error?s.message:String(s)}`}]}}})}function vl(a){a.registerTool("get_groups",{title:"Get Groups",description:"Get all groups in Requestly.",inputSchema:{offset:l.number().optional().default(0),pageSize:l.number().optional().default(30)}},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let s=new URLSearchParams;typeof e.offset=="number"&&s.append("offset",String(e.offset)),typeof e.pageSize=="number"&&s.append("pageSize",String(e.pageSize));let n=await(await fetch(`https://api2.requestly.io/v1/groups?${s.toString()}`,{method:"GET",headers:{accept:"application/json","x-api-key":t}})).json();return{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error getting groups: ${s instanceof Error?s.message:String(s)}`}]}}})}function gl(a){a.registerTool("update_group",{title:"Update Group",description:"Update a specific group in Requestly.",inputSchema:{id:l.string().describe("Unique identifier of the group to update."),name:l.string().describe("New name of the group."),status:l.enum(["Active","Inactive"]).optional().default("Active"),isFavourite:l.boolean().optional().default(!1)}},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let{id:s,...r}=e,o=await(await fetch(`https://api2.requestly.io/v1/groups/${s}`,{method:"PUT",headers:{accept:"application/json","content-type":"application/json","x-api-key":t},body:JSON.stringify(r)})).json();return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error updating group: ${s instanceof Error?s.message:String(s)}`}]}}})}function yl(a){a.registerTool("delete_group",{title:"Delete Group",description:"Delete a specific group in Requestly using its id.",inputSchema:{id:l.string().describe("Unique identifier of the group to delete.")}},async e=>{let t=process.env.REQUESTLY_API_KEY;if(!t)return{content:[{type:"text",text:"Error: REQUESTLY_API_KEY environment variable is not set."}]};try{let{id:s}=e,n=await(await fetch(`https://api2.requestly.io/v1/groups/${s}`,{method:"DELETE",headers:{accept:"application/json","x-api-key":t}})).json();return{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(s){return{content:[{type:"text",text:`Error deleting group: ${s instanceof Error?s.message:String(s)}`}]}}})}function _l(a){cl(a),ul(a),pl(a),hl(a),ml(a),vl(a),gl(a),yl(a)}var bl=new Ra({name:"requestly-mcp-server",version:"1.0.0",description:"MCP server for automating and managing Requestly rules, groups, and integrations via the Requestly API.",documentation:"https://docs.requestly.io/api",capabilities:{resources:{},tools:{}}});async function Qf(){let a=new Ta;_l(bl),await bl.connect(a),console.error("Requestly MCP Server running on stdio")}Qf().catch(a=>{console.error("Fatal error in main():",a),process.exit(1)});
33
+ /*! Bundled license information:
34
+
35
+ uri-js/dist/es5/uri.all.js:
36
+ (** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
37
+ */