Files
claude-mem/plugin/scripts/mcp-server.cjs
Alex Newman 857ceb47b7 Merge main into feature/gemini-provider
Resolved conflicts to include both:
- Main's earliestPendingTimestamp for accurate observation timestamps
- PR's conversationHistory and currentProvider for Gemini provider switching

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 18:45:14 -05:00

17 lines
217 KiB
JavaScript
Executable File

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