Files
claude-mem/plugin/scripts/mcp-server.cjs
Justin Kowarsch 3d4baefac2 fix: Use getWorkerHost() instead of hardcoded localhost in MCP server (#276)
On Windows systems, `localhost` resolves to IPv6 (::1) while the worker
binds to IPv4 (127.0.0.1), causing MCP tool connections to fail.

This change uses the existing getWorkerHost() function which correctly
returns the configured host address (defaulting to 127.0.0.1).

Fixes connection failures on Windows where localhost prefers IPv6.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 15:54:03 -05:00

18 lines
248 KiB
JavaScript
Executable File

#!/usr/bin/env bun
"use strict";var jl=Object.create;var Da=Object.defineProperty;var Ml=Object.getOwnPropertyDescriptor;var Fl=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var W=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ul=(a,e)=>{for(var t in e)Da(a,t,{get:e[t],enumerable:!0})},Vl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Fl(e))!ql.call(a,r)&&r!==t&&Da(a,r,{get:()=>e[r],enumerable:!(s=Ml(e,r))||s.enumerable});return a};var Ia=(a,e,t)=>(t=a!=null?jl(Ll(a)):{},Vl(e||!a||!a.__esModule?Da(t,"default",{value:a,enumerable:!0}):t,a));var En=W((Yt,bn)=>{(function(a,e){typeof Yt=="object"&&typeof bn<"u"?e(Yt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Yt,(function(a){"use strict";function e(){for(var h=arguments.length,u=Array(h),g=0;g<h;g++)u[g]=arguments[g];if(u.length>1){u[0]=u[0].slice(0,-1);for(var E=u.length-1,S=1;S<E;++S)u[S]=u[S].slice(1,-1);return u[E]=u[E].slice(1),u.join("")}else return u[0]}function t(h){return"(?:"+h+")"}function s(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function r(h){return h.toUpperCase()}function n(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function l(h,u){var g=h;if(u)for(var E in u)g[E]=u[E];return g}function o(h){var u="[A-Za-z]",g="[\\x0D]",E="[0-9]",S="[\\x22]",j=e(E,"[A-Fa-f]"),Q="[\\x0A]",ae="[\\x20]",oe=t(t("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+t("%[89A-Fa-f]"+j+"%"+j+j)+"|"+t("%"+j+j)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",pe=e(be,te),Ee=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=h?"[\\uE000-\\uF8FF]":"[]",ne=e(u,E,"[\\-\\.\\_\\~]",Ee),he=t(u+e(u,E,"[\\+\\-\\.]")+"*"),ce=t(t(oe+"|"+e(ne,te,"[\\:]"))+"*"),Cr=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("[1-9]"+E)+"|"+E),qe=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("0?[1-9]"+E)+"|0?0?"+E),ze=t(qe+"\\."+qe+"\\."+qe+"\\."+qe),ue=t(j+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+ze),He=t(t(ue+"\\:")+"{6}"+Ue),ir=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),$r=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),hr=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),_t=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),Nt=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),jt=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),rt=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),tt=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),mr=t([He,ir,$r,hr,_t,Nt,jt,rt,tt].join("|")),at=t(t(ne+"|"+oe)+"+"),Ta=t(mr+"\\%25"+at),Nr=t(mr+t("\\%25|\\%(?!"+j+"{2})")+at),Al=t("[vV]"+j+"+\\."+e(ne,te,"[\\:]")+"+"),Dl=t("\\["+t(Nr+"|"+mr+"|"+Al)+"\\]"),Ls=t(t(oe+"|"+e(ne,te))+"*"),bt=t(Dl+"|"+ze+"(?!"+Ls+")|"+Ls),Et=t(E+"*"),qs=t(t(ce+"@")+"?"+bt+t("\\:"+Et)+"?"),St=t(oe+"|"+e(ne,te,"[\\:\\@]")),Il=t(St+"*"),Us=t(St+"+"),kl=t(t(oe+"|"+e(ne,te,"[\\@]"))+"+"),vr=t(t("\\/"+Il)+"*"),st=t("\\/"+t(Us+vr)+"?"),Aa=t(kl+vr),Mt=t(Us+vr),nt="(?!"+St+")",Bf=t(vr+"|"+st+"|"+Aa+"|"+Mt+"|"+nt),it=t(t(St+"|"+e("[\\/\\?]",de))+"*"),xt=t(t(St+"|[\\/\\?]")+"*"),Vs=t(t("\\/\\/"+qs+vr)+"|"+st+"|"+Mt+"|"+nt),Cl=t(he+"\\:"+Vs+t("\\?"+it)+"?"+t("\\#"+xt)+"?"),$l=t(t("\\/\\/"+qs+vr)+"|"+st+"|"+Aa+"|"+nt),Nl=t($l+t("\\?"+it)+"?"+t("\\#"+xt)+"?"),Wf=t(Cl+"|"+Nl),Kf=t(he+"\\:"+Vs+t("\\?"+it)+"?"),Qf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Mt+"|"+nt+")")+t("\\?("+it+")")+"?"+t("\\#("+xt+")")+"?$",Jf="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Aa+"|"+nt+")")+t("\\?("+it+")")+"?"+t("\\#("+xt+")")+"?$",Gf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Mt+"|"+nt+")")+t("\\?("+it+")")+"?$",Yf="^"+t("\\#("+xt+")")+"?$",Xf="^"+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",u,E,"[\\+\\-\\.]"),"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,pe),"g"),PCT_ENCODED:new RegExp(oe,"g"),IPV4ADDRESS:new RegExp("^("+ze+")$"),IPV6ADDRESS:new RegExp("^\\[?("+mr+")"+t(t("\\%25|\\%(?!"+j+"{2})")+"("+at+")")+"?\\]?$")}}var d=o(!1),f=o(!0),p=(function(){function h(u,g){var E=[],S=!0,j=!1,Q=void 0;try{for(var ae=u[Symbol.iterator](),oe;!(S=(oe=ae.next()).done)&&(E.push(oe.value),!(g&&E.length===g));S=!0);}catch(be){j=!0,Q=be}finally{try{!S&&ae.return&&ae.return()}finally{if(j)throw Q}}return E}return function(u,g){if(Array.isArray(u))return u;if(Symbol.iterator in Object(u))return h(u,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),m=function(h){if(Array.isArray(h)){for(var u=0,g=Array(h.length);u<h.length;u++)g[u]=h[u];return g}else return Array.from(h)},b=2147483647,c=36,y=1,_=26,v=38,x=700,T=72,P=128,O="-",D=/^xn--/,I=/[^\0-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-y,U=Math.floor,L=String.fromCharCode;function M(h){throw new RangeError(q[h])}function A(h,u){for(var g=[],E=h.length;E--;)g[E]=u(h[E]);return g}function C(h,u){var g=h.split("@"),E="";g.length>1&&(E=g[0]+"@",h=g[1]),h=h.replace(z,".");var S=h.split("."),j=A(S,u).join(".");return E+j}function F(h){for(var u=[],g=0,E=h.length;g<E;){var S=h.charCodeAt(g++);if(S>=55296&&S<=56319&&g<E){var j=h.charCodeAt(g++);(j&64512)==56320?u.push(((S&1023)<<10)+(j&1023)+65536):(u.push(S),g--)}else u.push(S)}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,g){return u+22+75*(u<26)-((g!=0)<<5)},G=function(u,g,E){var S=0;for(u=E?U(u/x):u>>1,u+=U(u/g);u>k*_>>1;S+=c)u=U(u/k);return U(S+(k+1)*u/(u+v))},H=function(u){var g=[],E=u.length,S=0,j=P,Q=T,ae=u.lastIndexOf(O);ae<0&&(ae=0);for(var oe=0;oe<ae;++oe)u.charCodeAt(oe)>=128&&M("not-basic"),g.push(u.charCodeAt(oe));for(var be=ae>0?ae+1:0;be<E;){for(var te=S,pe=1,Ee=c;;Ee+=c){be>=E&&M("invalid-input");var de=Y(u.charCodeAt(be++));(de>=c||de>U((b-S)/pe))&&M("overflow"),S+=de*pe;var ne=Ee<=Q?y:Ee>=Q+_?_:Ee-Q;if(de<ne)break;var he=c-ne;pe>U(b/he)&&M("overflow"),pe*=he}var ce=g.length+1;Q=G(S-te,ce,te==0),U(S/ce)>b-j&&M("overflow"),j+=U(S/ce),S%=ce,g.splice(S++,0,j)}return String.fromCodePoint.apply(String,g)},me=function(u){var g=[];u=F(u);var E=u.length,S=P,j=0,Q=T,ae=!0,oe=!1,be=void 0;try{for(var te=u[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var Ee=pe.value;Ee<128&&g.push(L(Ee))}}catch(Nr){oe=!0,be=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw be}}var de=g.length,ne=de;for(de&&g.push(O);ne<E;){var he=b,ce=!0,Cr=!1,qe=void 0;try{for(var ze=u[Symbol.iterator](),ue;!(ce=(ue=ze.next()).done);ce=!0){var Ue=ue.value;Ue>=S&&Ue<he&&(he=Ue)}}catch(Nr){Cr=!0,qe=Nr}finally{try{!ce&&ze.return&&ze.return()}finally{if(Cr)throw qe}}var He=ne+1;he-S>U((b-j)/He)&&M("overflow"),j+=(he-S)*He,S=he;var ir=!0,$r=!1,hr=void 0;try{for(var _t=u[Symbol.iterator](),Nt;!(ir=(Nt=_t.next()).done);ir=!0){var jt=Nt.value;if(jt<S&&++j>b&&M("overflow"),jt==S){for(var rt=j,tt=c;;tt+=c){var mr=tt<=Q?y:tt>=Q+_?_:tt-Q;if(rt<mr)break;var at=rt-mr,Ta=c-mr;g.push(L(re(mr+at%Ta,0))),rt=U(at/Ta)}g.push(L(re(rt,0))),Q=G(j,He,ne==de),j=0,++ne}}}catch(Nr){$r=!0,hr=Nr}finally{try{!ir&&_t.return&&_t.return()}finally{if($r)throw hr}}++j,++S}return g.join("")},we=function(u){return C(u,function(g){return D.test(g)?H(g.slice(4).toLowerCase()):g})},Te=function(u){return C(u,function(g){return I.test(g)?"xn--"+me(g):g})},se={version:"2.1.0",ucs2:{decode:F,encode:le},decode:H,encode:me,toASCII:Te,toUnicode:we},ye={};function Se(h){var u=h.charCodeAt(0),g=void 0;return u<16?g="%0"+u.toString(16).toUpperCase():u<128?g="%"+u.toString(16).toUpperCase():u<2048?g="%"+(u>>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():g="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),g}function Ae(h){for(var u="",g=0,E=h.length;g<E;){var S=parseInt(h.substr(g+1,2),16);if(S<128)u+=String.fromCharCode(S),g+=3;else if(S>=194&&S<224){if(E-g>=6){var j=parseInt(h.substr(g+4,2),16);u+=String.fromCharCode((S&31)<<6|j&63)}else u+=h.substr(g,6);g+=6}else if(S>=224){if(E-g>=9){var Q=parseInt(h.substr(g+4,2),16),ae=parseInt(h.substr(g+7,2),16);u+=String.fromCharCode((S&15)<<12|(Q&63)<<6|ae&63)}else u+=h.substr(g,9);g+=9}else u+=h.substr(g,3),g+=3}return u}function Er(h,u){function g(E){var S=Ae(E);return S.match(u.UNRESERVED)?S:E}return h.scheme&&(h.scheme=String(h.scheme).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(u.PCT_ENCODED,g).replace(u.NOT_USERINFO,Se).replace(u.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_HOST,Se).replace(u.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(u.PCT_ENCODED,g).replace(h.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Se).replace(u.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(u.PCT_ENCODED,g).replace(u.NOT_QUERY,Se).replace(u.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(u.PCT_ENCODED,g).replace(u.NOT_FRAGMENT,Se).replace(u.PCT_ENCODED,r)),h}function fr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,u){var g=h.match(u.IPV4ADDRESS)||[],E=p(g,2),S=E[1];return S?S.split(".").map(fr).join("."):h}function ve(h,u){var g=h.match(u.IPV6ADDRESS)||[],E=p(g,3),S=E[1],j=E[2];if(S){for(var Q=S.toLowerCase().split("::").reverse(),ae=p(Q,2),oe=ae[0],be=ae[1],te=be?be.split(":").map(fr):[],pe=oe.split(":").map(fr),Ee=u.IPV4ADDRESS.test(pe[pe.length-1]),de=Ee?7:8,ne=pe.length-de,he=Array(de),ce=0;ce<de;++ce)he[ce]=te[ce]||pe[ne+ce]||"";Ee&&(he[de-1]=_e(he[de-1],u));var Cr=he.reduce(function(He,ir,$r){if(!ir||ir==="0"){var hr=He[He.length-1];hr&&hr.index+hr.length===$r?hr.length++:He.push({index:$r,length:1})}return He},[]),qe=Cr.sort(function(He,ir){return ir.length-He.length})[0],ze=void 0;if(qe&&qe.length>1){var ue=he.slice(0,qe.index),Ue=he.slice(qe.index+qe.length);ze=ue.join(":")+"::"+Ue.join(":")}else ze=he.join(":");return j&&(ze+="%"+j),ze}else return h}var Dr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function ie(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},E=u.iri!==!1?f:d;u.reference==="suffix"&&(h=(u.scheme?u.scheme+":":"")+"//"+h);var S=h.match(Dr);if(S){Oe?(g.scheme=S[1],g.userinfo=S[3],g.host=S[4],g.port=parseInt(S[5],10),g.path=S[6]||"",g.query=S[7],g.fragment=S[8],isNaN(g.port)&&(g.port=S[5])):(g.scheme=S[1]||void 0,g.userinfo=h.indexOf("@")!==-1?S[3]:void 0,g.host=h.indexOf("//")!==-1?S[4]:void 0,g.port=parseInt(S[5],10),g.path=S[6]||"",g.query=h.indexOf("?")!==-1?S[7]:void 0,g.fragment=h.indexOf("#")!==-1?S[8]:void 0,isNaN(g.port)&&(g.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?S[4]:void 0)),g.host&&(g.host=ve(_e(g.host,E),E)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",u.reference&&u.reference!=="suffix"&&u.reference!==g.reference&&(g.error=g.error||"URI is not a "+u.reference+" reference.");var j=ye[(u.scheme||g.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!j||!j.unicodeSupport)){if(g.host&&(u.domainHost||j&&j.domainHost))try{g.host=se.toASCII(g.host.replace(E.PCT_ENCODED,Ae).toLowerCase())}catch(Q){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+Q}Er(g,d)}else Er(g,E);j&&j.parse&&j.parse(g,u)}else g.error=g.error||"URI can not be parsed.";return g}function Sr(h,u){var g=u.iri!==!1?f:d,E=[];return h.userinfo!==void 0&&(E.push(h.userinfo),E.push("@")),h.host!==void 0&&E.push(ve(_e(String(h.host),g),g).replace(g.IPV6ADDRESS,function(S,j,Q){return"["+j+(Q?"%25"+Q:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(E.push(":"),E.push(String(h.port))),E.length?E.join(""):void 0}var pr=/^\.\.?\//,Ir=/^\/\.(\/|$)/,kr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Ve(h){for(var u=[];h.length;)if(h.match(pr))h=h.replace(pr,"");else if(h.match(Ir))h=h.replace(Ir,"/");else if(h.match(kr))h=h.replace(kr,"/"),u.pop();else if(h==="."||h==="..")h="";else{var g=h.match(xe);if(g){var E=g[0];h=h.slice(E.length),u.push(E)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function Ce(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=u.iri?f:d,E=[],S=ye[(u.scheme||h.scheme||"").toLowerCase()];if(S&&S.serialize&&S.serialize(h,u),h.host&&!g.IPV6ADDRESS.test(h.host)){if(u.domainHost||S&&S.domainHost)try{h.host=u.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(g.PCT_ENCODED,Ae).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}Er(h,g),u.reference!=="suffix"&&h.scheme&&(E.push(h.scheme),E.push(":"));var j=Sr(h,u);if(j!==void 0&&(u.reference!=="suffix"&&E.push("//"),E.push(j),h.path&&h.path.charAt(0)!=="/"&&E.push("/")),h.path!==void 0){var Q=h.path;!u.absolutePath&&(!S||!S.absolutePath)&&(Q=Ve(Q)),j===void 0&&(Q=Q.replace(/^\/\//,"/%2F")),E.push(Q)}return h.query!==void 0&&(E.push("?"),E.push(h.query)),h.fragment!==void 0&&(E.push("#"),E.push(h.fragment)),E.join("")}function De(h,u){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments[3],S={};return E||(h=ie(Ce(h,g),g),u=ie(Ce(u,g),g)),g=g||{},!g.tolerant&&u.scheme?(S.scheme=u.scheme,S.userinfo=u.userinfo,S.host=u.host,S.port=u.port,S.path=Ve(u.path||""),S.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(S.userinfo=u.userinfo,S.host=u.host,S.port=u.port,S.path=Ve(u.path||""),S.query=u.query):(u.path?(u.path.charAt(0)==="/"?S.path=Ve(u.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?S.path="/"+u.path:h.path?S.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+u.path:S.path=u.path,S.path=Ve(S.path)),S.query=u.query):(S.path=h.path,u.query!==void 0?S.query=u.query:S.query=h.query),S.userinfo=h.userinfo,S.host=h.host,S.port=h.port),S.scheme=h.scheme),S.fragment=u.fragment,S}function sr(h,u,g){var E=l({scheme:"null"},g);return Ce(De(ie(h,E),ie(u,E),E,!0),E)}function Le(h,u){return typeof h=="string"?h=Ce(ie(h,u),u):s(h)==="object"&&(h=ie(Ce(h,u),u)),h}function $t(h,u,g){return typeof h=="string"?h=Ce(ie(h,g),g):s(h)==="object"&&(h=Ce(h,g)),typeof u=="string"?u=Ce(ie(u,g),g):s(u)==="object"&&(u=Ce(u,g)),h===u}function Oa(h,u){return h&&h.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Se)}function Je(h,u){return h&&h.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,Ae)}var gt={scheme:"http",domainHost:!0,parse:function(u,g){return u.host||(u.error=u.error||"HTTP URIs must have a host."),u},serialize:function(u,g){var E=String(u.scheme).toLowerCase()==="https";return(u.port===(E?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},Is={scheme:"https",domainHost:gt.domainHost,parse:gt.parse,serialize:gt.serialize};function ks(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var yt={scheme:"ws",domainHost:!0,parse:function(u,g){var E=u;return E.secure=ks(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E},serialize:function(u,g){if((u.port===(ks(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 E=u.resourceName.split("?"),S=p(E,2),j=S[0],Q=S[1];u.path=j&&j!=="/"?j:void 0,u.query=Q,u.resourceName=void 0}return u.fragment=void 0,u}},Cs={scheme:"wss",domainHost:yt.domainHost,parse:yt.parse,serialize:yt.serialize},gl={},yl=!0,$s="[A-Za-z0-9\\-\\.\\_\\~"+(yl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",nr="[0-9A-Fa-f]",_l=t(t("%[EFef]"+nr+"%"+nr+nr+"%"+nr+nr)+"|"+t("%[89A-Fa-f]"+nr+"%"+nr+nr)+"|"+t("%"+nr+nr)),bl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",El="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Sl=e(El,'[\\"\\\\]'),xl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Pl=new RegExp($s,"g"),et=new RegExp(_l,"g"),wl=new RegExp(e("[^]",bl,"[\\.]",'[\\"]',Sl),"g"),Ns=new RegExp(e("[^]",$s,xl),"g"),Ol=Ns;function Ra(h){var u=Ae(h);return u.match(Pl)?u:h}var js={scheme:"mailto",parse:function(u,g){var E=u,S=E.to=E.path?E.path.split(","):[];if(E.path=void 0,E.query){for(var j=!1,Q={},ae=E.query.split("&"),oe=0,be=ae.length;oe<be;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var pe=te[1].split(","),Ee=0,de=pe.length;Ee<de;++Ee)S.push(pe[Ee]);break;case"subject":E.subject=Je(te[1],g);break;case"body":E.body=Je(te[1],g);break;default:j=!0,Q[Je(te[0],g)]=Je(te[1],g);break}}j&&(E.headers=Q)}E.query=void 0;for(var ne=0,he=S.length;ne<he;++ne){var ce=S[ne].split("@");if(ce[0]=Je(ce[0]),g.unicodeSupport)ce[1]=Je(ce[1],g).toLowerCase();else try{ce[1]=se.toASCII(Je(ce[1],g).toLowerCase())}catch(Cr){E.error=E.error||"Email address's domain name can not be converted to ASCII via punycode: "+Cr}S[ne]=ce.join("@")}return E},serialize:function(u,g){var E=u,S=n(u.to);if(S){for(var j=0,Q=S.length;j<Q;++j){var ae=String(S[j]),oe=ae.lastIndexOf("@"),be=ae.slice(0,oe).replace(et,Ra).replace(et,r).replace(wl,Se),te=ae.slice(oe+1);try{te=g.iri?se.toUnicode(te):se.toASCII(Je(te,g).toLowerCase())}catch(ne){E.error=E.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+ne}S[j]=be+"@"+te}E.path=S.join(",")}var pe=u.headers=u.headers||{};u.subject&&(pe.subject=u.subject),u.body&&(pe.body=u.body);var Ee=[];for(var de in pe)pe[de]!==gl[de]&&Ee.push(de.replace(et,Ra).replace(et,r).replace(Ns,Se)+"="+pe[de].replace(et,Ra).replace(et,r).replace(Ol,Se));return Ee.length&&(E.query=Ee.join("&")),E}},Rl=/^([^\:]+)\:(.*)/,Ms={scheme:"urn",parse:function(u,g){var E=u.path&&u.path.match(Rl),S=u;if(E){var j=g.scheme||S.scheme||"urn",Q=E[1].toLowerCase(),ae=E[2],oe=j+":"+(g.nid||Q),be=ye[oe];S.nid=Q,S.nss=ae,S.path=void 0,be&&(S=be.parse(S,g))}else S.error=S.error||"URN can not be parsed.";return S},serialize:function(u,g){var E=g.scheme||u.scheme||"urn",S=u.nid,j=E+":"+(g.nid||S),Q=ye[j];Q&&(u=Q.serialize(u,g));var ae=u,oe=u.nss;return ae.path=(S||g.nid)+":"+oe,ae}},Tl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Fs={scheme:"urn:uuid",parse:function(u,g){var E=u;return E.uuid=E.nss,E.nss=void 0,!g.tolerant&&(!E.uuid||!E.uuid.match(Tl))&&(E.error=E.error||"UUID is not valid."),E},serialize:function(u,g){var E=u;return E.nss=(u.uuid||"").toLowerCase(),E}};ye[gt.scheme]=gt,ye[Is.scheme]=Is,ye[yt.scheme]=yt,ye[Cs.scheme]=Cs,ye[js.scheme]=js,ye[Ms.scheme]=Ms,ye[Fs.scheme]=Fs,a.SCHEMES=ye,a.pctEncChar=Se,a.pctDecChars=Ae,a.parse=ie,a.removeDotSegments=Ve,a.serialize=Ce,a.resolveComponents=De,a.resolve=sr,a.normalize=Le,a.equal=$t,a.escapeComponent=Oa,a.unescapeComponent=Je,Object.defineProperty(a,"__esModule",{value:!0})}))});var Xt=W((Fp,Sn)=>{"use strict";Sn.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 Pn=W((Lp,xn)=>{"use strict";xn.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 Yr=W((qp,Rn)=>{"use strict";Rn.exports={copy:Qu,checkDataType:Qa,checkDataTypes:Ju,coerceToTypes:Gu,toHash:Ga,getProperty:Ya,escapeQuotes:Xa,equal:Xt(),ucs2length:Pn(),varOccurences:ed,varReplace:rd,schemaHasRules:td,schemaHasRulesExcept:ad,schemaUnknownRules:sd,toQuotedString:Ja,getPathExpr:nd,getPath:id,getData:cd,unescapeFragment:ud,unescapeJsonPointer:rs,escapeFragment:dd,escapeJsonPointer:es};function Qu(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 Ju(a,e,t){switch(a.length){case 1:return Qa(a[0],e,t,!0);default:var s="",r=Ga(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 wn=Ga(["string","number","integer","boolean","null"]);function Gu(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(wn[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(wn[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Ga(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Yu=/^[a-z$_][a-z$_0-9]*$/i,Xu=/'|\\/g;function Ya(a){return typeof a=="number"?"["+a+"]":Yu.test(a)?"."+a:"['"+Xa(a)+"']"}function Xa(a){return a.replace(Xu,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function ed(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function rd(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function td(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function ad(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function sd(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Ja(a){return"'"+Xa(a)+"'"}function nd(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return On(a,r)}function id(a,e,t){var s=Ja(t?"/"+es(e):Ya(e));return On(a,s)}var od=/^\/(?:[^~]|~0|~1)*$/,ld=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function cd(a,e,t){var s,r,n,l;if(a==="")return"rootData";if(a[0]=="/"){if(!od.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(l=a.match(ld),!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 p=d[f];p&&(n+=Ya(rs(p)),o+=" && "+n)}return o}function On(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function ud(a){return rs(decodeURIComponent(a))}function dd(a){return encodeURIComponent(es(a))}function es(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function rs(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var ts=W((Up,Tn)=>{"use strict";var fd=Yr();Tn.exports=pd;function pd(a){fd.copy(a,this)}});var Dn=W((Vp,An)=>{"use strict";var Rr=An.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(){};ea(e,s,r,a,"",a)};Rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Rr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Rr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ea(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 p in s){var m=s[p];if(Array.isArray(m)){if(p in Rr.arrayKeywords)for(var b=0;b<m.length;b++)ea(a,e,t,m[b],r+"/"+p+"/"+b,n,r,p,s,b)}else if(p in Rr.propsKeywords){if(m&&typeof m=="object")for(var c in m)ea(a,e,t,m[c],r+"/"+p+"/"+hd(c),n,r,p,s,c)}else(p in Rr.keywords||a.allKeys&&!(p in Rr.skipKeywords))&&ea(a,e,t,m,r+"/"+p,n,r,p,s)}t(s,r,n,l,o,d,f)}}function hd(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var ia=W((zp,$n)=>{"use strict";var It=En(),In=Xt(),sa=Yr(),ra=ts(),md=Dn();$n.exports=Ar;Ar.normalizeId=Tr;Ar.fullPath=ta;Ar.url=aa;Ar.ids=bd;Ar.inlineRef=as;Ar.schema=na;function Ar(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Ar.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof ra)return as(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=na.call(this,e,t),n,l,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof ra?l=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(l=as(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),l}function na(a,e){var t=It.parse(e),s=Cn(t),r=ta(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Tr(s),l=this._refs[n];if(typeof l=="string")return vd.call(this,a,l,t);if(l instanceof ra)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof ra){if(l.validate||this._compile(l),n==Tr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=ta(this._getId(a.schema))}return kn.call(this,t,r,a.schema,a)}function vd(a,e,t){var s=na.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=aa(n,l)),kn.call(this,t,n,r,a)}}var gd=sa.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function kn(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=sa.unescapeFragment(l),t=t[l],t===void 0)break;var o;if(!gd[l]&&(o=this._getId(t),o&&(e=aa(e,o)),t.$ref)){var d=aa(e,t.$ref),f=na.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 yd=sa.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function as(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return ss(a);if(e)return ns(a)<=e}function ss(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!ss(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!ss(e)))return!1;return!0}function ns(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+=ns(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(yd[r])e++;else if(t=a[r],typeof t=="object"&&(e+=ns(t)+1),e==1/0)return 1/0}return e}function ta(a,e){e!==!1&&(a=Tr(a));var t=It.parse(a);return Cn(t)}function Cn(a){return It.serialize(a).split("#")[0]+"#"}var _d=/#\/?$/;function Tr(a){return a?a.replace(_d,""):""}function aa(a,e){return e=Tr(e),It.resolve(a,e)}function bd(a){var e=Tr(this._getId(a)),t={"":e},s={"":ta(e,!1)},r={},n=this;return md(a,{allKeys:!0},function(l,o,d,f,p,m,b){if(o!==""){var c=n._getId(l),y=t[f],_=s[f]+"/"+p;if(b!==void 0&&(_+="/"+(typeof b=="number"?b:sa.escapeFragment(b))),typeof c=="string"){c=y=Tr(y?It.resolve(y,c):c);var v=n._refs[c];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!In(l,v.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=Tr(_))if(c[0]=="#"){if(r[c]&&!In(l,r[c]))throw new Error('id "'+c+'" resolves to more than one schema');r[c]=l}else n._refs[c]=_}t[o]=y,s[o]=_}}),r}});var oa=W((Hp,jn)=>{"use strict";var is=ia();jn.exports={Validation:Nn(Ed),MissingRef:Nn(os)};function Ed(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}os.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function os(a,e,t){this.message=t||os.message(a,e),this.missingRef=is.url(a,e),this.missingSchema=is.normalizeId(is.fullPath(this.missingRef))}function Nn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var ls=W((Zp,Mn)=>{"use strict";Mn.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]},p={key:d,value:l[d]};return n(f,p)}}})(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,p=Object.keys(l).sort(s&&s(l));for(d="",o=0;o<p.length;o++){var m=p[o],b=n(l[m]);b&&(d&&(d+=","),d+=JSON.stringify(m)+":"+b)}return r.splice(f,1),"{"+d+"}"}})(a)}});var cs=W((Bp,Fn)=>{"use strict";Fn.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",p=e.level,m=e.dataLevel,b=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,q,_="data"+(m||""),O="valid"+p;if(e.schema===!1){e.isTop?D=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var T=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,_="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_"+p+" = errors;"}var O="valid"+p,D=!e.opts.allErrors,I="",z="",q,k=e.schema.type,U=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(U?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],U=!0)),U&&k.length==1&&(k=k[0],U=!1),e.schema.$ref&&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")),k){if(e.opts.coerceTypes)var L=e.util.coerceToTypes(e.opts.coerceTypes,k);var M=e.RULES.types[k];if(L||U||M===!0||M&&!xe(M)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](k,_,e.opts.strictNumbers,!0)+") { ",L){var C="dataType"+p,F="coerced"+p;r+=" var "+C+" = typeof "+_+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+C+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+F+" = "+_+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=L;if(le)for(var Y,re=-1,G=le.length-1;re<G;)Y=le[re+=1],Y=="string"?r+=" else if ("+C+" == 'number' || "+C+" == 'boolean') "+F+" = '' + "+_+"; else if ("+_+" === null) "+F+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+C+" == 'boolean' || "+_+" === null || ("+C+" == 'string' && "+_+" && "+_+" == +"+_+" ",Y=="integer"&&(r+=" && !("+_+" % 1)"),r+=")) "+F+" = +"+_+"; "):Y=="boolean"?r+=" else if ("+_+" === 'false' || "+_+" === 0 || "+_+" === null) "+F+" = false; else if ("+_+" === 'true' || "+_+" === 1) "+F+" = true; ":Y=="null"?r+=" else if ("+_+" === '' || "+_+" === 0 || "+_+" === false) "+F+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+C+" == 'string' || "+C+" == 'number' || "+C+" == 'boolean' || "+_+" == null) "+F+" = ["+_+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+F+" !== undefined) { ";var H=m?"data"+(m-1||""):"parentData",me=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+_+" = "+F+"; ",m||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+me+"] = "+F+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!l)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(r+=" } if (errors === ",T?r+="0":r+="errs_"+p,r+=") { ",z+="}");else{var we=e.RULES;if(we){for(var M,Te=-1,se=we.length-1;Te<se;)if(M=we[Te+=1],xe(M)){if(M.type&&(r+=" if ("+e.util.checkDataType(M.type,_,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(M.type=="object"&&e.schema.properties){var b=e.schema.properties,ye=Object.keys(b),Se=ye;if(Se)for(var Ae,Er=-1,fr=Se.length-1;Er<fr;){Ae=Se[Er+=1];var _e=b[Ae];if(_e.default!==void 0){var ve=_+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(M.type=="array"&&Array.isArray(e.schema.items)){var Dr=e.schema.items;if(Dr){for(var _e,re=-1,Oe=Dr.length-1;re<Oe;)if(_e=Dr[re+=1],_e.default!==void 0){var ve=_+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var ie=M.rules;if(ie){for(var Sr,pr=-1,Ir=ie.length-1;pr<Ir;)if(Sr=ie[pr+=1],Ve(Sr)){var kr=Sr.code(e,Sr.keyword,M.type);kr&&(r+=" "+kr+" ",D&&(I+="}"))}}if(D&&(r+=" "+I+" ",I=""),M.type&&(r+=" } ",k&&k===M.type&&!L)){r+=" else { ";var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}D&&(r+=" if (errors === ",T?r+="0":r+="errs_"+p,r+=") { ",z+="}")}}}D&&(r+=" "+z+" "),T?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+p+";";function xe(De){for(var sr=De.rules,Le=0;Le<sr.length;Le++)if(Ve(sr[Le]))return!0}function Ve(De){return e.schema[De.keyword]!==void 0||De.implements&&Ce(De)}function Ce(De){for(var sr=De.implements,Le=0;Le<sr.length;Le++)if(e.schema[sr[Le]]!==void 0)return!0}return r}});var zn=W((Wp,Vn)=>{"use strict";var la=ia(),ua=Yr(),qn=oa(),Sd=ls(),Ln=cs(),xd=ua.ucs2length,Pd=Xt(),wd=qn.Validation;Vn.exports=us;function us(a,e,t,s){var r=this,n=this._opts,l=[void 0],o={},d=[],f={},p=[],m={},b=[];e=e||{schema:a,refVal:l,refs:o};var c=Od.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=P;var _=this._formats,v=this.RULES;try{var x=O(a,e,t,s);y.validate=x;var T=y.callValidate;return T&&(T.schema=x.schema,T.errors=null,T.refs=x.refs,T.refVal=x.refVal,T.root=x.root,T.$async=x.$async,n.sourceCode&&(T.source=x.source)),x}finally{Rd.call(this,a,e,s)}function P(){var A=y.validate,C=A.apply(this,arguments);return P.errors=A.errors,C}function O(A,C,F,le){var Y=!C||C&&C.schema==A;if(C.schema!=e.schema)return us.call(r,A,C,F,le);var re=A.$async===!0,G=Ln({isTop:!0,schema:A,isRoot:Y,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:qn.MissingRef,RULES:v,validate:Ln,util:ua,resolve:la,resolveRef:D,usePattern:U,useDefault:L,useCustomRule:M,opts:n,formats:_,logger:r.logger,self:r});G=ca(l,Dd)+ca(d,Td)+ca(p,Ad)+ca(b,Id)+G,n.processCode&&(G=n.processCode(G,A));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);H=me(r,v,_,e,l,p,b,Pd,xd,wd),l[0]=H}catch(we){throw r.logger.error("Error compiling schema, function code:",G),we}return H.schema=A,H.errors=null,H.refs=o,H.refVal=l,H.root=Y?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:G,patterns:d,defaults:p}),H}function D(A,C,F){C=la.url(A,C);var le=o[C],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",k(Y,re);if(!F&&e.refs){var G=e.refs[C];if(G!==void 0)return Y=e.refVal[G],re=I(C,Y),k(Y,re)}re=I(C);var H=la.call(r,O,e,C);if(H===void 0){var me=t&&t[C];me&&(H=la.inlineRef(me,n.inlineRefs)?me:us.call(r,me,e,t,A))}if(H===void 0)z(C);else return q(C,H),k(H,re)}function I(A,C){var F=l.length;return l[F]=C,o[A]=F,"refVal"+F}function z(A){delete o[A]}function q(A,C){var F=o[A];l[F]=C}function k(A,C){return typeof A=="object"||typeof A=="boolean"?{code:C,schema:A,inline:!0}:{code:C,$async:A&&!!A.$async}}function U(A){var C=f[A];return C===void 0&&(C=f[A]=d.length,d[C]=A),"pattern"+C}function L(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return ua.toQuotedString(A);case"object":if(A===null)return"null";var C=Sd(A),F=m[C];return F===void 0&&(F=m[C]=p.length,p[F]=A),"default"+F}}function M(A,C,F,le){if(r._opts.validateSchema!==!1){var Y=A.definition.dependencies;if(Y&&!Y.every(function(Se){return Object.prototype.hasOwnProperty.call(F,Se)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=A.definition.validateSchema;if(re){var G=re(C);if(!G){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=A.definition.compile,we=A.definition.inline,Te=A.definition.macro,se;if(me)se=me.call(r,C,F,le);else if(Te)se=Te.call(r,C,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(we)se=we.call(r,le,A.keyword,C,F);else if(se=A.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var ye=b.length;return b[ye]=se,{code:"customRule"+ye,validate:se}}}function Od(a,e,t){var s=Un.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function Rd(a,e,t){var s=Un.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Un(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function Td(a,e){return"var pattern"+a+" = new RegExp("+ua.toQuotedString(e[a])+");"}function Ad(a){return"var default"+a+" = defaults["+a+"];"}function Dd(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function Id(a){return"var customRule"+a+" = customRules["+a+"];"}function ca(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Zn=W((Kp,Hn)=>{"use strict";var da=Hn.exports=function(){this._cache={}};da.prototype.put=function(e,t){this._cache[e]=t};da.prototype.get=function(e){return this._cache[e]};da.prototype.del=function(e){delete this._cache[e]};da.prototype.clear=function(){this._cache={}}});var ai=W((Qp,ti)=>{"use strict";var kd=Yr(),Cd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$d=[0,31,28,31,30,31,30,31,31,30,31,30,31],Nd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Bn=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,jd=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Md=/^(?:[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,Wn=/^(?:(?:[^\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,Kn=/^(?:(?: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,Qn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Jn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Gn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Yn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ti.exports=fa;function fa(a){return a=a=="full"?"full":"fast",kd.copy(fa[a])}fa.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":Wn,url:Kn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Bn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ri,uuid:Qn,"json-pointer":Jn,"json-pointer-uri-fragment":Gn,"relative-json-pointer":Yn};fa.full={date:Xn,time:ei,"date-time":qd,uri:Vd,"uri-reference":Md,"uri-template":Wn,url:Kn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Bn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ri,uuid:Qn,"json-pointer":Jn,"json-pointer-uri-fragment":Gn,"relative-json-pointer":Yn};function Fd(a){return a%4===0&&(a%100!==0||a%400===0)}function Xn(a){var e=a.match(Cd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Fd(t)?29:$d[s])}function ei(a,e){var t=a.match(Nd);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 Ld=/t|\s/i;function qd(a){var e=a.split(Ld);return e.length==2&&Xn(e[0])&&ei(e[1],!0)}var Ud=/\/|:/;function Vd(a){return Ud.test(a)&&jd.test(a)}var zd=/[^\\]\\Z/;function ri(a){if(zd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ni=W((Jp,si)=>{"use strict";si.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,p="data"+(l||""),m="valid"+n,b,c;if(o=="#"||o=="#/")e.isRoot?(b=e.async,c="validate"):(b=e.root.schema.$async===!0,c="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var _=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(_);var v=v||[];v.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: "+p+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,_)}else if(y.inline){var T=e.util.copy(e);T.level++;var P="valid"+T.level;T.schema=y.schema,T.schemaPath="",T.errSchemaPath=o;var O=e.validate(T).replace(/validate\.schema/g,y.code);r+=" "+O+" ",f&&(r+=" if ("+P+") { ")}else b=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var D=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+D+" , "+I+", rootData) ";var z=r;if(r=v.pop(),b){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+z+"; ",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 (!"+z+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var oi=W((Gp,ii)=>{"use strict";ii.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),p="";f.level++;var m="valid"+f.level,b=f.baseId,c=!0,y=n;if(y)for(var _,v=-1,x=y.length-1;v<x;)_=y[v+=1],(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(c=!1,f.schema=_,f.schemaPath=l+"["+v+"]",f.errSchemaPath=o+"/"+v,r+=" "+e.validate(f)+" ",f.baseId=b,d&&(r+=" if ("+m+") { ",p+="}"));return d&&(c?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ci=W((Yp,li)=>{"use strict";li.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,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x=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(x){var T=y.baseId;r+=" var "+c+" = errors; var "+b+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=o;if(O)for(var D,I=-1,z=O.length-1;I<z;)D=O[I+=1],y.schema=D,y.schemaPath=d+"["+I+"]",y.errSchemaPath=f+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+b+" = "+b+" || "+v+"; if (!"+b+") { ",_+="}";e.compositeRule=y.compositeRule=P,r+=" "+_+" if (!"+b+") { 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&&p&&(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 p&&(r+=" if (true) { ");return r}});var di=W((Xp,ui)=>{"use strict";ui.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 pi=W((eh,fi)=>{"use strict";fi.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,p=!e.opts.allErrors,m="data"+(l||""),b="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 "+b+" = equal("+m+", schema"+n+"); if (!"+b+") { ";var _=_||[];_.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 v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var mi=W((rh,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,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x="i"+n,T=y.dataLevel=e.dataLevel+1,P="data"+T,O=e.baseId,D=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 "+b+";",D){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var z=m+"["+x+"]";y.dataPathArr[T]=x;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,z)+" ":r+=" var "+P+" = "+z+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=k.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",D&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var gi=W((th,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,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v={},x={},T=e.opts.ownProperties;for(I in o)if(I!="__proto__"){var P=o[I],O=Array.isArray(P)?x:v;O[I]=P}r+="var "+b+" = errors;";var D=e.errorPath;r+="var missing"+n+";";for(var I in x)if(O=x[I],O.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),p){r+=" && ( ";var z=O;if(z)for(var q,k=-1,U=z.length-1;k<U;){q=z[k+=1],k&&(r+=" || ");var L=e.util.getProperty(q),M=m+L;r+=" ( ( "+M+" === undefined ",T&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:L)+") ) "}r+=")) { ";var A="missing"+n,C="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,A,!0):D+" + "+A);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+C+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var le=r;r=F.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,G=Y.length-1;re<G;){q=Y[re+=1];var L=e.util.getProperty(q),C=e.util.escapeQuotes(q),M=m+L;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,q,e.opts.jsonPointers)),r+=" if ( "+M+" === undefined ",T&&(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: '"+C+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(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+=" } ",p&&(y+="}",r+=" else { ")}e.errorPath=D;var H=c.baseId;for(var I in v){var P=v[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",c.schema=P,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",y+="}"))}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var _i=W((ah,yi)=>{"use strict";yi.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,p=!e.opts.allErrors,m="data"+(l||""),b="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 _="i"+n,v="schema"+n;c||(r+=" var "+v+" = validate.schema"+d+";"),r+="var "+b+";",c&&(r+=" if (schema"+n+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+n+")) "+b+" = false; else {"),r+=""+b+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+b+" = true; break; }",c&&(r+=" } "),r+=" if (!"+b+") { ";var x=x||[];x.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 T=r;return r=x.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var Ei=W((sh,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,p=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var b=e.opts.$data&&o&&o.$data,c;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=e.opts.unknownFormats,_=Array.isArray(y);if(b){var v="format"+n,x="isObject"+n,T="formatType"+n;r+=" var "+v+" = formats["+c+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+T+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+c+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),r+=") || "),r+=" ("+v+" && "+T+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+m+") : "+v+"("+m+")) ":r+=" "+v+"("+m+") ",r+=" : "+v+".test("+m+"))))) {"}else{var v=e.formats[o];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(_&&y.indexOf(o)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,T=x&&v.type||"string";if(x){var P=v.async===!0;v=v.validate}if(T!=s)return p&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+O+"("+m+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(o);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+m+") ":r+=" "+O+".test("+m+") ",r+=") { "}}var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",b?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,b?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=D.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var xi=W((nh,Si)=>{"use strict";Si.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,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e);y.level++;var _="valid"+y.level,v=e.schema.then,x=e.schema.else,T=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=y.baseId;if(T||P){var D;y.createErrors=!1,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+b+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,T?(r+=" if ("+_+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+b+" = "+_+"; ",T&&P?(D="ifClause"+n,r+=" var "+D+" = 'then'; "):D="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+_+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+b+" = "+_+"; ",T&&P?(D="ifClause"+n,r+=" var "+D+" = 'else'; "):D="'else'",r+=" } "),r+=" if (!"+b+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+D+` + '" 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&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var wi=W((ih,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,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x="i"+n,T=y.dataLevel=e.dataLevel+1,P="data"+T,O=e.baseId;if(r+="var "+c+" = errors;var "+b+";",Array.isArray(o)){var D=e.schema.additionalItems;if(D===!1){r+=" "+b+" = "+m+".length <= "+o.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+b+") { ";var z=z||[];z.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=z.pop(),!e.compositeRule&&p?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,p&&(_+="}",r+=" else { ")}var k=o;if(k){for(var U,L=-1,M=k.length-1;L<M;)if(U=k[L+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+L+") { ";var A=m+"["+L+"]";y.schema=U,y.schemaPath=d+"["+L+"]",y.errSchemaPath=f+"/"+L,y.errorPath=e.util.getPathExpr(e.errorPath,L,e.opts.jsonPointers,!0),y.dataPathArr[T]=L;var C=e.validate(y);y.baseId=O,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){y.schema=D,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+o.length+") { for (var "+x+" = "+o.length+"; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var A=m+"["+x+"]";y.dataPathArr[T]=x;var C=e.validate(y);y.baseId=O,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" } } ",p&&(r+=" if ("+v+") { ",_+="}")}}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 "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var A=m+"["+x+"]";y.dataPathArr[T]=x;var C=e.validate(y);y.baseId=O,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+c+" == errors) {"),r}});var ds=W((oh,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,p=!e.opts.allErrors,O,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=t=="maximum",_=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],x=e.opts.$data&&v&&v.$data,T=y?"<":">",P=y?">":"<",O=void 0;if(!(b||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(x){var D=e.util.getData(v.$data,l,e.dataPathArr),I="exclusive"+n,z="exclType"+n,q="exclIsNumber"+n,k="op"+n,U="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+D+"; ",D="schemaExcl"+n,r+=" var "+I+"; var "+z+" = typeof "+D+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var O=_,L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var M=r;r=L.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+M+"]); ":r+=" validate.errors = ["+M+"]; return false; ":r+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+z+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+D+" "+T+"= "+c+") ? "+m+" "+P+"= "+D+" : "+m+" "+P+" "+c+" ) : ( ("+I+" = "+D+" === true) ? "+m+" "+P+"= "+c+" : "+m+" "+P+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+T+"' : '"+T+"='; ",o===void 0&&(O=_,f=e.errSchemaPath+"/"+_,c=D,b=x)}else{var q=typeof v=="number",U=T;if(q&&b){var k="'"+U+"'";r+=" if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+v+" "+T+"= "+c+" ? "+m+" "+P+"= "+v+" : "+m+" "+P+" "+c+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(I=!0,O=_,f=e.errSchemaPath+"/"+_,c=v,P+="="):(q&&(c=Math[y?"min":"max"](v,o)),v===(q?c:!0)?(I=!0,O=_,f=e.errSchemaPath+"/"+_,P+="="):(I=!1,U+="="));var k="'"+U+"'";r+=" if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+P+" "+c+" || "+m+" !== "+m+") { "}}O=O||t;var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+k+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",b?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var M=r;return r=L.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+M+"]); ":r+=" validate.errors = ["+M+"]; return false; ":r+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var fs=W((lh,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,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_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 ",b?r+="' + "+c+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ps=W((ch,Ti)=>{"use strict";Ti.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,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_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 ",b?r+="' + "+c+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var hs=W((uh,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,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_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 ",b?r+="' + "+c+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ii=W((dh,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,p=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",b&&(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+=" ) ",b&&(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 ",b?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=y.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ci=W((fh,ki)=>{"use strict";ki.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,p=!e.opts.allErrors,m="data"+(l||""),b="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 "+b+" = errors; ";var _=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.createErrors=!1;var v;c.opts.allErrors&&(v=c.opts.allErrors,c.opts.allErrors=!1),r+=" "+e.validate(c)+" ",c.createErrors=!0,v&&(c.opts.allErrors=v),e.compositeRule=c.compositeRule=_,r+=" if ("+y+") { ";var x=x||[];x.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 T=r;r=x.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+b+"; if (vErrors !== null) { if ("+b+") vErrors.length = "+b+"; 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++; ",p&&(r+=" if (false) { ");return r}});var Ni=W((ph,$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,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x=y.baseId,T="prevValid"+n,P="passingSchemas"+n;r+="var "+c+" = errors , "+T+" = false , "+b+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var D=o;if(D)for(var I,z=-1,q=D.length-1;z<q;)I=D[z+=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+"["+z+"]",y.errSchemaPath=f+"/"+z,r+=" "+e.validate(y)+" ",y.baseId=x):r+=" var "+v+" = true; ",z&&(r+=" if ("+v+" && "+T+") { "+b+" = false; "+P+" = ["+P+", "+z+"]; } else { ",_+="}"),r+=" if ("+v+") { "+b+" = "+T+" = true; "+P+" = "+z+"; }";return e.compositeRule=y.compositeRule=O,r+=""+_+"if (!"+b+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+P+" } ",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&&p&&(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 Mi=W((hh,ji)=>{"use strict";ji.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,p=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=b?"(new RegExp("+c+"))":e.usePattern(o);r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",b?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,b?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Li=W((mh,Fi)=>{"use strict";Fi.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,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v="key"+n,x="idx"+n,T=c.dataLevel=e.dataLevel+1,P="data"+T,O="dataProperties"+n,D=Object.keys(o||{}).filter(re),I=e.schema.patternProperties||{},z=Object.keys(I).filter(re),q=e.schema.additionalProperties,k=D.length||z.length,U=q===!1,L=typeof q=="object"&&Object.keys(q).length,M=e.opts.removeAdditional,A=U||L||M,C=e.opts.ownProperties,F=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(Je){return Je!=="__proto__"}if(r+="var "+b+" = errors;var "+_+" = true;",C&&(r+=" var "+O+" = undefined;"),A){if(C?r+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",k){if(r+=" var isAdditional"+n+" = !(false ",D.length)if(D.length>8)r+=" || validate.schema"+d+".hasOwnProperty("+v+") ";else{var G=D;if(G)for(var H,me=-1,we=G.length-1;me<we;)H=G[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(H)+" "}if(z.length){var Te=z;if(Te)for(var se,ye=-1,Se=Te.length-1;ye<Se;)se=Te[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(M=="all")r+=" delete "+m+"["+v+"]; ";else{var Ae=e.errorPath,Er="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(M)r+=" delete "+m+"["+v+"]; ";else{r+=" "+_+" = false; ";var fr=f;f=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+Er+"' } ",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=_e.pop(),!e.compositeRule&&p?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=fr,p&&(r+=" break; ")}else if(L)if(M=="failing"){r+=" var "+b+" = errors; ";var Dr=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,v,e.opts.jsonPointers);var Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=F,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",r+=" if (!"+_+") { errors = "+b+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+v+"]; } ",e.compositeRule=c.compositeRule=Dr}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,v,e.opts.jsonPointers);var Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=F,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; ")}e.errorPath=Ae}k&&(r+=" } "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}var Sr=e.opts.useDefaults&&!e.compositeRule;if(D.length){var pr=D;if(pr)for(var H,Ir=-1,kr=pr.length-1;Ir<kr;){H=pr[Ir+=1];var xe=o[H];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Ve=e.util.getProperty(H),Oe=m+Ve,Ce=Sr&&xe.default!==void 0;c.schema=xe,c.schemaPath=d+Ve,c.errSchemaPath=f+"/"+e.util.escapeFragment(H),c.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),c.dataPathArr[T]=e.util.toQuotedString(H);var ie=e.validate(c);if(c.baseId=F,e.util.varOccurences(ie,P)<2){ie=e.util.varReplace(ie,P,Oe);var De=Oe}else{var De=P;r+=" var "+P+" = "+Oe+"; "}if(Ce)r+=" "+ie+" ";else{if(Y&&Y[H]){r+=" if ( "+De+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ae=e.errorPath,fr=f,sr=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,H,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+sr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+sr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&p?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=fr,e.errorPath=Ae,r+=" } else { "}else p?(r+=" if ( "+De+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+De+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",y+="}")}}if(z.length){var Le=z;if(Le)for(var se,$t=-1,Oa=Le.length-1;$t<Oa;){se=Le[$t+=1];var xe=I[se];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){c.schema=xe,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=F,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}}}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var Ui=W((vh,qi)=>{"use strict";qi.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,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level;if(r+="var "+b+" = 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 v="key"+n,x="idx"+n,T="i"+n,P="' + "+v+" + '",O=c.dataLevel=e.dataLevel+1,D="data"+O,I="dataProperties"+n,z=e.opts.ownProperties,q=e.baseId;z&&(r+=" var "+I+" = undefined; "),z?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+I+".length; "+x+"++) { var "+v+" = "+I+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var k=v,U=e.compositeRule;e.compositeRule=c.compositeRule=!0;var L=e.validate(c);c.baseId=q,e.util.varOccurences(L,D)<2?r+=" "+e.util.varReplace(L,D,k)+" ":r+=" var "+D+" = "+k+"; "+L+" ",e.compositeRule=c.compositeRule=U,r+=" if (!"+_+") { for (var "+T+"=startErrs"+n+"; "+T+"<errors; "+T+"++) { vErrors["+T+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' 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&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),p&&(r+=" break; "),r+=" } }"}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var zi=W((gh,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,p=!e.opts.allErrors,m="data"+(l||""),b="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 _="schema"+n;if(!c)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],x=o;if(x)for(var T,P=-1,O=x.length-1;P<O;){T=x[P+=1];var D=e.schema.properties[T];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(v[v.length]=T)}}else var v=o;if(c||v.length){var I=e.errorPath,z=c||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var k="i"+n,U="schema"+n+"["+k+"]",L="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),r+=" var "+b+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+n+")) "+b+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+_+".length; "+k+"++) { "+b+" = "+m+"["+_+"["+k+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+k+"]) "),r+="; if (!"+b+") break; } ",c&&(r+=" } "),r+=" if (!"+b+") { ";var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+L+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+L+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var F,k=-1,le=C.length-1;k<le;){F=C[k+=1],k&&(r+=" || ");var Y=e.util.getProperty(F),re=m+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:Y)+") ) "}r+=") { ";var U="missing"+n,L="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,U,!0):I+" + "+U);var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+L+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+L+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var k="i"+n,U="schema"+n+"["+k+"]",L="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),c&&(r+=" if ("+_+" && !Array.isArray("+_+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+L+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+L+"\\'",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 ("+_+" !== undefined) { "),r+=" for (var "+k+" = 0; "+k+" < "+_+".length; "+k+"++) { if ("+m+"["+_+"["+k+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+_+"["+k+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+L+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+L+"\\'",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=v;if(G)for(var F,H=-1,me=G.length-1;H<me;){F=G[H+=1];var Y=e.util.getProperty(F),L=e.util.escapeQuotes(F),re=m+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,F,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(F)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+L+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+L+"\\'",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 p&&(r+=" if (true) {");return r}});var Zi=W((yh,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,p=!e.opts.allErrors,m="data"+(l||""),b="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 "+b+"; if ("+y+" === false || "+y+" === undefined) "+b+" = true; else if (typeof "+y+" != 'boolean') "+b+" = false; else { "),r+=" var i = "+m+".length , "+b+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+b+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+b+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",c&&(r+=" } "),r+=" if (!"+b+") { ";var T=T||[];T.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 P=r;r=T.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Wi=W((_h,Bi)=>{"use strict";Bi.exports={$ref:ni(),allOf:oi(),anyOf:ci(),$comment:di(),const:pi(),contains:mi(),dependencies:gi(),enum:_i(),format:Ei(),if:xi(),items:wi(),maximum:ds(),minimum:ds(),maxItems:fs(),minItems:fs(),maxLength:ps(),minLength:ps(),maxProperties:hs(),minProperties:hs(),multipleOf:Ii(),not:Ci(),oneOf:Ni(),pattern:Mi(),properties:Li(),propertyNames:Ui(),required:zi(),uniqueItems:Zi(),validate:cs()}});var Ji=W((bh,Qi)=>{"use strict";var Ki=Wi(),ms=Yr().toHash;Qi.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=ms(t),e.types=ms(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(p){t.push(p),e.all[p]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Ki[l],implements:o};return f}),e.all.$comment={keyword:"$comment",code:Ki.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ms(t.concat(s)),e.custom={},e}});var Xi=W((Eh,Yi)=>{"use strict";var Gi=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Yi.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<Gi.length;n++){var l=Gi[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 to=W((Sh,ro)=>{"use strict";var Hd=oa().MissingRef;ro.exports=eo;function eo(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)?eo.call(s,{$ref:d},!0):Promise.resolve()}function l(o){try{return s._compile(o)}catch(f){if(f instanceof Hd)return d(f);throw f}function d(f){var p=f.missingSchema;if(c(p))throw new Error("Schema "+p+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(b,b)),m.then(function(y){if(!c(p))return n(y).then(function(){c(p)||s.addSchema(y,p,void 0,e)})}).then(function(){return l(o)});function b(){delete s._loadingSchemas[p]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var so=W((xh,ao)=>{"use strict";ao.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,p=!e.opts.allErrors,m,b="data"+(l||""),c="valid"+n,y="errs__"+n,_=e.opts.$data&&o&&o.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",v="schema"+n):v=o;var x=this,T="definition"+n,P=x.definition,O="",D,I,z,q,k;if(_&&P.$data){k="keywordValidate"+n;var U=P.validateSchema;r+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+k+" = "+T+".validate;"}else{if(q=e.useCustomRule(x,o,e.schema,e),!q)return;v="validate.schema"+d,k=q.code,D=P.compile,I=P.inline,z=P.macro}var L=k+".errors",M="i"+n,A="ruleErr"+n,C=P.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(I||z||(r+=""+L+" = null;"),r+="var "+y+" = errors;var "+c+";",_&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+c+" = true; } else { ",U&&(O+="}",r+=" "+c+" = "+T+".validateSchema("+v+"); if ("+c+") { ")),I)P.statements?r+=" "+q.validate+" ":r+=" "+c+" = "+q.validate+"; ";else if(z){var F=e.util.copy(e),O="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var Y=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,k);e.compositeRule=F.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",D||P.schema===!1?r+=" , "+b+" ":r+=" , "+v+" , "+b+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var we=r;r=G.pop(),P.errors===!1?(r+=" "+c+" = ",C&&(r+="await "),r+=""+we+"; "):C?(L="customErrors"+n,r+=" var "+L+" = null; try { "+c+" = await "+we+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+L+" = e.errors; else throw e; } "):r+=" "+L+" = null; "+c+" = "+we+"; "}if(P.modifying&&(r+=" if ("+H+") "+b+" = "+H+"["+me+"];"),r+=""+O,P.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",z?r+=""+le:r+=""+c):r+=" "+!P.valid+" ",r+=") { ",m=x.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: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var Te=r;r=G.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+Te+"]); ":r+=" validate.errors = ["+Te+"]; return false; ":r+=" var err = "+Te+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=G.pop(),I?P.errors?P.errors!="full"&&(r+=" for (var "+M+"="+y+"; "+M+"<errors; "+M+"++) { var "+A+" = vErrors["+M+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } "):P.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+M+"="+y+"; "+M+"<errors; "+M+"++) { var "+A+" = vErrors["+M+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } } "):z?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+L+")) { if (vErrors === null) vErrors = "+L+"; else vErrors = vErrors.concat("+L+"); errors = vErrors.length; for (var "+M+"="+y+"; "+M+"<errors; "+M+"++) { var "+A+" = vErrors["+M+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } } else { "+se+" } "),r+=" } ",p&&(r+=" else { ")}return r}});var vs=W((Ph,Zd)=>{Zd.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 oo=W((wh,io)=>{"use strict";var no=vs();io.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:no.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:no.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 co=W((Oh,lo)=>{"use strict";var Bd=/^[a-z_$][a-z0-9_$-]*$/i,Wd=so(),Kd=oo();lo.exports={add:Qd,get:Jd,remove:Gd,validate:gs};function Qd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Bd.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 p,m=0;m<t.length;m++){var b=t[m];if(b.type==d){p=b;break}}p||(p={type:d,rules:[]},t.push(p));var c={keyword:o,definition:f,custom:!0,code:Wd,implements:f.implements};p.rules.push(c),t.custom[o]=c}return this}function Jd(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Gd(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function gs(a,e){gs.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Kd,!0);if(t(a))return!0;if(gs.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var uo=W((Rh,Yd)=>{Yd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Eo=W((Th,bo)=>{"use strict";var po=zn(),Xr=ia(),Xd=Zn(),ho=ts(),ef=ls(),rf=ai(),tf=Ji(),mo=Xi(),vo=Yr();bo.exports=ge;ge.prototype.validate=sf;ge.prototype.compile=nf;ge.prototype.addSchema=of;ge.prototype.addMetaSchema=lf;ge.prototype.validateSchema=cf;ge.prototype.getSchema=df;ge.prototype.removeSchema=pf;ge.prototype.addFormat=Ef;ge.prototype.errorsText=bf;ge.prototype._addSchema=hf;ge.prototype._compile=mf;ge.prototype.compileAsync=to();var ma=co();ge.prototype.addKeyword=ma.add;ge.prototype.getKeyword=ma.get;ge.prototype.removeKeyword=ma.remove;ge.prototype.validateKeyword=ma.validate;var go=oa();ge.ValidationError=go.Validation;ge.MissingRefError=go.MissingRef;ge.$dataMetaSchema=mo;var ha="http://json-schema.org/draft-07/schema",fo=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],af=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=vo.copy(a)||{},Rf(this),this._schemas={},this._refs={},this._fragments={},this._formats=rf(a.format),this._cache=a.cache||new Xd,this._loadingSchemas={},this._compilations=[],this.RULES=tf(),this._getId=vf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=ef),this._metaOpts=Of(this),a.formats&&Pf(this),a.keywords&&wf(this),Sf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),xf(this)}function sf(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 nf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function of(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=Xr.normalizeId(e||n),_o(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function lf(a,e,t){return this.addSchema(a,e,t,!0),this}function cf(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||uf(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 uf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(ha)?ha:void 0,a._opts.defaultMeta}function df(a){var e=yo(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return ff(this,a)}}function ff(a,e){var t=Xr.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,l=po.call(a,s,r,void 0,n);return a._fragments[e]=new ho({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:l}),l}}function yo(a,e){return e=Xr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function pf(a){if(a instanceof RegExp)return pa(this,this._schemas,a),pa(this,this._refs,a),this;switch(typeof a){case"undefined":return pa(this,this._schemas),pa(this,this._refs),this._cache.clear(),this;case"string":var e=yo(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=Xr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function pa(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 hf(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=Xr.normalizeId(this._getId(a));o&&s&&_o(this,o);var d=this._opts.validateSchema!==!1&&!e,f;d&&!(f=o&&o==Xr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var p=Xr.ids.call(this,a),m=new ho({id:o,schema:a,localRefs:p,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 mf(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=po.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 vf(a){switch(a.schemaId){case"auto":return _f;case"id":return gf;default:return yf}}function gf(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function yf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function _f(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 bf(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 Ef(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function Sf(a){var e;if(a._opts.$data&&(e=uo(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=vs();a._opts.$data&&(t=mo(t,af)),a.addMetaSchema(t,ha,!0),a._refs["http://json-schema.org/schema"]=ha}}function xf(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function Pf(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function wf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function _o(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Of(a){for(var e=vo.copy(a._opts),t=0;t<fo.length;t++)delete e[fo[t]];return e}function Rf(a){var e=a._opts.logger;if(e===!1)a.logger={log:ys,warn:ys,error:ys};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 ys(){}});var i={};Ul(i,{BRAND:()=>hc,DIRTY:()=>jr,EMPTY_PATH:()=>Bl,INVALID:()=>Z,NEVER:()=>Yc,OK:()=>Re,ParseStatus:()=>Pe,Schema:()=>J,ZodAny:()=>wr,ZodArray:()=>br,ZodBigInt:()=>Fr,ZodBoolean:()=>Lr,ZodBranded:()=>wt,ZodCatch:()=>Jr,ZodDate:()=>qr,ZodDefault:()=>Qr,ZodDiscriminatedUnion:()=>qt,ZodEffects:()=>We,ZodEnum:()=>Wr,ZodError:()=>$e,ZodFirstPartyTypeKind:()=>R,ZodFunction:()=>Vt,ZodIntersection:()=>Hr,ZodIssueCode:()=>w,ZodLazy:()=>Zr,ZodLiteral:()=>Br,ZodMap:()=>ft,ZodNaN:()=>ht,ZodNativeEnum:()=>Kr,ZodNever:()=>Ge,ZodNull:()=>Vr,ZodNullable:()=>cr,ZodNumber:()=>Mr,ZodObject:()=>Ne,ZodOptional:()=>Ze,ZodParsedType:()=>N,ZodPipeline:()=>Ot,ZodPromise:()=>Or,ZodReadonly:()=>Gr,ZodRecord:()=>Ut,ZodSchema:()=>J,ZodSet:()=>pt,ZodString:()=>Pr,ZodSymbol:()=>ut,ZodTransformer:()=>We,ZodTuple:()=>lr,ZodType:()=>J,ZodUndefined:()=>Ur,ZodUnion:()=>zr,ZodUnknown:()=>_r,ZodVoid:()=>dt,addIssueToContext:()=>$,any:()=>xc,array:()=>Rc,bigint:()=>yc,boolean:()=>Xs,coerce:()=>Gc,custom:()=>Js,date:()=>_c,datetimeRegex:()=>Ks,defaultErrorMap:()=>gr,discriminatedUnion:()=>Ic,effect:()=>zc,enum:()=>qc,function:()=>Mc,getErrorMap:()=>ot,getParsedType:()=>or,instanceof:()=>vc,intersection:()=>kc,isAborted:()=>Ft,isAsync:()=>lt,isDirty:()=>Lt,isValid:()=>xr,late:()=>mc,lazy:()=>Fc,literal:()=>Lc,makeIssue:()=>Pt,map:()=>Nc,nan:()=>gc,nativeEnum:()=>Uc,never:()=>wc,null:()=>Sc,nullable:()=>Zc,number:()=>Ys,object:()=>Tc,objectUtil:()=>ka,oboolean:()=>Jc,onumber:()=>Qc,optional:()=>Hc,ostring:()=>Kc,pipeline:()=>Wc,preprocess:()=>Bc,promise:()=>Vc,quotelessJson:()=>zl,record:()=>$c,set:()=>jc,setErrorMap:()=>Zl,strictObject:()=>Ac,string:()=>Gs,symbol:()=>bc,transformer:()=>zc,tuple:()=>Cc,undefined:()=>Ec,union:()=>Dc,unknown:()=>Pc,util:()=>X,void:()=>Oc});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 ka;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ka||(ka={}));var N=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),or=a=>{switch(typeof a){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map<"u"&&a instanceof Map?N.map:typeof Set<"u"&&a instanceof Set?N.set:typeof Date<"u"&&a instanceof Date?N.date:N.object;default:return N.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"]),zl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),$e=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()}};$e.create=a=>new $e(a);var Hl=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===N.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}},gr=Hl;var zs=gr;function Zl(a){zs=a}function ot(){return zs}var Pt=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}},Bl=[];function $(a,e){let t=ot(),s=Pt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===gr?void 0:gr].filter(r=>!!r)});a.common.issues.push(s)}var Pe=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return Z;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,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 Z;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}}},Z=Object.freeze({status:"aborted"}),jr=a=>({status:"dirty",value:a}),Re=a=>({status:"valid",value:a}),Ft=a=>a.status==="aborted",Lt=a=>a.status==="dirty",xr=a=>a.status==="valid",lt=a=>typeof Promise<"u"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Be=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Hs=(a,e)=>{if(xr(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 $e(a.common.issues);return this._error=t,this._error}}};function K(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(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 J=class{get description(){return this._def.description}_getType(e){return or(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:or(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pe,ctx:{common:e.parent.common,data:e.data,parsedType:or(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lt(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:or(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Hs(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:or(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return xr(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=>xr(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:or(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(lt(r)?r:Promise.resolve(r));return Hs(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 We({schema:this,typeName:R.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 cr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return Or.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Hr.create(this,e,this._def)}transform(e){return new We({...K(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Qr({...K(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new wt({typeName:R.ZodBranded,type:this,...K(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Jr({...K(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ot.create(this,e)}readonly(){return Gr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wl=/^c[^\s-]{8,}$/i,Kl=/^[0-9a-z]+$/,Ql=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jl=/^[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,Gl=/^[a-z0-9_-]{21}$/i,Yl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xl=/^[-+]?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)?)??$/,ec=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ca,tc=/^(?:(?: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])$/,ac=/^(?:(?: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])$/,sc=/^(([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]))$/,nc=/^(([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])$/,ic=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bs="((\\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])))",lc=new RegExp(`^${Bs}$`);function Ws(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 cc(a){return new RegExp(`^${Ws(a)}$`)}function Ks(a){let e=`${Bs}T${Ws(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 uc(a,e){return!!((e==="v4"||!e)&&tc.test(a)||(e==="v6"||!e)&&sc.test(a))}function dc(a,e){if(!Yl.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 fc(a,e){return!!((e==="v4"||!e)&&ac.test(a)||(e==="v6"||!e)&&nc.test(a))}var Pr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:N.string,received:n.parsedType}),Z}let s=new Pe,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),$(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),$(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?$(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&$(r,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")ec.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"email",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Ca||(Ca=new RegExp(rc,"u")),Ca.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"emoji",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Jl.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"uuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Gl.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"nanoid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Wl.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"cuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Kl.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"cuid2",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ql.test(e.data)||(r=this._getOrReturnCtx(e,r),$(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),$(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),$(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),$(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),$(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),$(r,{code:w.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ks(n).test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:w.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?lc.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:w.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?cc(n).test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:w.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Xl.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"duration",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?uc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"ip",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?dc(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"jwt",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?fc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"cidr",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?ic.test(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{validation:"base64",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?oc.test(e.data)||(r=this._getOrReturnCtx(e,r),$(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,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){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,...V.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,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pr.create=a=>new Pr({checks:[],typeName:R.ZodString,coerce:a?.coerce??!1,...K(a)});function pc(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 Mr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==N.number){let n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:N.number,received:n.parsedType}),Z}let s,r=new Pe;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),$(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),$(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),$(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?pc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),$(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),$(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,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Mr.create=a=>new Mr({checks:[],typeName:R.ZodNumber,coerce:a?.coerce||!1,...K(a)});var Fr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let s,r=new Pe;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),$(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),$(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),$(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 $(t,{code:w.invalid_type,expected:N.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fr.create=a=>new Fr({checks:[],typeName:R.ZodBigInt,coerce:a?.coerce??!1,...K(a)});var Lr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.boolean,received:s.parsedType}),Z}return Re(e.data)}};Lr.create=a=>new Lr({typeName:R.ZodBoolean,coerce:a?.coerce||!1,...K(a)});var qr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_type,expected:N.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return $(n,{code:w.invalid_date}),Z}let s=new Pe,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),$(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),$(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:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};qr.create=a=>new qr({checks:[],coerce:a?.coerce||!1,typeName:R.ZodDate,...K(a)});var ut=class extends J{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.symbol,received:s.parsedType}),Z}return Re(e.data)}};ut.create=a=>new ut({typeName:R.ZodSymbol,...K(a)});var Ur=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.undefined,received:s.parsedType}),Z}return Re(e.data)}};Ur.create=a=>new Ur({typeName:R.ZodUndefined,...K(a)});var Vr=class extends J{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.null,received:s.parsedType}),Z}return Re(e.data)}};Vr.create=a=>new Vr({typeName:R.ZodNull,...K(a)});var wr=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};wr.create=a=>new wr({typeName:R.ZodAny,...K(a)});var _r=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};_r.create=a=>new _r({typeName:R.ZodUnknown,...K(a)});var Ge=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return $(t,{code:w.invalid_type,expected:N.never,received:t.parsedType}),Z}};Ge.create=a=>new Ge({typeName:R.ZodNever,...K(a)});var dt=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.void,received:s.parsedType}),Z}return Re(e.data)}};dt.create=a=>new dt({typeName:R.ZodVoid,...K(a)});var br=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return $(t,{code:w.invalid_type,expected:N.array,received:t.parsedType}),Z;if(r.exactLength!==null){let l=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(l||o)&&($(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&&($(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&&($(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 Be(t,l,t.path,o)))).then(l=>Pe.mergeArray(s,l));let n=[...t.data].map((l,o)=>r.type._parseSync(new Be(t,l,t.path,o)));return Pe.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};br.create=(a,e)=>new br({type:a,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...K(e)});function ct(a){if(a instanceof Ne){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(ct(s))}return new Ne({...a._def,shape:()=>e})}else return a instanceof br?new br({...a._def,type:ct(a.element)}):a instanceof Ze?Ze.create(ct(a.unwrap())):a instanceof cr?cr.create(ct(a.unwrap())):a instanceof lr?lr.create(a.items.map(e=>ct(e))):a}var Ne=class a extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let f=this._getOrReturnCtx(e);return $(f,{code:w.invalid_type,expected:N.object,received:f.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ge&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||o.push(f);let d=[];for(let f of l){let p=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:p._parse(new Be(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof Ge){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(f==="strict")o.length>0&&($(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 p of o){let m=r.data[p];d.push({key:{status:"valid",value:p},value:f._parse(new Be(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of d){let m=await p.key,b=await p.value;f.push({key:m,value:b,alwaysSet:p.alwaysSet})}return f}).then(f=>Pe.mergeObjectSync(s,f)):Pe.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return V.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:V.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:R.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 ct(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 Qs(X.objectKeys(this.shape))}};Ne.create=(a,e)=>new Ne({shape:()=>a,unknownKeys:"strip",catchall:Ge.create(),typeName:R.ZodObject,...K(e)});Ne.strictCreate=(a,e)=>new Ne({shape:()=>a,unknownKeys:"strict",catchall:Ge.create(),typeName:R.ZodObject,...K(e)});Ne.lazycreate=(a,e)=>new Ne({shape:a,unknownKeys:"strip",catchall:Ge.create(),typeName:R.ZodObject,...K(e)});var zr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let 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 $e(o.ctx.common.issues));return $(t,{code:w.invalid_union,unionErrors:l}),Z}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},p=d._parseSync({data:t.data,path:t.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=l.map(d=>new $e(d));return $(t,{code:w.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}};zr.create=(a,e)=>new zr({options:a,typeName:R.ZodUnion,...K(e)});var yr=a=>a instanceof Zr?yr(a.schema):a instanceof We?yr(a.innerType()):a instanceof Br?[a.value]:a instanceof Wr?a.options:a instanceof Kr?X.objectValues(a.enum):a instanceof Qr?yr(a._def.innerType):a instanceof Ur?[void 0]:a instanceof Vr?[null]:a instanceof Ze?[void 0,...yr(a.unwrap())]:a instanceof cr?[null,...yr(a.unwrap())]:a instanceof wt||a instanceof Gr?yr(a.unwrap()):a instanceof Jr?yr(a._def.innerType):[],qt=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return $(t,{code:w.invalid_type,expected:N.object,received:t.parsedType}),Z;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):($(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let l=yr(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:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...K(s)})}};function $a(a,e){let t=or(a),s=or(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.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=$a(a[o],e[o]);if(!d.valid)return{valid:!1};l[o]=d.data}return{valid:!0,data:l}}else if(t===N.array&&s===N.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=$a(l,o);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Hr=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,l)=>{if(Ft(n)||Ft(l))return Z;let o=$a(n.value,l.value);return o.valid?((Lt(n)||Lt(l))&&t.dirty(),{status:t.value,value:o.data}):($(s,{code:w.invalid_intersection_types}),Z)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,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}))}};Hr.create=(a,e,t)=>new Hr({left:a,right:e,typeName:R.ZodIntersection,...K(t)});var lr=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return $(s,{code:w.invalid_type,expected:N.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return $(s,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&s.data.length>this._def.items.length&&($(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 Be(s,l,s.path,o)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>Pe.mergeArray(t,l)):Pe.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};lr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new lr({items:a,typeName:R.ZodTuple,rest:null,...K(e)})};var Ut=class a extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.object)return $(s,{code:w.invalid_type,expected:N.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,l=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Be(s,o,s.path,o)),value:l._parse(new Be(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Pe.mergeObjectAsync(t,r):Pe.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:R.ZodRecord,...K(s)}):new a({keyType:Pr.create(),valueType:e,typeName:R.ZodRecord,...K(t)})}},ft=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.map)return $(s,{code:w.invalid_type,expected:N.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([o,d],f)=>({key:r._parse(new Be(s,o,s.path,[f,"key"])),value:n._parse(new Be(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,p=await d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of l){let f=d.key,p=d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}}}};ft.create=(a,e,t)=>new ft({valueType:e,keyType:a,typeName:R.ZodMap,...K(t)});var pt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return $(s,{code:w.invalid_type,expected:N.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&($(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&&($(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 p of d){if(p.status==="aborted")return Z;p.status==="dirty"&&t.dirty(),f.add(p.value)}return{status:t.value,value:f}}let o=[...s.data.values()].map((d,f)=>n._parse(new Be(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:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};pt.create=(a,e)=>new pt({valueType:a,minSize:null,maxSize:null,typeName:R.ZodSet,...K(e)});var Vt=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return $(t,{code:w.invalid_type,expected:N.function,received:t.parsedType}),Z;function s(o,d){return Pt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),gr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(o,d){return Pt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),gr].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 Or){let o=this;return Re(async function(...d){let f=new $e([]),p=await o._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,p);return await o._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let o=this;return Re(function(...d){let f=o._def.args.safeParse(d,n);if(!f.success)throw new $e([s(d,f.error)]);let p=Reflect.apply(l,this,f.data),m=o._def.returns.safeParse(p,n);if(!m.success)throw new $e([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:lr.create(e).rest(_r.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||lr.create([]).rest(_r.create()),returns:t||_r.create(),typeName:R.ZodFunction,...K(s)})}},Zr=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Zr.create=(a,e)=>new Zr({getter:a,typeName:R.ZodLazy,...K(e)});var Br=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Br.create=(a,e)=>new Br({value:a,typeName:R.ZodLiteral,...K(e)});function Qs(a,e){return new Wr({values:a,typeName:R.ZodEnum,...K(e)})}var Wr=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{received:t.data,code:w.invalid_enum_value,options:s}),Z}return Re(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})}};Wr.create=Qs;var Kr=class extends J{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=X.objectValues(t);return $(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),Z}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return $(s,{received:s.data,code:w.invalid_enum_value,options:r}),Z}return Re(e.data)}get enum(){return this._def.values}};Kr.create=(a,e)=>new Kr({values:a,typeName:R.ZodNativeEnum,...K(e)});var Or=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return $(t,{code:w.invalid_type,expected:N.promise,received:t.parsedType}),Z;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Re(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Or.create=(a,e)=>new Or({type:a,typeName:R.ZodPromise,...K(e)});var We=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.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=>{$(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 Z;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?Z:d.status==="dirty"?jr(d.value):t.value==="dirty"?jr(d.value):d});{if(t.value==="aborted")return Z;let o=this._def.schema._parseSync({data:l,path:s.path,parent:s});return o.status==="aborted"?Z:o.status==="dirty"?jr(o.value):t.value==="dirty"?jr(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"?Z:(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"?Z:(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(!xr(l))return Z;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=>xr(l)?Promise.resolve(r.transform(l.value,n)).then(o=>({status:t.value,value:o})):Z);X.assertNever(r)}};We.create=(a,e,t)=>new We({schema:a,typeName:R.ZodEffects,effect:e,...K(t)});We.createWithPreprocess=(a,e,t)=>new We({schema:e,effect:{type:"preprocess",transform:a},typeName:R.ZodEffects,...K(t)});var Ze=class extends J{_parse(e){return this._getType(e)===N.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:R.ZodOptional,...K(e)});var cr=class extends J{_parse(e){return this._getType(e)===N.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};cr.create=(a,e)=>new cr({innerType:a,typeName:R.ZodNullable,...K(e)});var Qr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Qr.create=(a,e)=>new Qr({innerType:a,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var Jr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return lt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new $e(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new $e(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});var ht=class extends J{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return $(s,{code:w.invalid_type,expected:N.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};ht.create=a=>new ht({typeName:R.ZodNaN,...K(a)});var hc=Symbol("zod_brand"),wt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ot=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Z:n.status==="dirty"?(t.dirty(),jr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Z:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:R.ZodPipeline})}},Gr=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(xr(r)&&(r.value=Object.freeze(r.value)),r);return lt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Gr.create=(a,e)=>new Gr({innerType:a,typeName:R.ZodReadonly,...K(e)});function Zs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Js(a,e={},t){return a?wr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let o=Zs(e,s),d=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:d})}});if(!n){let l=Zs(e,s),o=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:o})}}):wr.create()}var mc={object:Ne.lazycreate},R;(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"})(R||(R={}));var vc=(a,e={message:`Input not instance of ${a.name}`})=>Js(t=>t instanceof a,e),Gs=Pr.create,Ys=Mr.create,gc=ht.create,yc=Fr.create,Xs=Lr.create,_c=qr.create,bc=ut.create,Ec=Ur.create,Sc=Vr.create,xc=wr.create,Pc=_r.create,wc=Ge.create,Oc=dt.create,Rc=br.create,Tc=Ne.create,Ac=Ne.strictCreate,Dc=zr.create,Ic=qt.create,kc=Hr.create,Cc=lr.create,$c=Ut.create,Nc=ft.create,jc=pt.create,Mc=Vt.create,Fc=Zr.create,Lc=Br.create,qc=Wr.create,Uc=Kr.create,Vc=Or.create,zc=We.create,Hc=Ze.create,Zc=cr.create,Bc=We.createWithPreprocess,Wc=Ot.create,Kc=()=>Gs().optional(),Qc=()=>Ys().optional(),Jc=()=>Xs().optional(),Gc={string:(a=>Pr.create({...a,coerce:!0})),number:(a=>Mr.create({...a,coerce:!0})),boolean:(a=>Lr.create({...a,coerce:!0})),bigint:(a=>Fr.create({...a,coerce:!0})),date:(a=>qr.create({...a,coerce:!0}))};var Yc=Z;var Na="2025-06-18";var en=[Na,"2025-03-26","2024-11-05","2024-10-07"],zt="2.0",rn=i.union([i.string(),i.number().int()]),tn=i.string(),Xc=i.object({progressToken:i.optional(rn)}).passthrough(),Ke=i.object({_meta:i.optional(Xc)}).passthrough(),je=i.object({method:i.string(),params:i.optional(Ke)}),Rt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),ur=i.object({method:i.string(),params:i.optional(Rt)}),Qe=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ht=i.union([i.string(),i.number().int()]),an=i.object({jsonrpc:i.literal(zt),id:Ht}).merge(je).strict(),sn=a=>an.safeParse(a).success,nn=i.object({jsonrpc:i.literal(zt)}).merge(ur).strict(),on=a=>nn.safeParse(a).success,ln=i.object({jsonrpc:i.literal(zt),id:Ht,result:Qe}).strict(),ja=a=>ln.safeParse(a).success,Ye;(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"})(Ye||(Ye={}));var cn=i.object({jsonrpc:i.literal(zt),id:Ht,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),un=a=>cn.safeParse(a).success,dn=i.union([an,nn,ln,cn]),Zt=Qe.strict(),Bt=ur.extend({method:i.literal("notifications/cancelled"),params:Rt.extend({requestId:Ht,reason:i.string().optional()})}),eu=i.object({src:i.string(),mimeType:i.optional(i.string()),sizes:i.optional(i.array(i.string()))}).passthrough(),Tt=i.object({icons:i.array(eu).optional()}).passthrough(),At=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),fn=At.extend({version:i.string(),websiteUrl:i.optional(i.string())}).merge(Tt),ru=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(),Ma=je.extend({method:i.literal("initialize"),params:Ke.extend({protocolVersion:i.string(),capabilities:ru,clientInfo:fn})});var tu=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(),au=Qe.extend({protocolVersion:i.string(),capabilities:tu,serverInfo:fn,instructions:i.optional(i.string())}),Fa=ur.extend({method:i.literal("notifications/initialized")});var Wt=je.extend({method:i.literal("ping")}),su=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),Kt=ur.extend({method:i.literal("notifications/progress"),params:Rt.merge(su).extend({progressToken:rn})}),Qt=je.extend({params:Ke.extend({cursor:i.optional(tn)}).optional()}),Jt=Qe.extend({nextCursor:i.optional(tn)}),pn=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),hn=pn.extend({text:i.string()}),La=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),mn=pn.extend({blob:La}),vn=At.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),nu=At.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),iu=Qt.extend({method:i.literal("resources/list")}),ou=Jt.extend({resources:i.array(vn)}),lu=Qt.extend({method:i.literal("resources/templates/list")}),cu=Jt.extend({resourceTemplates:i.array(nu)}),uu=je.extend({method:i.literal("resources/read"),params:Ke.extend({uri:i.string()})}),du=Qe.extend({contents:i.array(i.union([hn,mn]))}),fu=ur.extend({method:i.literal("notifications/resources/list_changed")}),pu=je.extend({method:i.literal("resources/subscribe"),params:Ke.extend({uri:i.string()})}),hu=je.extend({method:i.literal("resources/unsubscribe"),params:Ke.extend({uri:i.string()})}),mu=ur.extend({method:i.literal("notifications/resources/updated"),params:Rt.extend({uri:i.string()})}),vu=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),gu=At.extend({description:i.optional(i.string()),arguments:i.optional(i.array(vu)),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),yu=Qt.extend({method:i.literal("prompts/list")}),_u=Jt.extend({prompts:i.array(gu)}),bu=je.extend({method:i.literal("prompts/get"),params:Ke.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),qa=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ua=i.object({type:i.literal("image"),data:La,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Va=i.object({type:i.literal("audio"),data:La,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Eu=i.object({type:i.literal("resource"),resource:i.union([hn,mn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Su=vn.extend({type:i.literal("resource_link")}),gn=i.union([qa,Ua,Va,Su,Eu]),xu=i.object({role:i.enum(["user","assistant"]),content:gn}).passthrough(),Pu=Qe.extend({description:i.optional(i.string()),messages:i.array(xu)}),wu=ur.extend({method:i.literal("notifications/prompts/list_changed")}),Ou=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(),Ru=At.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(Ou),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),za=Qt.extend({method:i.literal("tools/list")}),Tu=Jt.extend({tools:i.array(Ru)}),yn=Qe.extend({content:i.array(gn).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),Tp=yn.or(Qe.extend({toolResult:i.unknown()})),Ha=je.extend({method:i.literal("tools/call"),params:Ke.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),Au=ur.extend({method:i.literal("notifications/tools/list_changed")}),Dt=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Za=je.extend({method:i.literal("logging/setLevel"),params:Ke.extend({level:Dt})}),Du=ur.extend({method:i.literal("notifications/message"),params:Rt.extend({level:Dt,logger:i.optional(i.string()),data:i.unknown()})}),Iu=i.object({name:i.string().optional()}).passthrough(),ku=i.object({hints:i.optional(i.array(Iu)),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(),Cu=i.object({role:i.enum(["user","assistant"]),content:i.union([qa,Ua,Va])}).passthrough(),$u=je.extend({method:i.literal("sampling/createMessage"),params:Ke.extend({messages:i.array(Cu),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(ku)})}),Ba=Qe.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[qa,Ua,Va])}),Nu=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),ju=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(),Mu=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(),Fu=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(),Lu=i.union([Nu,ju,Mu,Fu]),qu=je.extend({method:i.literal("elicitation/create"),params:Ke.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),Lu),required:i.optional(i.array(i.string()))}).passthrough()})}),Wa=Qe.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),Uu=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var Vu=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),zu=je.extend({method:i.literal("completion/complete"),params:Ke.extend({ref:i.union([Vu,Uu]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),Hu=Qe.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Zu=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Bu=je.extend({method:i.literal("roots/list")}),Ka=Qe.extend({roots:i.array(Zu)}),Wu=ur.extend({method:i.literal("notifications/roots/list_changed")}),Ap=i.union([Wt,Ma,zu,Za,bu,yu,iu,lu,uu,pu,hu,Ha,za]),Dp=i.union([Bt,Kt,Fa,Wu]),Ip=i.union([Zt,Ba,Wa,Ka]),kp=i.union([Wt,$u,qu,Bu]),Cp=i.union([Bt,Kt,Du,mu,fu,Au,wu]),$p=i.union([Zt,au,Hu,Pu,_u,ou,cu,du,yn,Tu]),Xe=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Ku=6e4,Gt=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(Bt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Kt,t=>{this._onprogress(t)}),this.setRequestHandler(Wt,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 Xe(Ye.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,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),ja(d)||un(d)?this._onresponse(d):sn(d)?this._onrequest(d,f):on(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 Xe(Ye.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:Ye.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,p,m)=>this.request(f,p,{...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 p;if(!o.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ye.InternalError,message:(p=f.message)!==null&&p!==void 0?p:"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),ja(e))s(e);else{let r=new Xe(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,p,m,b,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),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let _=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),v.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});let x=O=>{var D;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(O)};this._responseHandlers.set(_,O=>{var D;if(!(!((D=s?.signal)===null||D===void 0)&&D.aborted)){if(O instanceof Error)return d(O);try{let I=t.parse(O.result);o(I)}catch(I){d(I)}}}),(b=s?.signal)===null||b===void 0||b.addEventListener("abort",()=>{var O;x((O=s?.signal)===null||O===void 0?void 0:O.reason)});let T=(c=s?.timeout)!==null&&c!==void 0?c:Ku,P=()=>x(new Xe(Ye.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(_,T,s?.maxTotalTimeout,P,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(O=>{this._cleanupTimeout(_),d(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.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(p=>this._onerror(p))});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 _n(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 So=Ia(Eo(),1),va=class extends Gt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Dt.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(Ma,r=>this._oninitialize(r)),this.setNotificationHandler(Fa,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Za,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=Dt.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=_n(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:en.includes(t)?t:Na,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"},Zt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ba,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Wa,t);if(s.action==="accept"&&s.content)try{let r=new So.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Xe(Ye.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Xe?r:new Xe(Ye.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ka,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 _s=Ia(require("node:process"),1);var ga=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),Tf(t)}clear(){this._buffer=void 0}};function Tf(a){return dn.parse(JSON.parse(a))}function xo(a){return JSON.stringify(a)+`
`}var ya=class{constructor(e=_s.default.stdin,t=_s.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new ga,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=xo(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var wo=Symbol("Let zodToJsonSchema decide on which parser to use");var Po={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"},Oo=a=>typeof a=="string"?{...Po,name:a}:{...Po,...a};var Ro=a=>{let e=Oo(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 bs(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,bs(a,e,s,r)}var _a=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?_a(e,a.currentPath):e.join("/")}}function To(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==R.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 Ao(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 Do(){return{type:"boolean"}}function ba(a,e){return B(a.type._def,e)}var Io=(a,e)=>B(a.innerType._def,e);function Es(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Es(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 Af(a,e)}}var Af=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function ko(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function Co(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function $o(a){return{type:"string",enum:Array.from(a.values)}}var Df=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function No(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(Df(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 jo(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 Ss,er={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:()=>(Ss===void 0&&(Ss=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ss),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 Ea(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":rr(t,"email",s.message,e);break;case"format:idn-email":rr(t,"idn-email",s.message,e);break;case"pattern:zod":Ie(t,er.email,s.message,e);break}break;case"url":rr(t,"uri",s.message,e);break;case"uuid":rr(t,"uuid",s.message,e);break;case"regex":Ie(t,s.regex,s.message,e);break;case"cuid":Ie(t,er.cuid,s.message,e);break;case"cuid2":Ie(t,er.cuid2,s.message,e);break;case"startsWith":Ie(t,RegExp(`^${xs(s.value,e)}`),s.message,e);break;case"endsWith":Ie(t,RegExp(`${xs(s.value,e)}$`),s.message,e);break;case"datetime":rr(t,"date-time",s.message,e);break;case"date":rr(t,"date",s.message,e);break;case"time":rr(t,"time",s.message,e);break;case"duration":rr(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(xs(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&rr(t,"ipv4",s.message,e),s.version!=="v4"&&rr(t,"ipv6",s.message,e);break}case"base64url":Ie(t,er.base64url,s.message,e);break;case"jwt":Ie(t,er.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ie(t,er.ipv4Cidr,s.message,e),s.version!=="v4"&&Ie(t,er.ipv6Cidr,s.message,e);break}case"emoji":Ie(t,er.emoji(),s.message,e);break;case"ulid":{Ie(t,er.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{rr(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ie(t,er.base64,s.message,e);break}}break}case"nanoid":Ie(t,er.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function xs(a,e){return e.patternStrategy==="escape"?kf(a):a}var If=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function kf(a){let e="";for(let t=0;t<a.length;t++)If.has(a[t])||(e+="\\"),e+=a[t];return e}function rr(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:Mo(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Mo(e,s),t,s)}function Mo(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 Sa(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===R.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===R.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=Ea(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===R.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===R.ZodBranded&&a.keyType._def.type._def.typeName===R.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ba(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Fo(a,e){if(e.mapStrategy==="record")return Sa(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 Lo(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 qo(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Uo(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var kt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function zo(a,e){if(e.target==="openApi3")return Vo(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in kt&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=kt[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 Vo(a,e)}var Vo=(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 Ho(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:kt[a.innerType._def.typeName],nullable:!0}:{type:[kt[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 Zo(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",bs(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 Bo(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=$f(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let p=B(d._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});p!==void 0&&(s.properties[o]=p,f||r.push(o))}r.length&&(s.required=r);let l=Cf(a,e);return l!==void 0&&(s.additionalProperties=l),s}function Cf(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 $f(a){try{return a.isOptional()}catch{return!0}}var Wo=(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 Ko=(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 Qo(a,e){return B(a.type._def,e)}function Jo(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 Go(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 Yo(a){return{not:fe(a)}}function Xo(a){return fe(a)}var el=(a,e)=>B(a.innerType._def,e);var rl=(a,e,t)=>{switch(e){case R.ZodString:return Ea(a,t);case R.ZodNumber:return Zo(a,t);case R.ZodObject:return Bo(a,t);case R.ZodBigInt:return Ao(a,t);case R.ZodBoolean:return Do();case R.ZodDate:return Es(a,t);case R.ZodUndefined:return Yo(t);case R.ZodNull:return Uo(t);case R.ZodArray:return To(a,t);case R.ZodUnion:case R.ZodDiscriminatedUnion:return zo(a,t);case R.ZodIntersection:return No(a,t);case R.ZodTuple:return Go(a,t);case R.ZodRecord:return Sa(a,t);case R.ZodLiteral:return jo(a,t);case R.ZodEnum:return $o(a);case R.ZodNativeEnum:return Lo(a);case R.ZodNullable:return Ho(a,t);case R.ZodOptional:return Wo(a,t);case R.ZodMap:return Fo(a,t);case R.ZodSet:return Jo(a,t);case R.ZodLazy:return()=>a.getter()._def;case R.ZodPromise:return Qo(a,t);case R.ZodNaN:case R.ZodNever:return qo(t);case R.ZodEffects:return Co(a,t);case R.ZodAny:return fe(t);case R.ZodUnknown:return Xo(t);case R.ZodDefault:return ko(a,t);case R.ZodBranded:return ba(a,t);case R.ZodReadonly:return el(a,t);case R.ZodCatch:return Io(a,t);case R.ZodPipeline:return Ko(a,t);case R.ZodFunction:case R.ZodVoid:case R.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!==wo)return o}if(s&&!t){let o=Nf(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=rl(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&jf(a,e,l),e.postProcess){let o=e.postProcess(l,a,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}var Nf=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:_a(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},jf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var Ps=(a,e)=>{let t=Ro(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,p])=>({...d,[f]:B(p._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 tl=require("fs"),al=require("os"),sl=require("path"),Mf=(0,sl.join)((0,al.homedir)(),".claude-mem","silent.log");function tr(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}] [HAPPY-PATH-ERROR] [${d}] ${a}`;if(e!==void 0)try{f+=` ${JSON.stringify(e)}`}catch(p){f+=` [stringify error: ${p}]`}f+=`
`;try{(0,tl.appendFileSync)(Mf,f)}catch(p){console.error("[silent-debug] Failed to write to log:",p)}return t}var Pa=Ia(require("path"),1),As=require("os");var mt=require("fs"),ol=require("path"),ll=require("os");var Ff=["bugfix","feature","refactor","discovery","decision","change"],Lf=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"];var nl=Ff.join(","),il=Lf.join(",");var ar=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,ol.join)((0,ll.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:nl,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:il,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let t=this.get(e);return parseInt(t,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,mt.existsSync)(e))return this.getAllDefaults();let t=(0,mt.readFileSync)(e,"utf-8"),s=JSON.parse(t),r=s;if(s.env&&typeof s.env=="object"){r=s.env;try{(0,mt.writeFileSync)(e,JSON.stringify(r,null,2),"utf-8"),Ct.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(l){Ct.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},l)}}let n={...this.DEFAULTS};for(let l of Object.keys(this.DEFAULTS))r[l]!==void 0&&(n[l]=r[l]);return n}};var ws=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.SILENT=4]="SILENT",n))(ws||{}),Os=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=ar.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=ws[e]??1}return this.level}correlationId(e,t){return`obs-${e}-${t}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Object.keys(e);return t.length===0?"{}":t.length<=3?JSON.stringify(e):`{${t.length} keys: ${t.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,t){if(!t)return e;try{let s=typeof t=="string"?JSON.parse(t):t;if(e==="Bash"&&s.command){let r=s.command.length>50?s.command.substring(0,50)+"...":s.command;return`${e}(${r})`}if(e==="Read"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Edit"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Write"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}return e}catch{return e}}log(e,t,s,r,n){if(e<this.getLevel())return;let l=new Date().toISOString().replace("T"," ").substring(0,23),o=ws[e].padEnd(5),d=t.padEnd(6),f="";r?.correlationId?f=`[${r.correlationId}] `:r?.sessionId&&(f=`[session-${r.sessionId}] `);let p="";n!=null&&(this.getLevel()===0&&typeof n=="object"?p=`
`+JSON.stringify(n,null,2):p=" "+this.formatData(n));let m="";if(r){let{sessionId:c,sdkSessionId:y,correlationId:_,...v}=r;Object.keys(v).length>0&&(m=` {${Object.entries(v).map(([T,P])=>`${T}=${P}`).join(", ")}}`)}let b=`[${l}] [${o}] [${d}] ${f}${s}${m}${p}`;e===3?console.error(b):console.log(b)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}},Ct=new Os;var Rs={DEFAULT:5e3,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,WINDOWS_MULTIPLIER:1.5};function cl(a){return process.platform==="win32"?Math.round(a*Rs.WINDOWS_MULTIPLIER):a}var xa=require("path");var fl=require("os");var ke=require("path"),ul=require("os");var dl=require("url");var Uf={};function qf(){return typeof __dirname<"u"?__dirname:(0,ke.dirname)((0,dl.fileURLToPath)(Uf.url))}var Mg=qf(),dr=ar.get("CLAUDE_MEM_DATA_DIR"),Ts=process.env.CLAUDE_CONFIG_DIR||(0,ke.join)((0,ul.homedir)(),".claude"),Fg=(0,ke.join)(dr,"archives"),Lg=(0,ke.join)(dr,"logs"),qg=(0,ke.join)(dr,"trash"),Ug=(0,ke.join)(dr,"backups"),Vg=(0,ke.join)(dr,"settings.json"),zg=(0,ke.join)(dr,"claude-mem.db"),Hg=(0,ke.join)(dr,"vector-db"),Zg=(0,ke.join)(Ts,"settings.json"),Bg=(0,ke.join)(Ts,"commands"),Wg=(0,ke.join)(Ts,"CLAUDE.md");var Jg=(0,xa.join)(dr,"worker.pid"),Gg=(0,xa.join)(dr,"logs"),Yg=(0,xa.join)((0,fl.homedir)(),".claude","plugins","marketplaces","thedotmack");var ny=Pa.default.join((0,As.homedir)(),".claude","plugins","marketplaces","thedotmack"),iy=cl(Rs.HEALTH_CHECK),vt=null;function pl(){if(vt!==null)return vt;try{let a=Pa.default.join(ar.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=ar.loadFromFile(a);return vt=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),vt}catch(a){return Ct.debug("SYSTEM","Failed to load port from settings, using default",{error:a}),vt=parseInt(ar.get("CLAUDE_MEM_WORKER_PORT"),10),vt}}function hl(){let a=Pa.default.join((0,As.homedir)(),".claude-mem","settings.json");return ar.loadFromFile(a).CLAUDE_MEM_WORKER_HOST}var Vf=pl(),zf=hl(),wa=`http://${zf}:${Vf}`,Me={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){tr("[mcp-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=`${wa}${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 tr("[mcp-server] \u2190 Worker API success",{endpoint:a}),n}catch(t){return tr("[mcp-server] \u2190 Worker API error",{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function Hf(){try{return(await fetch(`${wa}/api/health`)).ok}catch{return!1}}var ml=[{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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.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=Me.get_timeline_by_query;return await Fe(e,a)}}],Ds=new va({name:"claude-mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});Ds.setRequestHandler(za,async()=>({tools:ml.map(a=>({name:a.name,description:a.description,inputSchema:Ps(a.inputSchema)}))}));Ds.setRequestHandler(Ha,async a=>{let e=ml.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 vl(){tr("[mcp-server] Shutting down..."),process.exit(0)}process.on("SIGTERM",vl);process.on("SIGINT",vl);async function Zf(){let a=new ya;await Ds.connect(a),tr("[mcp-server] Claude-mem search server started"),setTimeout(async()=>{await Hf()?tr("[mcp-server] Worker available at",wa):(tr("[mcp-server] WARNING: Worker not available at",wa),tr("[mcp-server] Tools will fail until Worker is started"),tr("[mcp-server] Start Worker with: npm run worker:restart"))},0)}Zf().catch(a=>{tr("[mcp-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 *)
*/