Files
claude-mem/plugin/scripts/mcp-server.cjs
T
Alex Newman 0a34786df9 fix: enhance null safety and improve logging in SearchManager
- Added optional chaining and nullish coalescing to handle potential undefined values in Chroma results and timeline items.
- Updated logging statements to provide clearer information when no results are found.
- Refactored destructuring of parameters in findByConcept and findByFile methods for consistency.
2025-12-07 20:56:19 -05:00

16 lines
243 KiB
JavaScript
Executable File

#!/usr/bin/env node
"use strict";var hl=Object.create;var Pa=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var ml=Object.getOwnPropertyNames;var vl=Object.getPrototypeOf,gl=Object.prototype.hasOwnProperty;var Q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),yl=(a,e)=>{for(var t in e)Pa(a,t,{get:e[t],enumerable:!0})},bl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ml(e))!gl.call(a,r)&&r!==t&&Pa(a,r,{get:()=>e[r],enumerable:!(s=pl(e,r))||s.enumerable});return a};var $s=(a,e,t)=>(t=a!=null?hl(vl(a)):{},bl(e||!a||!a.__esModule?Pa(t,"default",{value:a,enumerable:!0}):t,a));var ln=Q((Bt,on)=>{(function(a,e){typeof Bt=="object"&&typeof on<"u"?e(Bt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Bt,(function(a){"use strict";function e(){for(var p=arguments.length,u=Array(p),v=0;v<p;v++)u[v]=arguments[v];if(u.length>1){u[0]=u[0].slice(0,-1);for(var x=u.length-1,P=1;P<x;++P)u[P]=u[P].slice(1,-1);return u[x]=u[x].slice(1),u.join("")}else return u[0]}function t(p){return"(?:"+p+")"}function s(p){return p===void 0?"undefined":p===null?"null":Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase()}function r(p){return p.toUpperCase()}function n(p){return p!=null?p instanceof Array?p:typeof p.length!="number"||p.split||p.setInterval||p.call?[p]:Array.prototype.slice.call(p):[]}function l(p,u){var v=p;if(u)for(var x in u)v[x]=u[x];return v}function o(p){var u="[A-Za-z]",v="[\\x0D]",x="[0-9]",P="[\\x22]",N=e(x,"[A-Fa-f]"),K="[\\x0A]",ae="[\\x20]",oe=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),_e="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=e(_e,te),xe=p?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=p?"[\\uE000-\\uF8FF]":"[]",ne=e(u,x,"[\\-\\.\\_\\~]",xe),pe=t(u+e(u,x,"[\\+\\-\\.]")+"*"),ce=t(t(oe+"|"+e(ne,te,"[\\:]"))+"*"),Tr=t(t("25[0-5]")+"|"+t("2[0-4]"+x)+"|"+t("1"+x+x)+"|"+t("[1-9]"+x)+"|"+x),Me=t(t("25[0-5]")+"|"+t("2[0-4]"+x)+"|"+t("1"+x+x)+"|"+t("0?[1-9]"+x)+"|0?0?"+x),Ue=t(Me+"\\."+Me+"\\."+Me+"\\."+Me),ue=t(N+"{1,4}"),qe=t(t(ue+"\\:"+ue)+"|"+Ue),Ve=t(t(ue+"\\:")+"{6}"+qe),sr=t("\\:\\:"+t(ue+"\\:")+"{5}"+qe),Ir=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+qe),dr=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+qe),pt=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+qe),$t=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+qe),Tt=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+qe),Yr=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),Xr=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),fr=t([Ve,sr,Ir,dr,pt,$t,Tt,Yr,Xr].join("|")),et=t(t(ne+"|"+oe)+"+"),_a=t(fr+"\\%25"+et),Ar=t(fr+t("\\%25|\\%(?!"+N+"{2})")+et),il=t("[vV]"+N+"+\\."+e(ne,te,"[\\:]")+"+"),ol=t("\\["+t(Ar+"|"+fr+"|"+il)+"\\]"),ws=t(t(oe+"|"+e(ne,te))+"*"),mt=t(ol+"|"+Ue+"(?!"+ws+")|"+ws),vt=t(x+"*"),Rs=t(t(ce+"@")+"?"+mt+t("\\:"+vt)+"?"),gt=t(oe+"|"+e(ne,te,"[\\:\\@]")),ll=t(gt+"*"),Os=t(gt+"+"),cl=t(t(oe+"|"+e(ne,te,"[\\@]"))+"+"),hr=t(t("\\/"+ll)+"*"),rt=t("\\/"+t(Os+hr)+"?"),xa=t(cl+hr),It=t(Os+hr),tt="(?!"+gt+")",yf=t(hr+"|"+rt+"|"+xa+"|"+It+"|"+tt),at=t(t(gt+"|"+e("[\\/\\?]",de))+"*"),yt=t(t(gt+"|[\\/\\?]")+"*"),Ds=t(t("\\/\\/"+Rs+hr)+"|"+rt+"|"+It+"|"+tt),ul=t(pe+"\\:"+Ds+t("\\?"+at)+"?"+t("\\#"+yt)+"?"),dl=t(t("\\/\\/"+Rs+hr)+"|"+rt+"|"+xa+"|"+tt),fl=t(dl+t("\\?"+at)+"?"+t("\\#"+yt)+"?"),bf=t(ul+"|"+fl),_f=t(pe+"\\:"+Ds+t("\\?"+at)+"?"),xf="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+mt+")"+t("\\:("+vt+")")+"?)")+"?("+hr+"|"+rt+"|"+It+"|"+tt+")")+t("\\?("+at+")")+"?"+t("\\#("+yt+")")+"?$",Pf="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+mt+")"+t("\\:("+vt+")")+"?)")+"?("+hr+"|"+rt+"|"+xa+"|"+tt+")")+t("\\?("+at+")")+"?"+t("\\#("+yt+")")+"?$",Ef="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+mt+")"+t("\\:("+vt+")")+"?)")+"?("+hr+"|"+rt+"|"+It+"|"+tt+")")+t("\\?("+at+")")+"?$",Sf="^"+t("\\#("+yt+")")+"?$",wf="^"+t("("+ce+")@")+"?("+mt+")"+t("\\:("+vt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",u,x,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,he),"g"),PCT_ENCODED:new RegExp(oe,"g"),IPV4ADDRESS:new RegExp("^("+Ue+")$"),IPV6ADDRESS:new RegExp("^\\[?("+fr+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+et+")")+"?\\]?$")}}var d=o(!1),f=o(!0),h=(function(){function p(u,v){var x=[],P=!0,N=!1,K=void 0;try{for(var ae=u[Symbol.iterator](),oe;!(P=(oe=ae.next()).done)&&(x.push(oe.value),!(v&&x.length===v));P=!0);}catch(_e){N=!0,K=_e}finally{try{!P&&ae.return&&ae.return()}finally{if(N)throw K}}return x}return function(u,v){if(Array.isArray(u))return u;if(Symbol.iterator in Object(u))return p(u,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),m=function(p){if(Array.isArray(p)){for(var u=0,v=Array(p.length);u<p.length;u++)v[u]=p[u];return v}else return Array.from(p)},_=2147483647,c=36,y=1,b=26,g=38,E=700,$=72,S=128,R="-",T=/^xn--/,I=/[^\0-\x7E]/,V=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=c-y,z=Math.floor,M=String.fromCharCode;function F(p){throw new RangeError(q[p])}function D(p,u){for(var v=[],x=p.length;x--;)v[x]=u(p[x]);return v}function k(p,u){var v=p.split("@"),x="";v.length>1&&(x=v[0]+"@",p=v[1]),p=p.replace(V,".");var P=p.split("."),N=D(P,u).join(".");return x+N}function L(p){for(var u=[],v=0,x=p.length;v<x;){var P=p.charCodeAt(v++);if(P>=55296&&P<=56319&&v<x){var N=p.charCodeAt(v++);(N&64512)==56320?u.push(((P&1023)<<10)+(N&1023)+65536):(u.push(P),v--)}else u.push(P)}return u}var le=function(u){return String.fromCodePoint.apply(String,m(u))},Y=function(u){return u-48<10?u-22:u-65<26?u-65:u-97<26?u-97:c},re=function(u,v){return u+22+75*(u<26)-((v!=0)<<5)},G=function(u,v,x){var P=0;for(u=x?z(u/E):u>>1,u+=z(u/v);u>A*b>>1;P+=c)u=z(u/A);return z(P+(A+1)*u/(u+g))},Z=function(u){var v=[],x=u.length,P=0,N=S,K=$,ae=u.lastIndexOf(R);ae<0&&(ae=0);for(var oe=0;oe<ae;++oe)u.charCodeAt(oe)>=128&&F("not-basic"),v.push(u.charCodeAt(oe));for(var _e=ae>0?ae+1:0;_e<x;){for(var te=P,he=1,xe=c;;xe+=c){_e>=x&&F("invalid-input");var de=Y(u.charCodeAt(_e++));(de>=c||de>z((_-P)/he))&&F("overflow"),P+=de*he;var ne=xe<=K?y:xe>=K+b?b:xe-K;if(de<ne)break;var pe=c-ne;he>z(_/pe)&&F("overflow"),he*=pe}var ce=v.length+1;K=G(P-te,ce,te==0),z(P/ce)>_-N&&F("overflow"),N+=z(P/ce),P%=ce,v.splice(P++,0,N)}return String.fromCodePoint.apply(String,v)},me=function(u){var v=[];u=L(u);var x=u.length,P=S,N=0,K=$,ae=!0,oe=!1,_e=void 0;try{for(var te=u[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&v.push(M(xe))}}catch(Ar){oe=!0,_e=Ar}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw _e}}var de=v.length,ne=de;for(de&&v.push(R);ne<x;){var pe=_,ce=!0,Tr=!1,Me=void 0;try{for(var Ue=u[Symbol.iterator](),ue;!(ce=(ue=Ue.next()).done);ce=!0){var qe=ue.value;qe>=P&&qe<pe&&(pe=qe)}}catch(Ar){Tr=!0,Me=Ar}finally{try{!ce&&Ue.return&&Ue.return()}finally{if(Tr)throw Me}}var Ve=ne+1;pe-P>z((_-N)/Ve)&&F("overflow"),N+=(pe-P)*Ve,P=pe;var sr=!0,Ir=!1,dr=void 0;try{for(var pt=u[Symbol.iterator](),$t;!(sr=($t=pt.next()).done);sr=!0){var Tt=$t.value;if(Tt<P&&++N>_&&F("overflow"),Tt==P){for(var Yr=N,Xr=c;;Xr+=c){var fr=Xr<=K?y:Xr>=K+b?b:Xr-K;if(Yr<fr)break;var et=Yr-fr,_a=c-fr;v.push(M(re(fr+et%_a,0))),Yr=z(et/_a)}v.push(M(re(Yr,0))),K=G(N,Ve,ne==de),N=0,++ne}}}catch(Ar){Ir=!0,dr=Ar}finally{try{!sr&&pt.return&&pt.return()}finally{if(Ir)throw dr}}++N,++P}return v.join("")},we=function(u){return k(u,function(v){return T.test(v)?Z(v.slice(4).toLowerCase()):v})},De=function(u){return k(u,function(v){return I.test(v)?"xn--"+me(v):v})},se={version:"2.1.0",ucs2:{decode:L,encode:le},decode:Z,encode:me,toASCII:De,toUnicode:we},ye={};function Pe(p){var u=p.charCodeAt(0),v=void 0;return u<16?v="%0"+u.toString(16).toUpperCase():u<128?v="%"+u.toString(16).toUpperCase():u<2048?v="%"+(u>>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():v="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),v}function $e(p){for(var u="",v=0,x=p.length;v<x;){var P=parseInt(p.substr(v+1,2),16);if(P<128)u+=String.fromCharCode(P),v+=3;else if(P>=194&&P<224){if(x-v>=6){var N=parseInt(p.substr(v+4,2),16);u+=String.fromCharCode((P&31)<<6|N&63)}else u+=p.substr(v,6);v+=6}else if(P>=224){if(x-v>=9){var K=parseInt(p.substr(v+4,2),16),ae=parseInt(p.substr(v+7,2),16);u+=String.fromCharCode((P&15)<<12|(K&63)<<6|ae&63)}else u+=p.substr(v,9);v+=9}else u+=p.substr(v,3),v+=3}return u}function yr(p,u){function v(x){var P=$e(x);return P.match(u.UNRESERVED)?P:x}return p.scheme&&(p.scheme=String(p.scheme).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_SCHEME,"")),p.userinfo!==void 0&&(p.userinfo=String(p.userinfo).replace(u.PCT_ENCODED,v).replace(u.NOT_USERINFO,Pe).replace(u.PCT_ENCODED,r)),p.host!==void 0&&(p.host=String(p.host).replace(u.PCT_ENCODED,v).toLowerCase().replace(u.NOT_HOST,Pe).replace(u.PCT_ENCODED,r)),p.path!==void 0&&(p.path=String(p.path).replace(u.PCT_ENCODED,v).replace(p.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Pe).replace(u.PCT_ENCODED,r)),p.query!==void 0&&(p.query=String(p.query).replace(u.PCT_ENCODED,v).replace(u.NOT_QUERY,Pe).replace(u.PCT_ENCODED,r)),p.fragment!==void 0&&(p.fragment=String(p.fragment).replace(u.PCT_ENCODED,v).replace(u.NOT_FRAGMENT,Pe).replace(u.PCT_ENCODED,r)),p}function cr(p){return p.replace(/^0*(.*)/,"$1")||"0"}function be(p,u){var v=p.match(u.IPV4ADDRESS)||[],x=h(v,2),P=x[1];return P?P.split(".").map(cr).join("."):p}function ve(p,u){var v=p.match(u.IPV6ADDRESS)||[],x=h(v,3),P=x[1],N=x[2];if(P){for(var K=P.toLowerCase().split("::").reverse(),ae=h(K,2),oe=ae[0],_e=ae[1],te=_e?_e.split(":").map(cr):[],he=oe.split(":").map(cr),xe=u.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce<de;++ce)pe[ce]=te[ce]||he[ne+ce]||"";xe&&(pe[de-1]=be(pe[de-1],u));var Tr=pe.reduce(function(Ve,sr,Ir){if(!sr||sr==="0"){var dr=Ve[Ve.length-1];dr&&dr.index+dr.length===Ir?dr.length++:Ve.push({index:Ir,length:1})}return Ve},[]),Me=Tr.sort(function(Ve,sr){return sr.length-Ve.length})[0],Ue=void 0;if(Me&&Me.length>1){var ue=pe.slice(0,Me.index),qe=pe.slice(Me.index+Me.length);Ue=ue.join(":")+"::"+qe.join(":")}else Ue=pe.join(":");return N&&(Ue+="%"+N),Ue}else return p}var Or=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Re="".match(/(){0}/)[1]===void 0;function ie(p){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},x=u.iri!==!1?f:d;u.reference==="suffix"&&(p=(u.scheme?u.scheme+":":"")+"//"+p);var P=p.match(Or);if(P){Re?(v.scheme=P[1],v.userinfo=P[3],v.host=P[4],v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=P[7],v.fragment=P[8],isNaN(v.port)&&(v.port=P[5])):(v.scheme=P[1]||void 0,v.userinfo=p.indexOf("@")!==-1?P[3]:void 0,v.host=p.indexOf("//")!==-1?P[4]:void 0,v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=p.indexOf("?")!==-1?P[7]:void 0,v.fragment=p.indexOf("#")!==-1?P[8]:void 0,isNaN(v.port)&&(v.port=p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),v.host&&(v.host=ve(be(v.host,x),x)),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",u.reference&&u.reference!=="suffix"&&u.reference!==v.reference&&(v.error=v.error||"URI is not a "+u.reference+" reference.");var N=ye[(u.scheme||v.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!N||!N.unicodeSupport)){if(v.host&&(u.domainHost||N&&N.domainHost))try{v.host=se.toASCII(v.host.replace(x.PCT_ENCODED,$e).toLowerCase())}catch(K){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+K}yr(v,d)}else yr(v,x);N&&N.parse&&N.parse(v,u)}else v.error=v.error||"URI can not be parsed.";return v}function br(p,u){var v=u.iri!==!1?f:d,x=[];return p.userinfo!==void 0&&(x.push(p.userinfo),x.push("@")),p.host!==void 0&&x.push(ve(be(String(p.host),v),v).replace(v.IPV6ADDRESS,function(P,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof p.port=="number"||typeof p.port=="string")&&(x.push(":"),x.push(String(p.port))),x.length?x.join(""):void 0}var ur=/^\.\.?\//,Dr=/^\/\.(\/|$)/,$r=/^\/\.\.(\/|$)/,Ee=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(p){for(var u=[];p.length;)if(p.match(ur))p=p.replace(ur,"");else if(p.match(Dr))p=p.replace(Dr,"/");else if(p.match($r))p=p.replace($r,"/"),u.pop();else if(p==="."||p==="..")p="";else{var v=p.match(Ee);if(v){var x=v[0];p=p.slice(x.length),u.push(x)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function Ae(p){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=u.iri?f:d,x=[],P=ye[(u.scheme||p.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(p,u),p.host&&!v.IPV6ADDRESS.test(p.host)){if(u.domainHost||P&&P.domainHost)try{p.host=u.iri?se.toUnicode(p.host):se.toASCII(p.host.replace(v.PCT_ENCODED,$e).toLowerCase())}catch(ae){p.error=p.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}yr(p,v),u.reference!=="suffix"&&p.scheme&&(x.push(p.scheme),x.push(":"));var N=br(p,u);if(N!==void 0&&(u.reference!=="suffix"&&x.push("//"),x.push(N),p.path&&p.path.charAt(0)!=="/"&&x.push("/")),p.path!==void 0){var K=p.path;!u.absolutePath&&(!P||!P.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),x.push(K)}return p.query!==void 0&&(x.push("?"),x.push(p.query)),p.fragment!==void 0&&(x.push("#"),x.push(p.fragment)),x.join("")}function Te(p,u){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],P={};return x||(p=ie(Ae(p,v),v),u=ie(Ae(u,v),v)),v=v||{},!v.tolerant&&u.scheme?(P.scheme=u.scheme,P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(P.userinfo=u.userinfo,P.host=u.host,P.port=u.port,P.path=ze(u.path||""),P.query=u.query):(u.path?(u.path.charAt(0)==="/"?P.path=ze(u.path):((p.userinfo!==void 0||p.host!==void 0||p.port!==void 0)&&!p.path?P.path="/"+u.path:p.path?P.path=p.path.slice(0,p.path.lastIndexOf("/")+1)+u.path:P.path=u.path,P.path=ze(P.path)),P.query=u.query):(P.path=p.path,u.query!==void 0?P.query=u.query:P.query=p.query),P.userinfo=p.userinfo,P.host=p.host,P.port=p.port),P.scheme=p.scheme),P.fragment=u.fragment,P}function tr(p,u,v){var x=l({scheme:"null"},v);return Ae(Te(ie(p,x),ie(u,x),x,!0),x)}function Le(p,u){return typeof p=="string"?p=Ae(ie(p,u),u):s(p)==="object"&&(p=ie(Ae(p,u),u)),p}function Dt(p,u,v){return typeof p=="string"?p=Ae(ie(p,v),v):s(p)==="object"&&(p=Ae(p,v)),typeof u=="string"?u=Ae(ie(u,v),v):s(u)==="object"&&(u=Ae(u,v)),p===u}function ya(p,u){return p&&p.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Pe)}function Ke(p,u){return p&&p.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,$e)}var ft={scheme:"http",domainHost:!0,parse:function(u,v){return u.host||(u.error=u.error||"HTTP URIs must have a host."),u},serialize:function(u,v){var x=String(u.scheme).toLowerCase()==="https";return(u.port===(x?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},gs={scheme:"https",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize};function ys(p){return typeof p.secure=="boolean"?p.secure:String(p.scheme).toLowerCase()==="wss"}var ht={scheme:"ws",domainHost:!0,parse:function(u,v){var x=u;return x.secure=ys(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(u,v){if((u.port===(ys(u)?443:80)||u.port==="")&&(u.port=void 0),typeof u.secure=="boolean"&&(u.scheme=u.secure?"wss":"ws",u.secure=void 0),u.resourceName){var x=u.resourceName.split("?"),P=h(x,2),N=P[0],K=P[1];u.path=N&&N!=="/"?N:void 0,u.query=K,u.resourceName=void 0}return u.fragment=void 0,u}},bs={scheme:"wss",domainHost:ht.domainHost,parse:ht.parse,serialize:ht.serialize},Jo={},Ko=!0,_s="[A-Za-z0-9\\-\\.\\_\\~"+(Ko?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",Wo=t(t("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+t("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+t("%"+ar+ar)),Go="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Yo="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Xo=e(Yo,'[\\"\\\\]'),el="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",rl=new RegExp(_s,"g"),Gr=new RegExp(Wo,"g"),tl=new RegExp(e("[^]",Go,"[\\.]",'[\\"]',Xo),"g"),xs=new RegExp(e("[^]",_s,el),"g"),al=xs;function ba(p){var u=$e(p);return u.match(rl)?u:p}var Ps={scheme:"mailto",parse:function(u,v){var x=u,P=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var N=!1,K={},ae=x.query.split("&"),oe=0,_e=ae.length;oe<_e;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe<de;++xe)P.push(he[xe]);break;case"subject":x.subject=Ke(te[1],v);break;case"body":x.body=Ke(te[1],v);break;default:N=!0,K[Ke(te[0],v)]=Ke(te[1],v);break}}N&&(x.headers=K)}x.query=void 0;for(var ne=0,pe=P.length;ne<pe;++ne){var ce=P[ne].split("@");if(ce[0]=Ke(ce[0]),v.unicodeSupport)ce[1]=Ke(ce[1],v).toLowerCase();else try{ce[1]=se.toASCII(Ke(ce[1],v).toLowerCase())}catch(Tr){x.error=x.error||"Email address's domain name can not be converted to ASCII via punycode: "+Tr}P[ne]=ce.join("@")}return x},serialize:function(u,v){var x=u,P=n(u.to);if(P){for(var N=0,K=P.length;N<K;++N){var ae=String(P[N]),oe=ae.lastIndexOf("@"),_e=ae.slice(0,oe).replace(Gr,ba).replace(Gr,r).replace(tl,Pe),te=ae.slice(oe+1);try{te=v.iri?se.toUnicode(te):se.toASCII(Ke(te,v).toLowerCase())}catch(ne){x.error=x.error||"Email address's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+ne}P[N]=_e+"@"+te}x.path=P.join(",")}var he=u.headers=u.headers||{};u.subject&&(he.subject=u.subject),u.body&&(he.body=u.body);var xe=[];for(var de in he)he[de]!==Jo[de]&&xe.push(de.replace(Gr,ba).replace(Gr,r).replace(xs,Pe)+"="+he[de].replace(Gr,ba).replace(Gr,r).replace(al,Pe));return xe.length&&(x.query=xe.join("&")),x}},sl=/^([^\:]+)\:(.*)/,Es={scheme:"urn",parse:function(u,v){var x=u.path&&u.path.match(sl),P=u;if(x){var N=v.scheme||P.scheme||"urn",K=x[1].toLowerCase(),ae=x[2],oe=N+":"+(v.nid||K),_e=ye[oe];P.nid=K,P.nss=ae,P.path=void 0,_e&&(P=_e.parse(P,v))}else P.error=P.error||"URN can not be parsed.";return P},serialize:function(u,v){var x=v.scheme||u.scheme||"urn",P=u.nid,N=x+":"+(v.nid||P),K=ye[N];K&&(u=K.serialize(u,v));var ae=u,oe=u.nss;return ae.path=(P||v.nid)+":"+oe,ae}},nl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ss={scheme:"urn:uuid",parse:function(u,v){var x=u;return x.uuid=x.nss,x.nss=void 0,!v.tolerant&&(!x.uuid||!x.uuid.match(nl))&&(x.error=x.error||"UUID is not valid."),x},serialize:function(u,v){var x=u;return x.nss=(u.uuid||"").toLowerCase(),x}};ye[ft.scheme]=ft,ye[gs.scheme]=gs,ye[ht.scheme]=ht,ye[bs.scheme]=bs,ye[Ps.scheme]=Ps,ye[Es.scheme]=Es,ye[Ss.scheme]=Ss,a.SCHEMES=ye,a.pctEncChar=Pe,a.pctDecChars=$e,a.parse=ie,a.removeDotSegments=ze,a.serialize=Ae,a.resolveComponents=Te,a.resolve=tr,a.normalize=Le,a.equal=Dt,a.escapeComponent=ya,a.unescapeComponent=Ke,Object.defineProperty(a,"__esModule",{value:!0})}))});var Qt=Q((uh,cn)=>{"use strict";cn.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 l=n[r];if(!a(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}});var dn=Q((dh,un)=>{"use strict";un.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 Kr=Q((fh,pn)=>{"use strict";pn.exports={copy:Ru,checkDataType:qa,checkDataTypes:Ou,coerceToTypes:Du,toHash:Ua,getProperty:Va,escapeQuotes:Za,equal:Qt(),ucs2length:dn(),varOccurences:Iu,varReplace:Au,schemaHasRules:ku,schemaHasRulesExcept:ju,schemaUnknownRules:Cu,toQuotedString:za,getPathExpr:Nu,getPath:Fu,getData:qu,unescapeFragment:zu,unescapeJsonPointer:Ba,escapeFragment:Uu,escapeJsonPointer:Ha};function Ru(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function qa(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",l=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return l+"Array.isArray("+e+")";case"object":return"("+l+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+l+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+l+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ou(a,e,t){switch(a.length){case 1:return qa(a[0],e,t,!0);default:var s="",r=Ua(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?" && ":"")+qa(n,e,t,!0);return s}}var fn=Ua(["string","number","integer","boolean","null"]);function Du(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(fn[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(fn[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Ua(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var $u=/^[a-z$_][a-z$_0-9]*$/i,Tu=/'|\\/g;function Va(a){return typeof a=="number"?"["+a+"]":$u.test(a)?"."+a:"['"+Za(a)+"']"}function Za(a){return a.replace(Tu,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Iu(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function Au(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function ku(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function ju(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function Cu(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function za(a){return"'"+Za(a)+"'"}function Nu(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return hn(a,r)}function Fu(a,e,t){var s=za(t?"/"+Ha(e):Va(e));return hn(a,s)}var Lu=/^\/(?:[^~]|~0|~1)*$/,Mu=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qu(a,e,t){var s,r,n,l;if(a==="")return"rootData";if(a[0]=="/"){if(!Lu.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(l=a.match(Mu),!l)throw new Error("Invalid JSON-pointer: "+a);if(s=+l[1],r=l[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 o=n,d=r.split("/"),f=0;f<d.length;f++){var h=d[f];h&&(n+=Va(Ba(h)),o+=" && "+n)}return o}function hn(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function zu(a){return Ba(decodeURIComponent(a))}function Uu(a){return encodeURIComponent(Ha(a))}function Ha(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ba(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var Qa=Q((hh,mn)=>{"use strict";var Vu=Kr();mn.exports=Zu;function Zu(a){Vu.copy(a,this)}});var gn=Q((ph,vn)=>{"use strict";var Sr=vn.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(){};Jt(e,s,r,a,"",a)};Sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Sr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Sr.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 Jt(a,e,t,s,r,n,l,o,d,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,l,o,d,f);for(var h in s){var m=s[h];if(Array.isArray(m)){if(h in Sr.arrayKeywords)for(var _=0;_<m.length;_++)Jt(a,e,t,m[_],r+"/"+h+"/"+_,n,r,h,s,_)}else if(h in Sr.propsKeywords){if(m&&typeof m=="object")for(var c in m)Jt(a,e,t,m[c],r+"/"+h+"/"+Hu(c),n,r,h,s,c)}else(h in Sr.keywords||a.allKeys&&!(h in Sr.skipKeywords))&&Jt(a,e,t,m,r+"/"+h,n,r,h,s)}t(s,r,n,l,o,d,f)}}function Hu(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var ea=Q((mh,xn)=>{"use strict";var Rt=ln(),yn=Qt(),Yt=Kr(),Kt=Qa(),Bu=gn();xn.exports=Rr;Rr.normalizeId=wr;Rr.fullPath=Wt;Rr.url=Gt;Rr.ids=Gu;Rr.inlineRef=Ja;Rr.schema=Xt;function Rr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Rr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Kt)return Ja(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Xt.call(this,e,t),n,l,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Kt?l=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(l=Ja(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),l}function Xt(a,e){var t=Rt.parse(e),s=_n(t),r=Wt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=wr(s),l=this._refs[n];if(typeof l=="string")return Qu.call(this,a,l,t);if(l instanceof Kt)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof Kt){if(l.validate||this._compile(l),n==wr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=Wt(this._getId(a.schema))}return bn.call(this,t,r,a.schema,a)}function Qu(a,e,t){var s=Xt.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=Gt(n,l)),bn.call(this,t,n,r,a)}}var Ju=Yt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function bn(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 l=r[n];if(l){if(l=Yt.unescapeFragment(l),t=t[l],t===void 0)break;var o;if(!Ju[l]&&(o=this._getId(t),o&&(e=Gt(e,o)),t.$ref)){var d=Gt(e,t.$ref),f=Xt.call(this,s,d);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 Ku=Yt.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Ja(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return Ka(a);if(e)return Wa(a)<=e}function Ka(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!Ka(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!Ka(e)))return!1;return!0}function Wa(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+=Wa(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(Ku[r])e++;else if(t=a[r],typeof t=="object"&&(e+=Wa(t)+1),e==1/0)return 1/0}return e}function Wt(a,e){e!==!1&&(a=wr(a));var t=Rt.parse(a);return _n(t)}function _n(a){return Rt.serialize(a).split("#")[0]+"#"}var Wu=/#\/?$/;function wr(a){return a?a.replace(Wu,""):""}function Gt(a,e){return e=wr(e),Rt.resolve(a,e)}function Gu(a){var e=wr(this._getId(a)),t={"":e},s={"":Wt(e,!1)},r={},n=this;return Bu(a,{allKeys:!0},function(l,o,d,f,h,m,_){if(o!==""){var c=n._getId(l),y=t[f],b=s[f]+"/"+h;if(_!==void 0&&(b+="/"+(typeof _=="number"?_:Yt.escapeFragment(_))),typeof c=="string"){c=y=wr(y?Rt.resolve(y,c):c);var g=n._refs[c];if(typeof g=="string"&&(g=n._refs[g]),g&&g.schema){if(!yn(l,g.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=wr(b))if(c[0]=="#"){if(r[c]&&!yn(l,r[c]))throw new Error('id "'+c+'" resolves to more than one schema');r[c]=l}else n._refs[c]=b}t[o]=y,s[o]=b}}),r}});var ra=Q((vh,En)=>{"use strict";var Ga=ea();En.exports={Validation:Pn(Yu),MissingRef:Pn(Ya)};function Yu(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ya.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ya(a,e,t){this.message=t||Ya.message(a,e),this.missingRef=Ga.url(a,e),this.missingSchema=Ga.normalizeId(Ga.fullPath(this.missingRef))}function Pn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Xa=Q((gh,Sn)=>{"use strict";Sn.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(l){return function(o,d){var f={key:o,value:l[o]},h={key:d,value:l[d]};return n(f,h)}}})(e.cmp),r=[];return(function n(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var o,d;if(Array.isArray(l)){for(d="[",o=0;o<l.length;o++)o&&(d+=","),d+=n(l[o])||"null";return d+"]"}if(l===null)return"null";if(r.indexOf(l)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=r.push(l)-1,h=Object.keys(l).sort(s&&s(l));for(d="",o=0;o<h.length;o++){var m=h[o],_=n(l[m]);_&&(d&&(d+=","),d+=JSON.stringify(m)+":"+_)}return r.splice(f,1),"{"+d+"}"}})(a)}});var es=Q((yh,wn)=>{"use strict";wn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;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'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var t="false schema",h=e.level,m=e.dataLevel,_=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,T=!e.opts.allErrors,q,b="data"+(m||""),R="valid"+h;if(e.schema===!1){e.isTop?T=!0:r+=" var "+R+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?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 "+R+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,h=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 h=e.level,m=e.dataLevel,b="data"+(m||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+h+" = errors;"}var R="valid"+h,T=!e.opts.allErrors,I="",V="",q,A=e.schema.type,z=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&(z?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],z=!0)),z&&A.length==1&&(A=A[0],z=!1),e.schema.$ref&&l){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&&(l=!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")),A){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,A);var F=e.RULES.types[A];if(M||z||F===!0||F&&!Ee(F)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",D=z?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[D](A,b,e.opts.strictNumbers,!0)+") { ",M){var k="dataType"+h,L="coerced"+h;r+=" var "+k+" = typeof "+b+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+k+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+k+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+L+" = "+b+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,G=le.length-1;re<G;)Y=le[re+=1],Y=="string"?r+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+L+" = '' + "+b+"; else if ("+b+" === null) "+L+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+k+" == 'boolean' || "+b+" === null || ("+k+" == 'string' && "+b+" && "+b+" == +"+b+" ",Y=="integer"&&(r+=" && !("+b+" % 1)"),r+=")) "+L+" = +"+b+"; "):Y=="boolean"?r+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+L+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+L+" = true; ":Y=="null"?r+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+L+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+b+" == null) "+L+" = ["+b+"]; ");r+=" else { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?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 ("+L+" !== undefined) { ";var Z=m?"data"+(m-1||""):"parentData",me=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+b+" = "+L+"; ",m||(r+="if ("+Z+" !== undefined)"),r+=" "+Z+"["+me+"] = "+L+"; } "}else{var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?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&&!l)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",T&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+h,r+=") { ",V+="}");else{var we=e.RULES;if(we){for(var F,De=-1,se=we.length-1;De<se;)if(F=we[De+=1],Ee(F)){if(F.type&&(r+=" if ("+e.util.checkDataType(F.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var _=e.schema.properties,ye=Object.keys(_),Pe=ye;if(Pe)for(var $e,yr=-1,cr=Pe.length-1;yr<cr;){$e=Pe[yr+=1];var be=_[$e];if(be.default!==void 0){var ve=b+e.util.getProperty($e);if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(be.default)+" ":r+=" "+JSON.stringify(be.default)+" ",r+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var Or=e.schema.items;if(Or){for(var be,re=-1,Re=Or.length-1;re<Re;)if(be=Or[re+=1],be.default!==void 0){var ve=b+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(be.default)+" ":r+=" "+JSON.stringify(be.default)+" ",r+="; "}}}}var ie=F.rules;if(ie){for(var br,ur=-1,Dr=ie.length-1;ur<Dr;)if(br=ie[ur+=1],ze(br)){var $r=br.code(e,br.keyword,F.type);$r&&(r+=" "+$r+" ",T&&(I+="}"))}}if(T&&(r+=" "+I+" ",I=""),F.type&&(r+=" } ",A&&A===F.type&&!M)){r+=" else { ";var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",z?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",z?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var E=r;r=g.pop(),!e.compositeRule&&T?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+=" } "}T&&(r+=" if (errors === ",$?r+="0":r+="errs_"+h,r+=") { ",V+="}")}}}T&&(r+=" "+V+" "),$?(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 "+R+" = errors === errs_"+h+";";function Ee(Te){for(var tr=Te.rules,Le=0;Le<tr.length;Le++)if(ze(tr[Le]))return!0}function ze(Te){return e.schema[Te.keyword]!==void 0||Te.implements&&Ae(Te)}function Ae(Te){for(var tr=Te.implements,Le=0;Le<tr.length;Le++)if(e.schema[tr[Le]]!==void 0)return!0}return r}});var Tn=Q((bh,$n)=>{"use strict";var ta=ea(),sa=Kr(),On=ra(),Xu=Xa(),Rn=es(),ed=sa.ucs2length,rd=Qt(),td=On.Validation;$n.exports=rs;function rs(a,e,t,s){var r=this,n=this._opts,l=[void 0],o={},d=[],f={},h=[],m={},_=[];e=e||{schema:a,refVal:l,refs:o};var c=ad.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=S;var b=this._formats,g=this.RULES;try{var E=R(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{sd.call(this,a,e,s)}function S(){var D=y.validate,k=D.apply(this,arguments);return S.errors=D.errors,k}function R(D,k,L,le){var Y=!k||k&&k.schema==D;if(k.schema!=e.schema)return rs.call(r,D,k,L,le);var re=D.$async===!0,G=Rn({isTop:!0,schema:D,isRoot:Y,baseId:le,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:On.MissingRef,RULES:g,validate:Rn,util:sa,resolve:ta,resolveRef:T,usePattern:z,useDefault:M,useCustomRule:F,opts:n,formats:b,logger:r.logger,self:r});G=aa(l,od)+aa(d,nd)+aa(h,id)+aa(_,ld)+G,n.processCode&&(G=n.processCode(G,D));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);Z=me(r,g,b,e,l,h,_,rd,ed,td),l[0]=Z}catch(we){throw r.logger.error("Error compiling schema, function code:",G),we}return Z.schema=D,Z.errors=null,Z.refs=o,Z.refVal=l,Z.root=Y?Z:k,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:G,patterns:d,defaults:h}),Z}function T(D,k,L){k=ta.url(D,k);var le=o[k],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",A(Y,re);if(!L&&e.refs){var G=e.refs[k];if(G!==void 0)return Y=e.refVal[G],re=I(k,Y),A(Y,re)}re=I(k);var Z=ta.call(r,R,e,k);if(Z===void 0){var me=t&&t[k];me&&(Z=ta.inlineRef(me,n.inlineRefs)?me:rs.call(r,me,e,t,D))}if(Z===void 0)V(k);else return q(k,Z),A(Z,re)}function I(D,k){var L=l.length;return l[L]=k,o[D]=L,"refVal"+L}function V(D){delete o[D]}function q(D,k){var L=o[D];l[L]=k}function A(D,k){return typeof D=="object"||typeof D=="boolean"?{code:k,schema:D,inline:!0}:{code:k,$async:D&&!!D.$async}}function z(D){var k=f[D];return k===void 0&&(k=f[D]=d.length,d[k]=D),"pattern"+k}function M(D){switch(typeof D){case"boolean":case"number":return""+D;case"string":return sa.toQuotedString(D);case"object":if(D===null)return"null";var k=Xu(D),L=m[k];return L===void 0&&(L=m[k]=h.length,h[L]=D),"default"+L}}function F(D,k,L,le){if(r._opts.validateSchema!==!1){var Y=D.definition.dependencies;if(Y&&!Y.every(function(Pe){return Object.prototype.hasOwnProperty.call(L,Pe)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=D.definition.validateSchema;if(re){var G=re(k);if(!G){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=D.definition.compile,we=D.definition.inline,De=D.definition.macro,se;if(me)se=me.call(r,k,L,le);else if(De)se=De.call(r,k,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(we)se=we.call(r,le,D.keyword,k,L);else if(se=D.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+D.keyword+'"failed to compile');var ye=_.length;return _[ye]=se,{code:"customRule"+ye,validate:se}}}function ad(a,e,t){var s=Dn.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 sd(a,e,t){var s=Dn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Dn(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 nd(a,e){return"var pattern"+a+" = new RegExp("+sa.toQuotedString(e[a])+");"}function id(a){return"var default"+a+" = defaults["+a+"];"}function od(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function ld(a){return"var customRule"+a+" = customRules["+a+"];"}function aa(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var An=Q((_h,In)=>{"use strict";var na=In.exports=function(){this._cache={}};na.prototype.put=function(e,t){this._cache[e]=t};na.prototype.get=function(e){return this._cache[e]};na.prototype.del=function(e){delete this._cache[e]};na.prototype.clear=function(){this._cache={}}});var Zn=Q((xh,Vn)=>{"use strict";var cd=Kr(),ud=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dd=[0,31,28,31,30,31,30,31,31,30,31,30,31],fd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,kn=/^(?=.{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,hd=/^(?:[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,pd=/^(?:[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,jn=/^(?:(?:[^\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,Cn=/^(?:(?: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,Nn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Fn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ln=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Mn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Vn.exports=ia;function ia(a){return a=a=="full"?"full":"fast",cd.copy(ia[a])}ia.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":jn,url:Cn,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:kn,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:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};ia.full={date:qn,time:zn,"date-time":gd,uri:bd,"uri-reference":pd,"uri-template":jn,url:Cn,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:kn,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:Un,uuid:Nn,"json-pointer":Fn,"json-pointer-uri-fragment":Ln,"relative-json-pointer":Mn};function md(a){return a%4===0&&(a%100!==0||a%400===0)}function qn(a){var e=a.match(ud);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&md(t)?29:dd[s])}function zn(a,e){var t=a.match(fd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],l=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||l)}var vd=/t|\s/i;function gd(a){var e=a.split(vd);return e.length==2&&qn(e[0])&&zn(e[1],!0)}var yd=/\/|:/;function bd(a){return yd.test(a)&&hd.test(a)}var _d=/[^\\]\\Z/;function Un(a){if(_d.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Bn=Q((Ph,Hn)=>{"use strict";Hn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(l||""),m="valid"+n,_,c;if(o=="#"||o=="#/")e.isRoot?(_=e.async,c="validate"):(_=e.root.schema.$async===!0,c="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,o);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(d)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),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,o,b)}else if(y.inline){var $=e.util.copy(e);$.level++;var S="valid"+$.level;$.schema=y.schema,$.schemaPath="",$.errSchemaPath=o;var R=e.validate($).replace(/validate\.schema/g,y.code);r+=" "+R+" ",f&&(r+=" if ("+S+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var T=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+T+" , "+I+", rootData) ";var V=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",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 (!"+V+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var Jn=Q((Eh,Qn)=>{"use strict";Qn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,f=e.util.copy(e),h="";f.level++;var m="valid"+f.level,_=f.baseId,c=!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))&&(c=!1,f.schema=b,f.schemaPath=l+"["+g+"]",f.errSchemaPath=o+"/"+g,r+=" "+e.validate(f)+" ",f.baseId=_,d&&(r+=" if ("+m+") { ",h+="}"));return d&&(c?r+=" if (true) { ":r+=" "+h.slice(0,-1)+" "),r}});var Wn=Q((Sh,Kn)=>{"use strict";Kn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,E=o.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(E){var $=y.baseId;r+=" var "+c+" = errors; var "+_+" = false; ";var S=e.compositeRule;e.compositeRule=y.compositeRule=!0;var R=o;if(R)for(var T,I=-1,V=R.length-1;I<V;)T=R[I+=1],y.schema=T,y.schemaPath=d+"["+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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else h&&(r+=" if (true) { ");return r}});var Yn=Q((wh,Gn)=>{"use strict";Gn.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+d+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}});var ei=Q((Rh,Xn)=>{"use strict";Xn.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,c||(r+=" var schema"+n+" = validate.schema"+d+";"),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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&h?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+=" }",h&&(r+=" else { "),r}});var ti=Q((Oh,ri)=>{"use strict";ri.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="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"+$,R=e.baseId,T=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+c+" = errors;var "+_+";",T){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=d,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 V=m+"["+E+"]";y.dataPathArr[$]=E;var q=e.validate(y);y.baseId=R,e.util.varOccurences(q,S)<2?r+=" "+e.util.varReplace(q,S,V)+" ":r+=" var "+S+" = "+V+"; "+q+" ",r+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+b+" if (!"+g+") {"}else r+=" if ("+m+".length == 0) {";var A=A||[];A.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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;return r=A.pop(),!e.compositeRule&&h?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 { ",T&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var si=Q((Dh,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g={},E={},$=e.opts.ownProperties;for(I in o)if(I!="__proto__"){var S=o[I],R=Array.isArray(S)?E:g;R[I]=S}r+="var "+_+" = errors;";var T=e.errorPath;r+="var missing"+n+";";for(var I in E)if(R=E[I],R.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),h){r+=" && ( ";var V=R;if(V)for(var q,A=-1,z=V.length-1;A<z;){q=V[A+=1],A&&(r+=" || ");var M=e.util.getProperty(q),F=m+M;r+=" ( ( "+F+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var D="missing"+n,k="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(T,D,!0):T+" + "+D);var L=L||[];L.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: '"+k+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",R.length==1?r+="property "+e.util.escapeQuotes(R[0]):r+="properties "+e.util.escapeQuotes(R.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var le=r;r=L.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=R;if(Y)for(var q,re=-1,G=Y.length-1;re<G;){q=Y[re+=1];var M=e.util.getProperty(q),k=e.util.escapeQuotes(q),F=m+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(T,q,e.opts.jsonPointers)),r+=" if ( "+F+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(q)+"') "),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: '"+k+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",R.length==1?r+="property "+e.util.escapeQuotes(R[0]):r+="properties "+e.util.escapeQuotes(R.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",h&&(y+="}",r+=" else { ")}e.errorPath=T;var Z=c.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+=") { ",c.schema=S,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=Z,r+=" } ",h&&(r+=" if ("+b+") { ",y+="}"))}return h&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var ii=Q(($h,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="i"+n,g="schema"+n;c||(r+=" var "+g+" = validate.schema"+d+";"),r+="var "+_+";",c&&(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; }",c&&(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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;return r=E.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var li=Q((Th,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return h&&(r+=" if (true) { "),r;var _=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var g="format"+n,E="isObject"+n,$="formatType"+n;r+=" var "+g+" = formats["+c+"]; 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+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+c+" && !"+g+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+c+") == -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[o];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(r+=" if (true) { "),r;if(b&&y.indexOf(o)>=0)return h&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" 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 h&&(r+=" if (true) { "),r;if(S){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+R+"("+m+"))) { "}else{r+=" if (! ";var R="formats"+e.util.getProperty(o);E&&(R+=".validate"),typeof g=="function"?r+=" "+R+"("+m+") ":r+=" "+R+".test("+m+") ",r+=") { "}}var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",_?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=T.pop(),!e.compositeRule&&h?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+=" } ",h&&(r+=" else { "),r}});var ui=Q((Ih,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="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)),R=y.baseId;if($||S){var T;y.createErrors=!1,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+_+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=R,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; 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=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'then'; "):T="'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=R,r+=" "+_+" = "+b+"; ",$&&S?(T="ifClause"+n,r+=" var "+T+" = 'else'; "):T="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var fi=Q((Ah,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="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"+$,R=e.baseId;if(r+="var "+c+" = errors;var "+_+";",Array.isArray(o)){var T=e.schema.additionalItems;if(T===!1){r+=" "+_+" = "+m+".length <= "+o.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f=I,h&&(b+="}",r+=" else { ")}var A=o;if(A){for(var z,M=-1,F=A.length-1;M<F;)if(z=A[M+=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 > "+M+") { ";var D=m+"["+M+"]";y.schema=z,y.schemaPath=d+"["+M+"]",y.errSchemaPath=f+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[$]=M;var k=e.validate(y);y.baseId=R,e.util.varOccurences(k,S)<2?r+=" "+e.util.varReplace(k,S,D)+" ":r+=" var "+S+" = "+D+"; "+k+" ",r+=" } ",h&&(r+=" if ("+g+") { ",b+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){y.schema=T,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+m+".length > "+o.length+") { for (var "+E+" = "+o.length+"; "+E+" < "+m+".length; "+E+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0);var D=m+"["+E+"]";y.dataPathArr[$]=E;var k=e.validate(y);y.baseId=R,e.util.varOccurences(k,S)<2?r+=" "+e.util.varReplace(k,S,D)+" ":r+=" var "+S+" = "+D+"; "+k+" ",h&&(r+=" if (!"+g+") break; "),r+=" } } ",h&&(r+=" if ("+g+") { ",b+="}")}}else if(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=d,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 D=m+"["+E+"]";y.dataPathArr[$]=E;var k=e.validate(y);y.baseId=R,e.util.varOccurences(k,S)<2?r+=" "+e.util.varReplace(k,S,D)+" ":r+=" var "+S+" = "+D+"; "+k+" ",h&&(r+=" if (!"+g+") break; "),r+=" }"}return h&&(r+=" "+b+" if ("+c+" == errors) {"),r}});var ts=Q((kh,hi)=>{"use strict";hi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,R,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],E=e.opts.$data&&g&&g.$data,$=y?"<":">",S=y?">":"<",R=void 0;if(!(_||typeof o=="number"||o===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 T=e.util.getData(g.$data,l,e.dataPathArr),I="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,A="op"+n,z="' + "+A+" + '";r+=" var schemaExcl"+n+" = "+T+"; ",T="schemaExcl"+n,r+=" var "+I+"; var "+V+" = typeof "+T+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var R=b,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+T+" "+$+"= "+c+") ? "+m+" "+S+"= "+T+" : "+m+" "+S+" "+c+" ) : ( ("+I+" = "+T+" === true) ? "+m+" "+S+"= "+c+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+$+"' : '"+$+"='; ",o===void 0&&(R=b,f=e.errSchemaPath+"/"+b,c=T,_=E)}else{var q=typeof g=="number",z=$;if(q&&_){var A="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+g+" "+$+"= "+c+" ? "+m+" "+S+"= "+g+" : "+m+" "+S+" "+c+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(I=!0,R=b,f=e.errSchemaPath+"/"+b,c=g,S+="="):(q&&(c=Math[y?"min":"max"](g,o)),g===(q?c:!0)?(I=!0,R=b,f=e.errSchemaPath+"/"+b,S+="="):(I=!1,z+="="));var A="'"+z+"'";r+=" if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+S+" "+c+" || "+m+" !== "+m+") { "}}R=R||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+A+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+z+" ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var as=Q((jh,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";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: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var ss=Q((Ch,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";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: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var ns=Q((Nh,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,b,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";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: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+c+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var yi=Q((Fh,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(_||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+c+" !== undefined && ( typeof "+c+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+c+", ",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: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&h?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+="} ",h&&(r+=" else { "),r}});var _i=Q((Lh,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e);c.level++;var y="valid"+c.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.createErrors=!1;var g;c.opts.allErrors&&(g=c.opts.allErrors,c.opts.allErrors=!1),r+=" "+e.validate(c)+" ",c.createErrors=!0,g&&(c.opts.allErrors=g),e.compositeRule=c.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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var $=r;r=E.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(r+=" if (false) { ");return r}});var Pi=Q((Mh,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c="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 "+c+" = errors , "+$+" = false , "+_+" = false , "+S+" = null; ";var R=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=o;if(T)for(var I,V=-1,q=T.length-1;V<q;)I=T[V+=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=d+"["+V+"]",y.errSchemaPath=f+"/"+V,r+=" "+e.validate(y)+" ",y.baseId=E):r+=" var "+g+" = true; ",V&&(r+=" if ("+g+" && "+$+") { "+_+" = false; "+S+" = ["+S+", "+V+"]; } else { ",b+="}"),r+=" if ("+g+") { "+_+" = "+$+" = true; "+S+" = "+V+"; }";return e.compositeRule=y.compositeRule=R,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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Si=Q((qh,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_=e.opts.$data&&o&&o.$data,c;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=_?"(new RegExp("+c+"))":e.usePattern(o);r+="if ( ",_&&(r+=" ("+c+" !== undefined && typeof "+c+" != '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+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&h?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+="} ",h&&(r+=" else { "),r}});var Ri=Q((zh,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level,g="key"+n,E="idx"+n,$=c.dataLevel=e.dataLevel+1,S="data"+$,R="dataProperties"+n,T=Object.keys(o||{}).filter(re),I=e.schema.patternProperties||{},V=Object.keys(I).filter(re),q=e.schema.additionalProperties,A=T.length||V.length,z=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,D=z||M||F,k=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(Ke){return Ke!=="__proto__"}if(r+="var "+_+" = errors;var "+b+" = true;",k&&(r+=" var "+R+" = undefined;"),D){if(k?r+=" "+R+" = "+R+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+R+".length; "+E+"++) { var "+g+" = "+R+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",A){if(r+=" var isAdditional"+n+" = !(false ",T.length)if(T.length>8)r+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var G=T;if(G)for(var Z,me=-1,we=G.length-1;me<we;)Z=G[me+=1],r+=" || "+g+" == "+e.util.toQuotedString(Z)+" "}if(V.length){var De=V;if(De)for(var se,ye=-1,Pe=De.length-1;ye<Pe;)se=De[ye+=1],r+=" || "+e.usePattern(se)+".test("+g+") "}r+=" ); if (isAdditional"+n+") { "}if(F=="all")r+=" delete "+m+"["+g+"]; ";else{var $e=e.errorPath,yr="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),z)if(F)r+=" delete "+m+"["+g+"]; ";else{r+=" "+b+" = false; ";var cr=f;f=e.errSchemaPath+"/additionalProperties";var be=be||[];be.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+yr+"' } ",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 ve=r;r=be.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=cr,h&&(r+=" break; ")}else if(M)if(F=="failing"){r+=" var "+_+" = errors; ";var Or=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.schema=q,c.schemaPath=e.schemaPath+".additionalProperties",c.errSchemaPath=e.errSchemaPath+"/additionalProperties",c.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Re=m+"["+g+"]";c.dataPathArr[$]=g;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,S)<2?r+=" "+e.util.varReplace(ie,S,Re)+" ":r+=" var "+S+" = "+Re+"; "+ie+" ",r+=" if (!"+b+") { errors = "+_+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+g+"]; } ",e.compositeRule=c.compositeRule=Or}else{c.schema=q,c.schemaPath=e.schemaPath+".additionalProperties",c.errSchemaPath=e.errSchemaPath+"/additionalProperties",c.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Re=m+"["+g+"]";c.dataPathArr[$]=g;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,S)<2?r+=" "+e.util.varReplace(ie,S,Re)+" ":r+=" var "+S+" = "+Re+"; "+ie+" ",h&&(r+=" if (!"+b+") break; ")}e.errorPath=$e}A&&(r+=" } "),r+=" } ",h&&(r+=" if ("+b+") { ",y+="}")}var br=e.opts.useDefaults&&!e.compositeRule;if(T.length){var ur=T;if(ur)for(var Z,Dr=-1,$r=ur.length-1;Dr<$r;){Z=ur[Dr+=1];var Ee=o[Z];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){var ze=e.util.getProperty(Z),Re=m+ze,Ae=br&&Ee.default!==void 0;c.schema=Ee,c.schemaPath=d+ze,c.errSchemaPath=f+"/"+e.util.escapeFragment(Z),c.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),c.dataPathArr[$]=e.util.toQuotedString(Z);var ie=e.validate(c);if(c.baseId=L,e.util.varOccurences(ie,S)<2){ie=e.util.varReplace(ie,S,Re);var Te=Re}else{var Te=S;r+=" var "+S+" = "+Re+"; "}if(Ae)r+=" "+ie+" ";else{if(Y&&Y[Z]){r+=" if ( "+Te+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = false; ";var $e=e.errorPath,cr=f,tr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath($e,Z,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var be=be||[];be.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+tr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+tr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=be.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=cr,e.errorPath=$e,r+=" } else { "}else h?(r+=" if ( "+Te+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+Te+" !== undefined ",k&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+ie+" } "}}h&&(r+=" if ("+b+") { ",y+="}")}}if(V.length){var Le=V;if(Le)for(var se,Dt=-1,ya=Le.length-1;Dt<ya;){se=Le[Dt+=1];var Ee=I[se];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===!1:e.util.schemaHasRules(Ee,e.RULES.all)){c.schema=Ee,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),k?r+=" "+R+" = "+R+" || Object.keys("+m+"); for (var "+E+"=0; "+E+"<"+R+".length; "+E+"++) { var "+g+" = "+R+"["+E+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+g+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Re=m+"["+g+"]";c.dataPathArr[$]=g;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,S)<2?r+=" "+e.util.varReplace(ie,S,Re)+" ":r+=" var "+S+" = "+Re+"; "+ie+" ",h&&(r+=" if (!"+b+") break; "),r+=" } ",h&&(r+=" else "+b+" = true; "),r+=" } ",h&&(r+=" if ("+b+") { ",y+="}")}}}return h&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Di=Q((Uh,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="errs__"+n,c=e.util.copy(e),y="";c.level++;var b="valid"+c.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){c.schema=o,c.schemaPath=d,c.errSchemaPath=f;var g="key"+n,E="idx"+n,$="i"+n,S="' + "+g+" + '",R=c.dataLevel=e.dataLevel+1,T="data"+R,I="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+I+" = undefined; "),V?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 A=g,z=e.compositeRule;e.compositeRule=c.compositeRule=!0;var M=e.validate(c);c.baseId=q,e.util.varOccurences(M,T)<2?r+=" "+e.util.varReplace(M,T,A)+" ":r+=" var "+T+" = "+A+"; "+M+" ",e.compositeRule=c.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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),h&&(r+=" break; "),r+=" } }"}return h&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Ti=Q((Vh,$i)=>{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="schema"+n;if(!c)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],E=o;if(E)for(var $,S=-1,R=E.length-1;S<R;){$=E[S+=1];var T=e.schema.properties[$];T&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(g[g.length]=$)}}else var g=o;if(c||g.length){var I=e.errorPath,V=c||g.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(h)if(r+=" var missing"+n+"; ",V){c||(r+=" var "+b+" = validate.schema"+d+"; ");var A="i"+n,z="schema"+n+"["+A+"]",M="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),r+=" var "+_+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+A+" = 0; "+A+" < "+b+".length; "+A+"++) { "+_+" = "+m+"["+b+"["+A+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+A+"]) "),r+="; if (!"+_+") break; } ",c&&(r+=" } "),r+=" if (!"+_+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var k=g;if(k)for(var L,A=-1,le=k.length-1;A<le;){L=k[A+=1],A&&(r+=" || ");var Y=e.util.getProperty(L),re=m+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:Y)+") ) "}r+=") { ";var z="missing"+n,M="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,z,!0):I+" + "+z);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(V){c||(r+=" var "+b+" = validate.schema"+d+"; ");var A="i"+n,z="schema"+n+"["+A+"]",M="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,z,e.opts.jsonPointers)),c&&(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: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , 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 "+A+" = 0; "+A+" < "+b+".length; "+A+"++) { if ("+m+"["+b+"["+A+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+b+"["+A+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",c&&(r+=" } ")}else{var G=g;if(G)for(var L,Z=-1,me=G.length-1;Z<me;){L=G[Z+=1];var Y=e.util.getProperty(L),M=e.util.escapeQuotes(L),re=m+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,L,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else h&&(r+=" if (true) {");return r}});var Ai=Q((Zh,Ii)=>{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m="data"+(l||""),_="valid"+n,c=e.opts.$data&&o&&o.$data,y;if(c?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||c)&&e.opts.uniqueItems!==!1){c&&(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+=" } ",c&&(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: ",c?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;r=$.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var ji=Q((Hh,ki)=>{"use strict";ki.exports={$ref:Bn(),allOf:Jn(),anyOf:Wn(),$comment:Yn(),const:ei(),contains:ti(),dependencies:si(),enum:ii(),format:li(),if:ui(),items:fi(),maximum:ts(),minimum:ts(),maxItems:as(),minItems:as(),maxLength:ss(),minLength:ss(),maxProperties:ns(),minProperties:ns(),multipleOf:yi(),not:_i(),oneOf:Pi(),pattern:Si(),properties:Ri(),propertyNames:Di(),required:Ti(),uniqueItems:Ai(),validate:es()}});var Fi=Q((Bh,Ni)=>{"use strict";var Ci=ji(),is=Kr().toHash;Ni.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=is(t),e.types=is(r),e.forEach(function(n){n.rules=n.rules.map(function(l){var o;if(typeof l=="object"){var d=Object.keys(l)[0];o=l[d],l=d,o.forEach(function(h){t.push(h),e.all[h]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Ci[l],implements:o};return f}),e.all.$comment={keyword:"$comment",code:Ci.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=is(t.concat(s)),e.custom={},e}});var qi=Q((Qh,Mi)=>{"use strict";var Li=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Mi.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<Li.length;n++){var l=Li[n],o=r[l];o&&(r[l]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Vi=Q((Jh,Ui)=>{"use strict";var xd=ra().MissingRef;Ui.exports=zi;function zi(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 o=s._addSchema(a,void 0,e);return o.validate||l(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var d=o.$schema;return d&&!s.getSchema(d)?zi.call(s,{$ref:d},!0):Promise.resolve()}function l(o){try{return s._compile(o)}catch(f){if(f instanceof xd)return d(f);throw f}function d(f){var h=f.missingSchema;if(c(h))throw new Error("Schema "+h+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[h];return m||(m=s._loadingSchemas[h]=s._opts.loadSchema(h),m.then(_,_)),m.then(function(y){if(!c(h))return n(y).then(function(){c(h)||s.addSchema(y,h,void 0,e)})}).then(function(){return l(o)});function _(){delete s._loadingSchemas[h]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var Hi=Q((Kh,Zi)=>{"use strict";Zi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,_="data"+(l||""),c="valid"+n,y="errs__"+n,b=e.opts.$data&&o&&o.$data,g;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",g="schema"+n):g=o;var E=this,$="definition"+n,S=E.definition,R="",T,I,V,q,A;if(b&&S.$data){A="keywordValidate"+n;var z=S.validateSchema;r+=" var "+$+" = RULES.custom['"+t+"'].definition; var "+A+" = "+$+".validate;"}else{if(q=e.useCustomRule(E,o,e.schema,e),!q)return;g="validate.schema"+d,A=q.code,T=S.compile,I=S.inline,V=S.macro}var M=A+".errors",F="i"+n,D="ruleErr"+n,k=S.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(I||V||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+c+";",b&&S.$data&&(R+="}",r+=" if ("+g+" === undefined) { "+c+" = true; } else { ",z&&(R+="}",r+=" "+c+" = "+$+".validateSchema("+g+"); if ("+c+") { ")),I)S.statements?r+=" "+q.validate+" ":r+=" "+c+" = "+q.validate+"; ";else if(V){var L=e.util.copy(e),R="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,A);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+A+".call( ",e.opts.passContext?r+="this":r+="self",T||S.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var we=r;r=G.pop(),S.errors===!1?(r+=" "+c+" = ",k&&(r+="await "),r+=""+we+"; "):k?(M="customErrors"+n,r+=" var "+M+" = null; try { "+c+" = await "+we+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+c+" = "+we+"; "}if(S.modifying&&(r+=" if ("+Z+") "+_+" = "+Z+"["+me+"];"),r+=""+R,S.valid)h&&(r+=" if (true) { ");else{r+=" if ( ",S.valid===void 0?(r+=" !",V?r+=""+le:r+=""+c):r+=" "+!S.valid+" ",r+=") { ",m=E.keyword;var G=G||[];G.push(r),r="";var G=G||[];G.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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var De=r;r=G.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+De+"]); ":r+=" validate.errors = ["+De+"]; return false; ":r+=" var err = "+De+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=G.pop(),I?S.errors?S.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+D+" = vErrors["+F+"]; if ("+D+".dataPath === undefined) "+D+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+D+".schemaPath === undefined) { "+D+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+D+".schema = "+g+"; "+D+".data = "+_+"; "),r+=" } "):S.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+D+" = vErrors["+F+"]; if ("+D+".dataPath === undefined) "+D+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+D+".schemaPath === undefined) { "+D+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+D+".schema = "+g+"; "+D+".data = "+_+"; "),r+=" } } "):V?(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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):S.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+D+" = vErrors["+F+"]; if ("+D+".dataPath === undefined) "+D+".dataPath = (dataPath || '') + "+e.errorPath+"; "+D+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+D+".schema = "+g+"; "+D+".data = "+_+"; "),r+=" } } else { "+se+" } "),r+=" } ",h&&(r+=" else { ")}return r}});var os=Q((Wh,Pd)=>{Pd.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 Ji=Q((Gh,Qi)=>{"use strict";var Bi=os();Qi.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Bi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Bi.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 Wi=Q((Yh,Ki)=>{"use strict";var Ed=/^[a-z_$][a-z0-9_$-]*$/i,Sd=Hi(),wd=Ji();Ki.exports={add:Rd,get:Od,remove:Dd,validate:ls};function Rd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Ed.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++)l(a,s[r],e);else l(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 l(o,d,f){for(var h,m=0;m<t.length;m++){var _=t[m];if(_.type==d){h=_;break}}h||(h={type:d,rules:[]},t.push(h));var c={keyword:o,definition:f,custom:!0,code:Sd,implements:f.implements};h.rules.push(c),t.custom[o]=c}return this}function Od(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Dd(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 ls(a,e){ls.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(wd,!0);if(t(a))return!0;if(ls.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var Gi=Q((Xh,$d)=>{$d.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 oo=Q((ep,io)=>{"use strict";var Xi=Tn(),Wr=ea(),Td=An(),eo=Qa(),Id=Xa(),Ad=Zn(),kd=Fi(),ro=qi(),to=Kr();io.exports=ge;ge.prototype.validate=Cd;ge.prototype.compile=Nd;ge.prototype.addSchema=Fd;ge.prototype.addMetaSchema=Ld;ge.prototype.validateSchema=Md;ge.prototype.getSchema=zd;ge.prototype.removeSchema=Vd;ge.prototype.addFormat=Gd;ge.prototype.errorsText=Wd;ge.prototype._addSchema=Zd;ge.prototype._compile=Hd;ge.prototype.compileAsync=Vi();var ca=Wi();ge.prototype.addKeyword=ca.add;ge.prototype.getKeyword=ca.get;ge.prototype.removeKeyword=ca.remove;ge.prototype.validateKeyword=ca.validate;var ao=ra();ge.ValidationError=ao.Validation;ge.MissingRefError=ao.MissingRef;ge.$dataMetaSchema=ro;var la="http://json-schema.org/draft-07/schema",Yi=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],jd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=to.copy(a)||{},af(this),this._schemas={},this._refs={},this._fragments={},this._formats=Ad(a.format),this._cache=a.cache||new Td,this._loadingSchemas={},this._compilations=[],this.RULES=kd(),this._getId=Bd(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Id),this._metaOpts=tf(this),a.formats&&ef(this),a.keywords&&rf(this),Yd(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Xd(this)}function Cd(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 Nd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Fd(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=Wr.normalizeId(e||n),no(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Ld(a,e,t){return this.addSchema(a,e,t,!0),this}function Md(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||qd(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 qd(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(la)?la:void 0,a._opts.defaultMeta}function zd(a){var e=so(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Ud(this,a)}}function Ud(a,e){var t=Wr.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,l=Xi.call(a,s,r,void 0,n);return a._fragments[e]=new eo({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:l}),l}}function so(a,e){return e=Wr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function Vd(a){if(a instanceof RegExp)return oa(this,this._schemas,a),oa(this,this._refs,a),this;switch(typeof a){case"undefined":return oa(this,this._schemas),oa(this,this._refs),this._cache.clear(),this;case"string":var e=so(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=Wr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function oa(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 Zd(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,l=this._cache.get(n);if(l)return l;s=s||this._opts.addUsedSchema!==!1;var o=Wr.normalizeId(this._getId(a));o&&s&&no(this,o);var d=this._opts.validateSchema!==!1&&!e,f;d&&!(f=o&&o==Wr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var h=Wr.ids.call(this,a),m=new eo({id:o,schema:a,localRefs:h,cacheKey:n,meta:t});return o[0]!="#"&&s&&(this._refs[o]=m),this._cache.put(n,m),d&&f&&this.validateSchema(a,!0),m}function Hd(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=Xi.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,l=n.apply(this,arguments);return r.errors=n.errors,l}}function Bd(a){switch(a.schemaId){case"auto":return Kd;case"id":return Qd;default:return Jd}}function Qd(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function Jd(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function Kd(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 Wd(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 l=a[n];l&&(r+=s+l.dataPath+" "+l.message+t)}return r.slice(0,-t.length)}function Gd(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function Yd(a){var e;if(a._opts.$data&&(e=Gi(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=os();a._opts.$data&&(t=ro(t,jd)),a.addMetaSchema(t,la,!0),a._refs["http://json-schema.org/schema"]=la}}function Xd(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 rf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function no(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function tf(a){for(var e=to.copy(a._opts),t=0;t<Yi.length;t++)delete e[Yi[t]];return e}function af(a){var e=a._opts.logger;if(e===!1)a.logger={log:cs,warn:cs,error:cs};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 cs(){}});var i={};yl(i,{BRAND:()=>Hl,DIRTY:()=>kr,EMPTY_PATH:()=>El,INVALID:()=>H,NEVER:()=>$c,OK:()=>Oe,ParseStatus:()=>Se,Schema:()=>W,ZodAny:()=>Pr,ZodArray:()=>gr,ZodBigInt:()=>Cr,ZodBoolean:()=>Nr,ZodBranded:()=>_t,ZodCatch:()=>Qr,ZodDate:()=>Fr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>jt,ZodEffects:()=>Be,ZodEnum:()=>Zr,ZodError:()=>ke,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>Nt,ZodIntersection:()=>zr,ZodIssueCode:()=>w,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>We,ZodNull:()=>Mr,ZodNullable:()=>or,ZodNumber:()=>jr,ZodObject:()=>je,ZodOptional:()=>Ze,ZodParsedType:()=>C,ZodPipeline:()=>xt,ZodPromise:()=>Er,ZodReadonly:()=>Jr,ZodRecord:()=>Ct,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>xr,ZodSymbol:()=>ot,ZodTransformer:()=>Be,ZodTuple:()=>ir,ZodType:()=>W,ZodUndefined:()=>Lr,ZodUnion:()=>qr,ZodUnknown:()=>vr,ZodVoid:()=>lt,addIssueToContext:()=>j,any:()=>ec,array:()=>sc,bigint:()=>Kl,boolean:()=>qs,coerce:()=>Dc,custom:()=>Fs,date:()=>Wl,datetimeRegex:()=>Cs,defaultErrorMap:()=>pr,discriminatedUnion:()=>lc,effect:()=>_c,enum:()=>gc,function:()=>pc,getErrorMap:()=>st,getParsedType:()=>nr,instanceof:()=>Ql,intersection:()=>cc,isAborted:()=>At,isAsync:()=>nt,isDirty:()=>kt,isValid:()=>_r,late:()=>Bl,lazy:()=>mc,literal:()=>vc,makeIssue:()=>bt,map:()=>fc,nan:()=>Jl,nativeEnum:()=>yc,never:()=>tc,null:()=>Xl,nullable:()=>Pc,number:()=>Ms,object:()=>nc,objectUtil:()=>Ea,oboolean:()=>Oc,onumber:()=>Rc,optional:()=>xc,ostring:()=>wc,pipeline:()=>Sc,preprocess:()=>Ec,promise:()=>bc,quotelessJson:()=>_l,record:()=>dc,set:()=>hc,setErrorMap:()=>Pl,strictObject:()=>ic,string:()=>Ls,symbol:()=>Gl,transformer:()=>_c,tuple:()=>uc,undefined:()=>Yl,union:()=>oc,unknown:()=>rc,util:()=>X,void:()=>ac});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 l of r)n[l]=l;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),l={};for(let o of n)l[o]=r[o];return a.objectValues(l)},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 l in r)Object.prototype.hasOwnProperty.call(r,l)&&n.push(l);return n},a.find=(r,n)=>{for(let l of r)if(n(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Ea;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ea||(Ea={}));var C=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=a=>{switch(typeof a){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(a)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(a)?C.array:a===null?C.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?C.promise:typeof Map<"u"&&a instanceof Map?C.map:typeof Set<"u"&&a instanceof Set?C.set:typeof Date<"u"&&a instanceof Date?C.date:C.object;default:return C.unknown}};var w=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"]),_l=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),ke=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 l of n.issues)if(l.code==="invalid_union")l.unionErrors.map(r);else if(l.code==="invalid_return_type")r(l.returnTypeError);else if(l.code==="invalid_arguments")r(l.argumentsError);else if(l.path.length===0)s._errors.push(t(l));else{let o=s,d=0;for(;d<l.path.length;){let f=l.path[d];d===l.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(l))):o[f]=o[f]||{_errors:[]},o=o[f],d++}}};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()}};ke.create=a=>new ke(a);var xl=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===C.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.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 w.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 w.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 w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},pr=xl;var Ts=pr;function Pl(a){Ts=a}function st(){return Ts}var bt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],l={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",d=s.filter(f=>!!f).slice().reverse();for(let f of d)o=f(l,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},El=[];function j(a,e){let t=st(),s=bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return H;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,l=await r.value;s.push({key:n,value:l})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:l}=r;if(n.status==="aborted"||l.status==="aborted")return H;n.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof l.value<"u"||r.alwaysSet)&&(s[n.value]=l.value)}return{status:e.value,value:s}}},H=Object.freeze({status:"aborted"}),kr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),At=a=>a.status==="aborted",kt=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=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 He=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}},Is=(a,e)=>{if(_r(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 ke(a.common.issues);return this._error=t,this._error}}};function J(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:(l,o)=>{let{message:d}=a;return l.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(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:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Is(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(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=>_r(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:nr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Is(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 l=e(r),o=()=>n.addIssue({code:w.custom,...s(r)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(o(),!1)):l?!0:(o(),!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:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ze.create(this,this._def)}nullable(){return or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gr.create(this)}promise(){return Er.create(this,this._def)}or(e){return qr.create([this,e],this._def)}and(e){return zr.create(this,e,this._def)}transform(e){return new Be({...J(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...J(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new _t({typeName:O.ZodBranded,type:this,...J(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Qr({...J(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xt.create(this,e)}readonly(){return Jr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Sl=/^c[^\s-]{8,}$/i,wl=/^[0-9a-z]+$/,Rl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ol=/^[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,Dl=/^[a-z0-9_-]{21}$/i,$l=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tl=/^[-+]?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)?)??$/,Il=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Al="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sa,kl=/^(?:(?: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])$/,jl=/^(?:(?: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])$/,Cl=/^(([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]))$/,Nl=/^(([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])$/,Fl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ks="((\\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])))",Ml=new RegExp(`^${ks}$`);function js(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 ql(a){return new RegExp(`^${js(a)}$`)}function Cs(a){let e=`${ks}T${js(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 zl(a,e){return!!((e==="v4"||!e)&&kl.test(a)||(e==="v6"||!e)&&Cl.test(a))}function Ul(a,e){if(!$l.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 Vl(a,e){return!!((e==="v4"||!e)&&jl.test(a)||(e==="v6"||!e)&&Nl.test(a))}var xr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.string,received:n.parsedType}),H}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.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),j(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let l=e.data.length>n.value,o=e.data.length<n.value;(l||o)&&(r=this._getOrReturnCtx(e,r),l?j(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&j(r,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Il.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"email",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Sa||(Sa=new RegExp(Al,"u")),Sa.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"emoji",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Ol.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"uuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Dl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"nanoid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Sl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")wl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid2",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Rl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ulid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),j(r,{validation:"url",code:w.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),j(r,{validation:"regex",code:w.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),j(r,{code:w.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),j(r,{code:w.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),j(r,{code:w.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Cs(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:w.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Ml.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:w.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?ql(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:w.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Tl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"duration",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?zl(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ip",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Ul(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"jwt",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Vl(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cidr",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Fl.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Ll.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64url",code:w.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:w.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:O.ZodString,coerce:a?.coerce??!1,...J(a)});function Zl(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(".","")),l=Number.parseInt(e.toFixed(r).replace(".",""));return n%l/10**r}var jr=class a extends W{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)!==C.number){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.number,received:n.parsedType}),H}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.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),j(s,{code:w.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),j(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Zl(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:w.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:O.ZodNumber,coerce:a?.coerce||!1,...J(a)});var Cr=class a extends W{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)!==C.bigint)return this._getInvalidInput(e);let s,r=new Se;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:w.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),j(s,{code:w.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),j(s,{code:w.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 j(t,{code:w.invalid_type,expected:C.bigint,received:t.parsedType}),H}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}};Cr.create=a=>new Cr({checks:[],typeName:O.ZodBigInt,coerce:a?.coerce??!1,...J(a)});var Nr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.boolean,received:s.parsedType}),H}return Oe(e.data)}};Nr.create=a=>new Nr({typeName:O.ZodBoolean,coerce:a?.coerce||!1,...J(a)});var Fr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:C.date,received:n.parsedType}),H}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_date}),H}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:w.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),j(r,{code:w.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:O.ZodDate,...J(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==C.symbol){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.symbol,received:s.parsedType}),H}return Oe(e.data)}};ot.create=a=>new ot({typeName:O.ZodSymbol,...J(a)});var Lr=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.undefined,received:s.parsedType}),H}return Oe(e.data)}};Lr.create=a=>new Lr({typeName:O.ZodUndefined,...J(a)});var Mr=class extends W{_parse(e){if(this._getType(e)!==C.null){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.null,received:s.parsedType}),H}return Oe(e.data)}};Mr.create=a=>new Mr({typeName:O.ZodNull,...J(a)});var Pr=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};Pr.create=a=>new Pr({typeName:O.ZodAny,...J(a)});var vr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};vr.create=a=>new vr({typeName:O.ZodUnknown,...J(a)});var We=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:w.invalid_type,expected:C.never,received:t.parsedType}),H}};We.create=a=>new We({typeName:O.ZodNever,...J(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.void,received:s.parsedType}),H}return Oe(e.data)}};lt.create=a=>new lt({typeName:O.ZodVoid,...J(a)});var gr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==C.array)return j(t,{code:w.invalid_type,expected:C.array,received:t.parsedType}),H;if(r.exactLength!==null){let l=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(l||o)&&(j(t,{code:l?w.too_big:w.too_small,minimum:o?r.exactLength.value:void 0,maximum:l?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&&(j(t,{code:w.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&&(j(t,{code:w.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((l,o)=>r.type._parseAsync(new He(t,l,t.path,o)))).then(l=>Se.mergeArray(s,l));let n=[...t.data].map((l,o)=>r.type._parseSync(new He(t,l,t.path,o)));return Se.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)}};gr.create=(a,e)=>new gr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...J(e)});function it(a){if(a instanceof je){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(it(s))}return new je({...a._def,shape:()=>e})}else return a instanceof gr?new gr({...a._def,type:it(a.element)}):a instanceof Ze?Ze.create(it(a.unwrap())):a instanceof or?or.create(it(a.unwrap())):a instanceof ir?ir.create(a.items.map(e=>it(e))):a}var je=class a extends W{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)!==C.object){let f=this._getOrReturnCtx(e);return j(f,{code:w.invalid_type,expected:C.object,received:f.parsedType}),H}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||o.push(f);let d=[];for(let f of l){let h=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new He(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof We){let f=this._def.unknownKeys;if(f==="passthrough")for(let h of o)d.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(f==="strict")o.length>0&&(j(r,{code:w.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let h of o){let m=r.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new He(r,m,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let h of d){let m=await h.key,_=await h.value;f.push({key:m,value:_,alwaysSet:h.alwaysSet})}return f}).then(f=>Se.mergeObjectSync(s,f)):Se.mergeObjectSync(s,d)}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:O.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 it(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 Ns(X.objectKeys(this.shape))}};je.create=(a,e)=>new je({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.strictCreate=(a,e)=>new je({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:O.ZodObject,...J(e)});je.lazycreate=(a,e)=>new je({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:O.ZodObject,...J(e)});var qr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let l=n.map(o=>new ke(o.ctx.common.issues));return j(t,{code:w.invalid_union,unionErrors:l}),H}if(t.common.async)return Promise.all(s.map(async n=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let n,l=[];for(let d of s){let f={...t,common:{...t.common,issues:[]},parent:null},h=d._parseSync({data:t.data,path:t.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=l.map(d=>new ke(d));return j(t,{code:w.invalid_union,unionErrors:o}),H}}get options(){return this._def.options}};qr.create=(a,e)=>new qr({options:a,typeName:O.ZodUnion,...J(e)});var mr=a=>a instanceof Ur?mr(a.schema):a instanceof Be?mr(a.innerType()):a instanceof Vr?[a.value]:a instanceof Zr?a.options:a instanceof Hr?X.objectValues(a.enum):a instanceof Br?mr(a._def.innerType):a instanceof Lr?[void 0]:a instanceof Mr?[null]:a instanceof Ze?[void 0,...mr(a.unwrap())]:a instanceof or?[null,...mr(a.unwrap())]:a instanceof _t||a instanceof Jr?mr(a.unwrap()):a instanceof Qr?mr(a._def.innerType):[],jt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return j(t,{code:w.invalid_type,expected:C.object,received:t.parsedType}),H;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}):(j(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),H)}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 l=mr(n.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of l){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...J(s)})}};function wa(a,e){let t=nr(a),s=nr(e);if(a===e)return{valid:!0,data:a};if(t===C.object&&s===C.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(o=>r.indexOf(o)!==-1),l={...a,...e};for(let o of n){let d=wa(a[o],e[o]);if(!d.valid)return{valid:!1};l[o]=d.data}return{valid:!0,data:l}}else if(t===C.array&&s===C.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let l=a[n],o=e[n],d=wa(l,o);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return t===C.date&&s===C.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var zr=class extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,l)=>{if(At(n)||At(l))return H;let o=wa(n.value,l.value);return o.valid?((kt(n)||kt(l))&&t.dirty(),{status:t.value,value:o.data}):(j(s,{code:w.invalid_intersection_types}),H)};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,l])=>r(n,l)):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}))}};zr.create=(a,e,t)=>new zr({left:a,right:e,typeName:O.ZodIntersection,...J(t)});var ir=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.array)return j(s,{code:w.invalid_type,expected:C.array,received:s.parsedType}),H;if(s.data.length<this._def.items.length)return j(s,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&s.data.length>this._def.items.length&&(j(s,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((l,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new He(s,l,s.path,o)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>Se.mergeArray(t,l)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};ir.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ir({items:a,typeName:O.ZodTuple,rest:null,...J(e)})};var Ct=class a extends W{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!==C.object)return j(s,{code:w.invalid_type,expected:C.object,received:s.parsedType}),H;let r=[],n=this._def.keyType,l=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new He(s,o,s.path,o)),value:l._parse(new He(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:O.ZodRecord,...J(s)}):new a({keyType:xr.create(),valueType:e,typeName:O.ZodRecord,...J(t)})}},ct=class extends W{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!==C.map)return j(s,{code:w.invalid_type,expected:C.map,received:s.parsedType}),H;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([o,d],f)=>({key:r._parse(new He(s,o,s.path,[f,"key"])),value:n._parse(new He(s,d,s.path,[f,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of l){let f=await d.key,h=await d.value;if(f.status==="aborted"||h.status==="aborted")return H;(f.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(f.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of l){let f=d.key,h=d.value;if(f.status==="aborted"||h.status==="aborted")return H;(f.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(f.value,h.value)}return{status:t.value,value:o}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:O.ZodMap,...J(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.set)return j(s,{code:w.invalid_type,expected:C.set,received:s.parsedType}),H;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(j(s,{code:w.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&&(j(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function l(d){let f=new Set;for(let h of d){if(h.status==="aborted")return H;h.status==="dirty"&&t.dirty(),f.add(h.value)}return{status:t.value,value:f}}let o=[...s.data.values()].map((d,f)=>n._parse(new He(s,d,s.path,f)));return s.common.async?Promise.all(o).then(d=>l(d)):l(o)}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)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:O.ZodSet,...J(e)});var Nt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return j(t,{code:w.invalid_type,expected:C.function,received:t.parsedType}),H;function s(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(o,d){return bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(f=>!!f),issueData:{code:w.invalid_return_type,returnTypeError:d}})}let n={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Er){let o=this;return Oe(async function(...d){let f=new ke([]),h=await o._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,h);return await o._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let o=this;return Oe(function(...d){let f=o._def.args.safeParse(d,n);if(!f.success)throw new ke([s(d,f.error)]);let h=Reflect.apply(l,this,f.data),m=o._def.returns.safeParse(h,n);if(!m.success)throw new ke([r(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:ir.create(e).rest(vr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||ir.create([]).rest(vr.create()),returns:t||vr.create(),typeName:O.ZodFunction,...J(s)})}},Ur=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:O.ZodLazy,...J(e)});var Vr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vr.create=(a,e)=>new Vr({value:a,typeName:O.ZodLiteral,...J(e)});function Ns(a,e){return new Zr({values:a,typeName:O.ZodEnum,...J(e)})}var Zr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),H}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 j(t,{received:t.data,code:w.invalid_enum_value,options:s}),H}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=Ns;var Hr=class extends W{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==C.string&&s.parsedType!==C.number){let r=X.objectValues(t);return j(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),H}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return j(s,{received:s.data,code:w.invalid_enum_value,options:r}),H}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:O.ZodNativeEnum,...J(e)});var Er=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return j(t,{code:w.invalid_type,expected:C.promise,received:t.parsedType}),H;let s=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Er.create=(a,e)=>new Er({type:a,typeName:O.ZodPromise,...J(e)});var Be=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.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:l=>{j(s,l),l.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let l=r.transform(s.data,n);if(s.common.async)return Promise.resolve(l).then(async o=>{if(t.value==="aborted")return H;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?H:d.status==="dirty"?kr(d.value):t.value==="dirty"?kr(d.value):d});{if(t.value==="aborted")return H;let o=this._def.schema._parseSync({data:l,path:s.path,parent:s});return o.status==="aborted"?H:o.status==="dirty"?kr(o.value):t.value==="dirty"?kr(o.value):o}}if(r.type==="refinement"){let l=o=>{let d=r.refinement(o,n);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?H:(o.status==="dirty"&&t.dirty(),l(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(l))return H;let o=r.transform(l.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>_r(l)?Promise.resolve(r.transform(l.value,n)).then(o=>({status:t.value,value:o})):H);X.assertNever(r)}};Be.create=(a,e,t)=>new Be({schema:a,typeName:O.ZodEffects,effect:e,...J(t)});Be.createWithPreprocess=(a,e,t)=>new Be({schema:e,effect:{type:"preprocess",transform:a},typeName:O.ZodEffects,...J(t)});var Ze=class extends W{_parse(e){return this._getType(e)===C.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:O.ZodOptional,...J(e)});var or=class extends W{_parse(e){return this._getType(e)===C.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:O.ZodNullable,...J(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===C.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:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...J(e)});var Qr=class extends W{_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 nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ke(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ke(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Qr.create=(a,e)=>new Qr({innerType:a,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...J(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==C.nan){let s=this._getOrReturnCtx(e);return j(s,{code:w.invalid_type,expected:C.nan,received:s.parsedType}),H}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:O.ZodNaN,...J(a)});var Hl=Symbol("zod_brand"),_t=class extends W{_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}},xt=class a extends W{_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"?H:n.status==="dirty"?(t.dirty(),kr(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"?H: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:O.ZodPipeline})}},Jr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:O.ZodReadonly,...J(e)});function As(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Fs(a,e={},t){return a?Pr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let o=As(e,s),d=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:d})}});if(!n){let l=As(e,s),o=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:o})}}):Pr.create()}var Bl={object:je.lazycreate},O;(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"})(O||(O={}));var Ql=(a,e={message:`Input not instance of ${a.name}`})=>Fs(t=>t instanceof a,e),Ls=xr.create,Ms=jr.create,Jl=dt.create,Kl=Cr.create,qs=Nr.create,Wl=Fr.create,Gl=ot.create,Yl=Lr.create,Xl=Mr.create,ec=Pr.create,rc=vr.create,tc=We.create,ac=lt.create,sc=gr.create,nc=je.create,ic=je.strictCreate,oc=qr.create,lc=jt.create,cc=zr.create,uc=ir.create,dc=Ct.create,fc=ct.create,hc=ut.create,pc=Nt.create,mc=Ur.create,vc=Vr.create,gc=Zr.create,yc=Hr.create,bc=Er.create,_c=Be.create,xc=Ze.create,Pc=or.create,Ec=Be.createWithPreprocess,Sc=xt.create,wc=()=>Ls().optional(),Rc=()=>Ms().optional(),Oc=()=>qs().optional(),Dc={string:(a=>xr.create({...a,coerce:!0})),number:(a=>jr.create({...a,coerce:!0})),boolean:(a=>Nr.create({...a,coerce:!0})),bigint:(a=>Cr.create({...a,coerce:!0})),date:(a=>Fr.create({...a,coerce:!0}))};var $c=H;var Ra="2025-06-18";var zs=[Ra,"2025-03-26","2024-11-05","2024-10-07"],Ft="2.0",Us=i.union([i.string(),i.number().int()]),Vs=i.string(),Tc=i.object({progressToken:i.optional(Us)}).passthrough(),Qe=i.object({_meta:i.optional(Tc)}).passthrough(),Ce=i.object({method:i.string(),params:i.optional(Qe)}),Pt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),lr=i.object({method:i.string(),params:i.optional(Pt)}),Je=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),Lt=i.union([i.string(),i.number().int()]),Zs=i.object({jsonrpc:i.literal(Ft),id:Lt}).merge(Ce).strict(),Hs=a=>Zs.safeParse(a).success,Bs=i.object({jsonrpc:i.literal(Ft)}).merge(lr).strict(),Qs=a=>Bs.safeParse(a).success,Js=i.object({jsonrpc:i.literal(Ft),id:Lt,result:Je}).strict(),Oa=a=>Js.safeParse(a).success,Ge;(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"})(Ge||(Ge={}));var Ks=i.object({jsonrpc:i.literal(Ft),id:Lt,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),Ws=a=>Ks.safeParse(a).success,Gs=i.union([Zs,Bs,Js,Ks]),Mt=Je.strict(),qt=lr.extend({method:i.literal("notifications/cancelled"),params:Pt.extend({requestId:Lt,reason:i.string().optional()})}),Ic=i.object({src:i.string(),mimeType:i.optional(i.string()),sizes:i.optional(i.array(i.string()))}).passthrough(),Et=i.object({icons:i.array(Ic).optional()}).passthrough(),St=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),Ys=St.extend({version:i.string(),websiteUrl:i.optional(i.string())}).merge(Et),Ac=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),Da=Ce.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:Ac,clientInfo:Ys})});var kc=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),jc=Je.extend({protocolVersion:i.string(),capabilities:kc,serverInfo:Ys,instructions:i.optional(i.string())}),$a=lr.extend({method:i.literal("notifications/initialized")});var zt=Ce.extend({method:i.literal("ping")}),Cc=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),Ut=lr.extend({method:i.literal("notifications/progress"),params:Pt.merge(Cc).extend({progressToken:Us})}),Vt=Ce.extend({params:Qe.extend({cursor:i.optional(Vs)}).optional()}),Zt=Je.extend({nextCursor:i.optional(Vs)}),Xs=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),en=Xs.extend({text:i.string()}),Ta=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),rn=Xs.extend({blob:Ta}),tn=St.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Nc=St.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Fc=Vt.extend({method:i.literal("resources/list")}),Lc=Zt.extend({resources:i.array(tn)}),Mc=Vt.extend({method:i.literal("resources/templates/list")}),qc=Zt.extend({resourceTemplates:i.array(Nc)}),zc=Ce.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),Uc=Je.extend({contents:i.array(i.union([en,rn]))}),Vc=lr.extend({method:i.literal("notifications/resources/list_changed")}),Zc=Ce.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),Hc=Ce.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),Bc=lr.extend({method:i.literal("notifications/resources/updated"),params:Pt.extend({uri:i.string()})}),Qc=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),Jc=St.extend({description:i.optional(i.string()),arguments:i.optional(i.array(Qc)),_meta:i.optional(i.object({}).passthrough())}).merge(Et),Kc=Vt.extend({method:i.literal("prompts/list")}),Wc=Zt.extend({prompts:i.array(Jc)}),Gc=Ce.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),Ia=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Aa=i.object({type:i.literal("image"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ka=i.object({type:i.literal("audio"),data:Ta,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Yc=i.object({type:i.literal("resource"),resource:i.union([en,rn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Xc=tn.extend({type:i.literal("resource_link")}),an=i.union([Ia,Aa,ka,Xc,Yc]),eu=i.object({role:i.enum(["user","assistant"]),content:an}).passthrough(),ru=Je.extend({description:i.optional(i.string()),messages:i.array(eu)}),tu=lr.extend({method:i.literal("notifications/prompts/list_changed")}),au=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),su=St.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(au),_meta:i.optional(i.object({}).passthrough())}).merge(Et),ja=Vt.extend({method:i.literal("tools/list")}),nu=Zt.extend({tools:i.array(su)}),sn=Je.extend({content:i.array(an).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),eh=sn.or(Je.extend({toolResult:i.unknown()})),Ca=Ce.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),iu=lr.extend({method:i.literal("notifications/tools/list_changed")}),wt=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Na=Ce.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:wt})}),ou=lr.extend({method:i.literal("notifications/message"),params:Pt.extend({level:wt,logger:i.optional(i.string()),data:i.unknown()})}),lu=i.object({name:i.string().optional()}).passthrough(),cu=i.object({hints:i.optional(i.array(lu)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),uu=i.object({role:i.enum(["user","assistant"]),content:i.union([Ia,Aa,ka])}).passthrough(),du=Ce.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(uu),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(cu)})}),Fa=Je.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[Ia,Aa,ka])}),fu=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),hu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),pu=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),mu=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),vu=i.union([fu,hu,pu,mu]),gu=Ce.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),vu),required:i.optional(i.array(i.string()))}).passthrough()})}),La=Je.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),yu=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var bu=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),_u=Ce.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([bu,yu]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),xu=Je.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Pu=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Eu=Ce.extend({method:i.literal("roots/list")}),Ma=Je.extend({roots:i.array(Pu)}),Su=lr.extend({method:i.literal("notifications/roots/list_changed")}),rh=i.union([zt,Da,_u,Na,Gc,Kc,Fc,Mc,zc,Zc,Hc,Ca,ja]),th=i.union([qt,Ut,$a,Su]),ah=i.union([Mt,Fa,La,Ma]),sh=i.union([zt,du,gu,Eu]),nh=i.union([qt,Ut,ou,Bc,Vc,iu,tu]),ih=i.union([Mt,jc,xu,ru,Wc,Lc,qc,Uc,sn,nu]),Ye=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var wu=6e4,Ht=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(qt,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 Ye(Ge.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 l=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(d,f)=>{o?.(d,f),Oa(d)||Ws(d)?this._onresponse(d):Hs(d)?this._onrequest(d,f):Qs(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},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 Ye(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,l=this._transport;if(n===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let d={signal:o.signal,sessionId:l?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,h,m)=>this.request(f,h,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,d)).then(f=>{if(!o.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var h;if(!o.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ge.InternalError,message:(h=f.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).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 l=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&l&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){l(d);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),Oa(e))s(e);else{let r=new Ye(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:l}=s??{};return new Promise((o,d)=>{var f,h,m,_,c,y;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=s?.signal)===null||h===void 0||h.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=R=>{var T;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(T=this._transport)===null||T===void 0||T.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(R)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(R)};this._responseHandlers.set(b,R=>{var T;if(!(!((T=s?.signal)===null||T===void 0)&&T.aborted)){if(R instanceof Error)return d(R);try{let I=t.parse(R.result);o(I)}catch(I){d(I)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var R;E((R=s?.signal)===null||R===void 0?void 0:R.reason)});let $=(c=s?.timeout)!==null&&c!==void 0?c:wu,S=()=>E(new Ye(Ge.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:l}).catch(R=>{this._cleanupTimeout(b),d(R)})})}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 d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,t).catch(h=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,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 nn(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 lo=$s(oo(),1),ua=class extends Ht{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let l=this._loggingLevels.get(n);return l?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(l):!1},this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(Da,r=>this._oninitialize(r)),this.setNotificationHandler($a,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Na,async(r,n)=>{var l;let o=n.sessionId||((l=n.requestInfo)===null||l===void 0?void 0:l.headers["mcp-session-id"])||void 0,{level:d}=r.params,f=wt.safeParse(d);return f.success&&this._loggingLevels.set(o,f.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nn(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:zs.includes(t)?t:Ra,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"},Mt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Fa,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},La,t);if(s.action==="accept"&&s.content)try{let r=new lo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ye(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ye?r:new Ye(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ma,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var us=$s(require("node:process"),1);var da=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),sf(t)}clear(){this._buffer=void 0}};function sf(a){return Gs.parse(JSON.parse(a))}function co(a){return JSON.stringify(a)+`
`}var fa=class{constructor(e=us.default.stdin,t=us.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new da,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=co(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var fo=Symbol("Let zodToJsonSchema decide on which parser to use");var uo={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"},ho=a=>typeof a=="string"?{...uo,name:a}:{...uo,...a};var po=a=>{let e=ho(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 ds(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ds(a,e,s,r)}var ha=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?ha(e,a.currentPath):e.join("/")}}function mo(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==O.ZodAny&&(t.items=B(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function vo(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 go(){return{type:"boolean"}}function pa(a,e){return B(a.type._def,e)}var yo=(a,e)=>B(a.innerType._def,e);function fs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>fs(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 nf(a,e)}}var nf=(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 bo(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function _o(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function xo(a){return{type:"string",enum:Array.from(a.values)}}var of=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Po(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(of(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let l=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...d}=n;l=d}else s=void 0;r.push(l)}}),r.length?{allOf:r,...s}:void 0}function Eo(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 hs,Xe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(hs===void 0&&(hs=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),hs),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 ma(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":Ie(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":Ie(t,s.regex,s.message,e);break;case"cuid":Ie(t,Xe.cuid,s.message,e);break;case"cuid2":Ie(t,Xe.cuid2,s.message,e);break;case"startsWith":Ie(t,RegExp(`^${ps(s.value,e)}`),s.message,e);break;case"endsWith":Ie(t,RegExp(`${ps(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ie(t,RegExp(ps(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":Ie(t,Xe.base64url,s.message,e);break;case"jwt":Ie(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ie(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&Ie(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":Ie(t,Xe.emoji(),s.message,e);break;case"ulid":{Ie(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ie(t,Xe.base64,s.message,e);break}}break}case"nanoid":Ie(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function ps(a,e){return e.patternStrategy==="escape"?cf(a):a}var lf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function cf(a){let e="";for(let t=0;t<a.length;t++)lf.has(a[t])||(e+="\\"),e+=a[t];return e}function er(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 Ie(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:So(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",So(e,s),t,s)}function So(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,l=!1,o=!1;for(let d=0;d<s.length;d++){if(n){r+=s[d],n=!1;continue}if(t.i){if(l){if(s[d].match(/[a-z]/)){o?(r+=s[d],r+=`${s[d-2]}-${s[d]}`.toUpperCase(),o=!1):s[d+1]==="-"&&s[d+2]?.match(/[a-z]/)?(r+=s[d],o=!0):r+=`${s[d]}${s[d].toUpperCase()}`;continue}}else if(s[d].match(/[a-z]/)){r+=`[${s[d]}${s[d].toUpperCase()}]`;continue}}if(t.m){if(s[d]==="^"){r+=`(^|(?<=[\r
]))`;continue}else if(s[d]==="$"){r+=`($|(?=[\r
]))`;continue}}if(t.s&&s[d]==="."){r+=l?`${s[d]}\r
`:`[${s[d]}\r
]`;continue}r+=s[d],s[d]==="\\"?n=!0:l&&s[d]==="]"?l=!1:!l&&s[d]==="["&&(l=!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 va(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===O.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===O.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=ma(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===O.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===O.ZodBranded&&a.keyType._def.type._def.typeName===O.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=pa(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function wo(a,e){if(e.mapStrategy==="record")return va(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Ro(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 Oo(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Do(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ot={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function To(a,e){if(e.target==="openApi3")return $o(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ot&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=Ot[n._def.typeName];return l&&!r.includes(l)?[...r,l]: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 l=typeof n._def.value;switch(l){case"string":case"number":case"boolean":return[...r,l];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,l,o)=>o.indexOf(n)===l);return{type:r.length>1?r:r[0],enum:t.reduce((n,l)=>n.includes(l._def.value)?n:[...n,l._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 $o(a,e)}var $o=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Io(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:Ot[a.innerType._def.typeName],nullable:!0}:{type:[Ot[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Ao(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",ds(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 ko(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let d=n[o];if(d===void 0||d._def===void 0)continue;let f=df(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let h=B(d._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});h!==void 0&&(s.properties[o]=h,f||r.push(o))}r.length&&(s.required=r);let l=uf(a,e);return l!==void 0&&(s.additionalProperties=l),s}function uf(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function df(a){try{return a.isOptional()}catch{return!0}}var jo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Co=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function No(a,e){return B(a.type._def,e)}function Fo(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Lo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Mo(a){return{not:fe(a)}}function qo(a){return fe(a)}var zo=(a,e)=>B(a.innerType._def,e);var Uo=(a,e,t)=>{switch(e){case O.ZodString:return ma(a,t);case O.ZodNumber:return Ao(a,t);case O.ZodObject:return ko(a,t);case O.ZodBigInt:return vo(a,t);case O.ZodBoolean:return go();case O.ZodDate:return fs(a,t);case O.ZodUndefined:return Mo(t);case O.ZodNull:return Do(t);case O.ZodArray:return mo(a,t);case O.ZodUnion:case O.ZodDiscriminatedUnion:return To(a,t);case O.ZodIntersection:return Po(a,t);case O.ZodTuple:return Lo(a,t);case O.ZodRecord:return va(a,t);case O.ZodLiteral:return Eo(a,t);case O.ZodEnum:return xo(a);case O.ZodNativeEnum:return Ro(a);case O.ZodNullable:return Io(a,t);case O.ZodOptional:return jo(a,t);case O.ZodMap:return wo(a,t);case O.ZodSet:return Fo(a,t);case O.ZodLazy:return()=>a.getter()._def;case O.ZodPromise:return No(a,t);case O.ZodNaN:case O.ZodNever:return Oo(t);case O.ZodEffects:return _o(a,t);case O.ZodAny:return fe(t);case O.ZodUnknown:return qo(t);case O.ZodDefault:return bo(a,t);case O.ZodBranded:return pa(a,t);case O.ZodReadonly:return zo(a,t);case O.ZodCatch:return yo(a,t);case O.ZodPipeline:return Co(a,t);case O.ZodFunction:case O.ZodVoid:case O.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==fo)return o}if(s&&!t){let o=ff(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Uo(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&hf(a,e,l),e.postProcess){let o=e.postProcess(l,a,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}var ff=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:ha(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},hf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ms=(a,e)=>{let t=po(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,h])=>({...d,[f]:B(h._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(n.title=l),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 o=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"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Vo=require("fs"),Zo=require("os"),Ho=require("path"),pf=(0,Ho.join)((0,Zo.homedir)(),".claude-mem","silent.log");function rr(a,e,t=""){let s=new Date().toISOString(),o=((new Error().stack||"").split(`
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=o?`${o[1].split("/").pop()}:${o[2]}`:"unknown",f=`[${s}] [${d}] ${a}`;if(e!==void 0)try{f+=` ${JSON.stringify(e)}`}catch(h){f+=` [stringify error: ${h}]`}f+=`
`;try{(0,Vo.appendFileSync)(pf,f)}catch(h){console.error("[silent-debug] Failed to write to log:",h)}return t}var mf=parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10),ga=`http://localhost:${mf}`,Ne={search:"/api/search",timeline:"/api/timeline",decisions:"/api/decisions",changes:"/api/changes",how_it_works:"/api/how-it-works",search_observations:"/api/search/observations",search_sessions:"/api/search/sessions",search_user_prompts:"/api/search/prompts",find_by_concept:"/api/search/by-concept",find_by_file:"/api/search/by-file",find_by_type:"/api/search/by-type",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",get_timeline_by_query:"/api/timeline/by-query"};async function Fe(a,e){rr("[search-server] \u2192 Worker API",{endpoint:a,params:e});try{let t=new URLSearchParams;for(let[l,o]of Object.entries(e))o!=null&&t.append(l,String(o));let s=`${ga}${a}?${t}`,r=await fetch(s);if(!r.ok){let l=await r.text();throw new Error(`Worker API error (${r.status}): ${l}`)}let n=await r.json();return rr("[search-server] \u2190 Worker API success",{endpoint:a}),n}catch(t){return rr("[search-server] \u2190 Worker API error",{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function vf(){try{return(await fetch(`${ga}/api/health`)).ok}catch{return!1}}var Bo=[{name:"search",description:'Unified search across all memory types (observations, sessions, and user prompts) using vector-first semantic search (ChromaDB). Returns combined results from all document types. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:i.object({query:i.string().optional().describe("Natural language search query for semantic ranking via ChromaDB vector search. Optional - omit for date-filtered queries only (Chroma cannot filter by date, requires direct SQLite)."),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),type:i.enum(["observations","sessions","prompts"]).optional().describe("Filter by document type (observations, sessions, or prompts). Omit to search all types."),obs_type:i.string().optional().describe('Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change). Only applies when type="observations"'),concepts:i.string().optional().describe('Filter by concept tags (single value or comma-separated list). Only applies when type="observations"'),files:i.string().optional().describe('Filter by file paths (single value or comma-separated list for partial match). Only applies when type="observations"'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.search;return await Fe(e,a)}},{name:"timeline",description:"Fetch timeline of observations around a specific point in time. Supports two modes: anchor-based (fetch observations before/after a specific observation ID) and query-based (semantic search for anchor point). IMPORTANT: Use anchor_id when you know the specific observation, or query to find an anchor point first.",inputSchema:i.object({query:i.string().optional().describe("Natural language query to find anchor observation (query-based mode). Mutually exclusive with anchor_id."),anchor_id:i.number().optional().describe("Observation ID to use as anchor (anchor-based mode). Mutually exclusive with query."),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),obs_type:i.string().optional().describe("Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.timeline;return await Fe(e,a)}},{name:"decisions",description:"Semantic shortcut for finding architectural, design, and implementation decisions. Optimized for decision-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding decisions"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.decisions;return await Fe(e,a)}},{name:"changes",description:"Semantic shortcut for finding code changes, refactorings, and modifications. Optimized for change-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding changes"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.changes;return await Fe(e,a)}},{name:"how_it_works",description:"Semantic shortcut for understanding system architecture, design patterns, and implementation details. Optimized for discovery-type observations with architecture/design keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for understanding how something works"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.how_it_works;return await Fe(e,a)}},{name:"search_observations",description:'[DEPRECATED - Use "search" with type="observations" instead] Search observations (facts/narratives) using FTS5 full-text search. Supports filtering by type, concepts, files, and date range.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_observations;return await Fe(e,a)}},{name:"search_sessions",description:'[DEPRECATED - Use "search" with type="sessions" instead] Search session summaries using FTS5 full-text search. Returns both request_summary and learned_summary fields.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_sessions;return await Fe(e,a)}},{name:"search_user_prompts",description:'[DEPRECATED - Use "search" with type="prompts" instead] Search user prompts using FTS5 full-text search. Searches prompt text only.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Ne.search_user_prompts;return await Fe(e,a)}},{name:"find_by_concept",description:"Find observations tagged with specific concepts. Returns observations that match any of the provided concept tags.",inputSchema:i.object({concepts:i.string().describe("Concept tag(s) to filter by (single value or comma-separated list)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_concept;return await Fe(e,a)}},{name:"find_by_file",description:"Find observations related to specific file paths. Uses partial matching - searches for file paths containing the provided string.",inputSchema:i.object({files:i.string().describe("File path(s) to filter by (single value or comma-separated list for partial match)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_file;return await Fe(e,a)}},{name:"find_by_type",description:"Find observations of specific types. Returns observations matching any of the provided observation types.",inputSchema:i.object({type:i.string().describe("Observation type(s) to filter by (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Ne.find_by_type;return await Fe(e,a)}},{name:"get_recent_context",description:"Get recent session context for timeline display. Returns recent observations, sessions, and user prompts with metadata for building timeline UI.",inputSchema:i.object({limit:i.number().min(1).max(100).default(30).describe("Maximum number of timeline items to return"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_recent_context;return await Fe(e,a)}},{name:"get_context_timeline",description:"Get timeline of observations around a specific observation ID. Returns observations before and after the anchor point with metadata for timeline display.",inputSchema:i.object({anchor_id:i.number().describe("Observation ID to use as anchor point"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Ne.get_context_timeline;return await Fe(e,a)}},{name:"get_timeline_by_query",description:"Combined search + timeline tool. First searches for observations matching the query, then returns timeline around the best match. Useful for finding specific observations and viewing their context.",inputSchema:i.object({query:i.string().describe("Natural language query to find anchor observation"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Ne.get_timeline_by_query;return await Fe(e,a)}}],vs=new ua({name:"claude-mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});vs.setRequestHandler(ja,async()=>({tools:Bo.map(a=>({name:a.name,description:a.description,inputSchema:ms(a.inputSchema)}))}));vs.setRequestHandler(Ca,async a=>{let e=Bo.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function Qo(){rr("[search-server] Shutting down..."),process.exit(0)}process.on("SIGTERM",Qo);process.on("SIGINT",Qo);async function gf(){let a=new fa;await vs.connect(a),rr("[search-server] Claude-mem search server started"),setTimeout(async()=>{await vf()?rr("[search-server] Worker available at",ga):(rr("[search-server] WARNING: Worker not available at",ga),rr("[search-server] Tools will fail until Worker is started"),rr("[search-server] Start Worker with: npm run worker:restart"))},0)}gf().catch(a=>{rr("[search-server] Fatal error:",a),process.exit(1)});
/*! Bundled license information:
uri-js/dist/es5/uri.all.js:
(** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
*/